2019-02-25 17:45:05 +08:00
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import platform
|
2020-07-20 18:20:20 +08:00
|
|
|
import shutil
|
2019-08-15 08:14:32 +08:00
|
|
|
from shutil import copyfile
|
2019-02-25 17:45:05 +08:00
|
|
|
|
2019-08-20 17:27:48 +08:00
|
|
|
TOOLS_PREFIX=''
|
2019-08-22 10:54:28 +08:00
|
|
|
OS_NAME = platform.system();
|
|
|
|
MACH = platform.machine();
|
2019-05-11 21:20:19 +08:00
|
|
|
ARCH = platform.architecture();
|
|
|
|
is32bit = (ARCH[0] == '32bit');
|
2019-02-25 17:45:05 +08:00
|
|
|
|
2019-05-11 21:20:19 +08:00
|
|
|
if is32bit:
|
2020-04-17 16:23:03 +08:00
|
|
|
if MACH == 'i686' or MACH == 'i386' or MACH == 'x86':
|
2019-08-22 10:54:28 +08:00
|
|
|
TARGET_ARCH='x86'
|
|
|
|
else:
|
|
|
|
TARGET_ARCH='arm'
|
2019-05-11 17:37:07 +08:00
|
|
|
else:
|
|
|
|
TARGET_ARCH=''
|
2019-03-20 09:34:25 +08:00
|
|
|
|
2019-08-22 13:50:47 +08:00
|
|
|
print('MACH=' + MACH + ' ARCH=' + str(ARCH) + ' TARGET_ARCH=' + TARGET_ARCH)
|
2019-03-20 09:34:25 +08:00
|
|
|
|
2019-02-25 17:45:05 +08:00
|
|
|
def joinPath(root, subdir):
|
|
|
|
return os.path.normpath(os.path.join(root, subdir))
|
|
|
|
|
|
|
|
TK_ROOT=os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
|
|
|
|
|
2020-06-10 21:37:55 +08:00
|
|
|
WIN32_AWTK_RES=os.path.join(TK_ROOT, 'win32_res/awtk.res');
|
|
|
|
|
2019-02-25 17:45:05 +08:00
|
|
|
print('TK_ROOT: ' + TK_ROOT);
|
|
|
|
|
|
|
|
TK_SRC = joinPath(TK_ROOT, 'src')
|
|
|
|
TK_BIN_DIR = joinPath(TK_ROOT, 'bin')
|
|
|
|
TK_LIB_DIR = joinPath(TK_ROOT, 'lib')
|
|
|
|
TK_3RD_ROOT = joinPath(TK_ROOT, '3rd')
|
|
|
|
TK_TOOLS_ROOT = joinPath(TK_ROOT, 'tools')
|
|
|
|
TK_DEMO_ROOT = joinPath(TK_ROOT, 'demos')
|
|
|
|
GTEST_ROOT = joinPath(TK_ROOT, '3rd/gtest/googletest')
|
2021-03-25 17:16:12 +08:00
|
|
|
AWTK_STATIC_LIBS=['awtk_global', 'extwidgets', 'widgets', 'base', 'gpinyin', 'streams', 'conf_io', 'hal', 'csv', 'ubjson', 'compressors', 'fribidi', 'mbedtls', 'miniz', 'tkc_static', 'linebreak', 'mbedtls']
|
2019-02-25 17:45:05 +08:00
|
|
|
|
|
|
|
#INPUT_ENGINE='null'
|
2020-04-21 10:22:05 +08:00
|
|
|
#INPUT_ENGINE='spinyin'
|
|
|
|
#INPUT_ENGINE='t9'
|
2020-04-22 15:53:42 +08:00
|
|
|
#INPUT_ENGINE='t9ext'
|
|
|
|
INPUT_ENGINE='pinyin'
|
2019-02-25 17:45:05 +08:00
|
|
|
|
2019-05-29 09:49:34 +08:00
|
|
|
VGCANVAS='NANOVG'
|
2019-05-31 12:09:41 +08:00
|
|
|
if OS_NAME == 'Windows':
|
|
|
|
TK_ROOT=TK_ROOT.replace('\\', '\\\\');
|
2019-06-04 10:17:16 +08:00
|
|
|
NANOVG_BACKEND='GLES2'
|
2019-05-31 12:09:41 +08:00
|
|
|
else:
|
|
|
|
NANOVG_BACKEND='GL3'
|
|
|
|
|
2020-02-24 12:09:37 +08:00
|
|
|
#VGCANVAS='CAIRO'
|
2019-06-03 11:46:02 +08:00
|
|
|
#NANOVG_BACKEND='GLES2'
|
|
|
|
#NANOVG_BACKEND='GLES3'
|
2019-10-31 11:28:42 +08:00
|
|
|
#NANOVG_BACKEND='AGG'
|
2020-06-05 10:43:29 +08:00
|
|
|
#NANOVG_BACKEND='AGGE'
|
2019-06-03 11:46:02 +08:00
|
|
|
#NANOVG_BACKEND='BGFX'
|
2019-02-25 17:45:05 +08:00
|
|
|
|
|
|
|
FRAME_BUFFER_FORMAT=''
|
2019-05-15 16:09:57 +08:00
|
|
|
if VGCANVAS == 'CAIRO':
|
2019-02-25 17:45:05 +08:00
|
|
|
LCD='SDL_FB'
|
|
|
|
FRAME_BUFFER_FORMAT='bgr565'
|
|
|
|
#FRAME_BUFFER_FORMAT='bgra8888'
|
2019-05-15 16:09:57 +08:00
|
|
|
else:
|
|
|
|
if NANOVG_BACKEND == 'AGGE' or NANOVG_BACKEND == 'AGG':
|
|
|
|
LCD='SDL_FB'
|
|
|
|
FRAME_BUFFER_FORMAT='bgr565'
|
|
|
|
#FRAME_BUFFER_FORMAT='bgra8888'
|
|
|
|
else:
|
|
|
|
LCD='SDL_GPU'
|
2019-08-13 10:37:40 +08:00
|
|
|
#LCD='SDL_FB_MONO'
|
2019-02-25 17:45:05 +08:00
|
|
|
|
|
|
|
NANOVG_BACKEND_LIBS=[];
|
|
|
|
NANOVG_BACKEND_PROJS=[];
|
|
|
|
|
2019-08-01 11:10:17 +08:00
|
|
|
NATIVE_WINDOW='sdl'
|
2019-08-15 12:16:49 +08:00
|
|
|
TOOLS_NAME = ''
|
2021-03-30 14:45:15 +08:00
|
|
|
#TOOLS_NAME = 'mingw'
|
2019-08-01 11:10:17 +08:00
|
|
|
|
2020-08-12 16:05:24 +08:00
|
|
|
COMMON_CCFLAGS=' -DTK_ROOT=\"\\\"'+TK_ROOT+'\\\"\" '
|
2019-03-21 16:29:27 +08:00
|
|
|
#COMMON_CCFLAGS=COMMON_CCFLAGS+' -DENABLE_PERFORMANCE_PROFILE=1 '
|
2020-06-10 16:58:40 +08:00
|
|
|
#COMMON_CCFLAGS=COMMON_CCFLAGS+' -DNATIVE_WINDOW_BORDERLESS=1 '
|
2020-06-17 18:09:05 +08:00
|
|
|
#COMMON_CCFLAGS=COMMON_CCFLAGS+' -DENABLE_MEM_LEAK_CHECK=1 '
|
2020-06-10 16:58:40 +08:00
|
|
|
|
2021-04-04 10:58:07 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_MBEDTLS=1 '
|
2020-05-24 19:23:42 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DENABLE_CURSOR=1 '
|
2020-07-09 17:05:21 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_TEXT_BIDI=1 '
|
2020-12-14 11:31:42 +08:00
|
|
|
#COMMON_CCFLAGS=COMMON_CCFLAGS+' -DLOAD_ASSET_WITH_MMAP=1 '
|
2020-06-07 16:28:10 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_DATA_READER_WRITER=1 '
|
2020-05-18 12:32:42 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_EVENT_RECORDER_PLAYER=1 '
|
2020-02-27 16:01:10 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_ASSET_LOADER -DWITH_FS_RES -DWITH_ASSET_LOADER_ZIP '
|
2020-03-14 16:17:43 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DSTBTT_STATIC -DSTB_IMAGE_STATIC -DWITH_STB_IMAGE '
|
2019-02-25 17:45:05 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_VGCANVAS -DWITH_UNICODE_BREAK -DWITH_DESKTOP_STYLE '
|
2021-04-22 14:52:29 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_SDL -DHAS_STDIO -DHAVE_STDIO_H -DHAS_GET_TIME_US64 '
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DHAS_STD_MALLOC -DTK_MAX_MEM_BLOCK_NR=3 '
|
|
|
|
|
|
|
|
#COMMON_CCFLAGS=COMMON_CCFLAGS+' -DTK_MAX_MEM_BLOCK_NR=3 '
|
2019-02-25 17:45:05 +08:00
|
|
|
|
2019-10-31 22:07:56 +08:00
|
|
|
GRAPHIC_BUFFER='default'
|
|
|
|
|
2019-06-22 08:52:48 +08:00
|
|
|
#only for c compiler flags
|
|
|
|
COMMON_CFLAGS=''
|
|
|
|
|
2020-04-21 10:22:05 +08:00
|
|
|
if INPUT_ENGINE == 't9':
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_IME_T9 '
|
|
|
|
elif INPUT_ENGINE == 't9ext' :
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_IME_T9EXT'
|
|
|
|
elif INPUT_ENGINE == 'pinyin' :
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_IME_PINYIN '
|
|
|
|
elif INPUT_ENGINE == 'spinyin' :
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_IME_SPINYIN '
|
|
|
|
elif INPUT_ENGINE == 'null' :
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_IME_NULL '
|
|
|
|
|
2019-02-25 17:45:05 +08:00
|
|
|
if LCD == 'SDL_GPU':
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GPU -DWITH_VGCANVAS_LCD'
|
2019-09-04 15:22:50 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_STB_FONT '
|
2019-08-13 10:37:40 +08:00
|
|
|
elif LCD == 'SDL_FB_MONO':
|
2019-08-15 09:06:35 +08:00
|
|
|
NANOVG_BACKEND='AGGE'
|
2019-08-13 11:06:44 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_LCD_MONO -DWITH_NANOVG_SOFT '
|
2021-03-24 17:15:28 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_STB_FONT '
|
2019-02-25 17:45:05 +08:00
|
|
|
else:
|
2019-09-04 15:22:50 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_STB_FONT '
|
2019-02-25 17:45:05 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_BITMAP_BGRA -DWITH_NANOVG_SOFT '
|
|
|
|
if FRAME_BUFFER_FORMAT=='bgra8888':
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGRA8888=1 ';
|
|
|
|
else:
|
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGR565=1';
|
|
|
|
|
2019-05-15 16:09:57 +08:00
|
|
|
if VGCANVAS == 'CAIRO':
|
|
|
|
NANOVG_BACKEND_LIBS=['cairo', 'pixman'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/cairo/SConscript', '3rd/pixman/SConscript'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_VGCANVAS_CAIRO -DHAVE_CONFIG_H -DCAIRO_WIN32_STATIC_BUILD '
|
2019-02-25 17:45:05 +08:00
|
|
|
else:
|
2019-05-15 16:09:57 +08:00
|
|
|
if NANOVG_BACKEND == 'AGG':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg-agg', 'nanovg', 'agg'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/agg/SConscript'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_AGG '
|
|
|
|
elif NANOVG_BACKEND == 'AGGE':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg-agge', 'nanovg', 'agge'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/agge/SConscript'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_AGGE '
|
|
|
|
elif NANOVG_BACKEND == 'BGFX':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg-bgfx','nanovg', 'bgfx'];
|
|
|
|
NANOVG_BACKEND_PROJS=['3rd/bgfx/SConscript'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_BGFX '
|
|
|
|
elif NANOVG_BACKEND == 'GLES2':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES2 -DWITH_NANOVG_GL '
|
|
|
|
elif NANOVG_BACKEND == 'GLES3':
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES3 -DWITH_NANOVG_GL '
|
|
|
|
else:
|
|
|
|
NANOVG_BACKEND_LIBS=['nanovg'];
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GL3 -DWITH_NANOVG_GL '
|
2019-02-25 17:45:05 +08:00
|
|
|
|
|
|
|
OS_FLAGS=''
|
|
|
|
OS_LIBS=[]
|
|
|
|
OS_LIBPATH=[]
|
|
|
|
OS_CPPPATH=[]
|
|
|
|
OS_LINKFLAGS=''
|
|
|
|
OS_SUBSYSTEM_CONSOLE=''
|
|
|
|
OS_SUBSYSTEM_WINDOWS=''
|
|
|
|
OS_PROJECTS=[]
|
2020-04-28 06:36:53 +08:00
|
|
|
OS_WHOLE_ARCHIVE=''
|
2019-02-25 17:45:05 +08:00
|
|
|
if OS_NAME == 'Darwin':
|
2019-08-15 12:16:49 +08:00
|
|
|
TOOLS_NAME = ''
|
2020-09-15 09:23:54 +08:00
|
|
|
OS_FLAGS='-g -Wall -fPIC -DWITHOUT_GLAD=1 '
|
2020-08-19 10:55:25 +08:00
|
|
|
OS_LIBS = ['stdc++', 'iconv','pthread', 'm', 'dl']
|
2019-11-24 18:43:47 +08:00
|
|
|
OS_LINKFLAGS='-framework IOKit -framework Cocoa -framework QuartzCore -framework OpenGL -weak_framework Metal -weak_framework MetalKit'
|
2020-03-10 08:29:23 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DHAS_SEM_OPEN '
|
2020-06-17 17:59:38 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__APPLE__ -DHAS_PTHREAD -DMACOS '
|
2019-02-25 17:45:05 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -DBGFX_CONFIG_RENDERER_METAL=1 '
|
2020-04-28 09:54:56 +08:00
|
|
|
AWTK_DLL_DEPS_LIBS = AWTK_STATIC_LIBS + NANOVG_BACKEND_LIBS + ['SDL2', 'glad'] + OS_LIBS
|
|
|
|
OS_WHOLE_ARCHIVE=' -all_load '
|
2019-02-25 17:45:05 +08:00
|
|
|
|
|
|
|
elif OS_NAME == 'Linux':
|
2019-08-15 12:16:49 +08:00
|
|
|
TOOLS_NAME = ''
|
2019-12-05 18:11:23 +08:00
|
|
|
OS_FLAGS='-g -Wall -fPIC '
|
2020-08-19 11:02:18 +08:00
|
|
|
OS_LIBS = ['GL', 'gtk-3','gdk-3','Xext', 'X11', 'sndio','stdc++', 'pthread', 'm', 'dl', 'asound']
|
2019-07-02 14:10:03 +08:00
|
|
|
COMMON_CFLAGS=COMMON_CFLAGS+' -std=gnu99 '
|
2019-02-25 17:45:05 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DLINUX -DHAS_PTHREAD'
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_REAL_API -DSDL_TIMER_UNIX -DSDL_VIDEO_DRIVER_X11 -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS '
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_AUDIO_DRIVER_SNDIO -DSDL_VIDEO_OPENGL_GLX -DSDL_VIDEO_RENDER_OGL '
|
|
|
|
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']
|
2019-05-11 17:37:07 +08:00
|
|
|
if TARGET_ARCH == 'x86':
|
2020-05-21 20:35:02 +08:00
|
|
|
OS_FLAGS = OS_FLAGS + ' -U__FLT_EVAL_METHOD__ -D__FLT_EVAL_METHOD__=0 '
|
2019-05-15 16:09:57 +08:00
|
|
|
else:
|
|
|
|
OS_FLAGS = OS_FLAGS + ' -DWITH_64BIT_CPU '
|
2019-02-25 17:45:05 +08:00
|
|
|
|
2021-03-06 11:41:43 +08:00
|
|
|
OS_LINKFLAGS=' -Wl,-rpath=./bin -Wl,-rpath=./ '
|
2020-04-28 09:54:56 +08:00
|
|
|
AWTK_DLL_DEPS_LIBS = NANOVG_BACKEND_LIBS + ['SDL2', 'glad'] + OS_LIBS
|
2021-03-25 17:16:12 +08:00
|
|
|
OS_WHOLE_ARCHIVE =' -Wl,--whole-archive -lawtk_global -lextwidgets -lwidgets -lbase -lgpinyin -lstreams -lconf_io -lhal -lcsv -lubjson -lcompressors -lfribidi -lmbedtls -lminiz -ltkc_static -llinebreak -Wl,--no-whole-archive'
|
2020-04-28 06:36:53 +08:00
|
|
|
|
2019-02-25 17:45:05 +08:00
|
|
|
elif OS_NAME == 'Windows':
|
2019-08-15 12:16:49 +08:00
|
|
|
if not os.path.exists(os.path.abspath(TK_BIN_DIR)) :
|
|
|
|
os.makedirs(os.path.abspath(TK_BIN_DIR))
|
|
|
|
if not os.path.exists(os.path.abspath(TK_LIB_DIR)) :
|
|
|
|
os.makedirs(os.path.abspath(TK_LIB_DIR))
|
|
|
|
if TOOLS_NAME == '' :
|
2019-08-30 05:40:27 +08:00
|
|
|
OS_LIBS=['gdi32', 'user32','winmm.lib','imm32.lib','version.lib','shell32.lib','ole32.lib','Oleaut32.lib','Advapi32.lib','DelayImp.lib','psapi.lib']
|
2020-04-04 07:01:43 +08:00
|
|
|
OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 /utf-8'
|
2019-08-15 12:16:49 +08:00
|
|
|
if TARGET_ARCH == 'x86':
|
2020-08-12 16:29:55 +08:00
|
|
|
OS_LINKFLAGS='/MACHINE:X86 /DEBUG \"' + WIN32_AWTK_RES + '\" '
|
2019-08-15 12:16:49 +08:00
|
|
|
OS_SUBSYSTEM_CONSOLE='/SUBSYSTEM:CONSOLE,5.01 '
|
|
|
|
OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS,5.01 '
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D_WIN32 '
|
|
|
|
else:
|
|
|
|
OS_FLAGS = OS_FLAGS + ' -DWITH_64BIT_CPU '
|
2020-08-12 16:29:55 +08:00
|
|
|
OS_LINKFLAGS='/MACHINE:X64 /DEBUG \"' + WIN32_AWTK_RES + '\" '
|
2019-08-15 12:16:49 +08:00
|
|
|
OS_SUBSYSTEM_CONSOLE='/SUBSYSTEM:CONSOLE '
|
|
|
|
OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS '
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D_WIN64 '
|
2021-01-26 14:07:56 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DHAVE_LIBC '
|
2020-05-20 08:40:36 +08:00
|
|
|
OS_WHOLE_ARCHIVE=' /DEF:"dllexports/awtk.def" '
|
2020-04-28 09:54:56 +08:00
|
|
|
AWTK_DLL_DEPS_LIBS = AWTK_STATIC_LIBS + NANOVG_BACKEND_LIBS + ['SDL2', 'glad'] + OS_LIBS
|
2020-04-28 06:36:53 +08:00
|
|
|
|
2019-08-15 12:16:49 +08:00
|
|
|
elif TOOLS_NAME == 'mingw' :
|
2020-05-21 20:35:02 +08:00
|
|
|
OS_LIBS=['kernel32', 'gdi32', 'user32', 'winmm','imm32','version','shell32','ole32','Oleaut32','Advapi32','oleaut32','uuid','stdc++',"ws2_32"]
|
|
|
|
OS_FLAGS='-DMINGW -DWINDOWS -D_CONSOLE -g -Wall'
|
2021-03-06 11:41:43 +08:00
|
|
|
OS_LINKFLAGS=' -Wl,-rpath=./bin -Wl,-rpath=./ '
|
2019-08-15 12:16:49 +08:00
|
|
|
COMMON_CFLAGS=COMMON_CFLAGS+' -std=gnu99 '
|
2020-05-21 20:35:02 +08:00
|
|
|
COMMON_CCFLAGS=COMMON_CCFLAGS+' -U__FLT_EVAL_METHOD__ -D__FLT_EVAL_METHOD__=0 -DUNICODE -DDECLSPEC= '
|
2021-03-25 17:16:12 +08:00
|
|
|
OS_WHOLE_ARCHIVE =' -Wl,--whole-archive -lawtk_global -lextwidgets -lwidgets -lbase -lgpinyin -lstreams -lconf_io -lhal -lcsv -lubjson -lcompressors -lfribidi -lmbedtls -lminiz -ltkc_static -llinebreak -Wl,--no-whole-archive'
|
2020-04-28 09:54:56 +08:00
|
|
|
AWTK_DLL_DEPS_LIBS = AWTK_STATIC_LIBS + NANOVG_BACKEND_LIBS + ['SDL2', 'glad'] + OS_LIBS
|
2019-08-15 12:16:49 +08:00
|
|
|
|
2019-02-25 17:45:05 +08:00
|
|
|
#OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 -D_DEBUG /MDd '
|
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_REAL_API -DSDL_HAPTIC_DISABLED -DSDL_SENSOR_DISABLED -DSDL_JOYSTICK_DISABLED '
|
|
|
|
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'
|
2019-03-20 09:34:25 +08:00
|
|
|
COMMON_CCFLAGS = COMMON_CCFLAGS + '-D_SECURE_SCL=0 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE '
|
2019-02-25 17:45:05 +08:00
|
|
|
OS_PROJECTS=['3rd/SDL/SConscript']
|
2019-08-15 08:14:32 +08:00
|
|
|
|
2019-08-15 12:16:49 +08:00
|
|
|
|
2019-06-22 08:52:48 +08:00
|
|
|
CFLAGS=COMMON_CFLAGS
|
2019-02-25 17:45:05 +08:00
|
|
|
LINKFLAGS=OS_LINKFLAGS;
|
2020-04-28 09:34:09 +08:00
|
|
|
LIBPATH=[TK_LIB_DIR, TK_BIN_DIR] + OS_LIBPATH
|
2019-02-25 17:45:05 +08:00
|
|
|
CCFLAGS=OS_FLAGS + COMMON_CCFLAGS
|
2020-05-20 16:55:10 +08:00
|
|
|
AWTK_CCFLAGS=OS_FLAGS + COMMON_CCFLAGS + ' -DWITH_WIDGET_TYPE_CHECK=1 '
|
2020-04-28 06:36:53 +08:00
|
|
|
|
2020-04-28 09:54:56 +08:00
|
|
|
STATIC_LIBS = AWTK_STATIC_LIBS + NANOVG_BACKEND_LIBS + ['SDL2', 'glad'] + OS_LIBS
|
2020-04-28 09:58:15 +08:00
|
|
|
SHARED_LIBS=['awtk'] + OS_LIBS;
|
|
|
|
|
|
|
|
LIBS=STATIC_LIBS
|
2019-02-25 17:45:05 +08:00
|
|
|
|
|
|
|
CPPPATH=[TK_ROOT,
|
|
|
|
TK_SRC,
|
|
|
|
TK_3RD_ROOT,
|
|
|
|
joinPath(TK_SRC, 'ext_widgets'),
|
2020-12-27 08:50:34 +08:00
|
|
|
joinPath(TK_SRC, 'custom_widgets'),
|
2020-07-09 17:05:21 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'fribidi'),
|
2021-03-25 17:16:12 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'mbedtls/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'mbedtls/3rdparty/everest/include'),
|
2019-04-02 09:32:22 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'pixman'),
|
2019-08-15 06:28:23 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'cairo'),
|
2019-02-25 17:45:05 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'bgfx/bgfx/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'bgfx/bx/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'bgfx/bimg/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'agge'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'agg/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/gl'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/base'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/agge'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'nanovg/bgfx'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'SDL/src'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'SDL/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'agge/src'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'agge/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'gpinyin/include'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'libunibreak'),
|
2019-08-22 09:05:37 +08:00
|
|
|
joinPath(TK_3RD_ROOT, 'gtest/googletest'),
|
|
|
|
joinPath(TK_3RD_ROOT, 'gtest/googletest/include'),
|
2019-02-25 17:45:05 +08:00
|
|
|
TK_TOOLS_ROOT] + OS_CPPPATH
|
|
|
|
|
|
|
|
os.environ['LCD'] = LCD
|
2019-02-25 17:59:58 +08:00
|
|
|
os.environ['TK_ROOT'] = TK_ROOT
|
2019-02-25 17:45:05 +08:00
|
|
|
os.environ['CCFLAGS'] = CCFLAGS;
|
|
|
|
os.environ['VGCANVAS'] = VGCANVAS
|
2019-08-15 12:16:49 +08:00
|
|
|
os.environ['TOOLS_NAME'] = TOOLS_NAME;
|
2019-02-25 17:45:05 +08:00
|
|
|
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;
|
2019-08-01 11:10:17 +08:00
|
|
|
os.environ['NATIVE_WINDOW'] = NATIVE_WINDOW;
|
2019-10-31 22:07:56 +08:00
|
|
|
os.environ['GRAPHIC_BUFFER'] = GRAPHIC_BUFFER;
|
2019-02-25 17:45:05 +08:00
|
|
|
os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT;
|
2020-04-28 06:36:53 +08:00
|
|
|
os.environ['OS_WHOLE_ARCHIVE'] = OS_WHOLE_ARCHIVE;
|
2020-04-28 09:54:56 +08:00
|
|
|
os.environ['AWTK_DLL_DEPS_LIBS'] = ';'.join(AWTK_DLL_DEPS_LIBS)
|
2020-04-28 12:20:37 +08:00
|
|
|
os.environ['STATIC_LIBS'] = ';'.join(STATIC_LIBS)
|
2020-05-20 16:55:10 +08:00
|
|
|
|
2020-05-18 18:16:13 +08:00
|
|
|
os.environ['WITH_AWTK_SO'] = 'true'
|
2020-05-20 16:55:10 +08:00
|
|
|
os.environ['AWTK_CCFLAGS'] = AWTK_CCFLAGS;
|
2019-02-25 17:45:05 +08:00
|
|
|
|
2021-01-29 12:25:29 +08:00
|
|
|
os.environ['SDL_UBUNTU_USE_IME'] = str(False)
|
|
|
|
# os.environ['SDL_UBUNTU_USE_IME'] = str(True)
|
|
|
|
|
2020-03-12 07:13:52 +08:00
|
|
|
def has_custom_cc():
|
|
|
|
return False
|
2020-07-20 18:20:20 +08:00
|
|
|
|
|
|
|
def copySharedLib(src, dst, name):
|
|
|
|
if OS_NAME == 'Darwin':
|
|
|
|
src = os.path.join(src, 'bin/lib'+name+'.dylib')
|
|
|
|
elif OS_NAME == 'Linux':
|
|
|
|
src = os.path.join(src, 'bin/lib'+name+'.so')
|
|
|
|
elif OS_NAME == 'Windows':
|
|
|
|
src = os.path.join(src, 'bin/'+name+'.dll')
|
|
|
|
else:
|
|
|
|
print('not support ' + OS_NAME)
|
|
|
|
return
|
2020-08-12 16:29:55 +08:00
|
|
|
|
|
|
|
src = os.path.normpath(src);
|
|
|
|
dst = os.path.normpath(dst);
|
2020-08-17 10:46:54 +08:00
|
|
|
|
|
|
|
if os.path.dirname(src) == dst:
|
|
|
|
return
|
|
|
|
|
2020-07-20 18:20:20 +08:00
|
|
|
if not os.path.exists(src):
|
|
|
|
print('Can\'t find ' + src + '. Please build '+name+'before!')
|
|
|
|
else:
|
|
|
|
if not os.path.exists(dst):
|
|
|
|
os.makedirs(dst)
|
|
|
|
shutil.copy(src, dst)
|
|
|
|
print(src + '==>' + dst);
|
|
|
|
|
|
|
|
def isBuildShared():
|
|
|
|
return 'WITH_AWTK_SO' in os.environ and os.environ['WITH_AWTK_SO'] == 'true'
|
|
|
|
|
2020-12-26 22:24:26 +08:00
|
|
|
def genIdlAndDef():
|
|
|
|
cmds = [
|
|
|
|
'node tools/idl_gen/tkc.js tools/idl_gen/tkc.json',
|
|
|
|
'node tools/idl_gen/index.js tools/idl_gen/idl.json',
|
|
|
|
'node tools/dll_def_gen/index.js tools/idl_gen/idl.json dllexports/awtk.def false',
|
|
|
|
'node tools/dll_def_gen/index.js tools/idl_gen/tkc.json dllexports/tkc.def false'
|
|
|
|
];
|
|
|
|
|
|
|
|
for cmd in cmds:
|
|
|
|
print(cmd)
|
|
|
|
if os.system(cmd) != 0:
|
|
|
|
print('exe cmd: ' + cmd + ' failed.')
|