awtk/SConstruct

144 lines
4.5 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
if OS_NAME == 'Windows':
LCD='NANOVG'
2018-05-10 13:47:39 +08:00
TK_ROOT=TK_ROOT.replace('\\', '\\\\');
print(TK_ROOT)
else:
2018-06-28 17:10:38 +08:00
LCD='SDL'
2018-06-28 17:14:02 +08:00
LCD='NANOVG'
VGCANVAS='AGG'
VGCANVAS='PICASSO'
2018-06-22 18:35:56 +08:00
INPUT_METHOD='native'
INPUT_METHOD='default'
2018-06-23 17:55:52 +08:00
INPUT_ENGINE='null'
2018-06-24 12:23:51 +08:00
INPUT_ENGINE='pinyin'
2018-04-13 10:25:58 +08:00
2018-05-27 11:52:44 +08:00
FRAME_BUFFER_FORMAT='rgba8888'
2018-05-27 17:27:27 +08:00
FRAME_BUFFER_FORMAT='rgb565'
2018-07-05 11:46:38 +08:00
COMMON_CCFLAGS=' -DTK_ROOT=\\\"'+TK_ROOT+'\\\" -DHAS_STD_MALLOC -DSDL2 -DWITH_FS_RES -DHAS_STDIO -DWITH_DESKTOP_STYLE'
2018-05-04 14:52:15 +08:00
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DLUA_COMPAT_MODULE -DSTBTT_STATIC -DSTB_IMAGE_STATIC -DWITH_STB_IMAGE -DWITH_STB_FONT -DWITH_DYNAMIC_TR'
2018-04-13 10:25:58 +08:00
if FRAME_BUFFER_FORMAT=='rgba8888':
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_8888=1';
else:
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_565=1';
2018-06-22 06:47:54 +08:00
if INPUT_METHOD == 'native':
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_NATIVE_IM=1';
else:
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_DEFAULT_IM=1';
2018-04-13 10:25:58 +08:00
if LCD == 'NANOVG':
2018-04-24 17:38:22 +08:00
VGCANVAS='NANOVG'
2018-05-31 11:01:46 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG -DWITH_GL3 -DWITH_VGCANVAS_LCD'
2018-04-13 10:25:58 +08:00
else:
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 -DIMAGE_RGBA'
2018-06-09 16:36:53 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_BITMAP_RGB565'
2018-04-25 15:14:30 +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-06-22 06:47:54 +08:00
os.environ['INPUT_METHOD'] = INPUT_METHOD;
2018-06-23 17:55:52 +08:00
os.environ['INPUT_ENGINE'] = INPUT_ENGINE;
os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT;
2018-04-24 17:38:22 +08:00
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-07-10 14:04:00 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DLUA_USE_POSIX -D__APPLE__ -DHAS_PTHREAD -DMACOS'
2018-04-26 15:01:19 +08:00
if VGCANVAS == 'PICASSO':
OS_LIBS = ['freetype'] + OS_LIBS
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DENABLE_FREE_TYPE2=1 -DFONT_FILE_NAME=\\\"'+TK_ROOT+'/demos/res/raw/fonts/default_ttf.ttf\\\"'
2018-07-10 14:04:00 +08:00
OS_LIBS = ['picasso', 'agg'] + OS_LIBS
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']
2018-05-18 17:42:13 +08:00
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DLUA_USE_POSIX -DLINUX -DHAS_PTHREAD'
2018-04-26 15:01:19 +08:00
if VGCANVAS == 'PICASSO':
OS_LIBS = ['freetype'] + OS_LIBS
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DENABLE_FREE_TYPE2=1 -DFONT_FILE_NAME=\\\"'+TK_ROOT+'/demos/res/raw/fonts/default_ttf.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-07-10 14:04:00 +08:00
LIBS=['awtk', 'gpinyin', 'awtk', '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'),
2018-05-27 11:52:44 +08:00
os.path.join(TK_3RD_ROOT, 'agg/include'),
2018-06-24 12:23:51 +08:00
os.path.join(TK_3RD_ROOT, 'gpinyin/include'),
2018-04-27 11:23:09 +08:00
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
2018-05-10 13:47:39 +08:00
SConscriptFiles=[
2018-04-13 10:25:58 +08:00
'3rd/nanovg/SConscript',
2018-04-13 13:54:36 +08:00
'3rd/glad/SConscript',
2018-05-10 14:22:10 +08:00
'3rd/lua/SConscript',
2018-05-27 11:52:44 +08:00
'3rd/agg/SConscript',
2018-06-24 12:23:51 +08:00
'3rd/gpinyin/SConscript',
2018-05-10 14:22:10 +08:00
'3rd/picasso/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-07-10 15:59:21 +08:00
'tools/image_resize/SConscript',
2018-04-01 08:13:10 +08:00
'tools/res_gen/SConscript',
2018-05-04 14:52:15 +08:00
'tools/str_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',
'lua/SConscript'
2018-05-10 13:47:39 +08:00
]
SConscript(SConscriptFiles)