awtk/SConstruct

111 lines
3.4 KiB
Python
Raw Normal View History

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-04-27 11:23:09 +08:00
TK_ROOT = os.path.normpath(os.getcwd())
TK_SRC = os.path.join(TK_ROOT, 'src')
TK_3RD_ROOT = os.path.join(TK_ROOT, '3rd')
TK_TOOLS_ROOT = os.path.join(TK_ROOT, 'tools')
GTEST_ROOT = os.path.join(TK_ROOT, '3rd/gtest/googletest')
BIN_DIR=os.path.join(TK_ROOT, 'bin')
LIB_DIR=os.path.join(TK_ROOT, 'lib')
2018-02-21 19:36:38 +08:00
2018-04-23 11:33:45 +08:00
LCD='SDL'
2018-04-25 15:14:30 +08:00
LCD='NANOVG'
2018-04-15 17:58:24 +08:00
2018-04-24 17:38:22 +08:00
VGCANVAS='AGG'
VGCANVAS='PICASSO'
2018-04-13 10:25:58 +08:00
2018-04-27 11:23:09 +08:00
COMMON_CCFLAGS=' -DTK_ROOT=\\\"'+TK_ROOT+'\\\" -DLUA_COMPAT_MODULE -DHAS_STD_MALLOC -DSTBTT_STATIC -DSTB_IMAGE_STATIC -DIMAGE_RGBA'
2018-04-13 10:25:58 +08:00
if LCD == 'NANOVG':
2018-04-24 17:38:22 +08:00
VGCANVAS='NANOVG'
2018-04-20 21:49:47 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG -DWITH_GL3'
2018-04-13 10:25:58 +08:00
else:
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_STB_IMAGE -DWITH_STB_FONT -DSDL2'
2018-04-25 15:14:30 +08:00
if VGCANVAS == 'AGG':
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_AGG'
elif VGCANVAS == 'PICASSO':
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_PICASSO'
2018-04-13 10:25:58 +08:00
2018-04-24 17:38:22 +08:00
os.environ['LCD'] = LCD
os.environ['VGCANVAS'] =VGCANVAS
os.environ['BIN_DIR'] = BIN_DIR;
os.environ['LIB_DIR'] = LIB_DIR;
2018-04-27 11:23:09 +08:00
os.environ['TK_ROOT'] = TK_ROOT;
2018-04-24 17:38:22 +08:00
os.environ['GTEST_ROOT'] = GTEST_ROOT;
2018-04-13 10:25:58 +08:00
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-26 15:01:19 +08:00
if VGCANVAS == 'PICASSO':
OS_LIBS = ['freetype'] + OS_LIBS
2018-04-27 11:23:09 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DENABLE_FREE_TYPE2=1 -DFONT_FILE_NAME=\\\"'+TK_ROOT+'/demos/res/raw/fonts/font.ttf\\\"'
2018-04-13 10:25:58 +08:00
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-26 15:01:19 +08:00
if VGCANVAS == 'PICASSO':
OS_LIBS = ['freetype'] + OS_LIBS
2018-04-27 11:23:09 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DENABLE_FREE_TYPE2=1 -DFONT_FILE_NAME=\\\"'+TK_ROOT+'/demos/res/raw/fonts/font.ttf\\\"'
2018-04-13 10:25:58 +08:00
elif OS_NAME == 'Windows':
2018-04-13 21:44:50 +08:00
OS_LIBS=['SDL2', 'glad']
2018-04-23 11:33:45 +08:00
OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG -DUNICODE -D_UNICODE /Od /ZI'
2018-04-13 21:44:50 +08:00
OS_LINKFLAGS='/MACHINE:X64 /DEBUG'
2018-04-27 11:23:09 +08:00
OS_LIBPATH=[TK_3RD_ROOT+'/SDL2-2.0.7/lib/x64']
OS_CPPPATH=[TK_3RD_ROOT+'/SDL2-2.0.7/']
2018-02-21 19:36:38 +08:00
OS_SUBSYSTEM_CONSOLE='/SUBSYSTEM:CONSOLE '
OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS '
2018-04-24 17:38:22 +08:00
LIBS=['lftk', 'picasso', 'agg', 'nanovg'] + OS_LIBS
2018-04-13 10:25:58 +08:00
CCFLAGS=OS_FLAGS + COMMON_CCFLAGS
2018-04-27 11:23:09 +08:00
CPPPATH=[TK_ROOT,
TK_SRC,
TK_3RD_ROOT,
os.path.join(TK_3RD_ROOT, 'nanovg/src'),
os.path.join(TK_3RD_ROOT, 'agg-2.5/include'),
os.path.join(TK_3RD_ROOT, 'picasso/src'),
os.path.join(TK_3RD_ROOT, 'picasso/build'),
os.path.join(TK_3RD_ROOT, 'picasso/include'),
os.path.join(TK_3RD_ROOT, 'picasso/src/gfx'),
os.path.join(TK_3RD_ROOT, 'picasso/src/include'),
os.path.join(TK_3RD_ROOT, 'freetype2/include'),
TK_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-04-27 11:23:09 +08:00
LIBPATH=[os.path.join(TK_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-24 17:38:22 +08:00
'3rd/picasso/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-04-15 17:58:24 +08:00
'tools/ui_gen/xml_to_ui/SConscript',
'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'
])