1
1
#!/usr/bin/env python
2
2
# coding: utf-8
3
- import os , string , sys , shutil , math
3
+ import os , string , sys , shutil , math , SCons . Util
4
4
from tools import *
5
5
6
6
env = GpickEnvironment (ENV = os .environ )
@@ -17,6 +17,7 @@ vars.Add(BoolVariable('PREBUILD_GRAMMAR', 'Use prebuild grammar files', False))
17
17
vars .Add (BoolVariable ('USE_GTK3' , 'Use GTK3 instead of GTK2' , True ))
18
18
vars .Add (BoolVariable ('DEV_BUILD' , 'Use development flags' , False ))
19
19
vars .Add (BoolVariable ('PREFER_VERSION_FILE' , 'Read version information from file instead of using GIT' , False ))
20
+ vars .Add (EnumVariable ('LUA_TYPE' , 'Lua library type' , 'patched-C++' , allowed_values = ('C++' , 'patched-C++' , 'C' )))
20
21
vars .Update (env )
21
22
22
23
if env ['LOCALEDIR' ] == '' :
@@ -77,7 +78,10 @@ if not env.GetOption('clean'):
77
78
libs ['GIO_PC' ] = {'checks' :{'gio-unix-2.0' : '>= 2.26.0' , 'gio-2.0' : '>= 2.26.0' }}
78
79
else :
79
80
libs ['GTK_PC' ] = {'checks' :{'gtk+-3.0' : '>= 3.0.0' }}
80
- libs ['LUA_PC' ] = {'checks' :{'lua5.4-c++' : '>= 5.4' , 'lua5.3-c++' : '>= 5.3' , 'lua-c++' : '>= 5.2' , 'lua5.2-c++' : '>= 5.2' }}
81
+ if env ['LUA_TYPE' ] != 'C' :
82
+ libs ['LUA_PC' ] = {'checks' :{'lua5.4-c++' : '>= 5.4' , 'lua5-c++' : '>= 5.4' , 'lua-c++' : '>= 5.4' , 'lua5.3-c++' : '>= 5.3' , 'lua5-c++' : '>= 5.3' , 'lua-c++' : '>= 5.3' , 'lua5.2-c++' : '>= 5.2' , 'lua5-c++' : '>= 5.2' , 'lua-c++' : '>= 5.2' }}
83
+ else :
84
+ libs ['LUA_PC' ] = {'checks' :{'lua5.4' : '>= 5.4' , 'lua5' : '>= 5.4' , 'lua' : '>= 5.4' , 'lua5.3' : '>= 5.3' , 'lua5' : '>= 5.3' , 'lua' : '>= 5.3' , 'lua5.2' : '>= 5.2' , 'lua5' : '>= 5.2' , 'lua' : '>= 5.2' }}
81
85
env .ConfirmLibs (conf , libs )
82
86
env .ConfirmBoost (conf , '1.71' )
83
87
env = conf .Finish ()
@@ -155,19 +159,23 @@ def buildLayout(env):
155
159
if not env .GetOption ('clean' ) and not env ['TOOLCHAIN' ] == 'msvc' :
156
160
layout_env .ParseConfig ('pkg-config --cflags --libs $GTK_PC' )
157
161
layout_env .ParseConfig ('pkg-config --cflags --libs $LUA_PC' )
162
+ if env ['LUA_TYPE' ] == 'C++' :
163
+ layout_env .Append (CPPDEFINES = ['LUA_SYMBOLS_MANGLED' ])
158
164
return layout_env .StaticObject (layout_env .Glob ('source/layout/*.cpp' ))
159
165
160
166
def buildGtk (env ):
161
167
gtk_env = env .Clone ()
162
168
if not env .GetOption ('clean' ) and not env ['TOOLCHAIN' ] == 'msvc' :
163
169
gtk_env .ParseConfig ('pkg-config --cflags --libs $GTK_PC' )
164
170
gtk_env .ParseConfig ('pkg-config --cflags --libs $LUA_PC' )
171
+ if env ['LUA_TYPE' ] == 'C++' :
172
+ gtk_env .Append (CPPDEFINES = ['LUA_SYMBOLS_MANGLED' ])
165
173
return gtk_env .StaticObject (gtk_env .Glob ('source/gtk/*.cpp' ))
166
174
167
175
def buildI18n (env ):
168
176
i18n_env = env .Clone ()
169
177
if not env .GetOption ('clean' ):
170
- if i18n_env ['ENABLE_NLS' ]:
178
+ if env ['ENABLE_NLS' ]:
171
179
i18n_env .Append (CPPDEFINES = ['ENABLE_NLS' , 'LOCALEDIR=' + i18n_env ['LOCALEDIR' ]])
172
180
return i18n_env .StaticObject (i18n_env .Glob ('source/i18n/*.cpp' ))
173
181
@@ -189,15 +197,19 @@ def buildTools(env):
189
197
if not env .GetOption ('clean' ) and not env ['TOOLCHAIN' ] == 'msvc' :
190
198
tools_env .ParseConfig ('pkg-config --cflags --libs $GTK_PC' )
191
199
tools_env .ParseConfig ('pkg-config --cflags --libs $LUA_PC' )
192
- if tools_env ['ENABLE_NLS' ]:
200
+ if env ['ENABLE_NLS' ]:
193
201
tools_env .Append (CPPDEFINES = ['ENABLE_NLS' ])
202
+ if env ['LUA_TYPE' ] == 'C++' :
203
+ tools_env .Append (CPPDEFINES = ['LUA_SYMBOLS_MANGLED' ])
194
204
return tools_env .StaticObject (tools_env .Glob ('source/tools/*.cpp' ))
195
205
196
206
def buildLua (env ):
197
207
lua_env = env .Clone ()
198
208
if not env .GetOption ('clean' ) and not env ['TOOLCHAIN' ] == 'msvc' :
199
209
lua_env .ParseConfig ('pkg-config --cflags --libs $GTK_PC' )
200
210
lua_env .ParseConfig ('pkg-config --cflags --libs $LUA_PC' )
211
+ if env ['LUA_TYPE' ] == 'C++' :
212
+ lua_env .Append (CPPDEFINES = ['LUA_SYMBOLS_MANGLED' ])
201
213
return lua_env .StaticObject (lua_env .Glob ('source/lua/*.cpp' ))
202
214
203
215
def buildColorNames (env ):
@@ -225,6 +237,8 @@ def buildGpick(env):
225
237
gpick_env .ParseConfig ('pkg-config --cflags --libs $LUA_PC' , None , False )
226
238
if env ['ENABLE_NLS' ]:
227
239
gpick_env .Append (CPPDEFINES = ['ENABLE_NLS' ])
240
+ if env ['LUA_TYPE' ] == 'C++' :
241
+ gpick_env .Append (CPPDEFINES = ['LUA_SYMBOLS_MANGLED' ])
228
242
gpick_env .Append (CPPDEFINES = ['GSEAL_ENABLE' ])
229
243
sources = gpick_env .Glob ('source/*.cpp' ) + gpick_env .Glob ('source/transformation/*.cpp' )
230
244
@@ -273,7 +287,7 @@ def buildGpick(env):
273
287
test_env = gpick_env .Clone ()
274
288
test_env .Append (LIBS = ['boost_unit_test_framework' ], CPPDEFINES = ['BOOST_TEST_DYN_LINK' ])
275
289
276
- tests = test_env .Program ('tests' , source = test_env .Glob ('source/test/*.cpp' ) + [object_map ['source/' + name ] for name in ['Color' , 'EventBus' , 'lua/Script' , 'lua/Ref' , 'lua/Color' , 'lua/ColorObject' , 'ColorList' , 'ColorObject' , 'FileFormat' , 'ErrorCode' , 'Converter' , 'Converters' , 'InternalConverters' , 'version/Version' ]] + dynv_objects + text_file_parser_objects + common_objects )
290
+ tests = test_env .Program ('tests' , source = test_env .Glob ('source/test/*.cpp' ) + [object_map ['source/' + name ] for name in ['Color' , 'EventBus' , 'lua/Script' , 'lua/Ref' , 'lua/Color' , 'lua/ColorObject' , 'ColorList' , 'ColorObject' , 'FileFormat' , 'ErrorCode' , 'Converter' , 'Converters' , 'InternalConverters' , 'math/BinaryTreeQuantization' , 'math/OctreeColorQuantization' , ' version/Version' ]] + dynv_objects + text_file_parser_objects + common_objects )
277
291
278
292
return executable , tests
279
293
0 commit comments