mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve build scripts
This commit is contained in:
parent
0a4c452a8f
commit
a4a49cedfb
@ -71,7 +71,7 @@ else:
|
||||
# LCD='SDL_FB_MONO'
|
||||
|
||||
if NANOVG_BACKEND == 'AGGE' or NANOVG_BACKEND == 'AGGE' :
|
||||
lcd_color_format = complie_helper.get_value('LCD_COLOR_FORMAT')
|
||||
lcd_color_format = complie_helper.get_value('LCD_COLOR_FORMAT', '')
|
||||
if lcd_color_format != '' :
|
||||
if lcd_color_format== 'mono' :
|
||||
LCD = 'SDL_FB_MONO'
|
||||
@ -234,7 +234,7 @@ elif OS_NAME == 'Windows':
|
||||
else :
|
||||
BUILD_DEBUG_FLAG = ' -DNDEBUG /MD /O2 /Oi '
|
||||
|
||||
if complie_helper.get_value('PDB') :
|
||||
if complie_helper.get_value('PDB', True) :
|
||||
BUILD_DEBUG_LINKFLAGS = ' /DEBUG '
|
||||
|
||||
|
||||
|
@ -93,7 +93,7 @@ OS_SUBSYSTEM_WINDOWS = ''
|
||||
OS_PROJECTS = []
|
||||
# only for c compiler flags
|
||||
COMMON_CFLAGS = ''
|
||||
OS_DEBUG = complie_helper.get_value('DEBUG')
|
||||
OS_DEBUG = complie_helper.get_value('DEBUG', True)
|
||||
|
||||
if OS_NAME == 'Darwin':
|
||||
TOOLS_NAME = ''
|
||||
@ -112,7 +112,7 @@ elif OS_NAME == 'Linux':
|
||||
'sndio', 'stdc++', 'asound', 'pthread', 'm', 'dl']
|
||||
COMMON_CFLAGS = COMMON_CFLAGS+' -std=gnu99 '
|
||||
OS_FLAGS = OS_FLAGS + ' -DLINUX -DHAS_PTHREAD'
|
||||
OS_FLAGS = OS_FLAGS + ' -DSDL_REAL_API -DSDL_TIMER_UNIX -DSDL_VIDEO_DRIVER_X11 -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS '
|
||||
OS_FLAGS = OS_FLAGS + ' -DSDL_TIMER_UNIX -DSDL_VIDEO_DRIVER_X11 -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS '
|
||||
OS_FLAGS = OS_FLAGS + \
|
||||
' -DSDL_AUDIO_DRIVER_SNDIO -DSDL_VIDEO_OPENGL_GLX -DSDL_VIDEO_RENDER_OGL '
|
||||
OS_FLAGS = OS_FLAGS + ' -DSDL_LOADSO_DLOPEN -DSDL_VIDEO_OPENGL_EGL -DSDL_VIDEO_OPENGL_ES2 '
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
2023/11/23
|
||||
* object\_default支持设置属性时保持属性类型不变。
|
||||
* 修正awtk的scons参数args的统一处理,以及删掉一些重复写的编译参数。对scons参数为none时才设置为默认值,对参数值为空字符串及空数组时直接替换进去不做特殊处理。(感谢陈谭和智明提供补丁)
|
||||
|
||||
2023/11/21
|
||||
* 修正了编译Win32平台时缺少inet_ntop函数定义的问题,还有几个文件缺少bom头的问题(感谢陈谭提供补丁)
|
||||
|
@ -15,33 +15,33 @@ SRT_SCONS_CONFIG_SCRIPT = 'SCONS_CONFIG_SCRIPT'
|
||||
SRT_SCONS_CONFIG_SCRIPT_ARGV = 'SCONS_CONFIG_SCRIPT_ARGV'
|
||||
|
||||
COMPILE_CONFIG = {
|
||||
'AWTK_ROOT' : { 'value' : '', 'desc' : ['awtk root'], 'help_info' : 'set link awtk root, AWTK_ROOT=XXXXX'},
|
||||
'AWTK_ROOT' : { 'value' : None, 'desc' : ['awtk root'], 'help_info' : 'set link awtk root, AWTK_ROOT=XXXXX'},
|
||||
'LINUX_FB' : { 'value' : False, 'desc' : ['use linux\'s building'], 'help_info' : 'use linux\'s compile tools prefix building, value is true or false'},
|
||||
'MVVM_ROOT' : { 'value' : '', 'desc' : ['awtk\'s mvvm root'], 'help_info' : 'set link awtk\'s mvvm root, MVVM_ROOT=XXXXX'},
|
||||
'MVVM_ROOT' : { 'value' : None, 'desc' : ['awtk\'s mvvm root'], 'help_info' : 'set link awtk\'s mvvm root, MVVM_ROOT=XXXXX'},
|
||||
'WITH_MVVM' : { 'value' : False, 'desc' : ['use mvvm'], 'help_info' : 'use mvvm\'s lib, value is true or false'},
|
||||
'WITH_JERRYSCRIPT' : { 'value' : False, 'desc' : ['use mvvm\'s js'], 'help_info' : 'use mvvm js\'s lib, value is true or false'},
|
||||
'WITH_IOTJS' : { 'value' : False, 'desc' : ['use mvvm\'s iotjs'], 'help_info' : 'use mvvm iotjs\'s lib, value is true or false'},
|
||||
'AWFLOW_ROOT' : { 'value' : '', 'desc' : ['awtk\'s awflow root'], 'help_info' : 'set link awtk\'s awflow root, AWFLOW_ROOT=XXXXX'},
|
||||
'AWFLOW_ROOT' : { 'value' : None, 'desc' : ['awtk\'s awflow root'], 'help_info' : 'set link awtk\'s awflow root, AWFLOW_ROOT=XXXXX'},
|
||||
'WITH_AWFLOW' : { 'value' : False, 'desc' : ['use awflow'], 'help_info' : 'use awflow\'s lib, value is true or false'},
|
||||
SRT_SCONS_CONFIG_SCRIPT : { 'value' : '', 'save_file' : False, 'desc' : ['set script file path, this is script has {0}(COMPILE_CONFIG, ARGUMENTS, argv) function'.format(SRT_SCONS_CONFIG_FUN)], 'help_info' : 'set res config file path, this is script must has {0}(COMPILE_CONFIG, ARGUMENTS, argv) function, {0}\'s function return compile_config\'s class, CONFIG_SCRIPT=XXXXX'.format(SRT_SCONS_CONFIG_FUN)},
|
||||
SRT_SCONS_CONFIG_SCRIPT_ARGV : { 'value' : '', 'save_file' : False, 'desc' : ['value is {0}\s argv for script file '.format(SRT_SCONS_CONFIG_FUN)], 'help_info' : 'value is {0}\s argv for script file\'s {0}, SCONS_CONFIG_SCRIPT_ARGV=XXXXX'.format(SRT_SCONS_CONFIG_FUN)},
|
||||
SRT_SCONS_CONFIG_SCRIPT : { 'value' : None, 'save_file' : False, 'desc' : ['set script file path, this is script has {0}(COMPILE_CONFIG, ARGUMENTS, argv) function'.format(SRT_SCONS_CONFIG_FUN)], 'help_info' : 'set res config file path, this is script must has {0}(COMPILE_CONFIG, ARGUMENTS, argv) function, {0}\'s function return compile_config\'s class, CONFIG_SCRIPT=XXXXX'.format(SRT_SCONS_CONFIG_FUN)},
|
||||
SRT_SCONS_CONFIG_SCRIPT_ARGV : { 'value' : None, 'save_file' : False, 'desc' : ['value is {0}\s argv for script file '.format(SRT_SCONS_CONFIG_FUN)], 'help_info' : 'value is {0}\s argv for script file\'s {0}, SCONS_CONFIG_SCRIPT_ARGV=XXXXX'.format(SRT_SCONS_CONFIG_FUN)},
|
||||
'BUILD_DIR' : { 'value' : None, 'desc' : ['build dir, compile temp file dir'], 'help_info' : 'set build dir, save compile temp file dir or *.obj/.*o dir, BUILD_DIR=XXXXX'},
|
||||
# 'APP_BIN_DIR' : { 'value' : None, 'desc' : ['build bin dir'], 'help_info' : 'set build bin dir, APP_BIN_DIR=XXXXX'},
|
||||
# 'APP_LIB_DIR' : { 'value' : None, 'desc' : ['build lib dir'], 'help_info' : 'set build lib dir, APP_LIB_DIR=XXXXX'},
|
||||
'DEBUG' : { 'value' : None, 'desc' : ['awtk\'s compile is debug'], 'help_info' : 'awtk\'s compile is debug, value is true or false' },
|
||||
'PDB' : { 'value' : True, 'desc' : ['export pdb file'], 'help_info' : 'export pdb file, value is true or false' },
|
||||
'FLAGS' : { 'value' : '', 'desc' : ['compile flags'], 'help_info' : 'set compile\'s flags, so care of system and compile tools'},
|
||||
'FLAGS' : { 'value' : None, 'desc' : ['compile flags'], 'help_info' : 'set compile\'s flags, so care of system and compile tools'},
|
||||
'LIBS' : { 'value' : [], 'desc' : ['compile libs'], 'help_info' : 'set compile\'s libs, so care of system and compile tools, use \',\' split muliple libraries '},
|
||||
'LIBPATH' : { 'value' : [], 'desc' : ['compile lib paths'], 'help_info' : 'set compile\'s lib paths, so care of system and compile tools, use \',\' split muliple librarie\'s paths '},
|
||||
'CPPPATH' : { 'value' : [], 'desc' : ['compile include paths'], 'help_info' : 'set compile\'s include paths, so care of system and compile tools, use \',\' split muliple include path '},
|
||||
'SHARED' : { 'value' : True, 'desc' : ['compile is SharedLibrary'], 'help_info' : 'app\'s compile is Shared Library, value is true or false' },
|
||||
'IDL_DEF' : { 'value' : True, 'desc' : ['compile build idl def file'], 'help_info' : 'app\'s compile build idl def file, value is true or false' },
|
||||
'LCD' : { 'value' : '', 'save_file' : False, 'desc' : ['app\'s lcd\'s size'], 'help_info' : 'app\'s lcd\'s size, value is [lcd_width]_[lcd_height], example is LCD=320_480' },
|
||||
'LANGUAGE' : { 'value' : '', 'save_file' : False, 'desc' : ['app\'s language'], 'help_info' : 'app\'s language, value is [country]_[language], example is LANGUAGE=zh_CH' },
|
||||
'FONT' : { 'value' : '', 'save_file' : False, 'desc' : ['app\'s font\'s name'], 'help_info' : 'app\'s font\'s name, FONT=XXXXX ' },
|
||||
'THEME' : { 'value' : '', 'save_file' : False, 'desc' : ['app\'s default\'s theme\'s name'], 'help_info' : 'app\'s default\'s theme\'s name, THEME=XXXXX ' },
|
||||
'RES_ROOT' : { 'value' : '', 'save_file' : False, 'desc' : ['app\'s res root'], 'help_info' : 'app\'s res root, RES_ROOT=XXXXX ' },
|
||||
'WIN32_RES' : { 'value' : '', 'desc' : ['app\'s win32 res path'], 'help_info' : 'app\'s win32 res path, WIN32_RES=XXXXX, value\'s default=\'awtk/win32_res/awtk.res\' ' },
|
||||
'LCD' : { 'value' : None, 'save_file' : False, 'desc' : ['app\'s lcd\'s size'], 'help_info' : 'app\'s lcd\'s size, value is [lcd_width]_[lcd_height], example is LCD=320_480' },
|
||||
'LANGUAGE' : { 'value' : None, 'save_file' : False, 'desc' : ['app\'s language'], 'help_info' : 'app\'s language, value is [country]_[language], example is LANGUAGE=zh_CH' },
|
||||
'FONT' : { 'value' : None, 'save_file' : False, 'desc' : ['app\'s font\'s name'], 'help_info' : 'app\'s font\'s name, FONT=XXXXX ' },
|
||||
'THEME' : { 'value' : None, 'save_file' : False, 'desc' : ['app\'s default\'s theme\'s name'], 'help_info' : 'app\'s default\'s theme\'s name, THEME=XXXXX ' },
|
||||
'RES_ROOT' : { 'value' : None, 'save_file' : False, 'desc' : ['app\'s res root'], 'help_info' : 'app\'s res root, RES_ROOT=XXXXX ' },
|
||||
'WIN32_RES' : { 'value' : None, 'desc' : ['app\'s win32 res path'], 'help_info' : 'app\'s win32 res path, WIN32_RES=XXXXX, value\'s default=\'awtk/win32_res/awtk.res\' ' },
|
||||
}
|
||||
|
||||
def set_compile_config(config) :
|
||||
@ -273,7 +273,7 @@ class AppHelperBase:
|
||||
self.AWTK_CFLAGS = self.awtk.CFLAGS
|
||||
self.AWTK_CCFLAGS = self.awtk.CCFLAGS
|
||||
self.APP_ROOT = APP_ROOT
|
||||
self.BUILD_DIR = self.complie_helper.get_value('BUILD_DIR')
|
||||
self.BUILD_DIR = self.complie_helper.get_value('BUILD_DIR', '')
|
||||
self.BIN_DIR = os.path.join(self.BUILD_DIR, 'bin')
|
||||
self.LIB_DIR = os.path.join(self.BUILD_DIR, 'lib')
|
||||
self.APP_BIN_DIR = os.path.join(APP_ROOT, self.BIN_DIR)
|
||||
@ -291,7 +291,7 @@ class AppHelperBase:
|
||||
if self.LINUX_FB and 'DEBUG' not in ARGUMENTS :
|
||||
self.DEBUG = False
|
||||
else :
|
||||
self.DEBUG = self.complie_helper.get_value('DEBUG')
|
||||
self.DEBUG = self.complie_helper.get_value('DEBUG', True)
|
||||
|
||||
self.parseArgs(self.awtk, ARGUMENTS)
|
||||
self.APP_CPPPATH = [self.APP_SRC, self.APP_RES] + self.complie_helper.get_value('CPPPATH', [])
|
||||
@ -313,7 +313,7 @@ class AppHelperBase:
|
||||
self.WITH_IOTJS = self.complie_helper.get_value('WITH_IOTJS', False)
|
||||
|
||||
WITH_MVVM = self.complie_helper.get_value('WITH_MVVM', False)
|
||||
MVVM_ROOT = self.complie_helper.get_value('MVVM_ROOT')
|
||||
MVVM_ROOT = self.complie_helper.get_value('MVVM_ROOT', '')
|
||||
if WITH_MVVM or os.path.exists(MVVM_ROOT):
|
||||
os.environ['WITH_MVVM'] = 'true'
|
||||
if not os.path.exists(MVVM_ROOT):
|
||||
@ -322,7 +322,7 @@ class AppHelperBase:
|
||||
print("MVVM_ROOT: " + self.MVVM_ROOT)
|
||||
|
||||
WITH_AWFLOW = self.complie_helper.get_value('WITH_AWFLOW', False)
|
||||
AWFLOW_ROOT = self.complie_helper.get_value('AWFLOW_ROOT')
|
||||
AWFLOW_ROOT = self.complie_helper.get_value('AWFLOW_ROOT', '')
|
||||
print(WITH_AWFLOW)
|
||||
if WITH_AWFLOW or os.path.exists(AWFLOW_ROOT):
|
||||
os.environ['WITH_AWFLOW'] = 'true'
|
||||
@ -344,7 +344,7 @@ class AppHelperBase:
|
||||
os.chdir(self.AWTK_ROOT)
|
||||
compile_config.set_curr_app_root(tmp_cwd)
|
||||
tmp_complie_helper = compile_config.get_curr_config()
|
||||
compile_config.set_app_win32_res(tmp_complie_helper.get_value('WIN32_RES'))
|
||||
compile_config.set_app_win32_res(tmp_complie_helper.get_value('WIN32_RES', None))
|
||||
compile_config.set_curr_config(None)
|
||||
import awtk_config as awtk
|
||||
os.chdir(tmp_cwd)
|
||||
@ -462,7 +462,7 @@ class AppHelperBase:
|
||||
APP_RES_ROOT = config.get_res_res_root()
|
||||
LCD_ORIENTATION = config.get_res_lcd_orientation(APP_THEME)
|
||||
|
||||
LCD = self.complie_helper.get_value('LCD')
|
||||
LCD = self.complie_helper.get_value('LCD', '')
|
||||
if len(LCD) > 0:
|
||||
wh = LCD.split('_')
|
||||
if len(wh) >= 1:
|
||||
@ -470,13 +470,13 @@ class AppHelperBase:
|
||||
if len(wh) >= 2:
|
||||
LCD_HEIGHT = wh[1]
|
||||
|
||||
FONT = self.complie_helper.get_value('FONT')
|
||||
FONT = self.complie_helper.get_value('FONT', '')
|
||||
if len(FONT) > 0:
|
||||
APP_DEFAULT_FONT = FONT
|
||||
|
||||
APP_THEME = self.complie_helper.get_value('THEME', APP_THEME)
|
||||
|
||||
LANGUAGE = self.complie_helper.get_value('LANGUAGE')
|
||||
LANGUAGE = self.complie_helper.get_value('LANGUAGE', '')
|
||||
if len(LANGUAGE) > 0:
|
||||
lan = LANGUAGE.split('_')
|
||||
if len(lan) >= 1:
|
||||
@ -507,9 +507,9 @@ class AppHelperBase:
|
||||
APP_CCFLAGS = APP_CCFLAGS + ' -DAPP_ROOT=\"\\\"' + \
|
||||
self.APP_ROOT + '\\\"\" '
|
||||
|
||||
self.APP_CFLAGS = self.complie_helper.get_value('FLAGS')
|
||||
self.APP_CCFLAGS = APP_CCFLAGS + self.complie_helper.get_value('FLAGS')
|
||||
self.APP_CXXFLAGS = self.APP_CCFLAGS + self.complie_helper.get_value('FLAGS')
|
||||
self.APP_CFLAGS = ''
|
||||
self.APP_CCFLAGS = APP_CCFLAGS + self.complie_helper.get_value('FLAGS', '')
|
||||
self.APP_CXXFLAGS = ''
|
||||
|
||||
if PLATFORM == 'Linux':
|
||||
self.APP_LINKFLAGS += ' -Wl,-rpath=' + self.APP_BIN_DIR + ' '
|
||||
@ -683,13 +683,10 @@ class AppHelperBase:
|
||||
if DEBUG != OS_DEBUG:
|
||||
if DEBUG :
|
||||
CCFLAGS += ' -g -O0 '
|
||||
CFLAGS += ' -g -O0 '
|
||||
else :
|
||||
CCFLAGS += ' -Os '
|
||||
CFLAGS += ' -Os '
|
||||
else :
|
||||
CCFLAGS += BUILD_DEBUG_FLAG
|
||||
CFLAGS += BUILD_DEBUG_FLAG
|
||||
|
||||
env = DefaultEnvironment(
|
||||
ENV = os.environ,
|
||||
@ -714,16 +711,13 @@ class AppHelperBase:
|
||||
if DEBUG != OS_DEBUG:
|
||||
if DEBUG :
|
||||
CCFLAGS += ' -D_DEBUG -DDEBUG /DEBUG /MDd /Od '
|
||||
CFLAGS += ' -D_DEBUG -DDEBUG /DEBUG /MDd /Od '
|
||||
else :
|
||||
CCFLAGS += ' -DNDEBUG /MD /O2 /Oi '
|
||||
CFLAGS += ' -DNDEBUG /MD /O2 /Oi '
|
||||
|
||||
if self.complie_helper.get_value('PDB') :
|
||||
if self.complie_helper.get_value('PDB', True) :
|
||||
LINKFLAGS += ' /DEBUG '
|
||||
else :
|
||||
CCFLAGS += BUILD_DEBUG_FLAG
|
||||
CFLAGS += BUILD_DEBUG_FLAG
|
||||
LINKFLAGS += awtk.BUILD_DEBUG_LINKFLAGS
|
||||
|
||||
env = DefaultEnvironment(
|
||||
|
@ -86,12 +86,12 @@ class complie_helper :
|
||||
})
|
||||
|
||||
config = collections.OrderedDict({
|
||||
'OUTPUT_DIR' : { 'value' : '', 'desc' : ['compiled export directory '], 'help_info' : 'set awtk compiled export directory, default value is \'\', \'\' is system\'s value'},
|
||||
'TOOLS_NAME' : { 'value' : '', 'str_enum' : ['mingw'], 'desc' : ['value is mingw or \'\''], 'help_info' : 'set awtk compile\'s name, default value is \'\', \'\' is system\'s value'},
|
||||
'INPUT_ENGINE' : { 'value' : '', 'str_enum' : ['null', 'spinyin', 't9', 't9ext', 'pinyin'], 'desc' : ['value is null/spinyin/t9/t9ext/pinyin'], 'help_info' : 'set awtk use input engine, default value is \'\', \'\' is system\'s value' },
|
||||
'VGCANVAS' : { 'value' : '', 'str_enum' : ['NANOVG', 'NANOVG_PLUS', 'CAIRO'], 'desc' : ['value is NANOVG/NANOVG_PLUS/CAIRO'], 'help_info' : 'set awtk use render vgcanvas type, default value is \'\', \'\' is system\'s value' },
|
||||
'NANOVG_BACKEND' : { 'value' : '', 'str_enum' : ['GLES2', 'GLES3', 'GL3', 'AGG', 'AGGE'], 'desc' : ['if NANOVG_BACKEND is valid, VGCANVAS must be NANOVG or \'\'', 'if VGCANVAS is NANOVG_PLUS, NANOVG_BACKEND must be GLES2/GLES3/GL3 or \'\'', 'NANOVG_BACKEND is GLES2/GLES3/GL3/AGG/AGGE'], 'help_info' : 'set awtk\'s nanovg use render model, default value is \'\', \'\' is system\'s value'},
|
||||
'LCD_COLOR_FORMAT' : { 'value' : '', 'str_enum' : ['bgr565', 'bgra8888', 'mono'], 'desc' : ['if NANOVG_BACKEND is GLES2/GLES3/GL3, LCD_COLOR_FORMAT must be bgra8888 or \'\'', 'if NANOVG_BACKEND is AGG/AGGE, LCD_COLOR_FORMAT must be bgr565/bgra8888/mono or \'\'', 'NANOVG_BACKEND is bgr565/bgra8888/mono'], 'help_info' : 'set awtk\'s lcd color format, default value is \'\', \'\' is system\'s value'},
|
||||
'OUTPUT_DIR' : { 'value' : None, 'desc' : ['compiled export directory '], 'help_info' : 'set awtk compiled export directory, default value is \'\', \'\' is system\'s value'},
|
||||
'TOOLS_NAME' : { 'value' : None, 'str_enum' : ['mingw'], 'desc' : ['value is \'mingw\' or None'], 'help_info' : 'set awtk compile\'s name, default value is None, None is system\'s value'},
|
||||
'INPUT_ENGINE' : { 'value' : None, 'str_enum' : ['null', 'spinyin', 't9', 't9ext', 'pinyin'], 'desc' : ['value is null/spinyin/t9/t9ext/pinyin'], 'help_info' : 'set awtk use input engine, default value is None, None is system\'s value' },
|
||||
'VGCANVAS' : { 'value' : None, 'str_enum' : ['NANOVG', 'NANOVG_PLUS', 'CAIRO'], 'desc' : ['value is NANOVG/NANOVG_PLUS/CAIRO'], 'help_info' : 'set awtk use render vgcanvas type, default value is None, None is system\'s value' },
|
||||
'NANOVG_BACKEND' : { 'value' : None, 'str_enum' : ['GLES2', 'GLES3', 'GL3', 'AGG', 'AGGE'], 'desc' : ['if NANOVG_BACKEND is valid, VGCANVAS must be NANOVG or \'\'', 'if VGCANVAS is NANOVG_PLUS, NANOVG_BACKEND must be GLES2/GLES3/GL3 or None', 'NANOVG_BACKEND is GLES2/GLES3/GL3/AGG/AGGE'], 'help_info' : 'set awtk\'s nanovg use render model, default value is None, None is system\'s value'},
|
||||
'LCD_COLOR_FORMAT' : { 'value' : None, 'str_enum' : ['bgr565', 'bgra8888', 'mono'], 'desc' : ['if NANOVG_BACKEND is GLES2/GLES3/GL3, LCD_COLOR_FORMAT must be bgra8888 or \'\'', 'if NANOVG_BACKEND is AGG/AGGE, LCD_COLOR_FORMAT must be bgr565/bgra8888/mono or None', 'NANOVG_BACKEND is bgr565/bgra8888/mono'], 'help_info' : 'set awtk\'s lcd color format, default value is None, None is system\'s value'},
|
||||
'DEBUG' : { 'value' : True, 'desc' : ['awtk\'s compile is debug'], 'help_info' : 'awtk\'s compile is debug, value is true or false, default value is true' },
|
||||
'PDB' : { 'value' : True, 'desc' : ['export pdb file'], 'help_info' : 'export pdb file, value is true or false' },
|
||||
'SDL_UBUNTU_USE_IME' : { 'value' : False, 'desc' : ['ubuntu use chinese input engine'], 'help_info' : 'ubuntu use ime, this sopt is ubuntu use chinese input engine, value is true or false, default value is false' },
|
||||
@ -100,7 +100,7 @@ class complie_helper :
|
||||
'BUILD_TESTS' : { 'value' : True, 'desc' : ['build awtk\'s gtest demo'], 'help_info' : 'build awtk\'s gtest demo, value is true or false, default value is true' },
|
||||
'BUILD_DEMOS' : { 'value' : True, 'desc' : ['build awtk\'s demo examples'], 'help_info' : 'build awtk\'s demo examples, value is true or false, default value is true' },
|
||||
'BUILD_TOOLS' : { 'value' : True, 'desc' : ['build awtk\'s tools'], 'help_info' : 'build awtk\'s tools, value is true or false, default value is true' },
|
||||
'WIN32_RES' : { 'value' : '', 'save_file' : False, 'desc' : ['app\'s win32 res path'], 'help_info' : 'app\'s win32 res path, WIN32_RES=XXXXX, value\'s default=\'awtk/win32_res/awtk.res\' ' },
|
||||
'WIN32_RES' : { 'value' : None, 'save_file' : False, 'desc' : ['app\'s win32 res path'], 'help_info' : 'app\'s win32 res path, WIN32_RES=XXXXX, value\'s default=\'awtk/win32_res/awtk.res\' ' },
|
||||
})
|
||||
|
||||
def try_load_default_config(self) :
|
||||
@ -125,13 +125,16 @@ class complie_helper :
|
||||
check = False
|
||||
if not 'str_enum' in self.config[key] :
|
||||
continue
|
||||
if self.config[key]['value'] != '' :
|
||||
if self.config[key]['value'] != '' and self.config[key]['value'] != None:
|
||||
for str_enum in self.config[key]['str_enum'] :
|
||||
if str_enum == self.config[key]['value'] :
|
||||
check = True
|
||||
break
|
||||
if not check :
|
||||
sys.exit(key + ' \'s value is ' + self.config[key]['value'] + ', is not legality !')
|
||||
if self.config[key]['value'] == None:
|
||||
sys.exit(key + ' \'s value is None, is not legality !')
|
||||
else :
|
||||
sys.exit(key + ' \'s value is ' + self.config[key]['value'] + ', is not legality !')
|
||||
|
||||
def scons_user_sopt(self, ARGUMENTS) :
|
||||
EXPORT_USERDEFINE_FILE = None
|
||||
@ -190,8 +193,9 @@ class complie_helper :
|
||||
dir = os.path.dirname(file);
|
||||
if os.path.exists(dir) :
|
||||
save_data = ''
|
||||
save_data += '# user set default configuration item'
|
||||
save_data += '\n\n'
|
||||
save_data += '# user set default configuration item \n'
|
||||
save_data += '# if value is None, so value is default value \n'
|
||||
save_data += '\n'
|
||||
for key in self.config :
|
||||
if 'save_file' in self.config[key] and not self.config[key]['save_file'] :
|
||||
continue
|
||||
@ -230,13 +234,10 @@ class complie_helper :
|
||||
def has_key(self, name) :
|
||||
return name in self.config
|
||||
|
||||
def get_value(self, name, default_value = '') :
|
||||
if name in self.config :
|
||||
if self.config[name]['value'] != '' and self.config[name]['value'] != None :
|
||||
return self.config[name]['value']
|
||||
return default_value
|
||||
def get_value(self, name, default_value = None) :
|
||||
return self.get_unique_value(name, default_value)
|
||||
|
||||
def get_unique_value(self, name, default_value = '') :
|
||||
def get_unique_value(self, name, default_value) :
|
||||
if name in self.config and self.config[name]['value'] != None :
|
||||
return self.config[name]['value']
|
||||
return default_value
|
||||
|
Loading…
Reference in New Issue
Block a user