Merge pull request #208 from willnationsdev/scons

Replace ARGUMENTS with opts.Add/env and some cleanup
pull/210/head
Bastiaan Olij 2018-11-28 08:52:38 +11:00 committed by GitHub
commit 295950efd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 10 deletions

View File

@ -21,13 +21,25 @@ else:
opts = Variables([], ARGUMENTS) opts = Variables([], ARGUMENTS)
opts.Add(EnumVariable('platform', 'Target platform', host_platform, ('linux', 'osx', 'windows'))) opts.Add(EnumVariable('platform', 'Target platform', host_platform,
allowed_values=('linux', 'osx', 'windows'),
ignorecase=2))
opts.Add(EnumVariable('bits', 'Target platform bits', 'default', ('default', '32', '64'))) opts.Add(EnumVariable('bits', 'Target platform bits', 'default', ('default', '32', '64')))
opts.Add(BoolVariable('use_llvm', 'Use the LLVM compiler - only effective when targeting Linux', False)) opts.Add(BoolVariable('use_llvm', 'Use the LLVM compiler - only effective when targeting Linux', False))
opts.Add(BoolVariable('use_mingw', 'Use the MinGW compiler - only effective on Windows', False)) opts.Add(BoolVariable('use_mingw', 'Use the MinGW compiler - only effective on Windows', False))
# Must be the same setting as used for cpp_bindings # Must be the same setting as used for cpp_bindings
opts.Add(EnumVariable('target', 'Compilation target', 'debug', ('debug', 'release'))) opts.Add(EnumVariable('target', 'Compilation target', 'debug',
opts.Add(PathVariable('headers_dir', 'Path to the directory containing Godot headers', 'godot_headers')) allowed_values=('debug', 'release'),
ignorecase=2))
opts.Add(PathVariable('headers_dir', 'Path to the directory containing Godot headers', 'godot_headers', PathVariable.PathisDir))
opts.Add(BoolVariable('use_custom_api_file', 'Use a custom JSON API file', False))
opts.Add(PathVariable('custom_api_file', 'Path to the custom JSON API file', '', PathVariable.PathIsFile))
opts.Add(BoolVariable('generate_bindings', 'Generate GDNative API bindings', False))
unknown = vars.UnknownVariables()
if unknown:
print "Unknown variables:", unknown.keys()
Exit(1)
env = Environment() env = Environment()
opts.Update(env) opts.Update(env)
@ -101,22 +113,18 @@ env.Append(CPPPATH=['.', env['headers_dir'], 'include', 'include/gen', 'include/
# Generate bindings? # Generate bindings?
json_api_file = '' json_api_file = ''
# Generate bindings? if env['use_custom_api_file']:
json_api_file = '' json_api_file = env['custom_api_file']
if ARGUMENTS.get('use_custom_api_file', 'no') == 'yes':
json_api_file = ARGUMENTS.get('custom_api_file', '')
else: else:
json_api_file = os.path.join(os.getcwd(), 'godot_headers', 'api.json') json_api_file = os.path.join(os.getcwd(), 'godot_headers', 'api.json')
if ARGUMENTS.get('generate_bindings', 'no') == 'yes': if env['generate_bindings']:
# Actually create the bindings here # Actually create the bindings here
import binding_generator import binding_generator
binding_generator.generate_bindings(json_api_file) binding_generator.generate_bindings(json_api_file)
# source to compile # source to compile
sources = [] sources = []
add_sources(sources, 'src/core', 'cpp') add_sources(sources, 'src/core', 'cpp')