2018-02-21 19:36:38 +08:00
|
|
|
import os
|
2018-04-13 10:25:58 +08:00
|
|
|
import platform
|
2018-02-21 19:36:38 +08:00
|
|
|
|
2018-04-13 10:25:58 +08:00
|
|
|
OS_NAME=platform.system()
|
2018-02-21 19:36:38 +08:00
|
|
|
LFTK_ROOT = os.path.normpath(os.getcwd())
|
|
|
|
LFTK_SRC = os.path.join(LFTK_ROOT, 'src')
|
|
|
|
LFTK_3RD_ROOT = os.path.join(LFTK_ROOT, '3rd')
|
|
|
|
LFTK_TOOLS_ROOT = os.path.join(LFTK_ROOT, 'tools')
|
|
|
|
GTEST_ROOT = os.path.join(LFTK_ROOT, '3rd/gtest/googletest')
|
2018-03-18 11:29:31 +08:00
|
|
|
BIN_DIR=os.path.join(LFTK_ROOT, 'bin')
|
|
|
|
LIB_DIR=os.path.join(LFTK_ROOT, 'lib')
|
2018-02-21 19:36:38 +08:00
|
|
|
|
2018-04-13 10:25:58 +08:00
|
|
|
if OS_NAME == 'Windows':
|
|
|
|
LCD='SDL'
|
|
|
|
else:
|
|
|
|
LCD='NANOVG'
|
|
|
|
|
2018-04-13 21:44:50 +08:00
|
|
|
LCD='NANOVG'
|
2018-04-13 10:25:58 +08:00
|
|
|
os.environ['LCD'] = LCD
|
|
|
|
os.environ['BIN_DIR'] = BIN_DIR;
|
|
|
|
os.environ['LIB_DIR'] = LIB_DIR;
|
|
|
|
os.environ['LFTK_ROOT'] = LFTK_ROOT;
|
|
|
|
os.environ['GTEST_ROOT'] = GTEST_ROOT;
|
|
|
|
|
|
|
|
COMMON_CCFLAGS=' -DLFTK_ROOT=\\\"'+LFTK_ROOT+'\\\" -DLUA_COMPAT_MODULE -DHAS_STD_MALLOC -DSTBTT_STATIC -DSTB_IMAGE_STATIC'
|
|
|
|
|
|
|
|
if LCD == 'NANOVG':
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG -DNANOVG_GL2'
|
|
|
|
else:
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_STB_IMAGE -DWITH_STB_FONT -DSDL2'
|
|
|
|
|
|
|
|
OS_LIBPATH=[]
|
|
|
|
OS_CPPPATH=[]
|
|
|
|
OS_FLAGS='-g -Wall'
|
|
|
|
OS_SUBSYSTEM_CONSOLE=''
|
|
|
|
OS_SUBSYSTEM_WINDOWS=''
|
|
|
|
OS_LINKFLAGS=''
|
2018-04-13 13:54:36 +08:00
|
|
|
OS_LIBS=['SDL2', 'glad', 'stdc++', 'pthread', 'm']
|
2018-04-13 10:25:58 +08:00
|
|
|
|
|
|
|
if OS_NAME == 'Darwin':
|
|
|
|
OS_LINKFLAGS='-framework OpenGL'
|
2018-04-13 13:54:36 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DLUA_USE_POSIX -D__APPLE__'
|
2018-04-13 10:25:58 +08:00
|
|
|
print("Macos");
|
|
|
|
|
|
|
|
elif OS_NAME == 'Linux':
|
2018-04-13 13:54:36 +08:00
|
|
|
OS_LIBS = ['GL'] + OS_LIBS + ['dl']
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DLUA_USE_POSIX -DLINUX'
|
2018-04-13 10:25:58 +08:00
|
|
|
print("Linux");
|
|
|
|
|
|
|
|
elif OS_NAME == 'Windows':
|
2018-04-13 21:44:50 +08:00
|
|
|
OS_LIBS=['SDL2', 'glad']
|
|
|
|
OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /INCREMENTA -DUNICODE -D_UNICODE /Od /ZI'
|
|
|
|
OS_LINKFLAGS='/MACHINE:X64 /DEBUG'
|
2018-02-21 19:36:38 +08:00
|
|
|
OS_LIBPATH=[LFTK_3RD_ROOT+'/SDL2-2.0.7/lib/x64']
|
|
|
|
OS_CPPPATH=[LFTK_3RD_ROOT+'/SDL2-2.0.7/']
|
|
|
|
OS_SUBSYSTEM_CONSOLE='/SUBSYSTEM:CONSOLE '
|
|
|
|
OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS '
|
|
|
|
|
2018-04-13 10:25:58 +08:00
|
|
|
LIBS=['lftk', 'agg', 'nanovg'] + OS_LIBS
|
|
|
|
|
|
|
|
CCFLAGS=OS_FLAGS + COMMON_CCFLAGS
|
|
|
|
CPPPATH=[LFTK_ROOT, LFTK_SRC, LFTK_3RD_ROOT, os.path.join(LFTK_3RD_ROOT, 'nanovg/src'), os.path.join(LFTK_3RD_ROOT, 'agg-2.5/include'), LFTK_TOOLS_ROOT] + OS_CPPPATH
|
2018-02-21 19:36:38 +08:00
|
|
|
|
2018-03-18 11:29:31 +08:00
|
|
|
DefaultEnvironment(CCFLAGS = CCFLAGS,
|
2018-04-13 10:25:58 +08:00
|
|
|
CPPPATH = CPPPATH,
|
|
|
|
LIBS=LIBS,
|
2018-02-21 19:36:38 +08:00
|
|
|
LINKFLAGS=OS_LINKFLAGS,
|
|
|
|
OS_SUBSYSTEM_CONSOLE=OS_SUBSYSTEM_CONSOLE,
|
|
|
|
OS_SUBSYSTEM_WINDOWS=OS_SUBSYSTEM_WINDOWS,
|
2018-03-18 11:29:31 +08:00
|
|
|
LIBPATH=[os.path.join(LFTK_ROOT, 'lib')] + OS_LIBPATH)
|
2018-02-21 19:36:38 +08:00
|
|
|
|
|
|
|
SConscript([
|
2018-04-13 10:25:58 +08:00
|
|
|
'3rd/agg-2.5/SConscript',
|
|
|
|
'3rd/nanovg/SConscript',
|
2018-04-13 13:54:36 +08:00
|
|
|
'3rd/glad/SConscript',
|
2018-03-18 11:29:31 +08:00
|
|
|
'src/SConscript',
|
2018-02-21 19:36:38 +08:00
|
|
|
'tools/common/SConscript',
|
|
|
|
'tools/theme_gen/SConscript',
|
|
|
|
'tools/font_gen/SConscript',
|
|
|
|
'tools/image_gen/SConscript',
|
2018-04-01 08:13:10 +08:00
|
|
|
'tools/res_gen/SConscript',
|
2018-03-10 19:11:37 +08:00
|
|
|
'demos/SConscript',
|
2018-03-04 08:32:52 +08:00
|
|
|
'tests/SConscript',
|
2018-03-04 13:09:23 +08:00
|
|
|
'3rd/lua/SConscript',
|
2018-03-04 08:32:52 +08:00
|
|
|
'lua/SConscript'
|
|
|
|
])
|