@@ -8,98 +8,96 @@ env_jpg = env_modules.Clone()
88
99thirdparty_obj = []
1010
11- thirdparty_dir = "#thirdparty/libjpeg-turbo"
12-
13- thirdparty_sources_common = [
14- "jaricom.c" ,
15- "jcapimin.c" ,
16- "jcarith.c" ,
17- "jchuff.c" ,
18- "jcicc.c" ,
19- "jcinit.c" ,
20- "jcmarker.c" ,
21- "jcmaster.c" ,
22- "jcomapi.c" ,
23- "jcparam.c" ,
24- "jcphuff.c" ,
25- "jctrans.c" ,
26- "jdapimin.c" ,
27- "jdarith.c" ,
28- "jdatadst.c" ,
29- "jdatadst-tj.c" ,
30- "jdatasrc.c" ,
31- "jdatasrc-tj.c" ,
32- "jdhuff.c" ,
33- "jdicc.c" ,
34- "jdinput.c" ,
35- "jdmarker.c" ,
36- "jdmaster.c" ,
37- "jdphuff.c" ,
38- "jdtrans.c" ,
39- "jerror.c" ,
40- "jfdctflt.c" ,
41- "jmemmgr.c" ,
42- "jmemnobs.c" ,
43- "jpeg_nbits.c" ,
44- "transupp.c" ,
45- "turbojpeg.c" ,
46- ]
47-
48- thirdparty_sources_bit_dependent = [
49- "jcapistd.c" ,
50- "jccoefct.c" ,
51- "jccolor.c" ,
52- "jcdctmgr.c" ,
53- "jcmainct.c" ,
54- "jcprepct.c" ,
55- "jcsample.c" ,
56- "jdcoefct.c" ,
57- "jdcolor.c" ,
58- "jdapistd.c" ,
59- "jddctmgr.c" ,
60- "jdmainct.c" ,
61- "jdmerge.c" ,
62- "jdpostct.c" ,
63- "jdsample.c" ,
64- "jfdctfst.c" ,
65- "jfdctint.c" ,
66- "jidctflt.c" ,
67- "jidctfst.c" ,
68- "jidctint.c" ,
69- "jidctred.c" ,
70- "jutils.c" ,
71- "jquant1.c" ,
72- "jquant2.c" ,
73- ]
74-
75- thirdparty_sources_by_bits = {
76- 8 : list (thirdparty_sources_bit_dependent ),
77- 12 : list (thirdparty_sources_bit_dependent ),
78- }
79-
80-
81- def source_paths (files ):
82- return [thirdparty_dir + "/src/" + f for f in files ]
83-
84-
85- env_jpg .Prepend (CPPEXTPATH = [thirdparty_dir + "/src" ])
86-
87-
88- def add_bit_depth (bit_depth : int ):
89- env_bit_depth = env_jpg .Clone ()
90- env_bit_depth .disable_warnings ()
91- env_bit_depth ["OBJSUFFIX" ] = f"_{ bit_depth } { env_bit_depth ['OBJSUFFIX' ]} "
92- env_bit_depth .Append (CPPDEFINES = [f"BITS_IN_JSAMPLE={ bit_depth } " ])
93- env_bit_depth .add_source_files (thirdparty_obj , source_paths (thirdparty_sources_by_bits [bit_depth ]))
94-
95-
96- add_bit_depth (8 )
97- add_bit_depth (12 )
98-
99- env_thirdparty = env_jpg .Clone ()
100- env_thirdparty .disable_warnings ()
101- env_thirdparty .add_source_files (thirdparty_obj , source_paths (thirdparty_sources_common ))
102- env .modules_sources += thirdparty_obj
11+ if env ["builtin_libjpeg_turbo" ]:
12+ thirdparty_dir = "#thirdparty/libjpeg-turbo"
13+
14+ thirdparty_sources_common = [
15+ "jaricom.c" ,
16+ "jcapimin.c" ,
17+ "jcarith.c" ,
18+ "jchuff.c" ,
19+ "jcicc.c" ,
20+ "jcinit.c" ,
21+ "jcmarker.c" ,
22+ "jcmaster.c" ,
23+ "jcomapi.c" ,
24+ "jcparam.c" ,
25+ "jcphuff.c" ,
26+ "jctrans.c" ,
27+ "jdapimin.c" ,
28+ "jdarith.c" ,
29+ "jdatadst.c" ,
30+ "jdatadst-tj.c" ,
31+ "jdatasrc.c" ,
32+ "jdatasrc-tj.c" ,
33+ "jdhuff.c" ,
34+ "jdicc.c" ,
35+ "jdinput.c" ,
36+ "jdmarker.c" ,
37+ "jdmaster.c" ,
38+ "jdphuff.c" ,
39+ "jdtrans.c" ,
40+ "jerror.c" ,
41+ "jfdctflt.c" ,
42+ "jmemmgr.c" ,
43+ "jmemnobs.c" ,
44+ "jpeg_nbits.c" ,
45+ "transupp.c" ,
46+ "turbojpeg.c" ,
47+ ]
48+
49+ thirdparty_sources_bit_dependent = [
50+ "jcapistd.c" ,
51+ "jccoefct.c" ,
52+ "jccolor.c" ,
53+ "jcdctmgr.c" ,
54+ "jcmainct.c" ,
55+ "jcprepct.c" ,
56+ "jcsample.c" ,
57+ "jdcoefct.c" ,
58+ "jdcolor.c" ,
59+ "jdapistd.c" ,
60+ "jddctmgr.c" ,
61+ "jdmainct.c" ,
62+ "jdmerge.c" ,
63+ "jdpostct.c" ,
64+ "jdsample.c" ,
65+ "jfdctfst.c" ,
66+ "jfdctint.c" ,
67+ "jidctflt.c" ,
68+ "jidctfst.c" ,
69+ "jidctint.c" ,
70+ "jidctred.c" ,
71+ "jutils.c" ,
72+ "jquant1.c" ,
73+ "jquant2.c" ,
74+ ]
75+
76+ thirdparty_sources_by_bits = {
77+ 8 : list (thirdparty_sources_bit_dependent ),
78+ 12 : list (thirdparty_sources_bit_dependent ),
79+ }
80+
81+ def source_paths (files ):
82+ return [thirdparty_dir + "/src/" + f for f in files ]
83+
84+ env_jpg .Prepend (CPPEXTPATH = [thirdparty_dir + "/src" ])
85+
86+ def add_bit_depth (bit_depth : int ):
87+ env_bit_depth = env_jpg .Clone ()
88+ env_bit_depth .disable_warnings ()
89+ env_bit_depth ["OBJSUFFIX" ] = f"_{ bit_depth } { env_bit_depth ['OBJSUFFIX' ]} "
90+ env_bit_depth .Append (CPPDEFINES = [f"BITS_IN_JSAMPLE={ bit_depth } " ])
91+ env_bit_depth .add_source_files (thirdparty_obj , source_paths (thirdparty_sources_by_bits [bit_depth ]))
92+
93+ add_bit_depth (8 )
94+ add_bit_depth (12 )
95+
96+ env_thirdparty = env_jpg .Clone ()
97+ env_thirdparty .disable_warnings ()
98+ env_thirdparty .add_source_files (thirdparty_obj , source_paths (thirdparty_sources_common ))
99+ env .modules_sources += thirdparty_obj
100+
103101
104102# Godot source files
105103
0 commit comments