Added --compiler option and made --config actually work.

This commit is contained in:
Patrick 2023-08-05 14:09:29 +02:00
parent b2a81cadb9
commit 3e370bfa52

View File

@ -127,13 +127,43 @@ AddOption(
default = 'config.py'
)
AddOption(
'--compiler',
dest = 'compiler',
type = 'choice',
choices = ('auto', 'gcc', 'clang', 'msvc'),
nargs = 1,
action = 'store',
default = 'auto'
)
build_type = GetOption('build_type')
unity_mode = GetOption('unity_mode')
variant = GetOption('variant')
enable_asan = GetOption('enable_asan')
config_file = GetOption('config_file')
compiler = GetOption('compiler')
env = Environment(tools = ['default', 'compilation_db', 'unity_build'])
default_CC = {
'gcc': 'gcc',
'clang': 'clang',
'msvc': 'cl.exe'
}.get(compiler, None)
default_CXX = {
'gcc': 'g++',
'clang': 'clang++',
'msvc': 'cl.exe'
}.get(compiler, None)
vars = Variables(config_file)
vars.Add('CC', 'The C Compiler', default_CC)
vars.Add('CXX', 'The C++ Compiler', default_CXX)
vars.Add('LINK', 'The Linker')
vars.Add('CCFLAGS', 'C/C++ Compiler Flags')
vars.Add('LINKFLAGS', 'Linker Flags')
vars.Add('PYTHON', 'Python Executable', 'python')
env = Environment(tools = ['default', 'compilation_db', 'unity_build'], variables = vars)
env['RECIPES_FOLDERS'] = [Dir('recipes')]
env['SYSTEM_CACHE_DIR'] = os.path.join(_find_system_cache_dir(), 'spp_cache')
env['CLONE_DIR'] = os.path.join(env['SYSTEM_CACHE_DIR'], 'cloned')