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-09-02 12:17:42 +08:00
|
|
|
def joinPath(root, subdir):
|
|
|
|
return os.path.normpath(os.path.join(root, subdir))
|
|
|
|
|
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())
|
2018-11-09 18:46:34 +08:00
|
|
|
BIN_DIR=joinPath(TK_ROOT, 'bin')
|
|
|
|
LIB_DIR=joinPath(TK_ROOT, 'lib')
|
2018-09-02 12:17:42 +08:00
|
|
|
TK_SRC = joinPath(TK_ROOT, 'src')
|
|
|
|
TK_3RD_ROOT = joinPath(TK_ROOT, '3rd')
|
|
|
|
TK_TOOLS_ROOT = joinPath(TK_ROOT, 'tools')
|
|
|
|
GTEST_ROOT = joinPath(TK_ROOT, '3rd/gtest/googletest')
|
2018-02-21 19:36:38 +08:00
|
|
|
|
2018-04-27 18:12:12 +08:00
|
|
|
if OS_NAME == 'Windows':
|
2018-05-10 13:47:39 +08:00
|
|
|
TK_ROOT=TK_ROOT.replace('\\', '\\\\');
|
2018-08-30 15:24:34 +08:00
|
|
|
|
2018-10-15 16:19:26 +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-09-26 11:30:25 +08:00
|
|
|
VGCANVAS='NANOVG'
|
2018-11-09 18:46:34 +08:00
|
|
|
NANOVG_BACKEND='GL3'
|
|
|
|
#NANOVG_BACKEND='GLES2'
|
|
|
|
#NANOVG_BACKEND='GLES3'
|
|
|
|
#NANOVG_BACKEND='AGG'
|
2018-10-15 16:19:26 +08:00
|
|
|
#NANOVG_BACKEND='AGGE'
|
|
|
|
#NANOVG_BACKEND='BGFX'
|
|
|
|
|
2018-11-09 18:46:34 +08:00
|
|
|
FRAME_BUFFER_FORMAT=''
|
|
|
|
if NANOVG_BACKEND == 'AGGE' or NANOVG_BACKEND == 'AGG':
|
|
|
|
LCD='SDL_FB'
|
|
|
|
FRAME_BUFFER_FORMAT='bgr565'
|
|
|
|
#FRAME_BUFFER_FORMAT='bgra8888'
|
|
|
|
else:
|
|
|
|
LCD='SDL_GPU'
|
2018-04-13 10:25:58 +08:00
|
|
|
|
2018-10-15 16:19:26 +08:00
|
|
|
NANOVG_BACKEND_LIBS=[];
|
|
|
|
NANOVG_BACKEND_PROJS=[];
|
2018-12-26 18:10:38 +08:00
|
|
|
|
|
|
|
COMMON_CCFLAGS=' -DTK_ROOT=\\\"'+TK_ROOT+'\\\" '
|
|
|
|
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_STB_FONT '
|
|
|
|
#COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FT_FONT '
|
|
|
|
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DSTBTT_STATIC -DSTB_IMAGE_STATIC -DWITH_STB_IMAGE '
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_VGCANVAS -DWITH_UNICODE_BREAK -DWITH_DESKTOP_STYLE '
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DSDL2 -DHAS_STD_MALLOC -DWITH_SDL -DWITH_FS_RES -DHAS_STDIO '
|
2018-10-15 16:19:26 +08:00
|
|
|
|
2018-11-09 18:46:34 +08:00
|
|
|
if LCD == 'SDL_GPU':
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GPU -DWITH_VGCANVAS_LCD'
|
2018-04-13 10:25:58 +08:00
|
|
|
else:
|
2018-10-15 16:19:26 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_BITMAP_BGRA -DWITH_NANOVG_SOFT '
|
2018-10-12 17:48:27 +08:00
|
|
|
if FRAME_BUFFER_FORMAT=='bgra8888':
|
2018-10-15 16:19:26 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGRA8888=1 ';
|
2018-10-12 17:48:27 +08:00
|
|
|
else:
|
2018-11-11 12:16:44 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGR565=1';
|
2018-10-15 16:19:26 +08:00
|
|
|
|
|
|
|
if NANOVG_BACKEND == 'AGG':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg-agg', 'agg'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/agg/SConscript'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_AGG '
|
|
|
|
elif NANOVG_BACKEND == 'AGGE':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg-agge', 'agge'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/agge/SConscript'];
|
2018-11-09 18:46:34 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_AGGE '
|
2018-10-15 16:19:26 +08:00
|
|
|
elif NANOVG_BACKEND == 'BGFX':
|
2018-11-09 18:46:34 +08:00
|
|
|
NANOVG_BACKEND_LIBS=['nanovg-bgfx','bgfx'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/bgfx/SConscript'];
|
2018-10-15 16:19:26 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_BGFX '
|
2018-11-09 18:46:34 +08:00
|
|
|
elif NANOVG_BACKEND == 'GLES2':
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES2 -DWITH_NANOVG_GL '
|
|
|
|
elif NANOVG_BACKEND == 'GLES3':
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES3 -DWITH_NANOVG_GL '
|
2018-10-15 16:19:26 +08:00
|
|
|
else:
|
2018-11-09 18:46:34 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GL3 -DWITH_NANOVG_GL '
|
2018-04-24 17:38:22 +08:00
|
|
|
|
2018-09-02 12:17:42 +08:00
|
|
|
OS_LIBS=[]
|
2018-04-13 10:25:58 +08:00
|
|
|
OS_LIBPATH=[]
|
|
|
|
OS_CPPPATH=[]
|
2018-09-02 12:17:42 +08:00
|
|
|
OS_LINKFLAGS=''
|
2018-04-13 10:25:58 +08:00
|
|
|
OS_FLAGS='-g -Wall'
|
|
|
|
OS_SUBSYSTEM_CONSOLE=''
|
|
|
|
OS_SUBSYSTEM_WINDOWS=''
|
2018-10-13 07:59:46 +08:00
|
|
|
OS_PROJECTS=[]
|
2018-04-13 10:25:58 +08:00
|
|
|
|
|
|
|
if OS_NAME == 'Darwin':
|
2018-10-30 10:30:30 +08:00
|
|
|
OS_LIBS = ['stdc++', 'pthread', 'm', 'dl']
|
2018-11-09 18:46:34 +08:00
|
|
|
OS_LINKFLAGS='-framework Cocoa -framework QuartzCore -framework OpenGL -weak_framework Metal -weak_framework MetalKit'
|
2018-12-22 19:04:55 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_WIDGET_POOL '
|
2018-11-09 18:46:34 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__APPLE__ -DHAS_PTHREAD -DMACOS -DENABLE_MEM_LEAK_CHECK '
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -DBGFX_CONFIG_RENDERER_METAL=1 '
|
2018-04-13 10:25:58 +08:00
|
|
|
|
|
|
|
elif OS_NAME == 'Linux':
|
2018-10-30 10:14:46 +08:00
|
|
|
OS_LIBS = ['GL', 'gtk-3','gdk-3','Xext', 'X11', 'sndio','stdc++', 'pthread', 'm', 'dl']
|
2018-08-05 18:56:46 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DLINUX -DHAS_PTHREAD'
|
2018-10-13 07:59:46 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_REAL_API -DSDL_TIMER_UNIX -DSDL_VIDEO_DRIVER_X11 -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS '
|
2018-10-15 16:19:26 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_AUDIO_DRIVER_SNDIO -DSDL_VIDEO_OPENGL_GLX -DSDL_VIDEO_RENDER_OGL '
|
2018-10-13 07:59:46 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_LOADSO_DLOPEN -DSDL_VIDEO_OPENGL_EGL -DSDL_VIDEO_OPENGL_ES2 '
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_REAL_API -DSDL_HAPTIC_DISABLED -DSDL_SENSOR_DISABLED -DSDL_JOYSTICK_DISABLED '
|
|
|
|
OS_PROJECTS=['3rd/SDL/SConscript']
|
2018-04-13 10:25:58 +08:00
|
|
|
|
|
|
|
elif OS_NAME == 'Windows':
|
2018-11-09 18:46:34 +08:00
|
|
|
OS_LIBS=['gdi32', 'user32','winmm.lib','imm32.lib','version.lib','shell32.lib','ole32.lib','Oleaut32.lib','Advapi32.lib','DelayImp.lib','psapi.lib']
|
2018-12-19 16:55:49 +08:00
|
|
|
OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 '
|
|
|
|
#OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 -D_DEBUG /MDd '
|
2018-10-13 07:59:46 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_REAL_API -DSDL_HAPTIC_DISABLED -DSDL_SENSOR_DISABLED -DSDL_JOYSTICK_DISABLED '
|
2018-11-09 18:46:34 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + '-D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_HAS_EXCEPTIONS=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_ITERATOR_DEBUG_LEVEL=0 -D_SCL_SECURE=0'
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + '-D_SECURE_SCL=0 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_WIN64'
|
2018-04-13 21:44:50 +08:00
|
|
|
OS_LINKFLAGS='/MACHINE:X64 /DEBUG'
|
2018-02-21 19:36:38 +08:00
|
|
|
OS_SUBSYSTEM_CONSOLE='/SUBSYSTEM:CONSOLE '
|
|
|
|
OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS '
|
2018-10-13 07:59:46 +08:00
|
|
|
OS_PROJECTS=['3rd/SDL/SConscript']
|
|
|
|
|
2018-09-02 12:17:42 +08:00
|
|
|
LINKFLAGS=OS_LINKFLAGS;
|
|
|
|
LIBPATH=[LIB_DIR] + OS_LIBPATH
|
2018-04-13 10:25:58 +08:00
|
|
|
CCFLAGS=OS_FLAGS + COMMON_CCFLAGS
|
2018-10-15 16:19:26 +08:00
|
|
|
LIBS=['awtk', 'gpinyin', 'awtk', 'linebreak'] + NANOVG_BACKEND_LIBS + ['nanovg', 'SDL2', 'glad'] + OS_LIBS
|
2018-09-02 12:17:42 +08:00
|
|
|
|
2018-04-27 11:23:09 +08:00
|
|
|
CPPPATH=[TK_ROOT,
|
|
|
|
TK_SRC,
|
|
|
|
TK_3RD_ROOT,
|
2018-09-02 12:17:42 +08:00
|
|
|
joinPath(TK_SRC, 'ext_widgets'),
|
2018-11-09 18:46:34 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'bgfx/bgfx/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'bgfx/bx/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'bgfx/bimg/include'),
|
2018-10-13 18:40:00 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'agge'),
|
2018-10-15 16:19:26 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'agg/include'),
|
2018-10-13 18:40:00 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/gl'),
|
2018-11-09 18:46:34 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/base'),
|
2018-10-13 18:40:00 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/agge'),
|
2018-11-09 18:46:34 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/bgfx'),
|
2018-10-13 07:59:46 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'SDL/src'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'SDL/include'),
|
2018-09-19 14:13:57 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'agge/src'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'agge/include'),
|
2018-09-02 12:17:42 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'gpinyin/include'),
|
2018-10-13 18:40:00 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'libunibreak'),
|
2018-04-27 11:23:09 +08:00
|
|
|
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-09-02 12:17:42 +08:00
|
|
|
LIBS = LIBS,
|
|
|
|
LIBPATH = LIBPATH,
|
2018-04-13 10:25:58 +08:00
|
|
|
CPPPATH = CPPPATH,
|
2018-09-02 12:17:42 +08:00
|
|
|
LINKFLAGS = LINKFLAGS,
|
2018-02-21 19:36:38 +08:00
|
|
|
OS_SUBSYSTEM_CONSOLE=OS_SUBSYSTEM_CONSOLE,
|
2018-09-02 12:17:42 +08:00
|
|
|
OS_SUBSYSTEM_WINDOWS=OS_SUBSYSTEM_WINDOWS
|
|
|
|
)
|
2018-02-21 19:36:38 +08:00
|
|
|
|
2018-11-09 18:46:34 +08:00
|
|
|
os.environ['LCD'] = LCD
|
|
|
|
os.environ['BIN_DIR'] = BIN_DIR;
|
|
|
|
os.environ['LIB_DIR'] = LIB_DIR;
|
|
|
|
os.environ['TK_ROOT'] = TK_ROOT;
|
|
|
|
os.environ['CCFLAGS'] = CCFLAGS;
|
|
|
|
os.environ['VGCANVAS'] = VGCANVAS
|
|
|
|
os.environ['GTEST_ROOT'] = GTEST_ROOT;
|
|
|
|
os.environ['TK_3RD_ROOT'] = TK_3RD_ROOT;
|
|
|
|
os.environ['INPUT_ENGINE'] = INPUT_ENGINE;
|
|
|
|
os.environ['NANOVG_BACKEND'] = NANOVG_BACKEND;
|
|
|
|
os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT;
|
|
|
|
|
2018-10-15 16:19:26 +08:00
|
|
|
SConscriptFiles=NANOVG_BACKEND_PROJS + [
|
2018-04-13 10:25:58 +08:00
|
|
|
'3rd/nanovg/SConscript',
|
2018-04-13 13:54:36 +08:00
|
|
|
'3rd/glad/SConscript',
|
2018-06-24 12:23:51 +08:00
|
|
|
'3rd/gpinyin/SConscript',
|
2018-07-27 10:50:05 +08:00
|
|
|
'3rd/libunibreak/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-10-11 11:24:06 +08:00
|
|
|
'tools/ui_gen/qt_to_xml/SConscript',
|
2018-04-15 17:58:24 +08:00
|
|
|
'tools/ui_gen/xml_to_ui/SConscript',
|
2018-11-19 17:31:03 +08:00
|
|
|
'tools/svg_gen/SConscript',
|
2018-03-10 19:11:37 +08:00
|
|
|
'demos/SConscript',
|
2018-08-05 11:59:11 +08:00
|
|
|
'tests/SConscript'
|
2018-10-13 07:59:46 +08:00
|
|
|
] + OS_PROJECTS
|
2018-05-10 13:47:39 +08:00
|
|
|
|
|
|
|
SConscript(SConscriptFiles)
|
|
|
|
|