style: Fix PEP8 whitespace issues in Python files

Done with `autopep8 --select=E2,W2`, fixes:

- E201 - Remove extraneous whitespace.
- E202 - Remove extraneous whitespace.
- E203 - Remove extraneous whitespace.
- E211 - Remove extraneous whitespace.
- E221 - Fix extraneous whitespace around keywords.
- E222 - Fix extraneous whitespace around keywords.
- E223 - Fix extraneous whitespace around keywords.
- E224 - Remove extraneous whitespace around operator.
- E225 - Fix missing whitespace around operator.
- E226 - Fix missing whitespace around operator.
- E227 - Fix missing whitespace around operator.
- E228 - Fix missing whitespace around operator.
- E231 - Add missing whitespace.
- E231 - Fix various deprecated code (via lib2to3).
- E241 - Fix extraneous whitespace around keywords.
- E242 - Remove extraneous whitespace around operator.
- E251 - Remove whitespace around parameter '=' sign.
- E261 - Fix spacing after comment hash.
- E262 - Fix spacing after comment hash.
- E265 - Format block comments.
- E271 - Fix extraneous whitespace around keywords.
- E272 - Fix extraneous whitespace around keywords.
- E273 - Fix extraneous whitespace around keywords.
- E274 - Fix extraneous whitespace around keywords.
- W291 - Remove trailing whitespace.
- W293 - Remove trailing whitespace.
This commit is contained in:
Rémi Verschelde 2016-10-30 18:57:40 +01:00
parent 97c8508f5e
commit d4c17700aa
93 changed files with 2293 additions and 2293 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
EnsureSConsVersion(0,14); EnsureSConsVersion(0, 14);
import string import string
@ -14,85 +14,85 @@ methods.update_version()
# scan possible build platforms # scan possible build platforms
platform_list = [] # list of platforms platform_list = [] # list of platforms
platform_opts = {} # options for each platform platform_opts = {} # options for each platform
platform_flags = {} # flags for each platform platform_flags = {} # flags for each platform
active_platforms=[] active_platforms = []
active_platform_ids=[] active_platform_ids = []
platform_exporters=[] platform_exporters = []
global_defaults=[] global_defaults = []
for x in glob.glob("platform/*"): for x in glob.glob("platform/*"):
if (not os.path.isdir(x) or not os.path.exists(x+"/detect.py")): if (not os.path.isdir(x) or not os.path.exists(x + "/detect.py")):
continue continue
tmppath="./"+x tmppath = "./" + x
sys.path.append(tmppath) sys.path.append(tmppath)
import detect import detect
if (os.path.exists(x+"/export/export.cpp")): if (os.path.exists(x + "/export/export.cpp")):
platform_exporters.append(x[9:]) platform_exporters.append(x[9:])
if (os.path.exists(x+"/globals/global_defaults.cpp")): if (os.path.exists(x + "/globals/global_defaults.cpp")):
global_defaults.append(x[9:]) global_defaults.append(x[9:])
if (detect.is_active()): if (detect.is_active()):
active_platforms.append( detect.get_name() ) active_platforms.append(detect.get_name())
active_platform_ids.append(x); active_platform_ids.append(x);
if (detect.can_build()): if (detect.can_build()):
x=x.replace("platform/","") # rest of world x = x.replace("platform/", "") # rest of world
x=x.replace("platform\\","") # win32 x = x.replace("platform\\", "") # win32
platform_list+=[x] platform_list += [x]
platform_opts[x]=detect.get_opts() platform_opts[x] = detect.get_opts()
platform_flags[x]=detect.get_flags() platform_flags[x] = detect.get_flags()
sys.path.remove(tmppath) sys.path.remove(tmppath)
sys.modules.pop('detect') sys.modules.pop('detect')
module_list=methods.detect_modules() module_list = methods.detect_modules()
#print "Detected Platforms: "+str(platform_list) # print "Detected Platforms: "+str(platform_list)
methods.save_active_platforms(active_platforms,active_platform_ids) methods.save_active_platforms(active_platforms, active_platform_ids)
custom_tools=['default'] custom_tools = ['default']
platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False)) platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
if (os.name=="posix"): if (os.name == "posix"):
pass pass
elif (os.name=="nt"): elif (os.name == "nt"):
if ( os.getenv("VCINSTALLDIR")==None or platform_arg=="android"): if (os.getenv("VCINSTALLDIR") == None or platform_arg == "android"):
custom_tools=['mingw'] custom_tools = ['mingw']
env_base=Environment(tools=custom_tools); env_base = Environment(tools=custom_tools);
if 'TERM' in os.environ: if 'TERM' in os.environ:
env_base['ENV']['TERM'] = os.environ['TERM'] env_base['ENV']['TERM'] = os.environ['TERM']
env_base.AppendENVPath('PATH', os.getenv('PATH')) env_base.AppendENVPath('PATH', os.getenv('PATH'))
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
env_base.global_defaults=global_defaults env_base.global_defaults = global_defaults
env_base.android_maven_repos=[] env_base.android_maven_repos = []
env_base.android_dependencies=[] env_base.android_dependencies = []
env_base.android_java_dirs=[] env_base.android_java_dirs = []
env_base.android_res_dirs=[] env_base.android_res_dirs = []
env_base.android_aidl_dirs=[] env_base.android_aidl_dirs = []
env_base.android_jni_dirs=[] env_base.android_jni_dirs = []
env_base.android_default_config=[] env_base.android_default_config = []
env_base.android_manifest_chunk="" env_base.android_manifest_chunk = ""
env_base.android_permission_chunk="" env_base.android_permission_chunk = ""
env_base.android_appattributes_chunk="" env_base.android_appattributes_chunk = ""
env_base.disabled_modules=[] env_base.disabled_modules = []
env_base.use_ptrcall=False env_base.use_ptrcall = False
env_base.split_drivers=False env_base.split_drivers = False
env_base.__class__.android_add_maven_repository=methods.android_add_maven_repository env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository
env_base.__class__.android_add_dependency=methods.android_add_dependency env_base.__class__.android_add_dependency = methods.android_add_dependency
env_base.__class__.android_add_java_dir=methods.android_add_java_dir env_base.__class__.android_add_java_dir = methods.android_add_java_dir
env_base.__class__.android_add_res_dir=methods.android_add_res_dir env_base.__class__.android_add_res_dir = methods.android_add_res_dir
env_base.__class__.android_add_aidl_dir=methods.android_add_aidl_dir env_base.__class__.android_add_aidl_dir = methods.android_add_aidl_dir
env_base.__class__.android_add_jni_dir=methods.android_add_jni_dir env_base.__class__.android_add_jni_dir = methods.android_add_jni_dir
env_base.__class__.android_add_default_config=methods.android_add_default_config env_base.__class__.android_add_default_config = methods.android_add_default_config
env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest
env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions
env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
@ -102,8 +102,8 @@ env_base.__class__.add_source_files = methods.add_source_files
env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
env_base.__class__.split_lib = methods.split_lib env_base.__class__.split_lib = methods.split_lib
env_base["x86_libtheora_opt_gcc"]=False env_base["x86_libtheora_opt_gcc"] = False
env_base["x86_libtheora_opt_vc"]=False env_base["x86_libtheora_opt_vc"] = False
customs = ['custom.py'] customs = ['custom.py']
@ -112,43 +112,43 @@ if profile:
import os.path import os.path
if os.path.isfile(profile): if os.path.isfile(profile):
customs.append(profile) customs.append(profile)
elif os.path.isfile(profile+".py"): elif os.path.isfile(profile + ".py"):
customs.append(profile+".py") customs.append(profile + ".py")
opts=Variables(customs, ARGUMENTS) opts = Variables(customs, ARGUMENTS)
opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug") opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug")
opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "") opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "")
opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default") opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default")
opts.Add('platform','Platform: '+str(platform_list)+'.',"") opts.Add('platform', 'Platform: ' + str(platform_list) + '.', "")
opts.Add('p','Platform (same as platform=).',"") opts.Add('p', 'Platform (same as platform=).', "")
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes') opts.Add('tools', 'Build Tools (Including Editor): (yes/no)', 'yes')
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes') opts.Add('gdscript', 'Build GDSCript support: (yes/no)', 'yes')
opts.Add('libogg','Ogg library for ogg container support (system/builtin)','builtin') opts.Add('libogg', 'Ogg library for ogg container support (system/builtin)', 'builtin')
opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','builtin') opts.Add('libvorbis', 'Ogg Vorbis library for vorbis support (system/builtin)', 'builtin')
opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin') opts.Add('libtheora', 'Theora library for theora module (system/builtin)', 'builtin')
opts.Add('libvpx','VPX library for webm module (system/builtin)','builtin') opts.Add('libvpx', 'VPX library for webm module (system/builtin)', 'builtin')
opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin') opts.Add('opus', 'Opus and opusfile library for Opus format support: (system/builtin)', 'builtin')
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes') opts.Add('minizip', 'Build Minizip Archive Support: (yes/no)', 'yes')
opts.Add('squish','Squish library for BC Texture Compression in editor (system/builtin)','builtin') opts.Add('squish', 'Squish library for BC Texture Compression in editor (system/builtin)', 'builtin')
opts.Add('freetype','Freetype library for TTF support via freetype module (system/builtin)','builtin') opts.Add('freetype', 'Freetype library for TTF support via freetype module (system/builtin)', 'builtin')
opts.Add('xml','XML Save/Load support (yes/no)','yes') opts.Add('xml', 'XML Save/Load support (yes/no)', 'yes')
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin') opts.Add('libpng', 'libpng library for image loader support (system/builtin)', 'builtin')
opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin') opts.Add('libwebp', 'libwebp library for webp module (system/builtin)', 'builtin')
opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builtin') opts.Add('openssl', 'OpenSSL library for openssl module (system/builtin)', 'builtin')
opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin') opts.Add('libmpcdec', 'libmpcdec library for mpc module (system/builtin)', 'builtin')
opts.Add('enet','ENet library (system/builtin)','builtin') opts.Add('enet', 'ENet library (system/builtin)', 'builtin')
opts.Add('glew','GLEW library for the gl_context (system/builtin)','builtin') opts.Add('glew', 'GLEW library for the gl_context (system/builtin)', 'builtin')
opts.Add('xaudio2','XAudio2 audio driver (yes/no)','no') opts.Add('xaudio2', 'XAudio2 audio driver (yes/no)', 'no')
opts.Add("CXX", "C++ Compiler") opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler") opts.Add("CC", "C Compiler")
opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler"); opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler");
opts.Add("CFLAGS", "Custom flags for the C compiler"); opts.Add("CFLAGS", "Custom flags for the C compiler");
opts.Add("LINKFLAGS", "Custom flags for the linker"); opts.Add("LINKFLAGS", "Custom flags for the linker");
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','') opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.', '')
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no") opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes') opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes')
opts.Add('deprecated','Enable deprecated features (yes/no)','yes') opts.Add('deprecated', 'Enable deprecated features (yes/no)', 'yes')
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '') opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no') opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
@ -157,20 +157,20 @@ opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
for k in platform_opts.keys(): for k in platform_opts.keys():
opt_list = platform_opts[k] opt_list = platform_opts[k]
for o in opt_list: for o in opt_list:
opts.Add(o[0],o[1],o[2]) opts.Add(o[0], o[1], o[2])
for x in module_list: for x in module_list:
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"' (yes/no)", "yes") opts.Add('module_' + x + '_enabled', "Enable module '" + x + "' (yes/no)", "yes")
opts.Update(env_base) # update environment opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths # add default include paths
env_base.Append(CPPPATH=['#core','#core/math','#tools','#drivers','#']) env_base.Append(CPPPATH=['#core', '#core/math', '#tools', '#drivers', '#'])
# configure ENV for platform # configure ENV for platform
env_base.platform_exporters=platform_exporters env_base.platform_exporters = platform_exporters
""" """
sys.path.append("./platform/"+env_base["platform"]) sys.path.append("./platform/"+env_base["platform"])
@ -180,58 +180,58 @@ sys.path.remove("./platform/"+env_base["platform"])
sys.modules.pop('detect') sys.modules.pop('detect')
""" """
if (env_base['target']=='debug'): if (env_base['target'] == 'debug'):
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']); env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE']) env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
if (env_base['deprecated']!='no'): if (env_base['deprecated'] != 'no'):
env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']); env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']);
env_base.platforms = {} env_base.platforms = {}
selected_platform ="" selected_platform = ""
if env_base['platform'] != "": if env_base['platform'] != "":
selected_platform=env_base['platform'] selected_platform = env_base['platform']
elif env_base['p'] != "": elif env_base['p'] != "":
selected_platform=env_base['p'] selected_platform = env_base['p']
env_base["platform"]=selected_platform env_base["platform"] = selected_platform
if selected_platform in platform_list: if selected_platform in platform_list:
sys.path.append("./platform/"+selected_platform) sys.path.append("./platform/" + selected_platform)
import detect import detect
if "create" in dir(detect): if "create" in dir(detect):
env = detect.create(env_base) env = detect.create(env_base)
else: else:
env = env_base.Clone() env = env_base.Clone()
if env['vsproj']=="yes": if env['vsproj'] == "yes":
env.vs_incs = [] env.vs_incs = []
env.vs_srcs = [] env.vs_srcs = []
def AddToVSProject( sources ): def AddToVSProject(sources):
for x in sources: for x in sources:
if type(x) == type(""): if type(x) == type(""):
fname = env.File(x).path fname = env.File(x).path
else: else:
fname = env.File(x)[0].path fname = env.File(x)[0].path
pieces = fname.split(".") pieces = fname.split(".")
if len(pieces)>0: if len(pieces) > 0:
basename = pieces[0] basename = pieces[0]
basename = basename.replace('\\\\','/') basename = basename.replace('\\\\', '/')
env.vs_srcs = env.vs_srcs + [basename + ".cpp"] env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
env.vs_incs = env.vs_incs + [basename + ".h"] env.vs_incs = env.vs_incs + [basename + ".h"]
#print basename # print basename
env.AddToVSProject = AddToVSProject env.AddToVSProject = AddToVSProject
env.extra_suffix="" env.extra_suffix = ""
if env["extra_suffix"] != '' : if env["extra_suffix"] != '':
env.extra_suffix += '.'+env["extra_suffix"] env.extra_suffix += '.' + env["extra_suffix"]
CCFLAGS = env.get('CCFLAGS', '') CCFLAGS = env.get('CCFLAGS', '')
env['CCFLAGS'] = '' env['CCFLAGS'] = ''
@ -250,63 +250,63 @@ if selected_platform in platform_list:
flag_list = platform_flags[selected_platform] flag_list = platform_flags[selected_platform]
for f in flag_list: for f in flag_list:
if not (f[0] in ARGUMENTS): # allow command line to override platform flags if not (f[0] in ARGUMENTS): # allow command line to override platform flags
env[f[0]] = f[1] env[f[0]] = f[1]
#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11) # must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
detect.configure(env) detect.configure(env)
#env['platform_libsuffix'] = env['LIBSUFFIX'] #env['platform_libsuffix'] = env['LIBSUFFIX']
suffix="."+selected_platform suffix = "." + selected_platform
if (env["target"]=="release"): if (env["target"] == "release"):
if (env["tools"]=="yes"): if (env["tools"] == "yes"):
print("Tools can only be built with targets 'debug' and 'release_debug'.") print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255) sys.exit(255)
suffix+=".opt" suffix += ".opt"
env.Append(CCFLAGS=['-DNDEBUG']); env.Append(CCFLAGS=['-DNDEBUG']);
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
if (env["tools"]=="yes"): if (env["tools"] == "yes"):
suffix+=".opt.tools" suffix += ".opt.tools"
else: else:
suffix+=".opt.debug" suffix += ".opt.debug"
else: else:
if (env["tools"]=="yes"): if (env["tools"] == "yes"):
suffix+=".tools" suffix += ".tools"
else: else:
suffix+=".debug" suffix += ".debug"
if env["arch"] != "": if env["arch"] != "":
suffix += "."+env["arch"] suffix += "." + env["arch"]
elif (env["bits"]=="32"): elif (env["bits"] == "32"):
suffix+=".32" suffix += ".32"
elif (env["bits"]=="64"): elif (env["bits"] == "64"):
suffix+=".64" suffix += ".64"
elif (env["bits"]=="fat"): elif (env["bits"] == "fat"):
suffix+=".fat" suffix += ".fat"
suffix+=env.extra_suffix suffix += env.extra_suffix
env["PROGSUFFIX"]=suffix+env["PROGSUFFIX"] env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"]
env["OBJSUFFIX"]=suffix+env["OBJSUFFIX"] env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
env["LIBSUFFIX"]=suffix+env["LIBSUFFIX"] env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
env["SHLIBSUFFIX"]=suffix+env["SHLIBSUFFIX"] env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
sys.path.remove("./platform/"+selected_platform) sys.path.remove("./platform/" + selected_platform)
sys.modules.pop('detect') sys.modules.pop('detect')
env.module_list=[] env.module_list = []
for x in module_list: for x in module_list:
if env['module_'+x+'_enabled'] != "yes": if env['module_' + x + '_enabled'] != "yes":
continue continue
tmppath="./modules/"+x tmppath = "./modules/" + x
sys.path.append(tmppath) sys.path.append(tmppath)
env.current_module=x env.current_module = x
import config import config
if (config.can_build(selected_platform)): if (config.can_build(selected_platform)):
config.configure(env) config.configure(env)
@ -321,27 +321,27 @@ if selected_platform in platform_list:
# to test 64 bits compiltion # to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64']) # env.Append(CPPFLAGS=['-m64'])
if (env['tools']=='yes'): if (env['tools'] == 'yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED']) env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d']=='yes'): if (env['disable_3d'] == 'yes'):
env.Append(CPPFLAGS=['-D_3D_DISABLED']) env.Append(CPPFLAGS=['-D_3D_DISABLED'])
if (env['gdscript']=='yes'): if (env['gdscript'] == 'yes'):
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED']) env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
if (env['disable_advanced_gui']=='yes'): if (env['disable_advanced_gui'] == 'yes'):
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED']) env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
if (env['minizip'] == 'yes'): if (env['minizip'] == 'yes'):
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED']) env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
if (env['xml']=='yes'): if (env['xml'] == 'yes'):
env.Append(CPPFLAGS=['-DXML_ENABLED']) env.Append(CPPFLAGS=['-DXML_ENABLED'])
if (env['verbose']=='no'): if (env['verbose'] == 'no'):
methods.no_verbose(sys,env) methods.no_verbose(sys, env)
Export('env') Export('env')
#build subdirs, the build order is dependent on link order. # build subdirs, the build order is dependent on link order.
SConscript("core/SCsub") SConscript("core/SCsub")
SConscript("servers/SCsub") SConscript("servers/SCsub")
@ -353,10 +353,10 @@ if selected_platform in platform_list:
SConscript("modules/SCsub") SConscript("modules/SCsub")
SConscript("main/SCsub") SConscript("main/SCsub")
SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform SConscript("platform/" + selected_platform + "/SCsub"); # build selected platform
# Microsoft Visual Studio Project Generation # Microsoft Visual Studio Project Generation
if (env['vsproj'])=="yes": if (env['vsproj']) == "yes":
AddToVSProject(env.core_sources) AddToVSProject(env.core_sources)
AddToVSProject(env.main_sources) AddToVSProject(env.main_sources)
@ -369,7 +369,7 @@ if selected_platform in platform_list:
# Even then, SCons still seems to ignore it and builds with the latest MSVC... # Even then, SCons still seems to ignore it and builds with the latest MSVC...
# That said, it's not needed to be set so far but I'm leaving it here so that this comment # That said, it's not needed to be set so far but I'm leaving it here so that this comment
# has a purpose. # has a purpose.
#env['MSVS_VERSION']='9.0' # env['MSVS_VERSION']='9.0'
# Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options. # Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options.
@ -381,26 +381,26 @@ if selected_platform in platform_list:
# This version information (Win32, x64, Debug, Release, Release_Debug seems to be # This version information (Win32, x64, Debug, Release, Release_Debug seems to be
# required for Visual Studio to understand that it needs to generate an NMAKE # required for Visual Studio to understand that it needs to generate an NMAKE
# project. Do not modify without knowing what you are doing. # project. Do not modify without knowing what you are doing.
debug_variants = ['debug|Win32']+['debug|x64'] debug_variants = ['debug|Win32'] + ['debug|x64']
release_variants = ['release|Win32']+['release|x64'] release_variants = ['release|Win32'] + ['release|x64']
release_debug_variants = ['release_debug|Win32']+['release_debug|x64'] release_debug_variants = ['release_debug|Win32'] + ['release_debug|x64']
variants = debug_variants + release_variants + release_debug_variants variants = debug_variants + release_variants + release_debug_variants
debug_targets = ['bin\\godot.windows.tools.32.exe']+['bin\\godot.windows.tools.64.exe'] debug_targets = ['bin\\godot.windows.tools.32.exe'] + ['bin\\godot.windows.tools.64.exe']
release_targets = ['bin\\godot.windows.opt.32.exe']+['bin\\godot.windows.opt.64.exe'] release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe']
release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe']+['bin\\godot.windows.opt.tools.64.exe'] release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe']
targets = debug_targets + release_targets + release_debug_targets targets = debug_targets + release_targets + release_debug_targets
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ], msvproj = env.MSVSProject(target=['#godot' + env['MSVSPROJECTSUFFIX']],
incs = env.vs_incs, incs=env.vs_incs,
srcs = env.vs_srcs, srcs=env.vs_srcs,
runfile = targets, runfile=targets,
buildtarget = targets, buildtarget=targets,
auto_build_solution=1, auto_build_solution=1,
variant = variants) variant=variants)
else: else:
print("No valid target platform selected.") print("No valid target platform selected.")
print("The following were detected:") print("The following were detected:")
for x in platform_list: for x in platform_list:
print("\t"+x) print("\t" + x)
print("\nPlease run scons again with argument: platform=<string>") print("\nPlease run scons again with argument: platform=<string>")

View File

@ -2,13 +2,13 @@
Import('env') Import('env')
env.tests_sources=[] env.tests_sources = []
env.add_source_files(env.tests_sources,"*.cpp") env.add_source_files(env.tests_sources, "*.cpp")
Export('env') Export('env')
#SConscript('math/SCsub'); # SConscript('math/SCsub');
lib = env.Library("tests",env.tests_sources) lib = env.Library("tests", env.tests_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -2,66 +2,66 @@
Import('env') Import('env')
env.core_sources=[] env.core_sources = []
gd_call="" gd_call = ""
gd_inc="" gd_inc = ""
for x in env.global_defaults: for x in env.global_defaults:
env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp") env.core_sources.append("#platform/" + x + "/globals/global_defaults.cpp")
gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n' gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
gd_call+="\tregister_"+x+"_global_defaults();\n" gd_call += "\tregister_" + x + "_global_defaults();\n"
gd_cpp='#include "globals.h"\n' gd_cpp = '#include "globals.h"\n'
gd_cpp+=gd_inc gd_cpp += gd_inc
gd_cpp+="void Globals::register_global_defaults() {\n"+gd_call+"\n}\n" gd_cpp += "void Globals::register_global_defaults() {\n" + gd_call + "\n}\n"
f = open("global_defaults.cpp","wb") f = open("global_defaults.cpp", "wb")
f.write(gd_cpp) f.write(gd_cpp)
f.close() f.close()
import os import os
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ): if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
e=os.environ["SCRIPT_AES256_ENCRYPTION_KEY"] e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = "" txt = ""
ec_valid=True ec_valid = True
if (len(e)!=64): if (len(e) != 64):
ec_valid=False ec_valid = False
else: else:
for i in range(len(e)>>1): for i in range(len(e) >> 1):
if (i>0): if (i > 0):
txt+="," txt += ","
txts="0x"+e[i*2:i*2+2] txts = "0x" + e[i * 2:i * 2 + 2]
try: try:
int(txts,16) int(txts, 16)
except: except:
ec_valid=False ec_valid = False
txt+=txts txt += txts
if (not ec_valid): if (not ec_valid):
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
print("Invalid AES256 encryption key, not 64 bits hex: "+e) print("Invalid AES256 encryption key, not 64 bits hex: " + e)
f = open("script_encryption_key.cpp", "wb") f = open("script_encryption_key.cpp", "wb")
f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
f.close() f.close()
env.add_source_files(env.core_sources,"*.cpp") env.add_source_files(env.core_sources, "*.cpp")
Export('env') Export('env')
import make_binders import make_binders
env.Command(['method_bind.inc','method_bind_ext.inc'], 'make_binders.py', make_binders.run) env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
SConscript('os/SCsub'); SConscript('os/SCsub');
SConscript('math/SCsub'); SConscript('math/SCsub');
SConscript('io/SCsub'); SConscript('io/SCsub');
SConscript('bind/SCsub'); SConscript('bind/SCsub');
lib = env.Library("core",env.core_sources) lib = env.Library("core", env.core_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.core_sources,"*.cpp") env.add_source_files(env.core_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,8 +2,8 @@
Import('env') Import('env')
env.add_source_files(env.core_sources,"*.cpp") env.add_source_files(env.core_sources, "*.cpp")
env.add_source_files(env.core_sources,"*.c") env.add_source_files(env.core_sources, "*.c")
#env.core_sources.append("io/fastlz.c") # env.core_sources.append("io/fastlz.c")
Export('env') Export('env')

View File

@ -1,7 +1,7 @@
# -*- coding: ibm850 -*- # -*- coding: ibm850 -*-
template_typed=""" template_typed = """
#ifdef TYPED_METHOD_BIND #ifdef TYPED_METHOD_BIND
template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$> template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind { class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
@ -77,7 +77,7 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
#endif #endif
""" """
template=""" template = """
#ifndef TYPED_METHOD_BIND #ifndef TYPED_METHOD_BIND
$iftempl template<$ $ifret class R$ $ifretargs ,$ $arg, class P@$ $iftempl >$ $iftempl template<$ $ifret class R$ $ifretargs ,$ $arg, class P@$ $iftempl >$
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind { class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
@ -166,96 +166,96 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
""" """
def make_version(template,nargs,argmax,const,ret): def make_version(template, nargs, argmax, const, ret):
intext=template intext = template
from_pos=0 from_pos = 0
outtext="" outtext = ""
while(True): while(True):
to_pos=intext.find("$",from_pos) to_pos = intext.find("$", from_pos)
if (to_pos==-1): if (to_pos == -1):
outtext+=intext[from_pos:] outtext += intext[from_pos:]
break break
else: else:
outtext+=intext[from_pos:to_pos] outtext += intext[from_pos:to_pos]
end=intext.find("$",to_pos+1) end = intext.find("$", to_pos + 1)
if (end==-1): if (end == -1):
break # ignore break # ignore
macro=intext[to_pos+1:end] macro = intext[to_pos + 1:end]
cmd="" cmd = ""
data="" data = ""
if (macro.find(" ")!=-1): if (macro.find(" ") != -1):
cmd=macro[0:macro.find(" ")] cmd = macro[0:macro.find(" ")]
data=macro[macro.find(" ")+1:] data = macro[macro.find(" ") + 1:]
else: else:
cmd=macro cmd = macro
if (cmd=="argc"): if (cmd == "argc"):
outtext+=str(nargs) outtext += str(nargs)
if (cmd=="ifret" and ret): if (cmd == "ifret" and ret):
outtext+=data outtext += data
if (cmd=="ifargs" and nargs): if (cmd == "ifargs" and nargs):
outtext+=data outtext += data
if (cmd=="ifretargs" and nargs and ret): if (cmd == "ifretargs" and nargs and ret):
outtext+=data outtext += data
if (cmd=="ifconst" and const): if (cmd == "ifconst" and const):
outtext+=data outtext += data
elif (cmd=="ifnoconst" and not const): elif (cmd == "ifnoconst" and not const):
outtext+=data outtext += data
elif (cmd=="ifnoret" and not ret): elif (cmd == "ifnoret" and not ret):
outtext+=data outtext += data
elif (cmd=="iftempl" and (nargs>0 or ret)): elif (cmd == "iftempl" and (nargs > 0 or ret)):
outtext+=data outtext += data
elif (cmd=="arg,"): elif (cmd == "arg,"):
for i in range(1,nargs+1): for i in range(1, nargs + 1):
if (i>1): if (i > 1):
outtext+=", " outtext += ", "
outtext+=data.replace("@",str(i)) outtext += data.replace("@", str(i))
elif (cmd=="arg"): elif (cmd == "arg"):
for i in range(1,nargs+1): for i in range(1, nargs + 1):
outtext+=data.replace("@",str(i)) outtext += data.replace("@", str(i))
elif (cmd=="noarg"): elif (cmd == "noarg"):
for i in range(nargs+1,argmax+1): for i in range(nargs + 1, argmax + 1):
outtext+=data.replace("@",str(i)) outtext += data.replace("@", str(i))
elif (cmd=="noarg"): elif (cmd == "noarg"):
for i in range(nargs+1,argmax+1): for i in range(nargs + 1, argmax + 1):
outtext+=data.replace("@",str(i)) outtext += data.replace("@", str(i))
from_pos=end+1 from_pos = end + 1
return outtext return outtext
def run(target, source, env): def run(target, source, env):
versions=10 versions = 10
versions_ext=6 versions_ext = 6
text="" text = ""
text_ext="" text_ext = ""
for i in range(0,versions+1): for i in range(0, versions + 1):
t="" t = ""
t+=make_version(template,i,versions,False,False) t += make_version(template, i, versions, False, False)
t+=make_version(template_typed,i,versions,False,False) t += make_version(template_typed, i, versions, False, False)
t+=make_version(template,i,versions,False,True) t += make_version(template, i, versions, False, True)
t+=make_version(template_typed,i,versions,False,True) t += make_version(template_typed, i, versions, False, True)
t+=make_version(template,i,versions,True,False) t += make_version(template, i, versions, True, False)
t+=make_version(template_typed,i,versions,True,False) t += make_version(template_typed, i, versions, True, False)
t+=make_version(template,i,versions,True,True) t += make_version(template, i, versions, True, True)
t+=make_version(template_typed,i,versions,True,True) t += make_version(template_typed, i, versions, True, True)
if (i>=versions_ext): if (i >= versions_ext):
text_ext+=t text_ext += t
else: else:
text+=t text += t
f=open(target[0].path,"w") f = open(target[0].path, "w")
f.write(text) f.write(text)
f.close() f.close()
f=open(target[1].path,"w") f = open(target[1].path, "w")
f.write(text_ext) f.write(text_ext)
f.close() f.close()

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.core_sources,"*.cpp") env.add_source_files(env.core_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.core_sources,"*.cpp") env.add_source_files(env.core_sources, "*.cpp")
Export('env') Export('env')

View File

@ -6,17 +6,17 @@ import xml.etree.ElementTree as ET
tree = ET.parse(sys.argv[1]) tree = ET.parse(sys.argv[1])
old_doc=tree.getroot() old_doc = tree.getroot()
tree = ET.parse(sys.argv[2]) tree = ET.parse(sys.argv[2])
new_doc=tree.getroot() new_doc = tree.getroot()
f = file(sys.argv[3],"wb") f = file(sys.argv[3], "wb")
tab=0 tab = 0
old_classes={} old_classes = {}
def write_string(_f, text,newline=True): def write_string(_f, text, newline=True):
for t in range(tab): for t in range(tab):
_f.write("\t") _f.write("\t")
_f.write(text) _f.write(text)
@ -24,188 +24,188 @@ def write_string(_f, text,newline=True):
_f.write("\n") _f.write("\n")
def escape(ret): def escape(ret):
ret=ret.replace("&","&amp;"); ret = ret.replace("&", "&amp;");
ret=ret.replace("<","&gt;"); ret = ret.replace("<", "&gt;");
ret=ret.replace(">","&lt;"); ret = ret.replace(">", "&lt;");
ret=ret.replace("'","&apos;"); ret = ret.replace("'", "&apos;");
ret=ret.replace("\"","&quot;"); ret = ret.replace("\"", "&quot;");
return ret return ret
def inc_tab(): def inc_tab():
global tab global tab
tab+=1 tab += 1
def dec_tab(): def dec_tab():
global tab global tab
tab-=1 tab -= 1
write_string(f,'<?xml version="1.0" encoding="UTF-8" ?>') write_string(f, '<?xml version="1.0" encoding="UTF-8" ?>')
write_string(f,'<doc version="'+new_doc.attrib["version"]+'">') write_string(f, '<doc version="' + new_doc.attrib["version"] + '">')
def get_tag(node,name): def get_tag(node, name):
tag="" tag = ""
if (name in node.attrib): if (name in node.attrib):
tag=' '+name+'="'+escape(node.attrib[name])+'" ' tag = ' ' + name + '="' + escape(node.attrib[name]) + '" '
return tag return tag
def find_method_descr(old_class,name): def find_method_descr(old_class, name):
methods = old_class.find("methods") methods = old_class.find("methods")
if(methods!=None and len(list(methods))>0): if(methods != None and len(list(methods)) > 0):
for m in list(methods): for m in list(methods):
if (m.attrib["name"]==name): if (m.attrib["name"] == name):
description=m.find("description") description = m.find("description")
if (description!=None and description.text.strip()!=""): if (description != None and description.text.strip() != ""):
return description.text return description.text
return None return None
def find_signal_descr(old_class,name): def find_signal_descr(old_class, name):
signals = old_class.find("signals") signals = old_class.find("signals")
if(signals!=None and len(list(signals))>0): if(signals != None and len(list(signals)) > 0):
for m in list(signals): for m in list(signals):
if (m.attrib["name"]==name): if (m.attrib["name"] == name):
description=m.find("description") description = m.find("description")
if (description!=None and description.text.strip()!=""): if (description != None and description.text.strip() != ""):
return description.text return description.text
return None return None
def find_constant_descr(old_class,name): def find_constant_descr(old_class, name):
if (old_class==None): if (old_class == None):
return None return None
constants = old_class.find("constants") constants = old_class.find("constants")
if(constants!=None and len(list(constants))>0): if(constants != None and len(list(constants)) > 0):
for m in list(constants): for m in list(constants):
if (m.attrib["name"]==name): if (m.attrib["name"] == name):
if (m.text.strip()!=""): if (m.text.strip() != ""):
return m.text return m.text
return None return None
def write_class(c): def write_class(c):
class_name = c.attrib["name"] class_name = c.attrib["name"]
print("Parsing Class: "+class_name) print("Parsing Class: " + class_name)
if (class_name in old_classes): if (class_name in old_classes):
old_class=old_classes[class_name] old_class = old_classes[class_name]
else: else:
old_class=None old_class = None
category=get_tag(c,"category") category = get_tag(c, "category")
inherits=get_tag(c,"inherits") inherits = get_tag(c, "inherits")
write_string(f,'<class name="'+class_name+'" '+category+inherits+'>') write_string(f, '<class name="' + class_name + '" ' + category + inherits + '>')
inc_tab() inc_tab()
write_string(f,"<brief_description>") write_string(f, "<brief_description>")
if (old_class!=None): if (old_class != None):
old_brief_descr=old_class.find("brief_description") old_brief_descr = old_class.find("brief_description")
if (old_brief_descr!=None): if (old_brief_descr != None):
write_string(f,escape(old_brief_descr.text.strip())) write_string(f, escape(old_brief_descr.text.strip()))
write_string(f,"</brief_description>") write_string(f, "</brief_description>")
write_string(f,"<description>") write_string(f, "<description>")
if (old_class!=None): if (old_class != None):
old_descr=old_class.find("description") old_descr = old_class.find("description")
if (old_descr!=None): if (old_descr != None):
write_string(f,escape(old_descr.text.strip())) write_string(f, escape(old_descr.text.strip()))
write_string(f,"</description>") write_string(f, "</description>")
methods = c.find("methods") methods = c.find("methods")
if(methods!=None and len(list(methods))>0): if(methods != None and len(list(methods)) > 0):
write_string(f,"<methods>") write_string(f, "<methods>")
inc_tab() inc_tab()
for m in list(methods): for m in list(methods):
qualifiers=get_tag(m,"qualifiers") qualifiers = get_tag(m, "qualifiers")
write_string(f,'<method name="'+escape(m.attrib["name"])+'" ' +qualifiers+'>') write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + '>')
inc_tab() inc_tab()
for a in list(m): for a in list(m):
if (a.tag=="return"): if (a.tag == "return"):
typ=get_tag(a,"type") typ = get_tag(a, "type")
write_string(f,'<return'+typ+'>'); write_string(f, '<return' + typ + '>');
write_string(f,'</return>'); write_string(f, '</return>');
elif (a.tag=="argument"): elif (a.tag == "argument"):
default=get_tag(a,"default") default = get_tag(a, "default")
write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'"' +default+'>'); write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>');
write_string(f,'</argument>'); write_string(f, '</argument>');
write_string(f,'<description>'); write_string(f, '<description>');
if (old_class!=None): if (old_class != None):
old_method_descr=find_method_descr(old_class,m.attrib["name"]) old_method_descr = find_method_descr(old_class, m.attrib["name"])
if (old_method_descr): if (old_method_descr):
write_string(f,escape(escape(old_method_descr.strip()))) write_string(f, escape(escape(old_method_descr.strip())))
write_string(f,'</description>'); write_string(f, '</description>');
dec_tab() dec_tab()
write_string(f,"</method>") write_string(f, "</method>")
dec_tab() dec_tab()
write_string(f,"</methods>") write_string(f, "</methods>")
signals = c.find("signals") signals = c.find("signals")
if(signals!=None and len(list(signals))>0): if(signals != None and len(list(signals)) > 0):
write_string(f,"<signals>") write_string(f, "<signals>")
inc_tab() inc_tab()
for m in list(signals): for m in list(signals):
write_string(f,'<signal name="'+escape(m.attrib["name"])+'">') write_string(f, '<signal name="' + escape(m.attrib["name"]) + '">')
inc_tab() inc_tab()
for a in list(m): for a in list(m):
if (a.tag=="argument"): if (a.tag == "argument"):
write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'">'); write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">');
write_string(f,'</argument>'); write_string(f, '</argument>');
write_string(f,'<description>'); write_string(f, '<description>');
if (old_class!=None): if (old_class != None):
old_signal_descr=find_signal_descr(old_class,m.attrib["name"]) old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
if (old_signal_descr): if (old_signal_descr):
write_string(f,escape(old_signal_descr.strip())) write_string(f, escape(old_signal_descr.strip()))
write_string(f,'</description>'); write_string(f, '</description>');
dec_tab() dec_tab()
write_string(f,"</signal>") write_string(f, "</signal>")
dec_tab() dec_tab()
write_string(f,"</signals>") write_string(f, "</signals>")
constants = c.find("constants") constants = c.find("constants")
if(constants!=None and len(list(constants))>0): if(constants != None and len(list(constants)) > 0):
write_string(f,"<constants>") write_string(f, "<constants>")
inc_tab() inc_tab()
for m in list(constants): for m in list(constants):
write_string(f,'<constant name="'+escape(m.attrib["name"])+'" value="'+m.attrib["value"]+'">') write_string(f, '<constant name="' + escape(m.attrib["name"]) + '" value="' + m.attrib["value"] + '">')
old_constant_descr=find_constant_descr(old_class,m.attrib["name"]) old_constant_descr = find_constant_descr(old_class, m.attrib["name"])
if (old_constant_descr): if (old_constant_descr):
write_string(f,escape(old_constant_descr.strip())) write_string(f, escape(old_constant_descr.strip()))
write_string(f,"</constant>") write_string(f, "</constant>")
dec_tab() dec_tab()
write_string(f,"</constants>") write_string(f, "</constants>")
dec_tab() dec_tab()
write_string(f,"</class>") write_string(f, "</class>")
for c in list(old_doc): for c in list(old_doc):
old_classes[c.attrib["name"]]=c old_classes[c.attrib["name"]] = c
for c in list(new_doc): for c in list(new_doc):
write_class(c) write_class(c)
write_string(f,'</doc>\n') write_string(f, '</doc>\n')

View File

@ -11,7 +11,7 @@ import xml.etree.ElementTree as ET
################################################################################ ################################################################################
flags = { flags = {
'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes 'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
'b': False, 'b': False,
'g': False, 'g': False,
's': False, 's': False,
@ -62,15 +62,15 @@ long_flags = {
table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals'] table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals'] table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
colors = { colors = {
'name': [36], # cyan 'name': [36], # cyan
'part_big_problem': [4, 31], # underline, red 'part_big_problem': [4, 31], # underline, red
'part_problem': [31], # red 'part_problem': [31], # red
'part_mostly_good': [33], # yellow 'part_mostly_good': [33], # yellow
'part_good': [32], # green 'part_good': [32], # green
'url': [4, 34], # underline, blue 'url': [4, 34], # underline, blue
'section': [1, 4], # bold, underline 'section': [1, 4], # bold, underline
'state_off': [36], # cyan 'state_off': [36], # cyan
'state_on': [1, 35], # bold, magenta/plum 'state_on': [1, 35], # bold, magenta/plum
} }
overall_progress_description_weigth = 10 overall_progress_description_weigth = 10
@ -105,7 +105,7 @@ def nonescape_len(s):
################################################################################ ################################################################################
class ClassStatusProgress: class ClassStatusProgress:
def __init__(self, described = 0, total = 0): def __init__(self, described=0, total=0):
self.described = described self.described = described
self.total = total self.total = total
@ -127,12 +127,12 @@ class ClassStatusProgress:
return self.to_colored_string() return self.to_colored_string()
def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'): def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
ratio = self.described/self.total if self.total != 0 else 1 ratio = self.described / self.total if self.total != 0 else 1
percent = round(100*ratio) percent = round(100 * ratio)
s = format.format(has = str(self.described), total = str(self.total), percent = str(percent)) s = format.format(has=str(self.described), total=str(self.total), percent=str(percent))
if self.described >= self.total: if self.described >= self.total:
s = color('part_good', s) s = color('part_good', s)
elif self.described >= self.total/4*3: elif self.described >= self.total / 4 * 3:
s = color('part_mostly_good', s) s = color('part_mostly_good', s)
elif self.described > 0: elif self.described > 0:
s = color('part_problem', s) s = color('part_problem', s)
@ -142,7 +142,7 @@ class ClassStatusProgress:
pad_described = ''.ljust(pad_size - len(str(self.described))) pad_described = ''.ljust(pad_size - len(str(self.described)))
pad_percent = ''.ljust(3 - len(str(percent))) pad_percent = ''.ljust(3 - len(str(percent)))
pad_total = ''.ljust(pad_size - len(str(self.total))) pad_total = ''.ljust(pad_size - len(str(self.total)))
return pad_format.format(pad_described = pad_described, pad_total = pad_total, pad_percent = pad_percent, s = s) return pad_format.format(pad_described=pad_described, pad_total=pad_total, pad_percent=pad_percent, s=s)
class ClassStatus: class ClassStatus:
@ -231,7 +231,7 @@ class ClassStatus:
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0) status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
elif tag.tag in ['theme_items']: elif tag.tag in ['theme_items']:
pass #Ignore those tags, since they seem to lack description at all pass # Ignore those tags, since they seem to lack description at all
else: else:
print(tag.tag, tag.attrib) print(tag.tag, tag.attrib)
@ -296,10 +296,10 @@ if len(input_file_list) < 1 or flags['h']:
if long_flags[synonym] == flag: if long_flags[synonym] == flag:
synonyms.append(color('name', '--' + synonym)) synonyms.append(color('name', '--' + synonym))
print(('{synonyms} (Currently '+color('state_'+('on' if flags[flag] else 'off'), '{value}')+')\n\t{description}').format( print(('{synonyms} (Currently ' + color('state_' + ('on' if flags[flag] else 'off'), '{value}') + ')\n\t{description}').format(
synonyms = ', '.join(synonyms), synonyms=', '.join(synonyms),
value = ('on' if flags[flag] else 'off'), value=('on' if flags[flag] else 'off'),
description = flag_descriptions[flag] description=flag_descriptions[flag]
)) ))
sys.exit(0) sys.exit(0)
@ -413,9 +413,9 @@ for row_i, row in enumerate(table):
for cell_i, cell in enumerate(row): for cell_i, cell in enumerate(row):
padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2 padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
if cell_i == 0: if cell_i == 0:
row_string += table_row_chars[2] + cell + table_row_chars[2]*(padding_needed-1) row_string += table_row_chars[2] + cell + table_row_chars[2] * (padding_needed - 1)
else: else:
row_string += table_row_chars[2]*math.floor(padding_needed/2) + cell + table_row_chars[2]*math.ceil((padding_needed/2)) row_string += table_row_chars[2] * math.floor(padding_needed / 2) + cell + table_row_chars[2] * math.ceil((padding_needed / 2))
row_string += table_column_chars row_string += table_column_chars
print(row_string) print(row_string)

View File

@ -15,68 +15,68 @@ if len(input_list) < 1:
sys.exit(0) sys.exit(0)
def validate_tag(elem,tag): def validate_tag(elem, tag):
if (elem.tag != tag): if (elem.tag != tag):
print("Tag mismatch, expected '"+tag+"', got "+elem.tag); print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
sys.exit(255) sys.exit(255)
class_names=[] class_names = []
classes={} classes = {}
def make_class_list(class_list,columns): def make_class_list(class_list, columns):
f=open("class_list.txt","wb") f = open("class_list.txt", "wb")
prev=0 prev = 0
col_max = len(class_list) / columns + 1 col_max = len(class_list) / columns + 1
print("col max is ", col_max) print("col max is ", col_max)
col_count = 0 col_count = 0
row_count = 0 row_count = 0
last_initial = "" last_initial = ""
fit_columns=[] fit_columns = []
for n in range(0,columns): for n in range(0, columns):
fit_columns+=[[]] fit_columns += [[]]
indexers=[] indexers = []
last_initial="" last_initial = ""
idx=0 idx = 0
for n in class_list: for n in class_list:
col = idx/col_max col = idx / col_max
if (col>=columns): if (col >= columns):
col=columns-1 col = columns - 1
fit_columns[col]+=[n] fit_columns[col] += [n]
idx+=1 idx += 1
if (n[:1]!=last_initial): if (n[:1] != last_initial):
indexers+=[n] indexers += [n]
last_initial=n[:1] last_initial = n[:1]
row_max=0 row_max = 0
for n in range(0,columns): for n in range(0, columns):
if (len(fit_columns[n])>row_max): if (len(fit_columns[n]) > row_max):
row_max=len(fit_columns[n]) row_max = len(fit_columns[n])
for r in range(0,row_max): for r in range(0, row_max):
s="|" s = "|"
for c in range(0,columns): for c in range(0, columns):
if (r>=len(fit_columns[c])): if (r >= len(fit_columns[c])):
continue continue
classname = fit_columns[c][r] classname = fit_columns[c][r]
initial=classname[0] initial = classname[0]
if (classname in indexers): if (classname in indexers):
s+="**"+initial+"**|" s += "**" + initial + "**|"
else: else:
s+=" |" s += " |"
s+="[["+classname.lower()+"|"+classname+"]]|" s += "[[" + classname.lower() + "|" + classname + "]]|"
s+="\n" s += "\n"
f.write(s) f.write(s)
@ -86,221 +86,221 @@ def dokuize_text(txt):
def dokuize_text(text): def dokuize_text(text):
pos=0 pos = 0
while(True): while(True):
pos = text.find("[",pos) pos = text.find("[", pos)
if (pos==-1): if (pos == -1):
break break
endq_pos=text.find("]",pos+1) endq_pos = text.find("]", pos + 1)
if (endq_pos==-1): if (endq_pos == -1):
break break
pre_text=text[:pos] pre_text = text[:pos]
post_text=text[endq_pos+1:] post_text = text[endq_pos + 1:]
tag_text=text[pos+1:endq_pos] tag_text = text[pos + 1:endq_pos]
if (tag_text in class_names): if (tag_text in class_names):
tag_text="[["+tag_text.lower()+"|"+tag_text+"]]" tag_text = "[[" + tag_text.lower() + "|" + tag_text + "]]"
else: #command else: # command
cmd=tag_text cmd = tag_text
space_pos=tag_text.find(" ") space_pos = tag_text.find(" ")
if (cmd.find("html")==0): if (cmd.find("html") == 0):
cmd=tag_text[:space_pos] cmd = tag_text[:space_pos]
param=tag_text[space_pos+1:] param = tag_text[space_pos + 1:]
tag_text="<"+param+">" tag_text = "<" + param + ">"
elif(cmd.find("method")==0): elif(cmd.find("method") == 0):
cmd=tag_text[:space_pos] cmd = tag_text[:space_pos]
param=tag_text[space_pos+1:] param = tag_text[space_pos + 1:]
if (param.find(".")!=-1): if (param.find(".") != -1):
class_param,method_param=param.split(".") class_param, method_param = param.split(".")
tag_text="[["+class_param.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]" tag_text = "[[" + class_param.lower() + "#" + method_param + "|" + class_param + '.' + method_param + "]]"
else: else:
tag_text="[[#"+param+"|"+param+"]]" tag_text = "[[#" + param + "|" + param + "]]"
elif (cmd.find("image=")==0): elif (cmd.find("image=") == 0):
tag_text="{{"+cmd[6:]+"}}" tag_text = "{{" + cmd[6:] + "}}"
elif (cmd.find("url=")==0): elif (cmd.find("url=") == 0):
tag_text="[["+cmd[4:]+"|" tag_text = "[[" + cmd[4:] + "|"
elif (cmd=="/url"): elif (cmd == "/url"):
tag_text="]]>" tag_text = "]]>"
elif (cmd=="center"): elif (cmd == "center"):
tag_text="" tag_text = ""
elif (cmd=="/center"): elif (cmd == "/center"):
tag_text="" tag_text = ""
elif (cmd=="br"): elif (cmd == "br"):
tag_text="\\\\\n" tag_text = "\\\\\n"
elif (cmd=="i" or cmd=="/i"): elif (cmd == "i" or cmd == "/i"):
tag_text="//" tag_text = "//"
elif (cmd=="b" or cmd=="/b"): elif (cmd == "b" or cmd == "/b"):
tag_text="**" tag_text = "**"
elif (cmd=="u" or cmd=="/u"): elif (cmd == "u" or cmd == "/u"):
tag_text="__" tag_text = "__"
else: else:
tag_text="["+tag_text+"]" tag_text = "[" + tag_text + "]"
text=pre_text+tag_text+post_text text = pre_text + tag_text + post_text
pos=len(pre_text)+len(tag_text) pos = len(pre_text) + len(tag_text)
#tnode = ET.SubElement(parent,"div") #tnode = ET.SubElement(parent,"div")
#tnode.text=text # tnode.text=text
return text return text
def make_type(t): def make_type(t):
global class_names global class_names
if (t in class_names): if (t in class_names):
return "[["+t.lower()+"|"+t+"]]" return "[[" + t.lower() + "|" + t + "]]"
return t return t
def make_method(f,name,m,declare,event=False): def make_method(f, name, m, declare, event=False):
s=" * " s = " * "
ret_type="void" ret_type = "void"
args=list(m) args = list(m)
mdata={} mdata = {}
mdata["argidx"]=[] mdata["argidx"] = []
for a in args: for a in args:
if (a.tag=="return"): if (a.tag == "return"):
idx=-1 idx = -1
elif (a.tag=="argument"): elif (a.tag == "argument"):
idx=int(a.attrib["index"]) idx = int(a.attrib["index"])
else: else:
continue continue
mdata["argidx"].append(idx) mdata["argidx"].append(idx)
mdata[idx]=a mdata[idx] = a
if (not event): if (not event):
if (-1 in mdata["argidx"]): if (-1 in mdata["argidx"]):
s+=make_type(mdata[-1].attrib["type"]) s += make_type(mdata[-1].attrib["type"])
else: else:
s+="void" s += "void"
s+=" " s += " "
if (declare): if (declare):
#span.attrib["class"]="funcdecl" # span.attrib["class"]="funcdecl"
#a=ET.SubElement(span,"a") # a=ET.SubElement(span,"a")
#a.attrib["name"]=name+"_"+m.attrib["name"] # a.attrib["name"]=name+"_"+m.attrib["name"]
#a.text=name+"::"+m.attrib["name"] # a.text=name+"::"+m.attrib["name"]
s+="**"+m.attrib["name"]+"**" s += "**" + m.attrib["name"] + "**"
else: else:
s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]" s += "[[#" + m.attrib["name"] + "|" + m.attrib["name"] + "]]"
s+="**(**" s += "**(**"
argfound=False argfound = False
for a in mdata["argidx"]: for a in mdata["argidx"]:
arg=mdata[a] arg = mdata[a]
if (a<0): if (a < 0):
continue continue
if (a>0): if (a > 0):
s+=", " s += ", "
else: else:
s+=" " s += " "
s+=make_type(arg.attrib["type"]) s += make_type(arg.attrib["type"])
if ("name" in arg.attrib): if ("name" in arg.attrib):
s+=" "+arg.attrib["name"] s += " " + arg.attrib["name"]
else: else:
s+=" arg"+str(a) s += " arg" + str(a)
if ("default" in arg.attrib): if ("default" in arg.attrib):
s+="="+arg.attrib["default"] s += "=" + arg.attrib["default"]
argfound=True argfound = True
if (argfound): if (argfound):
s+=" " s += " "
s+="**)**" s += "**)**"
if ("qualifiers" in m.attrib): if ("qualifiers" in m.attrib):
s+=" "+m.attrib["qualifiers"] s += " " + m.attrib["qualifiers"]
f.write(s+"\n") f.write(s + "\n")
def make_doku_class(node): def make_doku_class(node):
name = node.attrib["name"] name = node.attrib["name"]
f=open(name.lower()+".txt","wb") f = open(name.lower() + ".txt", "wb")
f.write("====== "+name+" ======\n") f.write("====== " + name + " ======\n")
if ("inherits" in node.attrib): if ("inherits" in node.attrib):
inh=node.attrib["inherits"].strip() inh = node.attrib["inherits"].strip()
f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n") f.write("**Inherits:** [[" + inh.lower() + "|" + inh + "]]\\\\\n")
if ("category" in node.attrib): if ("category" in node.attrib):
f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n") f.write("**Category:** " + node.attrib["category"].strip() + "\\\\\n")
briefd = node.find("brief_description") briefd = node.find("brief_description")
if (briefd!=None): if (briefd != None):
f.write("===== Brief Description ======\n") f.write("===== Brief Description ======\n")
f.write( dokuize_text(briefd.text.strip())+"\n" ) f.write(dokuize_text(briefd.text.strip()) + "\n")
methods = node.find("methods") methods = node.find("methods")
if(methods!=None and len(list(methods))>0): if(methods != None and len(list(methods)) > 0):
f.write("===== Member Functions ======\n") f.write("===== Member Functions ======\n")
for m in list(methods): for m in list(methods):
make_method(f,node.attrib["name"],m,False) make_method(f, node.attrib["name"], m, False)
events = node.find("signals") events = node.find("signals")
if(events!=None and len(list(events))>0): if(events != None and len(list(events)) > 0):
f.write("===== Signals ======\n") f.write("===== Signals ======\n")
for m in list(events): for m in list(events):
make_method(f,node.attrib["name"],m,True,True) make_method(f, node.attrib["name"], m, True, True)
members = node.find("members") members = node.find("members")
if(members!=None and len(list(members))>0): if(members != None and len(list(members)) > 0):
f.write("===== Member Variables ======\n") f.write("===== Member Variables ======\n")
for c in list(members): for c in list(members):
s = " * " s = " * "
s+=make_type(c.attrib["type"])+" " s += make_type(c.attrib["type"]) + " "
s+="**"+c.attrib["name"]+"**" s += "**" + c.attrib["name"] + "**"
if (c.text.strip()!=""): if (c.text.strip() != ""):
s+=" - "+c.text.strip() s += " - " + c.text.strip()
f.write(s+"\n") f.write(s + "\n")
constants = node.find("constants") constants = node.find("constants")
if(constants!=None and len(list(constants))>0): if(constants != None and len(list(constants)) > 0):
f.write("===== Numeric Constants ======\n") f.write("===== Numeric Constants ======\n")
for c in list(constants): for c in list(constants):
s = " * " s = " * "
s+="**"+c.attrib["name"]+"**" s += "**" + c.attrib["name"] + "**"
if ("value" in c.attrib): if ("value" in c.attrib):
s+=" = **"+c.attrib["value"]+"**" s += " = **" + c.attrib["value"] + "**"
if (c.text.strip()!=""): if (c.text.strip() != ""):
s+=" - "+c.text.strip() s += " - " + c.text.strip()
f.write(s+"\n") f.write(s + "\n")
descr=node.find("description") descr = node.find("description")
if (descr!=None and descr.text.strip()!=""): if (descr != None and descr.text.strip() != ""):
f.write("===== Description ======\n") f.write("===== Description ======\n")
f.write(dokuize_text(descr.text.strip())+"\n") f.write(dokuize_text(descr.text.strip()) + "\n")
methods = node.find("methods") methods = node.find("methods")
if(methods!=None and len(list(methods))>0): if(methods != None and len(list(methods)) > 0):
f.write("===== Member Function Description ======\n") f.write("===== Member Function Description ======\n")
for m in list(methods): for m in list(methods):
d=m.find("description") d = m.find("description")
if (d==None or d.text.strip()==""): if (d == None or d.text.strip() == ""):
continue continue
f.write("== "+m.attrib["name"]+" ==\n") f.write("== " + m.attrib["name"] + " ==\n")
make_method(f,node.attrib["name"],m,False) make_method(f, node.attrib["name"], m, False)
f.write("\\\\\n") f.write("\\\\\n")
f.write(dokuize_text(d.text.strip())) f.write(dokuize_text(d.text.strip()))
f.write("\n") f.write("\n")
@ -488,27 +488,27 @@ def make_doku_class(node):
""" """
for file in input_list: for file in input_list:
tree = ET.parse(file) tree = ET.parse(file)
doc=tree.getroot() doc = tree.getroot()
if ("version" not in doc.attrib): if ("version" not in doc.attrib):
print("Version missing from 'doc'") print("Version missing from 'doc'")
sys.exit(255) sys.exit(255)
version=doc.attrib["version"] version = doc.attrib["version"]
for c in list(doc): for c in list(doc):
if (c.attrib["name"] in class_names): if (c.attrib["name"] in class_names):
continue continue
class_names.append(c.attrib["name"]) class_names.append(c.attrib["name"])
classes[c.attrib["name"]]=c classes[c.attrib["name"]] = c
class_names.sort() class_names.sort()
make_class_list(class_names,4) make_class_list(class_names, 4)
for cn in class_names: for cn in class_names:
c=classes[cn] c = classes[cn]
make_doku_class(c) make_doku_class(c)

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,7 @@ def make_class_list(class_list, columns):
else: else:
s += ' | ' s += ' | '
s += '[' + classname + '](class_'+ classname.lower()+') | ' s += '[' + classname + '](class_' + classname.lower() + ') | '
s += '\n' s += '\n'
f.write(s) f.write(s)
@ -126,14 +126,14 @@ def dokuize_text(text):
if param.find('.') != -1: if param.find('.') != -1:
(class_param, method_param) = param.split('.') (class_param, method_param) = param.split('.')
tag_text = '['+class_param+'.'+method_param.replace("_","&#95;")+'](' + class_param.lower() + '#' \ tag_text = '[' + class_param + '.' + method_param.replace("_", "&#95;") + '](' + class_param.lower() + '#' \
+ method_param + ')' + method_param + ')'
else: else:
tag_text = '[' + param.replace("_","&#95;") + '](#' + param + ')' tag_text = '[' + param.replace("_", "&#95;") + '](#' + param + ')'
elif cmd.find('image=') == 0: elif cmd.find('image=') == 0:
tag_text = '![](' + cmd[6:] + ')' tag_text = '![](' + cmd[6:] + ')'
elif cmd.find('url=') == 0: elif cmd.find('url=') == 0:
tag_text = '[' + cmd[4:] + ']('+cmd[4:] tag_text = '[' + cmd[4:] + '](' + cmd[4:]
elif cmd == '/url': elif cmd == '/url':
tag_text = ')' tag_text = ')'
elif cmd == 'center': elif cmd == 'center':
@ -205,9 +205,9 @@ def make_method(
# a.attrib["name"]=name+"_"+m.attrib["name"] # a.attrib["name"]=name+"_"+m.attrib["name"]
# a.text=name+"::"+m.attrib["name"] # a.text=name+"::"+m.attrib["name"]
s += ' **'+m.attrib['name'].replace("_","&#95;")+'** ' s += ' **' + m.attrib['name'].replace("_", "&#95;") + '** '
else: else:
s += ' **['+ m.attrib['name'].replace("_","&#95;")+'](#' + m.attrib['name'] + ')** ' s += ' **[' + m.attrib['name'].replace("_", "&#95;") + '](#' + m.attrib['name'] + ')** '
s += ' **(**' s += ' **(**'
argfound = False argfound = False
@ -245,13 +245,13 @@ def make_doku_class(node):
name = node.attrib['name'] name = node.attrib['name']
f = open("class_"+name.lower() + '.md', 'wb') f = open("class_" + name.lower() + '.md', 'wb')
f.write('# ' + name + ' \n') f.write('# ' + name + ' \n')
if 'inherits' in node.attrib: if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip() inh = node.attrib['inherits'].strip()
f.write('####**Inherits:** '+make_type(inh)+'\n') f.write('####**Inherits:** ' + make_type(inh) + '\n')
if 'category' in node.attrib: if 'category' in node.attrib:
f.write('####**Category:** ' + node.attrib['category'].strip() f.write('####**Category:** ' + node.attrib['category'].strip()
+ '\n') + '\n')
@ -313,7 +313,7 @@ def make_doku_class(node):
d = m.find('description') d = m.find('description')
if d == None or d.text.strip() == '': if d == None or d.text.strip() == '':
continue continue
f.write('\n#### <a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n') f.write('\n#### <a name="' + m.attrib['name'] + '">' + m.attrib['name'] + '</a>\n')
make_method(f, node.attrib['name'], m, True) make_method(f, node.attrib['name'], m, True)
f.write('\n') f.write('\n')
f.write(dokuize_text(d.text.strip())) f.write(dokuize_text(d.text.strip()))

View File

@ -24,11 +24,11 @@ def validate_tag(elem, tag):
class_names = [] class_names = []
classes = {} classes = {}
def ul_string(str,ul): def ul_string(str, ul):
str+="\n" str += "\n"
for i in range(len(str)-1): for i in range(len(str) - 1):
str+=ul str += ul
str+="\n" str += "\n"
return str return str
def make_class_list(class_list, columns): def make_class_list(class_list, columns):
@ -89,7 +89,7 @@ def make_class_list(class_list, columns):
else: else:
s += ' | ' s += ' | '
s += '[' + classname + '](class_'+ classname.lower()+') | ' s += '[' + classname + '](class_' + classname.lower() + ') | '
s += '\n' s += '\n'
f.write(s) f.write(s)
@ -99,7 +99,7 @@ def make_class_list(class_list, columns):
f.write("\n") f.write("\n")
def rstize_text(text,cclass): def rstize_text(text, cclass):
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock" # Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
pos = 0 pos = 0
@ -109,9 +109,9 @@ def rstize_text(text,cclass):
break break
pre_text = text[:pos] pre_text = text[:pos]
while text[pos+1] == '\t': while text[pos + 1] == '\t':
pos += 1 pos += 1
post_text = text[pos+1:] post_text = text[pos + 1:]
# Handle codeblocks # Handle codeblocks
if post_text.startswith("[codeblock]"): if post_text.startswith("[codeblock]"):
@ -130,14 +130,14 @@ def rstize_text(text,cclass):
break break
to_skip = 0 to_skip = 0
while code_pos+to_skip+1 < len(code_text) and code_text[code_pos+to_skip+1] == '\t': while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t':
to_skip += 1 to_skip += 1
if len(code_text[code_pos+to_skip+1:])==0: if len(code_text[code_pos + to_skip + 1:]) == 0:
code_text = code_text[:code_pos] + "\n" code_text = code_text[:code_pos] + "\n"
code_pos += 1 code_pos += 1
else: else:
code_text = code_text[:code_pos] + "\n " + code_text[code_pos+to_skip+1:] code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1:]
code_pos += 5 - to_skip code_pos += 5 - to_skip
text = pre_text + "\n[codeblock]" + code_text + post_text text = pre_text + "\n[codeblock]" + code_text + post_text
@ -163,7 +163,7 @@ def rstize_text(text,cclass):
pos = text.find('_', pos) pos = text.find('_', pos)
if pos == -1: if pos == -1:
break break
if not text[pos + 1].isalnum(): # don't escape within a snake_case word if not text[pos + 1].isalnum(): # don't escape within a snake_case word
text = text[:pos] + "\_" + text[pos + 1:] text = text[:pos] + "\_" + text[pos + 1:]
pos += 2 pos += 2
else: else:
@ -186,7 +186,7 @@ def rstize_text(text,cclass):
if tag_text in class_names: if tag_text in class_names:
tag_text = make_type(tag_text) tag_text = make_type(tag_text)
else: # command else: # command
cmd = tag_text cmd = tag_text
space_pos = tag_text.find(' ') space_pos = tag_text.find(' ')
if cmd.find('html') == 0: if cmd.find('html') == 0:
@ -199,13 +199,13 @@ def rstize_text(text,cclass):
if param.find('.') != -1: if param.find('.') != -1:
(class_param, method_param) = param.split('.') (class_param, method_param) = param.split('.')
tag_text = ':ref:`'+class_param+'.'+method_param+'<class_' + class_param + '_' + method_param + '>`' tag_text = ':ref:`' + class_param + '.' + method_param + '<class_' + class_param + '_' + method_param + '>`'
else: else:
tag_text = ':ref:`' + param + '<class_' + cclass +"_"+ param + '>`' tag_text = ':ref:`' + param + '<class_' + cclass + "_" + param + '>`'
elif cmd.find('image=') == 0: elif cmd.find('image=') == 0:
tag_text = "" #'![](' + cmd[6:] + ')' tag_text = "" # '![](' + cmd[6:] + ')'
elif cmd.find('url=') == 0: elif cmd.find('url=') == 0:
tag_text = ':ref:`' + cmd[4:] + '<'+cmd[4:]+">`" tag_text = ':ref:`' + cmd[4:] + '<' + cmd[4:] + ">`"
elif cmd == '/url': elif cmd == '/url':
tag_text = ')' tag_text = ')'
elif cmd == 'center': elif cmd == 'center':
@ -234,7 +234,7 @@ def rstize_text(text,cclass):
elif cmd == 'code' or cmd == '/code': elif cmd == 'code' or cmd == '/code':
tag_text = '``' tag_text = '``'
else: else:
tag_text = ':ref:`' + tag_text + '<class_'+tag_text.lower()+'>`' tag_text = ':ref:`' + tag_text + '<class_' + tag_text.lower() + '>`'
text = pre_text + tag_text + post_text text = pre_text + tag_text + post_text
pos = len(pre_text) + len(tag_text) pos = len(pre_text) + len(tag_text)
@ -248,7 +248,7 @@ def rstize_text(text,cclass):
def make_type(t): def make_type(t):
global class_names global class_names
if t in class_names: if t in class_names:
return ':ref:`'+t+'<class_' + t.lower()+'>`' return ':ref:`' + t + '<class_' + t.lower() + '>`'
return t return t
@ -262,7 +262,7 @@ def make_method(
pp=None pp=None
): ):
if (declare or pp==None): if (declare or pp == None):
t = '- ' t = '- '
else: else:
t = "" t = ""
@ -289,16 +289,16 @@ def make_method(
t += 'void' t += 'void'
t += ' ' t += ' '
if declare or pp==None: if declare or pp == None:
# span.attrib["class"]="funcdecl" # span.attrib["class"]="funcdecl"
# a=ET.SubElement(span,"a") # a=ET.SubElement(span,"a")
# a.attrib["name"]=name+"_"+m.attrib["name"] # a.attrib["name"]=name+"_"+m.attrib["name"]
# a.text=name+"::"+m.attrib["name"] # a.text=name+"::"+m.attrib["name"]
s = ' **'+m.attrib['name']+'** ' s = ' **' + m.attrib['name'] + '** '
else: else:
s = ':ref:`'+ m.attrib['name']+'<class_' + cname+"_"+m.attrib['name'] + '>` ' s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` '
s += ' **(**' s += ' **(**'
argfound = False argfound = False
@ -331,16 +331,16 @@ def make_method(
# f.write(s) # f.write(s)
if (not declare): if (not declare):
if (pp!=None): if (pp != None):
pp.append( (t,s) ) pp.append((t, s))
else: else:
f.write("- "+t+" "+s+"\n") f.write("- " + t + " " + s + "\n")
else: else:
f.write(t+s+"\n") f.write(t + s + "\n")
def make_heading(title, underline): def make_heading(title, underline):
return title + '\n' + underline*len(title) + "\n\n" return title + '\n' + underline * len(title) + "\n\n"
@ -348,47 +348,47 @@ def make_rst_class(node):
name = node.attrib['name'] name = node.attrib['name']
f = codecs.open("class_"+name.lower() + '.rst', 'wb', 'utf-8') f = codecs.open("class_" + name.lower() + '.rst', 'wb', 'utf-8')
# Warn contributors not to edit this file directly # Warn contributors not to edit this file directly
f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n") f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n") f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
f.write(".. _class_"+name+":\n\n") f.write(".. _class_" + name + ":\n\n")
f.write(make_heading(name, '=')) f.write(make_heading(name, '='))
if 'inherits' in node.attrib: if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip() inh = node.attrib['inherits'].strip()
# whle inh in classes[cn] # whle inh in classes[cn]
f.write('**Inherits:** ') f.write('**Inherits:** ')
first=True first = True
while(inh in classes): while(inh in classes):
if (not first): if (not first):
f.write(" **<** ") f.write(" **<** ")
else: else:
first=False first = False
f.write(make_type(inh)) f.write(make_type(inh))
inode = classes[inh] inode = classes[inh]
if ('inherits' in inode.attrib): if ('inherits' in inode.attrib):
inh=inode.attrib['inherits'].strip() inh = inode.attrib['inherits'].strip()
else: else:
inh=None inh = None
f.write("\n\n") f.write("\n\n")
inherited=[] inherited = []
for cn in classes: for cn in classes:
c=classes[cn] c = classes[cn]
if 'inherits' in c.attrib: if 'inherits' in c.attrib:
if (c.attrib['inherits'].strip()==name): if (c.attrib['inherits'].strip() == name):
inherited.append(c.attrib['name']) inherited.append(c.attrib['name'])
if (len(inherited)): if (len(inherited)):
f.write('**Inherited By:** ') f.write('**Inherited By:** ')
for i in range(len(inherited)): for i in range(len(inherited)):
if (i>0): if (i > 0):
f.write(", ") f.write(", ")
f.write(make_type(inherited[i])) f.write(make_type(inherited[i]))
f.write("\n\n") f.write("\n\n")
@ -398,41 +398,41 @@ def make_rst_class(node):
f.write(make_heading('Brief Description', '-')) f.write(make_heading('Brief Description', '-'))
briefd = node.find('brief_description') briefd = node.find('brief_description')
if briefd != None: if briefd != None:
f.write(rstize_text(briefd.text.strip(),name) + "\n\n") f.write(rstize_text(briefd.text.strip(), name) + "\n\n")
methods = node.find('methods') methods = node.find('methods')
if methods != None and len(list(methods)) > 0: if methods != None and len(list(methods)) > 0:
f.write(make_heading('Member Functions', '-')) f.write(make_heading('Member Functions', '-'))
ml=[] ml = []
for m in list(methods): for m in list(methods):
make_method(f, node.attrib['name'], m, False,name,False,ml) make_method(f, node.attrib['name'], m, False, name, False, ml)
longest_t = 0 longest_t = 0
longest_s = 0 longest_s = 0
for s in ml: for s in ml:
sl = len(s[0]) sl = len(s[0])
if (sl>longest_s): if (sl > longest_s):
longest_s=sl longest_s = sl
tl = len(s[1]) tl = len(s[1])
if (tl>longest_t): if (tl > longest_t):
longest_t=tl longest_t = tl
sep="+" sep = "+"
for i in range(longest_s+2): for i in range(longest_s + 2):
sep+="-" sep += "-"
sep+="+" sep += "+"
for i in range(longest_t+2): for i in range(longest_t + 2):
sep+="-" sep += "-"
sep+="+\n" sep += "+\n"
f.write(sep) f.write(sep)
for s in ml: for s in ml:
rt = s[0] rt = s[0]
while( len(rt) < longest_s ): while(len(rt) < longest_s):
rt+=" " rt += " "
st = s[1] st = s[1]
while( len(st) < longest_t ): while(len(st) < longest_t):
st+=" " st += " "
f.write("| "+rt+" | "+st+" |\n") f.write("| " + rt + " | " + st + " |\n")
f.write(sep) f.write(sep)
f.write('\n') f.write('\n')
@ -441,7 +441,7 @@ def make_rst_class(node):
if events != None and len(list(events)) > 0: if events != None and len(list(events)) > 0:
f.write(make_heading('Signals', '-')) f.write(make_heading('Signals', '-'))
for m in list(events): for m in list(events):
make_method(f, node.attrib['name'], m, True,name, True) make_method(f, node.attrib['name'], m, True, name, True)
f.write('\n') f.write('\n')
members = node.find('members') members = node.find('members')
@ -466,28 +466,28 @@ def make_rst_class(node):
if 'value' in c.attrib: if 'value' in c.attrib:
s += ' = **' + c.attrib['value'] + '**' s += ' = **' + c.attrib['value'] + '**'
if c.text.strip() != '': if c.text.strip() != '':
s += ' --- ' + rstize_text(c.text.strip(),name) s += ' --- ' + rstize_text(c.text.strip(), name)
f.write(s + '\n') f.write(s + '\n')
f.write('\n') f.write('\n')
descr = node.find('description') descr = node.find('description')
if descr != None and descr.text.strip() != '': if descr != None and descr.text.strip() != '':
f.write(make_heading('Description', '-')) f.write(make_heading('Description', '-'))
f.write(rstize_text(descr.text.strip(),name) + "\n\n") f.write(rstize_text(descr.text.strip(), name) + "\n\n")
methods = node.find('methods') methods = node.find('methods')
if methods != None and len(list(methods)) > 0: if methods != None and len(list(methods)) > 0:
f.write(make_heading('Member Function Description', '-')) f.write(make_heading('Member Function Description', '-'))
for m in list(methods): for m in list(methods):
f.write(".. _class_"+name+"_"+m.attrib['name']+":\n\n") f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
# f.write(ul_string(m.attrib['name'],"^")) # f.write(ul_string(m.attrib['name'],"^"))
#f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n') #f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n')
make_method(f, node.attrib['name'], m, True,name) make_method(f, node.attrib['name'], m, True, name)
f.write('\n') f.write('\n')
d = m.find('description') d = m.find('description')
if d == None or d.text.strip() == '': if d == None or d.text.strip() == '':
continue continue
f.write(rstize_text(d.text.strip(),name)) f.write(rstize_text(d.text.strip(), name))
f.write("\n\n") f.write("\n\n")
f.write('\n') f.write('\n')
@ -510,7 +510,7 @@ for file in input_list:
class_names.sort() class_names.sort()
#Don't make class list for Sphinx, :toctree: handles it # Don't make class list for Sphinx, :toctree: handles it
#make_class_list(class_names, 2) #make_class_list(class_names, 2)
for cn in class_names: for cn in class_names:

10
drivers/SCsub vendored
View File

@ -2,7 +2,7 @@
Import('env') Import('env')
env.drivers_sources=[] env.drivers_sources = []
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"): if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
SConscript("zlib/SCsub"); SConscript("zlib/SCsub");
@ -28,15 +28,15 @@ SConscript("png/SCsub");
# Tools override # Tools override
# FIXME: Should likely be integrated in the tools/ codebase # FIXME: Should likely be integrated in the tools/ codebase
if (env["tools"]=="yes"): if (env["tools"] == "yes"):
SConscript("convex_decomp/SCsub"); SConscript("convex_decomp/SCsub");
if env['vsproj']=="yes": if env['vsproj'] == "yes":
env.AddToVSProject(env.drivers_sources) env.AddToVSProject(env.drivers_sources)
if env.split_drivers: if env.split_drivers:
env.split_lib("drivers") env.split_lib("drivers")
else: else:
env.add_source_files(env.drivers_sources,"*.cpp") env.add_source_files(env.drivers_sources, "*.cpp")
lib = env.Library("drivers",env.drivers_sources) lib = env.Library("drivers", env.drivers_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -2,9 +2,9 @@
Import('env') Import('env')
if (env["platform"] in ["haiku","osx","windows","x11"]): if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
# Thirdparty source files # Thirdparty source files
if (env["glew"] != "system"): # builtin if (env["glew"] != "system"): # builtin
thirdparty_dir = "#thirdparty/glew/" thirdparty_dir = "#thirdparty/glew/"
thirdparty_sources = [ thirdparty_sources = [
"glew.c", "glew.c",
@ -12,10 +12,10 @@ if (env["platform"] in ["haiku","osx","windows","x11"]):
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources) env.add_source_files(env.drivers_sources, thirdparty_sources)
env.Append(CPPFLAGS = ['-DGLEW_STATIC']) env.Append(CPPFLAGS=['-DGLEW_STATIC'])
env.Append(CPPPATH = [thirdparty_dir]) env.Append(CPPPATH=[thirdparty_dir])
env.Append(CPPFLAGS = ['-DGLEW_ENABLED']) env.Append(CPPFLAGS=['-DGLEW_ENABLED'])
# Godot source files # Godot source files
env.add_source_files(env.drivers_sources, "*.cpp") env.add_source_files(env.drivers_sources, "*.cpp")

View File

@ -27,12 +27,12 @@ if (env["libpng"] == "builtin"):
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_png.add_source_files(env.drivers_sources, thirdparty_sources) env_png.add_source_files(env.drivers_sources, thirdparty_sources)
env_png.Append(CPPPATH = [thirdparty_dir]) env_png.Append(CPPPATH=[thirdparty_dir])
# Currently .ASM filter_neon.S does not compile on NT. # Currently .ASM filter_neon.S does not compile on NT.
import os import os
if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt": if ("neon_enabled" in env and env["neon_enabled"]) and os.name != "nt":
env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=2"]) env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
env_neon = env_png.Clone(); env_neon = env_png.Clone();
if "S_compiler" in env: if "S_compiler" in env:
env_neon['CC'] = env['S_compiler'] env_neon['CC'] = env['S_compiler']
@ -42,7 +42,7 @@ if (env["libpng"] == "builtin"):
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S")) neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
env.drivers_sources += neon_sources env.drivers_sources += neon_sources
else: else:
env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"]) env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
# Godot source files # Godot source files
env_png.add_source_files(env.drivers_sources, "*.cpp") env_png.add_source_files(env.drivers_sources, "*.cpp")

View File

@ -12,7 +12,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources) env.add_source_files(env.drivers_sources, thirdparty_sources)
env.Append(CPPPATH = [thirdparty_dir]) env.Append(CPPPATH=[thirdparty_dir])
# Driver source files # Driver source files
env.add_source_files(env.drivers_sources, "*.cpp") env.add_source_files(env.drivers_sources, "*.cpp")

View File

@ -2,13 +2,13 @@
Import('env') Import('env')
g_set_p='#ifdef UNIX_ENABLED\n' g_set_p = '#ifdef UNIX_ENABLED\n'
g_set_p+='#include "os_unix.h"\n' g_set_p += '#include "os_unix.h"\n'
g_set_p+='String OS_Unix::get_global_settings_path() const {\n' g_set_p += 'String OS_Unix::get_global_settings_path() const {\n'
g_set_p+='\treturn "' + env["unix_global_settings_path"]+'";\n' g_set_p += '\treturn "' + env["unix_global_settings_path"] + '";\n'
g_set_p+='}\n' g_set_p += '}\n'
g_set_p+='#endif' g_set_p += '#endif'
f = open("os_unix_global_settings_path.cpp","wb") f = open("os_unix_global_settings_path.cpp", "wb")
f.write(g_set_p) f.write(g_set_p)
f.close() f.close()

View File

@ -23,4 +23,4 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources) env.add_source_files(env.drivers_sources, thirdparty_sources)
env.Append(CPPPATH = [thirdparty_dir]) env.Append(CPPPATH=[thirdparty_dir])

View File

@ -2,11 +2,11 @@
Import('env') Import('env')
env.main_sources=[] env.main_sources = []
env.add_source_files(env.main_sources,"*.cpp") env.add_source_files(env.main_sources, "*.cpp")
Export('env') Export('env')
lib = env.Library("main",env.main_sources) lib = env.Library("main", env.main_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

File diff suppressed because it is too large Load Diff

View File

@ -6,18 +6,18 @@ env_modules = env.Clone()
Export('env_modules') Export('env_modules')
env.modules_sources=[ env.modules_sources = [
"register_module_types.cpp", "register_module_types.cpp",
] ]
#env.add_source_files(env.modules_sources,"*.cpp") # env.add_source_files(env.modules_sources,"*.cpp")
Export('env') Export('env')
for x in env.module_list: for x in env.module_list:
if (x in env.disabled_modules): if (x in env.disabled_modules):
continue continue
env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"]) env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"])
SConscript(x+"/SCsub") SConscript(x + "/SCsub")
lib = env_modules.Library("modules",env.modules_sources) lib = env_modules.Library("modules", env.modules_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -7,7 +7,7 @@ Import('env_modules')
env_enet = env_modules.Clone() env_enet = env_modules.Clone()
if (env["enet"] != "system"): # builtin if (env["enet"] != "system"): # builtin
thirdparty_dir = "#thirdparty/enet/" thirdparty_dir = "#thirdparty/enet/"
thirdparty_sources = [ thirdparty_sources = [
"callbacks.c", "callbacks.c",
@ -23,6 +23,6 @@ if (env["enet"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_enet.add_source_files(env.modules_sources, thirdparty_sources) env_enet.add_source_files(env.modules_sources, thirdparty_sources)
env_enet.Append(CPPPATH = [thirdparty_dir]) env_enet.Append(CPPPATH=[thirdparty_dir])
env_enet.add_source_files(env.modules_sources, "*.cpp") env_enet.add_source_files(env.modules_sources, "*.cpp")

View File

@ -14,7 +14,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_etc1.add_source_files(env.modules_sources, thirdparty_sources) env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
env_etc1.Append(CPPPATH = [thirdparty_dir]) env_etc1.Append(CPPPATH=[thirdparty_dir])
# Godot source files # Godot source files
env_etc1.add_source_files(env.modules_sources, "*.cpp") env_etc1.add_source_files(env.modules_sources, "*.cpp")

View File

@ -5,7 +5,7 @@ Import('env')
# Not building in a separate env as core needs it # Not building in a separate env as core needs it
# Thirdparty source files # Thirdparty source files
if (env["freetype"] != "system"): # builtin if (env["freetype"] != "system"): # builtin
thirdparty_dir = "#thirdparty/freetype/" thirdparty_dir = "#thirdparty/freetype/"
thirdparty_sources = [ thirdparty_sources = [
"src/autofit/autofit.c", "src/autofit/autofit.c",
@ -56,13 +56,13 @@ if (env["freetype"] != "system"): # builtin
# Include header for WinRT to fix build issues # Include header for WinRT to fix build issues
if "platform" in env and env["platform"] == "winrt": if "platform" in env and env["platform"] == "winrt":
env.Append(CCFLAGS = ['/FI', '"modules/freetype/winrtdef.h"']) env.Append(CCFLAGS=['/FI', '"modules/freetype/winrtdef.h"'])
env.Append(CPPPATH = [thirdparty_dir, thirdparty_dir + "/include"]) env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
# also requires libpng headers # also requires libpng headers
if (env["libpng"] != "system"): # builtin if (env["libpng"] != "system"): # builtin
env.Append(CPPPATH = ["#thirdparty/libpng"]) env.Append(CPPPATH=["#thirdparty/libpng"])
""" FIXME: Remove this commented code if Windows can handle the monolithic lib """ FIXME: Remove this commented code if Windows can handle the monolithic lib
# fix for Windows' shell miserably failing on long lines, split in two libraries # fix for Windows' shell miserably failing on long lines, split in two libraries
@ -81,10 +81,10 @@ if (env["freetype"] != "system"): # builtin
""" """
lib = env.Library("freetype_builtin", thirdparty_sources) lib = env.Library("freetype_builtin", thirdparty_sources)
env.Append(LIBS = [lib]) env.Append(LIBS=[lib])
# Godot source files # Godot source files
env.add_source_files(env.modules_sources, "*.cpp") env.add_source_files(env.modules_sources, "*.cpp")
env.Append(CCFLAGS = ['-DFREETYPE_ENABLED']) env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
Export('env') Export('env')

View File

@ -14,7 +14,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_jpg.add_source_files(env.modules_sources, thirdparty_sources) env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
env_jpg.Append(CPPPATH = [thirdparty_dir]) env_jpg.Append(CPPPATH=[thirdparty_dir])
# Godot's own source files # Godot's own source files
env_jpg.add_source_files(env.modules_sources, "*.cpp") env_jpg.add_source_files(env.modules_sources, "*.cpp")

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_mpc = env_modules.Clone() env_mpc = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["libmpcdec"] != "system"): # builtin if (env["libmpcdec"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libmpcdec/" thirdparty_dir = "#thirdparty/libmpcdec/"
thirdparty_sources = [ thirdparty_sources = [
"huffman.c", "huffman.c",
@ -22,7 +22,7 @@ if (env["libmpcdec"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_mpc.add_source_files(env.modules_sources, thirdparty_sources) env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
env_mpc.Append(CPPPATH = [thirdparty_dir]) env_mpc.Append(CPPPATH=[thirdparty_dir])
# Godot source files # Godot source files
env_mpc.add_source_files(env.modules_sources, "*.cpp") env_mpc.add_source_files(env.modules_sources, "*.cpp")

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_ogg = env_modules.Clone() env_ogg = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["libogg"] != "system"): # builtin if (env["libogg"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libogg/" thirdparty_dir = "#thirdparty/libogg/"
thirdparty_sources = [ thirdparty_sources = [
"bitwise.c", "bitwise.c",
@ -15,7 +15,7 @@ if (env["libogg"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_ogg.add_source_files(env.modules_sources, thirdparty_sources) env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
env_ogg.Append(CPPPATH = [thirdparty_dir]) env_ogg.Append(CPPPATH=[thirdparty_dir])
# Godot source files # Godot source files
env_ogg.add_source_files(env.modules_sources, "*.cpp") env_ogg.add_source_files(env.modules_sources, "*.cpp")

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_openssl = env_modules.Clone() env_openssl = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["openssl"] != "system"): # builtin if (env["openssl"] != "system"): # builtin
thirdparty_dir = "#thirdparty/openssl/" thirdparty_dir = "#thirdparty/openssl/"
thirdparty_sources = [ thirdparty_sources = [
@ -664,15 +664,15 @@ if (env["openssl"] != "system"): # builtin
"crypto/modes", "crypto/modes",
"openssl", "openssl",
] ]
env_openssl.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) env_openssl.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
env_openssl.Append(CPPFLAGS = ["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"]) env_openssl.Append(CPPFLAGS=["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"])
# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517) # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
import os import os
import methods import methods
if not (os.name=="nt" and os.getenv("VCINSTALLDIR")): # not Windows and not MSVC if not (os.name == "nt" and os.getenv("VCINSTALLDIR")): # not Windows and not MSVC
env_openssl.Append(CFLAGS = ["-Wno-error=implicit-function-declaration"]) env_openssl.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
# Module sources # Module sources
@ -681,7 +681,7 @@ env_openssl.add_source_files(env.modules_sources, "*.c")
# platform/winrt need to know openssl is available, pass to main env # platform/winrt need to know openssl is available, pass to main env
if "platform" in env and env["platform"] == "winrt": if "platform" in env and env["platform"] == "winrt":
env.Append(CPPPATH = [thirdparty_dir]) env.Append(CPPPATH=[thirdparty_dir])
env.Append(CPPFLAGS = ['-DOPENSSL_ENABLED']); env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
Export('env') Export('env')

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_opus = env_modules.Clone() env_opus = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["opus"] != "system"): # builtin if (env["opus"] != "system"): # builtin
thirdparty_dir = "#thirdparty/opus/" thirdparty_dir = "#thirdparty/opus/"
thirdparty_sources = [ thirdparty_sources = [
@ -129,8 +129,8 @@ if (env["opus"] != "system"): # builtin
opus_sources_silk = [] opus_sources_silk = []
if("opus_fixed_point" in env and env.opus_fixed_point=="yes"): if("opus_fixed_point" in env and env.opus_fixed_point == "yes"):
env_opus.Append(CFLAGS = ["-DFIXED_POINT"]) env_opus.Append(CFLAGS=["-DFIXED_POINT"])
opus_sources_silk = [ opus_sources_silk = [
"silk/fixed/schur64_FIX.c", "silk/fixed/schur64_FIX.c",
"silk/fixed/residual_energy16_FIX.c", "silk/fixed/residual_energy16_FIX.c",
@ -205,11 +205,11 @@ if (env["opus"] != "system"): # builtin
"silk/fixed", "silk/fixed",
"silk/float", "silk/float",
] ]
env_opus.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
# also requires libogg # also requires libogg
if (env["libogg"] != "system"): # builtin if (env["libogg"] != "system"): # builtin
env_opus.Append(CPPPATH = ["#thirdparty/libogg"]) env_opus.Append(CPPPATH=["#thirdparty/libogg"])
# Module files # Module files
env_opus.add_source_files(env.modules_sources, "*.cpp") env_opus.add_source_files(env.modules_sources, "*.cpp")

View File

@ -18,7 +18,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_pvr.add_source_files(env.modules_sources, thirdparty_sources) env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
env_pvr.Append(CPPPATH = [thirdparty_dir]) env_pvr.Append(CPPPATH=[thirdparty_dir])
# Godot source files # Godot source files
env_pvr.add_source_files(env.modules_sources, "*.cpp") env_pvr.add_source_files(env.modules_sources, "*.cpp")

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_squish = env_modules.Clone() env_squish = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["squish"] != "system"): # builtin if (env["squish"] != "system"): # builtin
thirdparty_dir = "#thirdparty/squish/" thirdparty_dir = "#thirdparty/squish/"
thirdparty_sources = [ thirdparty_sources = [
"alpha.cpp", "alpha.cpp",
@ -23,7 +23,7 @@ if (env["squish"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_squish.add_source_files(env.modules_sources, thirdparty_sources) env_squish.add_source_files(env.modules_sources, thirdparty_sources)
env_squish.Append(CPPPATH = [thirdparty_dir]) env_squish.Append(CPPPATH=[thirdparty_dir])
# Godot source files # Godot source files
env_squish.add_source_files(env.modules_sources, "*.cpp") env_squish.add_source_files(env.modules_sources, "*.cpp")

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_theora = env_modules.Clone() env_theora = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["libtheora"] != "system"): # builtin if (env["libtheora"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libtheora/" thirdparty_dir = "#thirdparty/libtheora/"
thirdparty_sources = [ thirdparty_sources = [
#"analyze.c", #"analyze.c",
@ -66,18 +66,18 @@ if (env["libtheora"] != "system"): # builtin
thirdparty_sources += thirdparty_sources_x86_vc thirdparty_sources += thirdparty_sources_x86_vc
if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]): if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
env_theora.Append(CCFLAGS = ["-DOC_X86_ASM"]) env_theora.Append(CCFLAGS=["-DOC_X86_ASM"])
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_theora.add_source_files(env.modules_sources, thirdparty_sources) env_theora.add_source_files(env.modules_sources, thirdparty_sources)
env_theora.Append(CPPPATH = [thirdparty_dir]) env_theora.Append(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis # also requires libogg and libvorbis
if (env["libogg"] != "system"): # builtin if (env["libogg"] != "system"): # builtin
env_theora.Append(CPPPATH = ["#thirdparty/libogg"]) env_theora.Append(CPPPATH=["#thirdparty/libogg"])
if (env["libvorbis"] != "system"): # builtin if (env["libvorbis"] != "system"): # builtin
env_theora.Append(CPPPATH = ["#thirdparty/libvorbis"]) env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
# Godot source files # Godot source files
env_theora.add_source_files(env.modules_sources, "*.cpp") env_theora.add_source_files(env.modules_sources, "*.cpp")

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_vorbis = env_modules.Clone() env_vorbis = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["libvorbis"] != "system"): # builtin if (env["libvorbis"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libvorbis/" thirdparty_dir = "#thirdparty/libvorbis/"
thirdparty_sources = [ thirdparty_sources = [
#"analysis.c", #"analysis.c",
@ -39,11 +39,11 @@ if (env["libvorbis"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_vorbis.add_source_files(env.modules_sources, thirdparty_sources) env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
env_vorbis.Append(CPPPATH = [thirdparty_dir]) env_vorbis.Append(CPPPATH=[thirdparty_dir])
# also requires libogg # also requires libogg
if (env["libogg"] != "system"): # builtin if (env["libogg"] != "system"): # builtin
env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"]) env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
# Godot source files # Godot source files
env_vorbis.add_source_files(env.modules_sources, "*.cpp") env_vorbis.add_source_files(env.modules_sources, "*.cpp")

View File

@ -16,17 +16,17 @@ thirdparty_libsimplewebm_sources = [
thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources] thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources]
env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources) env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
env_webm.Append(CPPPATH = [thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"]) env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
# also requires libogg, libvorbis and libopus # also requires libogg, libvorbis and libopus
if (env["libogg"] != "system"): # builtin if (env["libogg"] != "system"): # builtin
env_webm.Append(CPPPATH = ["#thirdparty/libogg"]) env_webm.Append(CPPPATH=["#thirdparty/libogg"])
if (env["libvorbis"] != "system"): # builtin if (env["libvorbis"] != "system"): # builtin
env_webm.Append(CPPPATH = ["#thirdparty/libvorbis"]) env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
if (env["opus"] != "system"): # builtin if (env["opus"] != "system"): # builtin
env_webm.Append(CPPPATH = ["#thirdparty"]) env_webm.Append(CPPPATH=["#thirdparty"])
if (env["libvpx"] != "system"): # builtin if (env["libvpx"] != "system"): # builtin
Export('env_webm') Export('env_webm')
SConscript("libvpx/SCsub") SConscript("libvpx/SCsub")

View File

@ -248,10 +248,10 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
Import('env') Import('env')
Import('env_webm') Import('env_webm')
env_webm.Append(CPPPATH = [libvpx_dir]) env_webm.Append(CPPPATH=[libvpx_dir])
env_libvpx = env.Clone() env_libvpx = env.Clone()
env_libvpx.Append(CPPPATH = [libvpx_dir]) env_libvpx.Append(CPPPATH=[libvpx_dir])
cpu_bits = env["bits"] cpu_bits = env["bits"]
osx_fat = (env["platform"] == 'osx' and cpu_bits == 'fat') osx_fat = (env["platform"] == 'osx' and cpu_bits == 'fat')

View File

@ -3,9 +3,9 @@
import sys import sys
import os import os
includes = sys.argv[1] includes = sys.argv[1]
output_file = sys.argv[2] output_file = sys.argv[2]
input_file = sys.argv[3] input_file = sys.argv[3]
can_remove = {} can_remove = {}

View File

@ -6,7 +6,7 @@ Import('env_modules')
env_webp = env_modules.Clone() env_webp = env_modules.Clone()
# Thirdparty source files # Thirdparty source files
if (env["libwebp"] != "system"): # builtin if (env["libwebp"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libwebp/" thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_sources = [ thirdparty_sources = [
"enc/webpenc.c", "enc/webpenc.c",
@ -115,7 +115,7 @@ if (env["libwebp"] != "system"): # builtin
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_webp.add_source_files(env.modules_sources, thirdparty_sources) env_webp.add_source_files(env.modules_sources, thirdparty_sources)
env_webp.Append(CPPPATH = [thirdparty_dir]) env_webp.Append(CPPPATH=[thirdparty_dir])
# Godot source files # Godot source files
env_webp.add_source_files(env.modules_sources, "*.cpp") env_webp.add_source_files(env.modules_sources, "*.cpp")

View File

@ -22,7 +22,7 @@ android_files = [
'java_class_wrapper.cpp' 'java_class_wrapper.cpp'
] ]
#env.Depends('#core/math/vector3.h', 'vector3_psp.h') # env.Depends('#core/math/vector3.h', 'vector3_psp.h')
#obj = env.SharedObject('godot_android.cpp') #obj = env.SharedObject('godot_android.cpp')
@ -30,86 +30,86 @@ env_android = env.Clone()
if env['target'] == "profile": if env['target'] == "profile":
env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED']) env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
android_objects=[] android_objects = []
for x in android_files: for x in android_files:
android_objects.append( env_android.SharedObject( x ) ) android_objects.append(env_android.SharedObject(x))
prog = None prog = None
abspath=env.Dir(".").abspath abspath = env.Dir(".").abspath
gradle_basein = open(abspath+"/build.gradle.template","rb") gradle_basein = open(abspath + "/build.gradle.template", "rb")
gradle_baseout = open(abspath+"/java/build.gradle","wb") gradle_baseout = open(abspath + "/java/build.gradle", "wb")
gradle_text = gradle_basein.read() gradle_text = gradle_basein.read()
gradle_maven_repos_text="" gradle_maven_repos_text = ""
if len(env.android_maven_repos) > 0: if len(env.android_maven_repos) > 0:
gradle_maven_repos_text+="maven {\n" gradle_maven_repos_text += "maven {\n"
for x in env.android_maven_repos: for x in env.android_maven_repos:
gradle_maven_repos_text+="\t\t"+x+"\n" gradle_maven_repos_text += "\t\t" + x + "\n"
gradle_maven_repos_text+="\t}\n" gradle_maven_repos_text += "\t}\n"
gradle_maven_dependencies_text="" gradle_maven_dependencies_text = ""
for x in env.android_dependencies: for x in env.android_dependencies:
gradle_maven_dependencies_text+=x+"\n" gradle_maven_dependencies_text += x + "\n"
gradle_java_dirs_text="" gradle_java_dirs_text = ""
for x in env.android_java_dirs: for x in env.android_java_dirs:
gradle_java_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'"
gradle_res_dirs_text="" gradle_res_dirs_text = ""
for x in env.android_res_dirs: for x in env.android_res_dirs:
gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_res_dirs_text += ",'" + x.replace("\\", "/") + "'"
gradle_aidl_dirs_text="" gradle_aidl_dirs_text = ""
for x in env.android_aidl_dirs: for x in env.android_aidl_dirs:
gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_aidl_dirs_text += ",'" + x.replace("\\", "/") + "'"
gradle_jni_dirs_text="" gradle_jni_dirs_text = ""
for x in env.android_jni_dirs: for x in env.android_jni_dirs:
gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_jni_dirs_text += ",'" + x.replace("\\", "/") + "'"
gradle_asset_dirs_text="" gradle_asset_dirs_text = ""
gradle_default_config_text="" gradle_default_config_text = ""
for x in env.android_default_config: for x in env.android_default_config:
gradle_default_config_text+=x+"\n\t\t" gradle_default_config_text += x + "\n\t\t"
gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$",gradle_maven_repos_text) gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$", gradle_maven_repos_text)
gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$",gradle_maven_dependencies_text) gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$", gradle_maven_dependencies_text)
gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$",gradle_java_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$", gradle_java_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$",gradle_res_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$", gradle_res_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$",gradle_asset_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$",gradle_aidl_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$",gradle_jni_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$",gradle_default_config_text) gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text)
gradle_baseout.write( gradle_text ) gradle_baseout.write(gradle_text)
gradle_baseout.close() gradle_baseout.close()
pp_basein = open(abspath+"/AndroidManifest.xml.template","rb") pp_basein = open(abspath + "/AndroidManifest.xml.template", "rb")
pp_baseout = open(abspath+"/java/AndroidManifest.xml","wb") pp_baseout = open(abspath + "/java/AndroidManifest.xml", "wb")
manifest = pp_basein.read() manifest = pp_basein.read()
manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_chunk) manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk)
manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk) manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk)
manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk) manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattributes_chunk)
pp_baseout.write( manifest ) pp_baseout.write(manifest)
env_android.SharedLibrary("#bin/libgodot",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"]) env_android.SharedLibrary("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
lib_arch_dir = '' lib_arch_dir = ''
@ -125,8 +125,8 @@ else:
if lib_arch_dir != '': if lib_arch_dir != '':
if env['target'] == 'release': if env['target'] == 'release':
lib_type_dir = 'release' lib_type_dir = 'release'
else: # release_debug, debug else: # release_debug, debug
lib_type_dir = 'debug' lib_type_dir = 'debug'
out_dir = '#platform/android/java/libs/'+lib_type_dir+'/'+lib_arch_dir out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir
env_android.Command(out_dir+'/libgodot_android.so', '#bin/libgodot'+env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE")) env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))

View File

@ -21,12 +21,12 @@ def get_opts():
return [ return [
('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)), ('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")), ('NDK_TARGET', 'toolchain to use for the NDK', os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")), ('NDK_TARGET_X86', 'toolchain to use for the NDK x86', os.environ.get("NDK_TARGET_X86", "x86-4.9")),
('ndk_platform', 'compile for platform: (android-<api> , example: android-14)',"android-14"), ('ndk_platform', 'compile for platform: (android-<api> , example: android-14)', "android-14"),
('android_arch', 'select compiler architecture: (armv7/armv6/x86)',"armv7"), ('android_arch', 'select compiler architecture: (armv7/armv6/x86)', "armv7"),
('android_neon','enable neon (armv7 only)',"yes"), ('android_neon', 'enable neon (armv7 only)', "yes"),
('android_stl','enable STL support in android port (for modules)',"no") ('android_stl', 'enable STL support in android port (for modules)', "no")
] ]
@ -34,7 +34,7 @@ def get_flags():
return [ return [
('tools', 'no'), ('tools', 'no'),
('openssl', 'builtin'), #use builtin openssl ('openssl', 'builtin'), # use builtin openssl
] ]
@ -52,16 +52,16 @@ def configure(env):
# Workaround for MinGW. See: # Workaround for MinGW. See:
# http://www.scons.org/wiki/LongCmdLinesOnWin32 # http://www.scons.org/wiki/LongCmdLinesOnWin32
import os import os
if (os.name=="nt"): if (os.name == "nt"):
import subprocess import subprocess
def mySubProcess(cmdline,env): def mySubProcess(cmdline, env):
#print "SPAWNED : " + cmdline # print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO() startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env) stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
data, err = proc.communicate() data, err = proc.communicate()
rv = proc.wait() rv = proc.wait()
if rv: if rv:
@ -75,176 +75,176 @@ def configure(env):
newargs = ' '.join(args[1:]) newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs cmdline = cmd + " " + newargs
rv=0 rv = 0
if len(cmdline) > 32000 and cmd.endswith("ar") : if len(cmdline) > 32000 and cmd.endswith("ar"):
cmdline = cmd + " " + args[1] + " " + args[2] + " " cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3,len(args)) : for i in range(3, len(args)):
rv = mySubProcess( cmdline + args[i], env ) rv = mySubProcess(cmdline + args[i], env)
if rv : if rv:
break break
else: else:
rv = mySubProcess( cmdline, env ) rv = mySubProcess(cmdline, env)
return rv return rv
env['SPAWN'] = mySpawn env['SPAWN'] = mySpawn
ndk_platform=env['ndk_platform'] ndk_platform = env['ndk_platform']
if env['android_arch'] not in ['armv7','armv6','x86']: if env['android_arch'] not in ['armv7', 'armv6', 'x86']:
env['android_arch']='armv7' env['android_arch'] = 'armv7'
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env['NDK_TARGET']=env['NDK_TARGET_X86'] env['NDK_TARGET'] = env['NDK_TARGET_X86']
env["x86_libtheora_opt_gcc"]=True env["x86_libtheora_opt_gcc"] = True
if env['PLATFORM'] == 'win32': if env['PLATFORM'] == 'win32':
env.Tool('gcc') env.Tool('gcc')
env['SHLIBSUFFIX'] = '.so' env['SHLIBSUFFIX'] = '.so'
neon_text="" neon_text = ""
if env["android_arch"]=="armv7" and env['android_neon']=='yes': if env["android_arch"] == "armv7" and env['android_neon'] == 'yes':
neon_text=" (with neon)" neon_text = " (with neon)"
print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text) print("Godot Android!!!!! (" + env['android_arch'] + ")" + neon_text)
env.Append(CPPPATH=['#platform/android']) env.Append(CPPPATH=['#platform/android'])
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env.extra_suffix=".x86"+env.extra_suffix env.extra_suffix = ".x86" + env.extra_suffix
elif env['android_arch']=='armv6': elif env['android_arch'] == 'armv6':
env.extra_suffix=".armv6"+env.extra_suffix env.extra_suffix = ".armv6" + env.extra_suffix
elif env["android_arch"]=="armv7": elif env["android_arch"] == "armv7":
if env['android_neon']=='yes': if env['android_neon'] == 'yes':
env.extra_suffix=".armv7.neon"+env.extra_suffix env.extra_suffix = ".armv7.neon" + env.extra_suffix
else: else:
env.extra_suffix=".armv7"+env.extra_suffix env.extra_suffix = ".armv7" + env.extra_suffix
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/"; gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/";
if (sys.platform.startswith("linux")): if (sys.platform.startswith("linux")):
if (platform.machine().endswith('64')): if (platform.machine().endswith('64')):
gcc_path=gcc_path+"/linux-x86_64/bin" gcc_path = gcc_path + "/linux-x86_64/bin"
else: else:
gcc_path=gcc_path+"/linux-x86/bin" gcc_path = gcc_path + "/linux-x86/bin"
elif (sys.platform.startswith("darwin")): elif (sys.platform.startswith("darwin")):
gcc_path=gcc_path+"/darwin-x86_64/bin" gcc_path = gcc_path + "/darwin-x86_64/bin"
env['SHLINKFLAGS'][1] = '-shared' env['SHLINKFLAGS'][1] = '-shared'
env['SHLIBSUFFIX'] = '.so' env['SHLIBSUFFIX'] = '.so'
elif (sys.platform.startswith('win')): elif (sys.platform.startswith('win')):
if (platform.machine().endswith('64')): if (platform.machine().endswith('64')):
gcc_path=gcc_path+"/windows-x86_64/bin" gcc_path = gcc_path + "/windows-x86_64/bin"
else: else:
gcc_path=gcc_path+"/windows-x86/bin" gcc_path = gcc_path + "/windows-x86/bin"
env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH'] env['ENV']['PATH'] = gcc_path + ":" + env['ENV']['PATH']
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env['CC'] = gcc_path+'/i686-linux-android-gcc' env['CC'] = gcc_path + '/i686-linux-android-gcc'
env['CXX'] = gcc_path+'/i686-linux-android-g++' env['CXX'] = gcc_path + '/i686-linux-android-g++'
env['AR'] = gcc_path+"/i686-linux-android-ar" env['AR'] = gcc_path + "/i686-linux-android-ar"
env['RANLIB'] = gcc_path+"/i686-linux-android-ranlib" env['RANLIB'] = gcc_path + "/i686-linux-android-ranlib"
env['AS'] = gcc_path+"/i686-linux-android-as" env['AS'] = gcc_path + "/i686-linux-android-as"
else: else:
env['CC'] = gcc_path+'/arm-linux-androideabi-gcc' env['CC'] = gcc_path + '/arm-linux-androideabi-gcc'
env['CXX'] = gcc_path+'/arm-linux-androideabi-g++' env['CXX'] = gcc_path + '/arm-linux-androideabi-g++'
env['AR'] = gcc_path+"/arm-linux-androideabi-ar" env['AR'] = gcc_path + "/arm-linux-androideabi-ar"
env['RANLIB'] = gcc_path+"/arm-linux-androideabi-ranlib" env['RANLIB'] = gcc_path + "/arm-linux-androideabi-ranlib"
env['AS'] = gcc_path+"/arm-linux-androideabi-as" env['AS'] = gcc_path + "/arm-linux-androideabi-as"
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env['ARCH'] = 'arch-x86' env['ARCH'] = 'arch-x86'
else: else:
env['ARCH'] = 'arch-arm' env['ARCH'] = 'arch-arm'
import string import string
#include path # include path
gcc_include=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH'] +"/usr/include" gcc_include = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH'] + "/usr/include"
ld_sysroot=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH'] ld_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH']
#glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue" # glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue"
ld_path=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']+"/usr/lib" ld_path = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH'] + "/usr/lib"
env.Append(CPPPATH=[gcc_include]) env.Append(CPPPATH=[gcc_include])
# env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ') # env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
env['neon_enabled']=False env['neon_enabled'] = False
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')) env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
elif env["android_arch"]=="armv6": elif env["android_arch"] == "armv6":
env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')) env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
elif env["android_arch"]=="armv7": elif env["android_arch"] == "armv7":
env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')) env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
if env['android_neon']=='yes': if env['android_neon'] == 'yes':
env['neon_enabled']=True env['neon_enabled'] = True
env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__']) env.Append(CCFLAGS=['-mfpu=neon', '-D__ARM_NEON__'])
else: else:
env.Append(CCFLAGS=['-mfpu=vfpv3-d16']) env.Append(CCFLAGS=['-mfpu=vfpv3-d16'])
env.Append(LDPATH=[ld_path]) env.Append(LDPATH=[ld_path])
env.Append(LIBS=['OpenSLES']) env.Append(LIBS=['OpenSLES'])
# env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android']) # env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android'])
env.Append(LIBS=['EGL','OpenSLES','android']) env.Append(LIBS=['EGL', 'OpenSLES', 'android'])
env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2', 'z']) env.Append(LIBS=['c', 'm', 'stdc++', 'log', 'GLESv1_CM', 'GLESv2', 'z'])
env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ") env["LINKFLAGS"] = string.split(" -g --sysroot=" + ld_sysroot + " -Wl,--no-undefined -Wl,-z,noexecstack ")
env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"]) env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"])
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2', '-ffast-math','-fomit-frame-pointer']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2', '-ffast-math','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT']) env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL', '-DMPC_FIXED_POINT'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT']) # env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
# TODO: Move that to opus module's config # TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
if (env["android_arch"]=="armv6" or env["android_arch"]=="armv7"): if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"]) env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
env.opus_fixed_point="yes" env.opus_fixed_point = "yes"
if (env['android_stl']=='yes'): if (env['android_stl'] == 'yes'):
#env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"]) # env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
elif env['android_arch']=='armv6': elif env['android_arch'] == 'armv6':
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
elif env["android_arch"]=="armv7": elif env["android_arch"] == "armv7":
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
env.Append(LIBS=["gnustl_static","supc++"]) env.Append(LIBS=["gnustl_static", "supc++"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cpufeatures"])
#env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"]) # env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"])
#env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"]) # env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"])
#env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"]) # env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"])
else: else:
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cpufeatures"])
if env['android_arch']=='x86': if env['android_arch'] == 'x86':
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
elif env["android_arch"]=="armv6": elif env["android_arch"] == "armv6":
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
elif env["android_arch"]=="armv7": elif env["android_arch"] == "armv7":
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
env.Append(LIBS=['gnustl_static']) env.Append(LIBS=['gnustl_static'])
env.Append(CCFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST']) env.Append(CCFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST'])
import methods import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
env.use_windows_spawn_fix() env.use_windows_spawn_fix()

View File

@ -53,7 +53,7 @@ def configure(env):
env['OBJSUFFIX'] = ".qnx.${qnx_target}.o" env['OBJSUFFIX'] = ".qnx.${qnx_target}.o"
env['LIBSUFFIX'] = ".qnx.${qnx_target}.a" env['LIBSUFFIX'] = ".qnx.${qnx_target}.a"
env['PROGSUFFIX'] = ".qnx.${qnx_target}" env['PROGSUFFIX'] = ".qnx.${qnx_target}"
print("PROGSUFFIX: "+env['PROGSUFFIX']+" target: "+env['qnx_target']) print("PROGSUFFIX: " + env['PROGSUFFIX'] + " target: " + env['qnx_target'])
env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin') env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin')
env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin') env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin')
@ -66,23 +66,23 @@ def configure(env):
env['AR'] = '$qnx_prefix-ar' env['AR'] = '$qnx_prefix-ar'
env['RANLIB'] = '$qnx_prefix-ranlib' env['RANLIB'] = '$qnx_prefix-ranlib'
env.Append(CPPPATH = ['#platform/bb10']) env.Append(CPPPATH=['#platform/bb10'])
env.Append(LIBPATH = ['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver']) env.Append(LIBPATH=['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
env.Append(CCFLAGS = string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL')) env.Append(CCFLAGS=string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
if env['bb10_exceptions']=="yes": if env['bb10_exceptions'] == "yes":
env.Append(CCFLAGS = ['-fexceptions']) env.Append(CCFLAGS=['-fexceptions'])
else: else:
env.Append(CCFLAGS = ['-fno-exceptions']) env.Append(CCFLAGS=['-fno-exceptions'])
#env.Append(LINKFLAGS = string.split() # env.Append(LINKFLAGS = string.split()
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-O3','-DRELEASE_BUILD']) env.Append(CCFLAGS=['-O3', '-DRELEASE_BUILD'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g', '-O0','-DDEBUG_ENABLED', '-D_DEBUG']) env.Append(CCFLAGS=['-g', '-O0', '-DDEBUG_ENABLED', '-D_DEBUG'])
env.Append(LINKFLAGS=['-g']) env.Append(LINKFLAGS=['-g'])
env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound']) env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound'])

View File

@ -20,7 +20,7 @@ target = env.Program(
command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef', command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef',
['rc -o $TARGET $SOURCE']) ['rc -o $TARGET $SOURCE'])
def addResourcesAction(target = None, source = None, env = None): def addResourcesAction(target=None, source=None, env=None):
return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc') return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
env.AddPostAction(target, addResourcesAction) env.AddPostAction(target, addResourcesAction)

View File

@ -18,7 +18,7 @@ def can_build():
def get_opts(): def get_opts():
return [ return [
('debug_release', 'Add debug symbols to release version','no') ('debug_release', 'Add debug symbols to release version', 'no')
] ]
def get_flags(): def get_flags():
@ -28,34 +28,34 @@ def get_flags():
def configure(env): def configure(env):
is64 = sys.maxsize > 2**32 is64 = sys.maxsize > 2**32
if (env["bits"]=="default"): if (env["bits"] == "default"):
if (is64): if (is64):
env["bits"]="64" env["bits"] = "64"
else: else:
env["bits"]="32" env["bits"] = "32"
env.Append(CPPPATH = ['#platform/haiku']) env.Append(CPPPATH=['#platform/haiku'])
env["CC"] = "gcc-x86" env["CC"] = "gcc-x86"
env["CXX"] = "g++-x86" env["CXX"] = "g++-x86"
if (env["target"]=="release"): if (env["target"] == "release"):
if (env["debug_release"]=="yes"): if (env["debug_release"] == "yes"):
env.Append(CCFLAGS=['-g2']) env.Append(CCFLAGS=['-g2'])
else: else:
env.Append(CCFLAGS=['-O3','-ffast-math']) env.Append(CCFLAGS=['-O3', '-ffast-math'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
#env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) # env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
env.Append(CPPFLAGS = ['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
env.Append(CPPFLAGS = ['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED']) env.Append(CPPFLAGS=['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
env.Append(CPPFLAGS = ['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL']) env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
env.Append(LIBS = ['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL']) env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
import methods import methods
env.Append(BUILDERS = {'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl')}) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append(BUILDERS = {'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl')}) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append(BUILDERS = {'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl')}) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

View File

@ -19,7 +19,7 @@ iphone_lib = [
'ios.mm', 'ios.mm',
] ]
#env.Depends('#core/math/vector3.h', 'vector3_psp.h') # env.Depends('#core/math/vector3.h', 'vector3_psp.h')
#iphone_lib = env.Library('iphone', iphone_lib) #iphone_lib = env.Library('iphone', iphone_lib)
@ -30,7 +30,7 @@ if env['ios_gles22_override'] == "yes":
env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE']) env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE'])
#if env['ios_appirater'] == "yes": # if env['ios_appirater'] == "yes":
# env_ios.Append(CPPFLAGS=['-DAPPIRATER_ENABLED']) # env_ios.Append(CPPFLAGS=['-DAPPIRATER_ENABLED'])
@ -38,5 +38,5 @@ obj = env_ios.Object('godot_iphone.cpp')
prog = None prog = None
prog = env_ios.Program('#bin/godot', [obj] + iphone_lib) prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
action = "$IPHONEPATH/usr/bin/dsymutil "+File(prog)[0].path+" -o " + File(prog)[0].path + ".dSYM" action = "$IPHONEPATH/usr/bin/dsymutil " + File(prog)[0].path + " -o " + File(prog)[0].path + ".dSYM"
env.AddPostAction(prog, action) env.AddPostAction(prog, action)

View File

@ -39,7 +39,7 @@ def get_flags():
('tools', 'no'), ('tools', 'no'),
('webp', 'yes'), ('webp', 'yes'),
('builtin_zlib', 'yes'), ('builtin_zlib', 'yes'),
('openssl','builtin'), #use builtin openssl ('openssl', 'builtin'), # use builtin openssl
] ]
@ -48,7 +48,7 @@ def configure(env):
env.Append(CPPPATH=['#platform/iphone']) env.Append(CPPPATH=['#platform/iphone'])
env['ENV']['PATH'] = env['IPHONEPATH']+"/Developer/usr/bin/:"+env['ENV']['PATH'] env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang' env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++' env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
@ -56,21 +56,21 @@ def configure(env):
env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib' env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
import string import string
if (env["ios_sim"]=="yes" or env["arch"] == "x86"): # i386, simulator if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator
env["arch"]="x86" env["arch"] = "x86"
env["bits"]="32" env["bits"] = "32"
env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"') env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
elif (env["arch"]=="arm64"): # arm64 elif (env["arch"] == "arm64"): # arm64
env["bits"] = "64" env["bits"] = "64"
env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
else: # armv7 else: # armv7
env["arch"] = "arm" env["arch"] = "arm"
env["bits"] = "32" env["bits"] = "32"
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK')
if (env["arch"]=="x86"): if (env["arch"] == "x86"):
env['IPHONEPLATFORM'] = 'iPhoneSimulator' env['IPHONEPLATFORM'] = 'iPhoneSimulator'
env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3', env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3',
'-isysroot', '$IPHONESDK', '-isysroot', '$IPHONESDK',
@ -92,7 +92,7 @@ def configure(env):
'-framework', 'SystemConfiguration', '-framework', 'SystemConfiguration',
'-F$IPHONESDK', '-F$IPHONESDK',
]) ])
elif (env["arch"]=="arm64"): elif (env["arch"] == "arm64"):
env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1', env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
'-isysroot', '$IPHONESDK', '-isysroot', '$IPHONESDK',
#'-stdlib=libc++', #'-stdlib=libc++',
@ -139,39 +139,39 @@ def configure(env):
if env['icloud'] == 'yes': if env['icloud'] == 'yes':
env.Append(CPPFLAGS=['-DICLOUD_ENABLED']) env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
env.Append(CPPPATH = ['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers']) env.Append(CPPPATH=['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-gdwarf-2']) # removed -ffast-math
env.Append(LINKFLAGS=['-O3']) # env.Append(LINKFLAGS=['-O3'])
elif env["target"] == "release_debug": elif env["target"] == "release_debug":
env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['-Os']) env.Append(LINKFLAGS=['-Os'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
elif (env["target"]=="profile"): elif (env["target"] == "profile"):
env.Append(CCFLAGS=['-g','-pg', '-Os']) env.Append(CCFLAGS=['-g', '-pg', '-Os'])
env.Append(LINKFLAGS=['-pg']) env.Append(LINKFLAGS=['-pg'])
if (env["ios_sim"]=="yes"): #TODO: Check if needed? if (env["ios_sim"] == "yes"): # TODO: Check if needed?
env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6' env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate' env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT']) env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
# TODO: Move that to opus module's config # TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
env.opus_fixed_point="yes" env.opus_fixed_point = "yes"
if env["arch"]=="x86": if env["arch"] == "x86":
pass pass
elif(env["arch"]=="arm64"): elif(env["arch"] == "arm64"):
env.Append(CFLAGS=["-DOPUS_ARM64_OPT"]) env.Append(CFLAGS=["-DOPUS_ARM64_OPT"])
else: else:
env.Append(CFLAGS=["-DOPUS_ARM_OPT"]) env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
@ -180,10 +180,10 @@ def configure(env):
env.Append(CPPFLAGS=['-fexceptions']) env.Append(CPPFLAGS=['-fexceptions'])
else: else:
env.Append(CPPFLAGS=['-fno-exceptions']) env.Append(CPPFLAGS=['-fno-exceptions'])
#env['neon_enabled']=True # env['neon_enabled']=True
env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc' env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
import methods import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

View File

@ -14,24 +14,24 @@ env_javascript = env.Clone()
if env['target'] == "profile": if env['target'] == "profile":
env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED']) env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
javascript_objects=[] javascript_objects = []
for x in javascript_files: for x in javascript_files:
javascript_objects.append( env_javascript.Object( x ) ) javascript_objects.append(env_javascript.Object(x))
env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""]) env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
env.Append(LINKFLAGS=["--shell-file",'"platform/javascript/godot_shell.html"']) env.Append(LINKFLAGS=["--shell-file", '"platform/javascript/godot_shell.html"'])
build = env.Program('#bin/godot',javascript_objects,PROGSUFFIX=env["PROGSUFFIX"]+".html") build = env.Program('#bin/godot', javascript_objects, PROGSUFFIX=env["PROGSUFFIX"] + ".html")
def make_html_shell(target, source, env): def make_html_shell(target, source, env):
html_path = target[0].rstr() html_path = target[0].rstr()
assert html_path[:4] == 'bin/' assert html_path[:4] == 'bin/'
assert html_path[-5:] == '.html' assert html_path[-5:] == '.html'
basename = html_path[4:-5] basename = html_path[4:-5]
with open(html_path, 'r+') as html_file: with open(html_path, 'r+') as html_file:
fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE') fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
html_file.seek(0) html_file.seek(0)
html_file.truncate() html_file.truncate()
html_file.write(fixed_html) html_file.write(fixed_html)
env.AddPostAction(build, Action(make_html_shell, "Creating HTML shell file")) env.AddPostAction(build, Action(make_html_shell, "Creating HTML shell file"))

View File

@ -18,8 +18,8 @@ def can_build():
def get_opts(): def get_opts():
return [ return [
['wasm','Compile to WebAssembly','no'], ['wasm', 'Compile to WebAssembly', 'no'],
['javascript_eval','Enable JavaScript eval interface','yes'], ['javascript_eval', 'Enable JavaScript eval interface', 'yes'],
] ]
def get_flags(): def get_flags():
@ -40,13 +40,13 @@ def configure(env):
env.Append(CPPPATH=['#platform/javascript']) env.Append(CPPPATH=['#platform/javascript'])
em_path=os.environ["EMSCRIPTEN_ROOT"] em_path = os.environ["EMSCRIPTEN_ROOT"]
env['ENV']['PATH'] = em_path+":"+env['ENV']['PATH'] env['ENV']['PATH'] = em_path + ":" + env['ENV']['PATH']
env['CC'] = em_path+'/emcc' env['CC'] = em_path + '/emcc'
env['CXX'] = em_path+'/emcc' env['CXX'] = em_path + '/emcc'
#env['AR'] = em_path+"/emar" #env['AR'] = em_path+"/emar"
env['AR'] = em_path+"/emcc" env['AR'] = em_path + "/emcc"
env['ARFLAGS'] = "-o" env['ARFLAGS'] = "-o"
# env['RANLIB'] = em_path+"/emranlib" # env['RANLIB'] = em_path+"/emranlib"
@ -60,11 +60,11 @@ def configure(env):
# env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ") # env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2']) env.Append(CCFLAGS=['-O2'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
#env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED']) #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
@ -73,33 +73,33 @@ def configure(env):
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
env.opus_fixed_point = "yes" env.opus_fixed_point = "yes"
env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti']) env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
env.Append(CPPFLAGS=['-DGLES2_ENABLED']) env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS']) env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
env.Append(CPPFLAGS=['-s','FULL_ES2=1']) env.Append(CPPFLAGS=['-s', 'FULL_ES2=1'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT']) # env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
if env['wasm'] == 'yes': if env['wasm'] == 'yes':
env.Append(LINKFLAGS=['-s','BINARYEN=1']) env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
env.Append(LINKFLAGS=['-s','\'BINARYEN_METHOD="native-wasm"\'']) env.Append(LINKFLAGS=['-s', '\'BINARYEN_METHOD="native-wasm"\''])
env["PROGSUFFIX"]+=".webassembly" env["PROGSUFFIX"] += ".webassembly"
else: else:
env.Append(CPPFLAGS=['-s','ASM_JS=1']) env.Append(CPPFLAGS=['-s', 'ASM_JS=1'])
env.Append(LINKFLAGS=['-s','ASM_JS=1']) env.Append(LINKFLAGS=['-s', 'ASM_JS=1'])
if env['javascript_eval'] == 'yes': if env['javascript_eval'] == 'yes':
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED']) env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
env.Append(LINKFLAGS=['-O2']) env.Append(LINKFLAGS=['-O2'])
#env.Append(LINKFLAGS=['-g4']) # env.Append(LINKFLAGS=['-g4'])
#print "CCCOM is:", env.subst('$CCCOM') # print "CCCOM is:", env.subst('$CCCOM')
#print "P: ", env['p'], " Platofrm: ", env['platform'] # print "P: ", env['p'], " Platofrm: ", env['platform']
import methods import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )

View File

@ -12,4 +12,4 @@ files = [
'joystick_osx.cpp', 'joystick_osx.cpp',
] ]
env.Program('#bin/godot',files) env.Program('#bin/godot', files)

View File

@ -20,8 +20,8 @@ def can_build():
def get_opts(): def get_opts():
return [ return [
('force_64_bits','Force 64 bits binary','no'), ('force_64_bits', 'Force 64 bits binary', 'no'),
('osxcross_sdk','OSXCross SDK version','darwin14'), ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
] ]
@ -36,67 +36,67 @@ def configure(env):
env.Append(CPPPATH=['#platform/osx']) env.Append(CPPPATH=['#platform/osx'])
if (env["bits"]=="default"): if (env["bits"] == "default"):
env["bits"]="32" env["bits"] = "32"
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer','-ftree-vectorize','-msse2']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['-g3', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
if (not os.environ.has_key("OSXCROSS_ROOT")): if (not os.environ.has_key("OSXCROSS_ROOT")):
#regular native build # regular native build
if (env["bits"]=="64"): if (env["bits"] == "64"):
env.Append(CCFLAGS=['-arch', 'x86_64']) env.Append(CCFLAGS=['-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'x86_64']) env.Append(LINKFLAGS=['-arch', 'x86_64'])
elif (env["bits"]=="32"): elif (env["bits"] == "32"):
env.Append(CCFLAGS=['-arch', 'i386']) env.Append(CCFLAGS=['-arch', 'i386'])
env.Append(LINKFLAGS=['-arch', 'i386']) env.Append(LINKFLAGS=['-arch', 'i386'])
else: else:
env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64']) env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64']) env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
else: else:
#osxcross build # osxcross build
root=os.environ.get("OSXCROSS_ROOT",0) root = os.environ.get("OSXCROSS_ROOT", 0)
if env["bits"]=="64": if env["bits"] == "64":
basecmd=root+"/target/bin/x86_64-apple-"+env["osxcross_sdk"]+"-" basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
else: else:
basecmd=root+"/target/bin/i386-apple-"+env["osxcross_sdk"]+"-" basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-"
env['CC'] = basecmd+"cc" env['CC'] = basecmd + "cc"
env['CXX'] = basecmd+"c++" env['CXX'] = basecmd + "c++"
env['AR'] = basecmd+"ar" env['AR'] = basecmd + "ar"
env['RANLIB'] = basecmd+"ranlib" env['RANLIB'] = basecmd + "ranlib"
env['AS'] = basecmd+"as" env['AS'] = basecmd + "as"
env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"]) env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
env.Append(CPPFLAGS=['-DUNIX_ENABLED','-DGLES2_ENABLED','-DOSX_ENABLED']) env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
env.Append(LIBS=['pthread']) env.Append(LIBS=['pthread'])
#env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4']) #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
#env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk']) #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback']) env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
if (env["CXX"]=="clang++"): if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"]="clang" env["CC"] = "clang"
env["LD"]="clang++" env["LD"] = "clang++"
import methods import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
env["x86_libtheora_opt_gcc"]=True env["x86_libtheora_opt_gcc"] = True

View File

@ -3,8 +3,8 @@
Import('env') Import('env')
common_server=[\ common_server = [\
"os_server.cpp",\ "os_server.cpp",\
] ]
env.Program('#bin/godot_server',['godot_server.cpp']+common_server) env.Program('#bin/godot_server', ['godot_server.cpp'] + common_server)

View File

@ -12,16 +12,16 @@ def get_name():
def can_build(): def can_build():
if (os.name!="posix"): if (os.name != "posix"):
return False return False
return True # enabled return True # enabled
def get_opts(): def get_opts():
return [ return [
('use_llvm','Use llvm compiler','no'), ('use_llvm', 'Use llvm compiler', 'no'),
('force_32_bits','Force 32 bits binary','no') ('force_32_bits', 'Force 32 bits binary', 'no')
] ]
def get_flags(): def get_flags():
@ -34,43 +34,43 @@ def get_flags():
def configure(env): def configure(env):
env.Append(CPPPATH=['#platform/server']) env.Append(CPPPATH=['#platform/server'])
if (env["use_llvm"]=="yes"): if (env["use_llvm"] == "yes"):
env["CC"]="clang" env["CC"] = "clang"
env["CXX"]="clang++" env["CXX"] = "clang++"
env["LD"]="clang++" env["LD"] = "clang++"
is64=sys.maxsize > 2**32 is64 = sys.maxsize > 2**32
if (env["bits"]=="default"): if (env["bits"] == "default"):
if (is64): if (is64):
env["bits"]="64" env["bits"] = "64"
else: else:
env["bits"]="32" env["bits"] = "32"
#if (env["tools"]=="no"): # if (env["tools"]=="no"):
# #no tools suffix # #no tools suffix
# env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX'] # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
# env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX'] # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED']) env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD! env.Append(LIBS=['pthread', 'z']) # TODO detect linux/BSD!
if (env["CXX"]=="clang++"): if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"]="clang" env["CC"] = "clang"
env["LD"]="clang++" env["LD"] = "clang++"

View File

@ -3,7 +3,7 @@
Import('env') Import('env')
common_win=[ common_win = [
"context_gl_win.cpp", "context_gl_win.cpp",
"os_windows.cpp", "os_windows.cpp",
"ctxgl_procaddr.cpp", "ctxgl_procaddr.cpp",
@ -14,16 +14,16 @@ common_win=[
"joystick.cpp", "joystick.cpp",
] ]
restarget="godot_res"+env["OBJSUFFIX"] restarget = "godot_res" + env["OBJSUFFIX"]
obj = env.RES(restarget,'godot_res.rc') obj = env.RES(restarget, 'godot_res.rc')
common_win.append(obj) common_win.append(obj)
env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"]) env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation # Microsoft Visual Studio Project Generation
if (env['vsproj'])=="yes": if (env['vsproj']) == "yes":
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"] env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win: for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)] env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]

View File

@ -85,7 +85,7 @@
##### #####
# TODO : # TODO :
# #
# - finish to cleanup this script to remove all the remains of previous hacks and workarounds # - finish to cleanup this script to remove all the remains of previous hacks and workarounds
# - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express # - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
# - confirm it works well with other Visual Studio versions. # - confirm it works well with other Visual Studio versions.
@ -107,21 +107,21 @@ def get_name():
def can_build(): def can_build():
if (os.name=="nt"): if (os.name == "nt"):
#building natively on windows! # building natively on windows!
if ( os.getenv("VCINSTALLDIR") ): if (os.getenv("VCINSTALLDIR")):
return True return True
else: else:
print("\nMSVC not detected, attempting Mingw.") print("\nMSVC not detected, attempting Mingw.")
mingw32 = "" mingw32 = ""
mingw64 = "" mingw64 = ""
if ( os.getenv("MINGW32_PREFIX") ) : if (os.getenv("MINGW32_PREFIX")):
mingw32 = os.getenv("MINGW32_PREFIX") mingw32 = os.getenv("MINGW32_PREFIX")
if ( os.getenv("MINGW64_PREFIX") ) : if (os.getenv("MINGW64_PREFIX")):
mingw64 = os.getenv("MINGW64_PREFIX") mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version > NUL 2>&1" test = "gcc --version > NUL 2>&1"
if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 : if os.system(test) != 0 and os.system(mingw32 + test) != 0 and os.system(mingw64 + test) != 0:
print("- could not detect gcc.") print("- could not detect gcc.")
print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n") print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
return False return False
@ -130,57 +130,57 @@ def can_build():
return True return True
if (os.name=="posix"): if (os.name == "posix"):
mingw = "i586-mingw32msvc-" mingw = "i586-mingw32msvc-"
mingw64 = "x86_64-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-"
mingw32 = "i686-w64-mingw32-" mingw32 = "i686-w64-mingw32-"
if (os.getenv("MINGW32_PREFIX")): if (os.getenv("MINGW32_PREFIX")):
mingw32=os.getenv("MINGW32_PREFIX") mingw32 = os.getenv("MINGW32_PREFIX")
mingw = mingw32 mingw = mingw32
if (os.getenv("MINGW64_PREFIX")): if (os.getenv("MINGW64_PREFIX")):
mingw64=os.getenv("MINGW64_PREFIX") mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version &>/dev/null" test = "gcc --version &>/dev/null"
if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0): if (os.system(mingw + test) == 0 or os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
return True return True
return False return False
def get_opts(): def get_opts():
mingw="" mingw = ""
mingw32="" mingw32 = ""
mingw64="" mingw64 = ""
if ( os.name == "posix" ): if (os.name == "posix"):
mingw = "i586-mingw32msvc-" mingw = "i586-mingw32msvc-"
mingw32 = "i686-w64-mingw32-" mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-"
if os.system(mingw32+"gcc --version &>/dev/null") != 0 : if os.system(mingw32 + "gcc --version &>/dev/null") != 0:
mingw32 = mingw mingw32 = mingw
if (os.getenv("MINGW32_PREFIX")): if (os.getenv("MINGW32_PREFIX")):
mingw32=os.getenv("MINGW32_PREFIX") mingw32 = os.getenv("MINGW32_PREFIX")
mingw = mingw32 mingw = mingw32
if (os.getenv("MINGW64_PREFIX")): if (os.getenv("MINGW64_PREFIX")):
mingw64=os.getenv("MINGW64_PREFIX") mingw64 = os.getenv("MINGW64_PREFIX")
return [ return [
('mingw_prefix','Mingw Prefix',mingw32), ('mingw_prefix', 'Mingw Prefix', mingw32),
('mingw_prefix_64','Mingw Prefix 64 bits',mingw64), ('mingw_prefix_64', 'Mingw Prefix 64 bits', mingw64),
] ]
def get_flags(): def get_flags():
return [ return [
('builtin_zlib', 'yes'), ('builtin_zlib', 'yes'),
('openssl','builtin'), #use builtin openssl ('openssl', 'builtin'), # use builtin openssl
] ]
def build_res_file( target, source, env ): def build_res_file(target, source, env):
cmdbase = "" cmdbase = ""
if (env["bits"] == "32"): if (env["bits"] == "32"):
@ -193,7 +193,7 @@ def build_res_file( target, source, env ):
for x in range(len(source)): for x in range(len(source)):
cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x]) cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
try: try:
out = subprocess.Popen(cmd,shell = True,stderr = subprocess.PIPE).communicate() out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
if len(out[1]): if len(out[1]):
return 1 return 1
except: except:
@ -203,66 +203,66 @@ def build_res_file( target, source, env ):
def configure(env): def configure(env):
env.Append(CPPPATH=['#platform/windows']) env.Append(CPPPATH=['#platform/windows'])
env['is_mingw']=False env['is_mingw'] = False
if (os.name=="nt" and os.getenv("VCINSTALLDIR") ): if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
#build using visual studio # build using visual studio
env['ENV']['TMP'] = os.environ['TMP'] env['ENV']['TMP'] = os.environ['TMP']
env.Append(CPPPATH=['#platform/windows/include']) env.Append(CPPPATH=['#platform/windows/include'])
env.Append(LIBPATH=['#platform/windows/lib']) env.Append(LIBPATH=['#platform/windows/lib'])
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['/O2']) env.Append(CCFLAGS=['/O2'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS']) env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup']) env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED']) env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
elif (env["target"]=="debug_release"): elif (env["target"] == "debug_release"):
env.Append(CCFLAGS=['/Z7','/Od']) env.Append(CCFLAGS=['/Z7', '/Od'])
env.Append(LINKFLAGS=['/DEBUG']) env.Append(LINKFLAGS=['/DEBUG'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS']) env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup']) env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['/Z7','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED','/DD3D_DEBUG_INFO','/Od']) env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG']) env.Append(LINKFLAGS=['/DEBUG'])
env.Append(CCFLAGS=['/MT','/Gd','/GR','/nologo']) env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
env.Append(CXXFLAGS=['/TP']) env.Append(CXXFLAGS=['/TP'])
env.Append(CPPFLAGS=['/DMSVC', '/GR', ]) env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"]) env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
env.Append(CCFLAGS=['/DWINDOWS_ENABLED']) env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DRTAUDIO_ENABLED']) env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['/DWIN32']) env.Append(CCFLAGS=['/DWIN32'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
env.Append(CCFLAGS=['/DGLES2_ENABLED']) env.Append(CCFLAGS=['/DGLES2_ENABLED'])
LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid'] LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS]) env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"]) env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
if (os.getenv("DXSDK_DIR")): if (os.getenv("DXSDK_DIR")):
DIRECTX_PATH=os.getenv("DXSDK_DIR") DIRECTX_PATH = os.getenv("DXSDK_DIR")
else: else:
DIRECTX_PATH="C:/Program Files/Microsoft DirectX SDK (March 2009)" DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"
if (os.getenv("VCINSTALLDIR")): if (os.getenv("VCINSTALLDIR")):
VC_PATH=os.getenv("VCINSTALLDIR") VC_PATH = os.getenv("VCINSTALLDIR")
else: else:
VC_PATH="" VC_PATH = ""
env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")]) env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")]) env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"]) env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"]) env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
env['ENV'] = os.environ; env['ENV'] = os.environ;
# This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
@ -272,26 +272,26 @@ def configure(env):
if(env["bits"] != "default"): if(env["bits"] != "default"):
print "Error: bits argument is disabled for MSVC" print "Error: bits argument is disabled for MSVC"
print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)" print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler" + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
+" will be executed and inform you.") + " will be executed and inform you.")
sys.exit() sys.exit()
# Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
# that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with) # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
env["bits"]="32" env["bits"] = "32"
env["x86_libtheora_opt_vc"]=True env["x86_libtheora_opt_vc"] = True
print "Detected MSVC compiler: "+compiler_version_str print "Detected MSVC compiler: " + compiler_version_str
# If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
env["bits"]="64" env["bits"] = "64"
env["x86_libtheora_opt_vc"]=False env["x86_libtheora_opt_vc"] = False
print "Compiled program architecture will be a 64 bit executable (forcing bits=64)." print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"): elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)." print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
else: else:
print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
if env["bits"]=="64": if env["bits"] == "64":
env.Append(CCFLAGS=['/D_WIN64']) env.Append(CCFLAGS=['/D_WIN64'])
# Incremental linking fix # Incremental linking fix
@ -304,32 +304,32 @@ def configure(env):
# http://www.scons.org/wiki/LongCmdLinesOnWin32 # http://www.scons.org/wiki/LongCmdLinesOnWin32
env.use_windows_spawn_fix() env.use_windows_spawn_fix()
#build using mingw # build using mingw
if (os.name=="nt"): if (os.name == "nt"):
env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes
else: else:
env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe" # for linux cross-compilation env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
mingw_prefix="" mingw_prefix = ""
if (env["bits"]=="default"): if (env["bits"] == "default"):
env["bits"]="32" env["bits"] = "32"
if (env["bits"]=="32"): if (env["bits"] == "32"):
env.Append(LINKFLAGS=['-static']) env.Append(LINKFLAGS=['-static'])
env.Append(LINKFLAGS=['-static-libgcc']) env.Append(LINKFLAGS=['-static-libgcc'])
env.Append(LINKFLAGS=['-static-libstdc++']) env.Append(LINKFLAGS=['-static-libstdc++'])
mingw_prefix=env["mingw_prefix"]; mingw_prefix = env["mingw_prefix"];
else: else:
env.Append(LINKFLAGS=['-static']) env.Append(LINKFLAGS=['-static'])
mingw_prefix=env["mingw_prefix_64"]; mingw_prefix = env["mingw_prefix_64"];
nulstr="" nulstr = ""
if (os.name=="posix"): if (os.name == "posix"):
nulstr=">/dev/null" nulstr = ">/dev/null"
else: else:
nulstr=">nul" nulstr = ">nul"
@ -338,42 +338,42 @@ def configure(env):
# print("Can't find Windows compiler: "+mingw_prefix) # print("Can't find Windows compiler: "+mingw_prefix)
# sys.exit(255) # sys.exit(255)
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CCFLAGS=['-msse2']) env.Append(CCFLAGS=['-msse2'])
if (env["bits"]=="64"): if (env["bits"] == "64"):
env.Append(CCFLAGS=['-O3']) env.Append(CCFLAGS=['-O3'])
else: else:
env.Append(CCFLAGS=['-O2']) env.Append(CCFLAGS=['-O2'])
env.Append(LINKFLAGS=['-Wl,--subsystem,windows']) env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['-g', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
env["CC"]=mingw_prefix+"gcc" env["CC"] = mingw_prefix + "gcc"
env['AS']=mingw_prefix+"as" env['AS'] = mingw_prefix + "as"
env['CXX'] = mingw_prefix+"g++" env['CXX'] = mingw_prefix + "g++"
env['AR'] = mingw_prefix+"ar" env['AR'] = mingw_prefix + "ar"
env['RANLIB'] = mingw_prefix+"ranlib" env['RANLIB'] = mingw_prefix + "ranlib"
env['LD'] = mingw_prefix+"g++" env['LD'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"]=True env["x86_libtheora_opt_gcc"] = True
#env['CC'] = "winegcc" #env['CC'] = "winegcc"
#env['CXX'] = "wineg++" #env['CXX'] = "wineg++"
env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows']) env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED']) env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DGLES2_ENABLED']) env.Append(CCFLAGS=['-DGLES2_ENABLED'])
env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid']) env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])
# if (env["bits"]=="32"): # if (env["bits"]=="32"):
# env.Append(LIBS=['gcc_s']) # env.Append(LIBS=['gcc_s'])
@ -386,13 +386,13 @@ def configure(env):
#'d3dx9d' #'d3dx9d'
env.Append(CPPFLAGS=['-DMINGW_ENABLED']) env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
#env.Append(LINKFLAGS=['-g']) # env.Append(LINKFLAGS=['-g'])
# resrc # resrc
env['is_mingw']=True env['is_mingw'] = True
env.Append( BUILDERS = { 'RES' : env.Builder(action = build_res_file, suffix = '.o',src_suffix = '.rc') } ) env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

View File

@ -12,8 +12,8 @@ def get_name():
return "WinRT" return "WinRT"
def can_build(): def can_build():
if (os.name=="nt"): if (os.name == "nt"):
#building natively on windows! # building natively on windows!
if (os.getenv("VSINSTALLDIR")): if (os.getenv("VSINSTALLDIR")):
if (os.getenv("ANGLE_SRC_PATH") == None): if (os.getenv("ANGLE_SRC_PATH") == None):
@ -40,8 +40,8 @@ def configure(env):
if(env["bits"] != "default"): if(env["bits"] != "default"):
print "Error: bits argument is disabled for MSVC" print "Error: bits argument is disabled for MSVC"
print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)" print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler" + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler"
+" will be executed and inform you.") + " will be executed and inform you.")
sys.exit() sys.exit()
arch = "" arch = ""
@ -60,8 +60,8 @@ def configure(env):
print "Compiled program architecture will be an ARM executable. (forcing bits=32)." print "Compiled program architecture will be an ARM executable. (forcing bits=32)."
arch="arm" arch = "arm"
env["bits"]="32" env["bits"] = "32"
env.Append(LINKFLAGS=['/MACHINE:ARM']) env.Append(LINKFLAGS=['/MACHINE:ARM'])
env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm']) env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
@ -74,14 +74,14 @@ def configure(env):
compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV']) compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
env["bits"]="64" env["bits"] = "64"
print "Compiled program architecture will be a x64 executable (forcing bits=64)." print "Compiled program architecture will be a x64 executable (forcing bits=64)."
elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"): elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
env["bits"]="32" env["bits"] = "32"
print "Compiled program architecture will be a x86 executable. (forcing bits=32)." print "Compiled program architecture will be a x86 executable. (forcing bits=32)."
else: else:
print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
env["bits"]="32" env["bits"] = "32"
if (env["bits"] == "32"): if (env["bits"] == "32"):
arch = "x86" arch = "x86"
@ -102,29 +102,29 @@ def configure(env):
env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64']) env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib']) env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
env.Append(CPPPATH=['#platform/winrt','#drivers/windows']) env.Append(CPPPATH=['#platform/winrt', '#drivers/windows'])
env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"']) env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
env.Append(CPPFLAGS=['/D','__WRL_NO_DEFAULT_LIB__','/D','WIN32']) env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32'])
env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd']) env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references']) env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references']) env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
if (env["target"]=="release"): if (env["target"] == "release"):
env.Append(CPPFLAGS=['/O2', '/GL']) env.Append(CPPFLAGS=['/O2', '/GL'])
env.Append(CPPFLAGS=['/MD']) env.Append(CPPFLAGS=['/MD'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG']) env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['/O2','/Zi','/DDEBUG_ENABLED']) env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['/MD']) env.Append(CPPFLAGS=['/MD'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED'])
env.Append(CPPFLAGS=['/MDd']) env.Append(CPPFLAGS=['/MDd'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG']) env.Append(LINKFLAGS=['/DEBUG'])
@ -132,18 +132,18 @@ def configure(env):
env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo')) env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
env.Append(CXXFLAGS=string.split('/ZW /FS')) env.Append(CXXFLAGS=string.split('/ZW /FS'))
env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR']+'\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR']+'\\References\\CommonConfiguration\\Neutral']) env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR'] + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
env["PROGSUFFIX"]="."+arch+env["PROGSUFFIX"] env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
env["OBJSUFFIX"]="."+arch+env["OBJSUFFIX"] env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
env["LIBSUFFIX"]="."+arch+env["LIBSUFFIX"] env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]
env.Append(CCFLAGS=['/DWINRT_ENABLED']) env.Append(CCFLAGS=['/DWINRT_ENABLED'])
env.Append(CCFLAGS=['/DWINDOWS_ENABLED']) env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
env.Append(CCFLAGS=['/DGLES2_ENABLED','/DGL_GLEXT_PROTOTYPES','/DEGL_EGLEXT_PROTOTYPES','/DANGLE_ENABLED']) env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
LIBS = [ LIBS = [
'WindowsApp', 'WindowsApp',
@ -152,15 +152,15 @@ def configure(env):
'libEGL', 'libEGL',
'libGLESv2', 'libGLESv2',
] ]
env.Append(LINKFLAGS=[p+".lib" for p in LIBS]) env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])
# Incremental linking fix # Incremental linking fix
env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program'] env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
env['BUILDERS']['Program'] = methods.precious_program env['BUILDERS']['Program'] = methods.precious_program
env.Append( BUILDERS = { 'ANGLE' : env.Builder(action = angle_build_cmd) } ) env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

View File

@ -3,11 +3,11 @@
Import('env') Import('env')
common_x11=[\ common_x11 = [\
"context_gl_x11.cpp",\ "context_gl_x11.cpp",\
"os_x11.cpp",\ "os_x11.cpp",\
"key_mapping_x11.cpp",\ "key_mapping_x11.cpp",\
"joystick_linux.cpp",\ "joystick_linux.cpp",\
] ]
env.Program('#bin/godot',['godot_x11.cpp']+common_x11) env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)

View File

@ -13,56 +13,56 @@ def get_name():
def can_build(): def can_build():
if (os.name!="posix"): if (os.name != "posix"):
return False return False
if sys.platform == "darwin": if sys.platform == "darwin":
return False # no x11 on mac for now return False # no x11 on mac for now
errorval=os.system("pkg-config --version > /dev/null") errorval = os.system("pkg-config --version > /dev/null")
if (errorval): if (errorval):
print("pkg-config not found.. x11 disabled.") print("pkg-config not found.. x11 disabled.")
return False return False
x11_error=os.system("pkg-config x11 --modversion > /dev/null ") x11_error = os.system("pkg-config x11 --modversion > /dev/null ")
if (x11_error): if (x11_error):
print("X11 not found.. x11 disabled.") print("X11 not found.. x11 disabled.")
return False return False
ssl_error=os.system("pkg-config openssl --modversion > /dev/null ") ssl_error = os.system("pkg-config openssl --modversion > /dev/null ")
if (ssl_error): if (ssl_error):
print("OpenSSL not found.. x11 disabled.") print("OpenSSL not found.. x11 disabled.")
return False return False
x11_error=os.system("pkg-config xcursor --modversion > /dev/null ") x11_error = os.system("pkg-config xcursor --modversion > /dev/null ")
if (x11_error): if (x11_error):
print("xcursor not found.. x11 disabled.") print("xcursor not found.. x11 disabled.")
return False return False
x11_error=os.system("pkg-config xinerama --modversion > /dev/null ") x11_error = os.system("pkg-config xinerama --modversion > /dev/null ")
if (x11_error): if (x11_error):
print("xinerama not found.. x11 disabled.") print("xinerama not found.. x11 disabled.")
return False return False
x11_error=os.system("pkg-config xrandr --modversion > /dev/null ") x11_error = os.system("pkg-config xrandr --modversion > /dev/null ")
if (x11_error): if (x11_error):
print("xrandr not found.. x11 disabled.") print("xrandr not found.. x11 disabled.")
return False return False
return True # X11 enabled return True # X11 enabled
def get_opts(): def get_opts():
return [ return [
('use_llvm','Use llvm compiler','no'), ('use_llvm', 'Use llvm compiler', 'no'),
('use_static_cpp','link stdc++ statically','no'), ('use_static_cpp', 'link stdc++ statically', 'no'),
('use_sanitizer','Use llvm compiler sanitize address','no'), ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'), ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
('pulseaudio','Detect & Use pulseaudio','yes'), ('pulseaudio', 'Detect & Use pulseaudio', 'yes'),
('udev','Use udev for gamepad connection callbacks','no'), ('udev', 'Use udev for gamepad connection callbacks', 'no'),
('debug_release', 'Add debug symbols to release version','no'), ('debug_release', 'Add debug symbols to release version', 'no'),
] ]
def get_flags(): def get_flags():
@ -77,56 +77,56 @@ def get_flags():
def configure(env): def configure(env):
is64=sys.maxsize > 2**32 is64 = sys.maxsize > 2**32
if (env["bits"]=="default"): if (env["bits"] == "default"):
if (is64): if (is64):
env["bits"]="64" env["bits"] = "64"
else: else:
env["bits"]="32" env["bits"] = "32"
env.Append(CPPPATH=['#platform/x11']) env.Append(CPPPATH=['#platform/x11'])
if (env["use_llvm"]=="yes"): if (env["use_llvm"] == "yes"):
if 'clang++' not in env['CXX']: if 'clang++' not in env['CXX']:
env["CC"]="clang" env["CC"] = "clang"
env["CXX"]="clang++" env["CXX"] = "clang++"
env["LD"]="clang++" env["LD"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix=".llvm" env.extra_suffix = ".llvm"
if (env["use_sanitizer"]=="yes"): if (env["use_sanitizer"] == "yes"):
env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer']) env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address']) env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix+="s" env.extra_suffix += "s"
if (env["use_leak_sanitizer"]=="yes"): if (env["use_leak_sanitizer"] == "yes"):
env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer']) env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address']) env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix+="s" env.extra_suffix += "s"
#if (env["tools"]=="no"): # if (env["tools"]=="no"):
# #no tools suffix # #no tools suffix
# env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX'] # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
# env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX'] # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
if (env["target"]=="release"): if (env["target"] == "release"):
if (env["debug_release"]=="yes"): if (env["debug_release"] == "yes"):
env.Append(CCFLAGS=['-g2']) env.Append(CCFLAGS=['-g2'])
else: else:
env.Append(CCFLAGS=['-O3','-ffast-math']) env.Append(CCFLAGS=['-O3', '-ffast-math'])
elif (env["target"]=="release_debug"): elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
if (env["debug_release"]=="yes"): if (env["debug_release"] == "yes"):
env.Append(CCFLAGS=['-g2']) env.Append(CCFLAGS=['-g2'])
elif (env["target"]=="debug"): elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs')
@ -180,7 +180,7 @@ def configure(env):
if (env["glew"] == "system"): if (env["glew"] == "system"):
env.ParseConfig('pkg-config glew --cflags --libs') env.ParseConfig('pkg-config glew --cflags --libs')
if os.system("pkg-config --exists alsa")==0: if os.system("pkg-config --exists alsa") == 0:
print("Enabling ALSA") print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED"]) env.Append(CPPFLAGS=["-DALSA_ENABLED"])
env.ParseConfig('pkg-config alsa --cflags --libs') env.ParseConfig('pkg-config alsa --cflags --libs')
@ -189,7 +189,7 @@ def configure(env):
if (platform.system() == "Linux"): if (platform.system() == "Linux"):
env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"]) env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
if (env["udev"]=="yes"): if (env["udev"] == "yes"):
# pkg-config returns 0 when the lib exists... # pkg-config returns 0 when the lib exists...
found_udev = not os.system("pkg-config --exists libudev") found_udev = not os.system("pkg-config --exists libudev")
@ -200,7 +200,7 @@ def configure(env):
else: else:
print("libudev development libraries not found, disabling udev support") print("libudev development libraries not found, disabling udev support")
if (env["pulseaudio"]=="yes"): if (env["pulseaudio"] == "yes"):
if not os.system("pkg-config --exists libpulse-simple"): if not os.system("pkg-config --exists libpulse-simple"):
print("Enabling PulseAudio") print("Enabling PulseAudio")
env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"]) env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
@ -208,33 +208,33 @@ def configure(env):
else: else:
print("PulseAudio development libraries not found, disabling driver") print("PulseAudio development libraries not found, disabling driver")
env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL']) env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
env.Append(LIBS=['GL', 'pthread', 'z']) env.Append(LIBS=['GL', 'pthread', 'z'])
if (platform.system() == "Linux"): if (platform.system() == "Linux"):
env.Append(LIBS='dl') env.Append(LIBS='dl')
#env.Append(CPPFLAGS=['-DMPC_FIXED_POINT']) # env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
#host compiler is default.. # host compiler is default..
if (is64 and env["bits"]=="32"): if (is64 and env["bits"] == "32"):
env.Append(CPPFLAGS=['-m32']) env.Append(CPPFLAGS=['-m32'])
env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu']) env.Append(LINKFLAGS=['-m32', '-L/usr/lib/i386-linux-gnu'])
elif (not is64 and env["bits"]=="64"): elif (not is64 and env["bits"] == "64"):
env.Append(CPPFLAGS=['-m64']) env.Append(CPPFLAGS=['-m64'])
env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu']) env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu'])
import methods import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
if (env["use_static_cpp"]=="yes"): if (env["use_static_cpp"] == "yes"):
env.Append(LINKFLAGS=['-static-libstdc++']) env.Append(LINKFLAGS=['-static-libstdc++'])
list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
if any(platform.machine() in s for s in list_of_x86): if any(platform.machine() in s for s in list_of_x86):
env["x86_libtheora_opt_gcc"]=True env["x86_libtheora_opt_gcc"] = True

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -3,11 +3,11 @@
Import('env') Import('env')
if (env["disable_3d"]=="yes"): if (env["disable_3d"] == "yes"):
env.scene_sources.append("3d/spatial.cpp") env.scene_sources.append("3d/spatial.cpp")
env.scene_sources.append("3d/skeleton.cpp") env.scene_sources.append("3d/skeleton.cpp")
else: else:
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,8 +2,8 @@
Import('env') Import('env')
env.scene_sources=[] env.scene_sources = []
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')
@ -17,6 +17,6 @@ SConscript('resources/SCsub');
SConscript('io/SCsub'); SConscript('io/SCsub');
lib = env.Library("scene",env.scene_sources) lib = env.Library("scene", env.scene_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,8 +2,8 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
env.add_source_files(env.scene_sources,"*.c") env.add_source_files(env.scene_sources, "*.c")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.scene_sources,"*.cpp") env.add_source_files(env.scene_sources, "*.cpp")
Export('env') Export('env')

View File

@ -4,15 +4,15 @@ import glob;
import string; import string;
#Generate include files # Generate include files
f=open("theme_data.h","wb") f = open("theme_data.h", "wb")
f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n"); f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n");
f.write("\n\n"); f.write("\n\n");
#Generate png image block # Generate png image block
pixmaps = glob.glob("*.png"); pixmaps = glob.glob("*.png");
@ -22,23 +22,23 @@ f.write("\n\n\n");
for x in pixmaps: for x in pixmaps:
var_str=x[:-4]+"_png"; var_str = x[:-4] + "_png";
f.write("static const unsigned char "+ var_str +"[]={\n"); f.write("static const unsigned char " + var_str + "[]={\n");
pngf=open(x,"rb"); pngf = open(x, "rb");
b=pngf.read(1); b = pngf.read(1);
while(len(b)==1): while(len(b) == 1):
f.write(hex(ord(b))) f.write(hex(ord(b)))
b=pngf.read(1); b = pngf.read(1);
if (len(b)==1): if (len(b) == 1):
f.write(",") f.write(",")
f.write("\n};\n\n\n"); f.write("\n};\n\n\n");
pngf.close(); pngf.close();
#Generate shaders block # Generate shaders block
shaders = glob.glob("*.gsl") shaders = glob.glob("*.gsl")
@ -48,22 +48,22 @@ f.write("\n\n\n");
for x in shaders: for x in shaders:
var_str=x[:-4]+"_shader_code"; var_str = x[:-4] + "_shader_code";
f.write("static const char *"+ var_str +"=\n"); f.write("static const char *" + var_str + "=\n");
sf=open(x,"rb"); sf = open(x, "rb");
b=sf.readline(); b = sf.readline();
while(b!=""): while(b != ""):
if (b.endswith("\r\n")): if (b.endswith("\r\n")):
b=b[:-2] b = b[:-2]
if (b.endswith("\n")): if (b.endswith("\n")):
b=b[:-1] b = b[:-1]
f.write(" \""+b) f.write(" \"" + b)
b=sf.readline(); b = sf.readline();
if (b!=""): if (b != ""):
f.write("\"\n") f.write("\"\n")
f.write("\";\n\n\n"); f.write("\";\n\n\n");

View File

@ -2,8 +2,8 @@
Import('env') Import('env')
env.servers_sources=[] env.servers_sources = []
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')
@ -14,6 +14,6 @@ SConscript('audio/SCsub');
SConscript('spatial_sound/SCsub'); SConscript('spatial_sound/SCsub');
SConscript('spatial_sound_2d/SCsub'); SConscript('spatial_sound_2d/SCsub');
lib = env.Library("servers",env.servers_sources) lib = env.Library("servers", env.servers_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,7 +2,7 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,4 +2,4 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.servers_sources,"*.cpp") env.add_source_files(env.servers_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,18 +2,18 @@
Import('env') Import('env')
env.tool_sources=[] env.tool_sources = []
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")
Export('env') Export('env')
def make_translations_header(target,source,env): def make_translations_header(target, source, env):
dst = target[0].srcnode().abspath dst = target[0].srcnode().abspath
g = open(dst,"wb") g = open(dst, "wb")
"""" """"
@ -29,24 +29,24 @@ def make_translations_header(target,source,env):
paths = [node.srcnode().abspath for node in source] paths = [node.srcnode().abspath for node in source]
sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0]) sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0])
xl_names=[] xl_names = []
for i in range(len(sorted_paths)): for i in range(len(sorted_paths)):
print("Appending translation: "+sorted_paths[i]) print("Appending translation: " + sorted_paths[i])
f = open(sorted_paths[i],"rb") f = open(sorted_paths[i], "rb")
buf = f.read() buf = f.read()
decomp_size = len(buf) decomp_size = len(buf)
buf = zlib.compress(buf) buf = zlib.compress(buf)
name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n") #g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n") #g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")
g.write("static const unsigned char _translation_"+name+"_compressed[]={\n") g.write("static const unsigned char _translation_" + name + "_compressed[]={\n")
for i in range(len(buf)): for i in range(len(buf)):
g.write(str(ord(buf[i]))+",\n") g.write(str(ord(buf[i])) + ",\n")
g.write("};\n") g.write("};\n")
xl_names.append([name,len(buf),str(decomp_size)]) xl_names.append([name, len(buf), str(decomp_size)])
g.write("struct EditorTranslationList {\n") g.write("struct EditorTranslationList {\n")
g.write("\tconst char* lang;\n"); g.write("\tconst char* lang;\n");
@ -56,19 +56,19 @@ def make_translations_header(target,source,env):
g.write("};\n\n"); g.write("};\n\n");
g.write("static EditorTranslationList _editor_translations[]={\n") g.write("static EditorTranslationList _editor_translations[]={\n")
for x in xl_names: for x in xl_names:
g.write("\t{ \""+x[0]+"\", "+str(x[1])+", "+str(x[2])+",_translation_"+x[0]+"_compressed},\n") g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n")
g.write("\t{NULL,0,0,NULL}\n") g.write("\t{NULL,0,0,NULL}\n")
g.write("};\n") g.write("};\n")
g.write("#endif") g.write("#endif")
def make_fonts_header(target,source,env): def make_fonts_header(target, source, env):
dst = target[0].srcnode().abspath dst = target[0].srcnode().abspath
g = open(dst,"wb") g = open(dst, "wb")
"""" """"
@ -78,48 +78,48 @@ def make_fonts_header(target,source,env):
g.write("#ifndef _EDITOR_FONTS_H\n") g.write("#ifndef _EDITOR_FONTS_H\n")
g.write("#define _EDITOR_FONTS_H\n") g.write("#define _EDITOR_FONTS_H\n")
#saving uncompressed, since freetype will reference from memory pointer # saving uncompressed, since freetype will reference from memory pointer
xl_names=[] xl_names = []
for i in range(len(source)): for i in range(len(source)):
print("Appending font: "+source[i].srcnode().abspath) print("Appending font: " + source[i].srcnode().abspath)
f = open(source[i].srcnode().abspath,"rb") f = open(source[i].srcnode().abspath, "rb")
buf = f.read() buf = f.read()
import os.path import os.path
name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0] name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
g.write("static const int _font_"+name+"_size="+str(len(buf))+";\n") g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n")
g.write("static const unsigned char _font_"+name+"[]={\n") g.write("static const unsigned char _font_" + name + "[]={\n")
for i in range(len(buf)): for i in range(len(buf)):
g.write(str(ord(buf[i]))+",\n") g.write(str(ord(buf[i])) + ",\n")
g.write("};\n") g.write("};\n")
g.write("#endif") g.write("#endif")
if (env["tools"]!="no"): if (env["tools"] != "no"):
import glob import glob
dir = env.Dir('.').abspath dir = env.Dir('.').abspath
tlist = glob.glob(dir + "/translations/*.po") tlist = glob.glob(dir + "/translations/*.po")
print("translations: ",tlist) print("translations: ", tlist)
env.Depends('#tools/editor/translations.h',tlist) env.Depends('#tools/editor/translations.h', tlist)
env.Command('#tools/editor/translations.h',tlist,make_translations_header) env.Command('#tools/editor/translations.h', tlist, make_translations_header)
flist = glob.glob(dir + "/editor_fonts/*.ttf") flist = glob.glob(dir + "/editor_fonts/*.ttf")
flist.append( glob.glob(dir + "/editor_fonts/*.otf") ) flist.append(glob.glob(dir + "/editor_fonts/*.otf"))
print("fonts: ",flist) print("fonts: ", flist)
env.Depends('#tools/editor/builtin_fonts.h',flist) env.Depends('#tools/editor/builtin_fonts.h', flist)
env.Command('#tools/editor/builtin_fonts.h',flist,make_fonts_header) env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header)
SConscript('editor/SCsub'); SConscript('editor/SCsub');
SConscript('collada/SCsub'); SConscript('collada/SCsub');
SConscript('doc/SCsub') SConscript('doc/SCsub')
lib = env.Library("tool",env.tool_sources) lib = env.Library("tool", env.tool_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")
Export('env') Export('env')

View File

@ -2,6 +2,6 @@
Import('env') Import('env')
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")
Export('env') Export('env')

View File

@ -3,12 +3,12 @@
Import('env') Import('env')
def make_doc_header(target,source,env): def make_doc_header(target, source, env):
src = source[0].srcnode().abspath src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath dst = target[0].srcnode().abspath
f = open(src,"rb") f = open(src, "rb")
g = open(dst,"wb") g = open(dst, "wb")
buf = f.read() buf = f.read()
decomp_size = len(buf) decomp_size = len(buf)
import zlib import zlib
@ -18,22 +18,22 @@ def make_doc_header(target,source,env):
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _DOC_DATA_RAW_H\n") g.write("#ifndef _DOC_DATA_RAW_H\n")
g.write("#define _DOC_DATA_RAW_H\n") g.write("#define _DOC_DATA_RAW_H\n")
g.write("static const int _doc_data_compressed_size="+str(len(buf))+";\n") g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n")
g.write("static const int _doc_data_uncompressed_size="+str(decomp_size)+";\n") g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _doc_data_compressed[]={\n") g.write("static const unsigned char _doc_data_compressed[]={\n")
for i in range(len(buf)): for i in range(len(buf)):
g.write(str(ord(buf[i]))+",\n") g.write(str(ord(buf[i])) + ",\n")
g.write("};\n") g.write("};\n")
g.write("#endif") g.write("#endif")
def make_certs_header(target,source,env): def make_certs_header(target, source, env):
src = source[0].srcnode().abspath src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath dst = target[0].srcnode().abspath
f = open(src,"rb") f = open(src, "rb")
g = open(dst,"wb") g = open(dst, "wb")
buf = f.read() buf = f.read()
decomp_size = len(buf) decomp_size = len(buf)
import zlib import zlib
@ -43,11 +43,11 @@ def make_certs_header(target,source,env):
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _CERTS_RAW_H\n") g.write("#ifndef _CERTS_RAW_H\n")
g.write("#define _CERTS_RAW_H\n") g.write("#define _CERTS_RAW_H\n")
g.write("static const int _certs_compressed_size="+str(len(buf))+";\n") g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n")
g.write("static const int _certs_uncompressed_size="+str(decomp_size)+";\n") g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n")
g.write("static const unsigned char _certs_compressed[]={\n") g.write("static const unsigned char _certs_compressed[]={\n")
for i in range(len(buf)): for i in range(len(buf)):
g.write(str(ord(buf[i]))+",\n") g.write(str(ord(buf[i])) + ",\n")
g.write("};\n") g.write("};\n")
g.write("#endif") g.write("#endif")
@ -57,29 +57,29 @@ def make_certs_header(target,source,env):
if (env["tools"]=="yes"): if (env["tools"] == "yes"):
reg_exporters_inc='#include "register_exporters.h"\n' reg_exporters_inc = '#include "register_exporters.h"\n'
reg_exporters='void register_exporters() {\n' reg_exporters = 'void register_exporters() {\n'
for e in env.platform_exporters: for e in env.platform_exporters:
env.tool_sources.append("#platform/"+e+"/export/export.cpp") env.tool_sources.append("#platform/" + e + "/export/export.cpp")
reg_exporters+='\tregister_'+e+'_exporter();\n' reg_exporters += '\tregister_' + e + '_exporter();\n'
reg_exporters_inc+='#include "platform/'+e+'/export/export.h"\n' reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
reg_exporters+='}\n' reg_exporters += '}\n'
f = open("register_exporters.cpp","wb") f = open("register_exporters.cpp", "wb")
f.write(reg_exporters_inc) f.write(reg_exporters_inc)
f.write(reg_exporters) f.write(reg_exporters)
f.close() f.close()
env.Depends("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml") env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml")
env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header) env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header)
env.Depends("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt") env.Depends("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt")
env.Command("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt",make_certs_header) env.Command("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt", make_certs_header)
#make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env) # make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env)
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")
Export('env') Export('env')
SConscript('icons/SCsub'); SConscript('icons/SCsub');

View File

@ -2,4 +2,4 @@
Import('env') Import('env')
Export('env') Export('env')
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")

View File

@ -16,47 +16,47 @@ def make_editor_icons_action(target, source, env):
s.write("#include \"editor_scale.h\"\n\n") s.write("#include \"editor_scale.h\"\n\n")
s.write("#include \"scene/resources/theme.h\"\n\n") s.write("#include \"scene/resources/theme.h\"\n\n")
hidpi_list=[] hidpi_list = []
for x in pixmaps: for x in pixmaps:
x=str(x) x = str(x)
var_str=os.path.basename(x)[:-4]+"_png"; var_str = os.path.basename(x)[:-4] + "_png";
#print(var_str) # print(var_str)
s.write("static const unsigned char "+ var_str +"[]={\n"); s.write("static const unsigned char " + var_str + "[]={\n");
pngf=open(x,"rb"); pngf = open(x, "rb");
b=pngf.read(1); b = pngf.read(1);
while(len(b)==1): while(len(b) == 1):
s.write(hex(ord(b))) s.write(hex(ord(b)))
b=pngf.read(1); b = pngf.read(1);
if (len(b)==1): if (len(b) == 1):
s.write(",") s.write(",")
s.write("\n};\n\n"); s.write("\n};\n\n");
pngf.close(); pngf.close();
var_str=os.path.basename(x)[:-4]+"_hidpi_png"; var_str = os.path.basename(x)[:-4] + "_hidpi_png";
try: try:
pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb")
s.write("static const unsigned char "+ var_str +"[]={\n"); s.write("static const unsigned char " + var_str + "[]={\n");
b=pngf.read(1); b = pngf.read(1);
while(len(b)==1): while(len(b) == 1):
s.write(hex(ord(b))) s.write(hex(ord(b)))
b=pngf.read(1); b = pngf.read(1);
if (len(b)==1): if (len(b) == 1):
s.write(",") s.write(",")
s.write("\n};\n\n\n"); s.write("\n};\n\n\n");
hidpi_list.append(x) hidpi_list.append(x)
except: except:
s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n"); s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n");
@ -75,24 +75,24 @@ def make_editor_icons_action(target, source, env):
for x in pixmaps: for x in pixmaps:
x=os.path.basename(str(x)) x = os.path.basename(str(x))
type=x[5:-4].title().replace("_",""); type = x[5:-4].title().replace("_", "");
var_str=x[:-4]+"_png"; var_str = x[:-4] + "_png";
var_str_hidpi=x[:-4]+"_hidpi_png"; var_str_hidpi = x[:-4] + "_hidpi_png";
s.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+","+var_str_hidpi+"));\n"); s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n");
s.write("\n\n}\n\n"); s.write("\n\n}\n\n");
f = open(dst,"wb") f = open(dst, "wb")
f.write(s.getvalue()) f.write(s.getvalue())
f.close() f.close()
s.close() s.close()
make_editor_icons_builder = Builder(action=make_editor_icons_action, make_editor_icons_builder = Builder(action=make_editor_icons_action,
suffix = '.cpp', suffix='.cpp',
src_suffix = '.png') src_suffix='.png')
env['BUILDERS']['MakeEditorIconsBuilder']=make_editor_icons_builder env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder
env.Alias('editor_icons',[env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp',Glob("*.png"))]) env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp', Glob("*.png"))])
env.tool_sources.append("#tools/editor/editor_icons.cpp") env.tool_sources.append("#tools/editor/editor_icons.cpp")
Export('env') Export('env')

View File

@ -2,4 +2,4 @@
Import('env') Import('env')
Export('env') Export('env')
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")

View File

@ -2,4 +2,4 @@
Import('env') Import('env')
Export('env') Export('env')
env.add_source_files(env.tool_sources,"*.cpp") env.add_source_files(env.tool_sources, "*.cpp")

View File

@ -1,4 +1,4 @@
header="""\ header = """\
/*************************************************************************/ /*************************************************************************/
/* $filename */ /* $filename */
/*************************************************************************/ /*************************************************************************/
@ -29,44 +29,44 @@ header="""\
/*************************************************************************/ /*************************************************************************/
""" """
f = open("files","rb") f = open("files", "rb")
fname = f.readline() fname = f.readline()
while (fname!=""): while (fname != ""):
fr = open(fname.strip(),"rb") fr = open(fname.strip(), "rb")
l = fr.readline() l = fr.readline()
bc=False bc = False
fsingle = fname.strip() fsingle = fname.strip()
if (fsingle.find("/")!=-1): if (fsingle.find("/") != -1):
fsingle=fsingle[fsingle.rfind("/")+1:] fsingle = fsingle[fsingle.rfind("/") + 1:]
rep_fl="$filename" rep_fl = "$filename"
rep_fi=fsingle rep_fi = fsingle
len_fl=len(rep_fl) len_fl = len(rep_fl)
len_fi=len(rep_fi) len_fi = len(rep_fi)
if (len_fi<len_fl): if (len_fi < len_fl):
for x in range(len_fl-len_fi): for x in range(len_fl - len_fi):
rep_fi+=" " rep_fi += " "
elif (len_fl<len_fi): elif (len_fl < len_fi):
for x in range(len_fi-len_fl): for x in range(len_fi - len_fl):
rep_fl+=" " rep_fl += " "
if (header.find(rep_fl)!=-1): if (header.find(rep_fl) != -1):
text=header.replace(rep_fl,rep_fi) text = header.replace(rep_fl, rep_fi)
else: else:
text=header.replace("$filename",fsingle) text = header.replace("$filename", fsingle)
while (l!=""): while (l != ""):
if ((l.find("//")!=0 and l.find("/*")!=0 and l.strip()!="") or bc): if ((l.find("//") != 0 and l.find("/*") != 0 and l.strip() != "") or bc):
text+=l text += l
bc=True bc = True
l=fr.readline() l = fr.readline()
fr.close() fr.close()
fr=open(fname.strip(),"wb") fr = open(fname.strip(), "wb")
fr.write(text) fr.write(text)
fr.close() fr.close()
#print(text) # print(text)
fname=f.readline() fname = f.readline()

View File

@ -5,27 +5,27 @@ import sys
def tof(filepath): def tof(filepath):
with open(filepath, 'r') as f: with open(filepath, 'r') as f:
content = f.read() content = f.read()
content = content.replace("0x","") content = content.replace("0x", "")
content = content.split(',') content = content.split(',')
for i in range(len(content)): for i in range(len(content)):
if len(content[i]) == 1: content[i] = "0" + content[i] if len(content[i]) == 1: content[i] = "0" + content[i]
content = "".join(content) content = "".join(content)
with open(filepath+".file", 'wb') as f: with open(filepath + ".file", 'wb') as f:
content = f.write(content.decode("hex")) content = f.write(content.decode("hex"))
print(os.path.basename(filepath)+".file created.") print(os.path.basename(filepath) + ".file created.")
exit(0) exit(0)
def toa(filepath): def toa(filepath):
with open(filepath, 'rb') as f: with open(filepath, 'rb') as f:
content = f.read() content = f.read()
content = binascii.hexlify(content) content = binascii.hexlify(content)
content = [content[i:i+2] for i in range(0, len(content), 2)] content = [content[i:i + 2] for i in range(0, len(content), 2)]
content = ",0x".join(content) content = ",0x".join(content)
content = "0x" + content content = "0x" + content
content = content.replace("0x00","0x0") content = content.replace("0x00", "0x0")
with open(filepath+".array", 'w') as f: with open(filepath + ".array", 'w') as f:
content = f.write(content) content = f.write(content)
print(os.path.basename(filepath)+".array created.") print(os.path.basename(filepath) + ".array created.")
exit(0) exit(0)
def usage(): def usage():

View File

@ -2,43 +2,43 @@
import sys import sys
if (len(sys.argv)!=2): if (len(sys.argv) != 2):
print("Pass me a .fnt argument!") print("Pass me a .fnt argument!")
f = open(sys.argv[1],"rb") f = open(sys.argv[1], "rb")
name = sys.argv[1].lower().replace(".fnt","") name = sys.argv[1].lower().replace(".fnt", "")
l = f.readline() l = f.readline()
font_height=0 font_height = 0
font_ascent=0 font_ascent = 0
font_charcount=0 font_charcount = 0
font_chars=[] font_chars = []
font_cc=0 font_cc = 0
while(l!=""): while(l != ""):
fs = l.strip().find(" ") fs = l.strip().find(" ")
if (fs==-1): if (fs == -1):
l=f.readline() l = f.readline()
continue continue
t = l[0:fs] t = l[0:fs]
dv = l[fs+1:].split(" ") dv = l[fs + 1:].split(" ")
d = {} d = {}
for x in dv: for x in dv:
if (x.find("=")==-1): if (x.find("=") == -1):
continue continue
s = x.split("=") s = x.split("=")
d[ s[0] ] = s[1] d[s[0]] = s[1]
if (t=="common"): if (t == "common"):
font_height=d["lineHeight"] font_height = d["lineHeight"]
font_ascent=d["base"] font_ascent = d["base"]
if (t=="char"): if (t == "char"):
font_chars.append(d["id"]) font_chars.append(d["id"])
font_chars.append(d["x"]) font_chars.append(d["x"])
font_chars.append(d["y"]) font_chars.append(d["y"])
@ -47,24 +47,24 @@ while(l!=""):
font_chars.append(d["xoffset"]) font_chars.append(d["xoffset"])
font_chars.append(d["yoffset"]) font_chars.append(d["yoffset"])
font_chars.append(d["xadvance"]) font_chars.append(d["xadvance"])
font_cc+=1 font_cc += 1
l = f.readline() l = f.readline()
print("static const int _bi_font_"+name+"_height="+str(font_height)+";") print("static const int _bi_font_" + name + "_height=" + str(font_height) + ";")
print("static const int _bi_font_"+name+"_ascent="+str(font_ascent)+";") print("static const int _bi_font_" + name + "_ascent=" + str(font_ascent) + ";")
print("static const int _bi_font_"+name+"_charcount="+str(font_cc)+";") print("static const int _bi_font_" + name + "_charcount=" + str(font_cc) + ";")
cstr="static const int _bi_font_"+name+"_characters={" cstr = "static const int _bi_font_" + name + "_characters={"
for i in range(len(font_chars)): for i in range(len(font_chars)):
c=font_chars[i] c = font_chars[i]
if (i>0): if (i > 0):
cstr+=", " cstr += ", "
cstr+=c cstr += c
cstr+=("};") cstr += ("};")
print(cstr) print(cstr)

View File

@ -1,31 +1,31 @@
#! /usr/bin/env python #! /usr/bin/env python
import sys import sys
if (len(sys.argv)<2): if (len(sys.argv) < 2):
print("usage: make_glwrapper.py <headers>") print("usage: make_glwrapper.py <headers>")
sys.exit(255) sys.exit(255)
functions=[] functions = []
types=[] types = []
constants=[] constants = []
READ_FUNCTIONS=0 READ_FUNCTIONS = 0
READ_TYPES=1 READ_TYPES = 1
READ_CONSTANTS=2 READ_CONSTANTS = 2
read_what=READ_TYPES read_what = READ_TYPES
for x in (range(len(sys.argv)-1)): for x in (range(len(sys.argv) - 1)):
f=open(sys.argv[x+1],"r") f = open(sys.argv[x + 1], "r")
while(True): while(True):
line=f.readline() line = f.readline()
if (line==""): if (line == ""):
break break
line=line.replace("\n","").strip() line = line.replace("\n", "").strip()
""" """
if (line.find("[types]")!=-1): if (line.find("[types]")!=-1):
read_what=READ_TYPES read_what=READ_TYPES
@ -38,67 +38,67 @@ for x in (range(len(sys.argv)-1)):
continue continue
""" """
if (line.find("#define")!=-1): if (line.find("#define") != -1):
if (line.find("0x")==-1 and line.find("GL_VERSION")==-1): if (line.find("0x") == -1 and line.find("GL_VERSION") == -1):
continue continue
constants.append(line) constants.append(line)
elif (line.find("typedef")!=-1): elif (line.find("typedef") != -1):
if (line.find("(")!=-1 or line.find(")")!=-1 or line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("GL")==-1): if (line.find("(") != -1 or line.find(")") != -1 or line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("GL") == -1):
continue continue
types.append(line) types.append(line)
elif (line.find("APIENTRY")!=-1 and line.find("GLAPI")!=-1): elif (line.find("APIENTRY") != -1 and line.find("GLAPI") != -1):
if (line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("NV")!=-1): if (line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("NV") != -1):
continue continue
line=line.replace("APIENTRY","") line = line.replace("APIENTRY", "")
line=line.replace("GLAPI","") line = line.replace("GLAPI", "")
glpos=line.find(" gl") glpos = line.find(" gl")
if (glpos==-1): if (glpos == -1):
glpos=line.find("\tgl") glpos = line.find("\tgl")
if (glpos==-1): if (glpos == -1):
continue continue
ret=line[:glpos].strip(); ret = line[:glpos].strip();
line=line[glpos:].strip() line = line[glpos:].strip()
namepos=line.find("(") namepos = line.find("(")
if (namepos==-1): if (namepos == -1):
continue continue
name=line[:namepos].strip() name = line[:namepos].strip()
line=line[namepos:] line = line[namepos:]
argpos=line.rfind(")") argpos = line.rfind(")")
if (argpos==-1): if (argpos == -1):
continue continue
args=line[1:argpos] args = line[1:argpos]
funcdata={} funcdata = {}
funcdata["ret"]=ret funcdata["ret"] = ret
funcdata["name"]=name funcdata["name"] = name
funcdata["args"]=args funcdata["args"] = args
functions.append(funcdata) functions.append(funcdata)
print(funcdata) print(funcdata)
#print(types) # print(types)
#print(constants) # print(constants)
#print(functions) # print(functions)
f=open("glwrapper.h","w") f = open("glwrapper.h", "w")
f.write("#ifndef GL_WRAPPER\n") f.write("#ifndef GL_WRAPPER\n")
f.write("#define GL_WRAPPER\n\n\n") f.write("#define GL_WRAPPER\n\n\n")
header_code="""\ header_code = """\
#if defined(__gl_h_) || defined(__GL_H__) #if defined(__gl_h_) || defined(__GL_H__)
#error gl.h included before glwrapper.h #error gl.h included before glwrapper.h
#endif #endif
@ -137,18 +137,18 @@ f.write("#else\n");
f.write("#define GLWRP_APIENTRY \n") f.write("#define GLWRP_APIENTRY \n")
f.write("#endif\n\n"); f.write("#endif\n\n");
for x in types: for x in types:
f.write(x+"\n") f.write(x + "\n")
f.write("\n\n") f.write("\n\n")
for x in constants: for x in constants:
f.write(x+"\n") f.write(x + "\n")
f.write("\n\n") f.write("\n\n")
for x in functions: for x in functions:
f.write("extern "+x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+");\n") f.write("extern " + x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ");\n")
f.write("#define "+x["name"]+" __wrapper_"+x["name"]+"\n") f.write("#define " + x["name"] + " __wrapper_" + x["name"] + "\n")
f.write("\n\n") f.write("\n\n")
f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n"); f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n");
@ -158,21 +158,21 @@ f.write("#ifdef __cplusplus\n}\n#endif\n")
f.write("#endif\n\n") f.write("#endif\n\n")
f=open("glwrapper.c","w") f = open("glwrapper.c", "w")
f.write("\n\n") f.write("\n\n")
f.write("#include \"glwrapper.h\"\n") f.write("#include \"glwrapper.h\"\n")
f.write("\n\n") f.write("\n\n")
for x in functions: for x in functions:
f.write(x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+")=NULL;\n") f.write(x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ")=NULL;\n")
f.write("\n\n") f.write("\n\n")
f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n") f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n")
f.write("\n") f.write("\n")
for x in functions: for x in functions:
f.write("\t__wrapper_"+x["name"]+"=("+x["ret"]+" GLWRP_APIENTRY (*)("+x["args"]+"))wrapperFunc(\""+x["name"]+"\");\n") f.write("\t__wrapper_" + x["name"] + "=(" + x["ret"] + " GLWRP_APIENTRY (*)(" + x["args"] + "))wrapperFunc(\"" + x["name"] + "\");\n")
f.write("\n\n") f.write("\n\n")
f.write("}\n") f.write("}\n")

View File

@ -1,5 +1,5 @@
text=""" text = """
#define FUNC$numR(m_r,m_func,$argt)\\ #define FUNC$numR(m_r,m_func,$argt)\\
virtual m_r m_func($argtp) { \\ virtual m_r m_func($argtp) { \\
if (Thread::get_caller_ID()!=server_thread) {\\ if (Thread::get_caller_ID()!=server_thread) {\\
@ -65,21 +65,21 @@ text="""
for i in range(1,8): for i in range(1, 8):
tp="" tp = ""
p="" p = ""
t="" t = ""
for j in range(i): for j in range(i):
if (j>0): if (j > 0):
tp+=", " tp += ", "
p+=", " p += ", "
t+=", " t += ", "
tp +=("m_arg"+str(j+1)+" p"+str(j+1)) tp += ("m_arg" + str(j + 1) + " p" + str(j + 1))
p+=("p"+str(j+1)) p += ("p" + str(j + 1))
t+=("m_arg"+str(j+1)) t += ("m_arg" + str(j + 1))
t = text.replace("$argtp",tp).replace("$argp",p).replace("$argt",t).replace("$num",str(i)) t = text.replace("$argtp", tp).replace("$argp", p).replace("$argt", t).replace("$num", str(i))
print(t) print(t)

View File

@ -1,35 +1,35 @@
import sys import sys
arg="memdump.txt" arg = "memdump.txt"
if (len(sys.argv)>1): if (len(sys.argv) > 1):
arg=sys.argv[1] arg = sys.argv[1]
f = open(arg,"rb") f = open(arg, "rb")
l=f.readline() l = f.readline()
sum = {} sum = {}
cnt={} cnt = {}
while(l!=""): while(l != ""):
s=l.split("-") s = l.split("-")
amount = int(s[1]) amount = int(s[1])
what=s[2] what = s[2]
if (what in sum): if (what in sum):
sum[what]+=amount sum[what] += amount
cnt[what]+=1 cnt[what] += 1
else: else:
sum[what]=amount sum[what] = amount
cnt[what]=1 cnt[what] = 1
l=f.readline() l = f.readline()
for x in sum: for x in sum:
print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x])) print(x.strip() + "(" + str(cnt[x]) + "):\n: " + str(sum[x]))

View File

@ -51,7 +51,7 @@ def export_icons():
# name without extensions # name without extensions
name_only = file_name.replace('.svg', '') name_only = file_name.replace('.svg', '')
out_icon_names = [name_only] # export to a png with the same file name out_icon_names = [name_only] # export to a png with the same file name
theme_out_icon_names = [] theme_out_icon_names = []
# special cases # special cases
if special_icons.has_key(name_only): if special_icons.has_key(name_only):
@ -82,7 +82,7 @@ def export_theme():
# name without extensions # name without extensions
name_only = file_name.replace('.svg', '') name_only = file_name.replace('.svg', '')
out_icon_names = [name_only] # export to a png with the same file name out_icon_names = [name_only] # export to a png with the same file name
# special cases # special cases
if theme_icons.has_key(name_only): if theme_icons.has_key(name_only):
special_icon = theme_icons[name_only] special_icon = theme_icons[name_only]
@ -102,30 +102,30 @@ special_icons = {
output_names=['icon_add'], output_names=['icon_add'],
theme_output_names=['icon_add', 'icon_zoom_more'] theme_output_names=['icon_add', 'icon_zoom_more']
), ),
'icon_new': dict( output_names=['icon_file'] ), 'icon_new': dict(output_names=['icon_file']),
'icon_animation_tree_player': dict( output_names=['icon_animation_tree'] ), 'icon_animation_tree_player': dict(output_names=['icon_animation_tree']),
'icon_tool_rotate': dict( 'icon_tool_rotate': dict(
output_names=['icon_reload'], output_names=['icon_reload'],
theme_output_names= ['icon_reload'] theme_output_names=['icon_reload']
), ),
'icon_multi_edit': dict( output_names=['icon_multi_node_edit'] ), 'icon_multi_edit': dict(output_names=['icon_multi_node_edit']),
'icon_folder': dict( 'icon_folder': dict(
output_names=['icon_load', 'icon_open'], output_names=['icon_load', 'icon_open'],
theme_output_names= ['icon_folder'] theme_output_names=['icon_folder']
), ),
'icon_file_list': dict( output_names=['icon_enum'] ), 'icon_file_list': dict(output_names=['icon_enum']),
'icon_collision_2d': dict( output_names=['icon_collision_polygon_2d', 'icon_polygon_2d'] ), 'icon_collision_2d': dict(output_names=['icon_collision_polygon_2d', 'icon_polygon_2d']),
'icon_class_list': dict( output_names=['icon_filesystem'] ), 'icon_class_list': dict(output_names=['icon_filesystem']),
'icon_color_ramp': dict( output_names=['icon_graph_color_ramp'] ), 'icon_color_ramp': dict(output_names=['icon_graph_color_ramp']),
'icon_translation': dict( output_names=['icon_p_hash_translation'] ), 'icon_translation': dict(output_names=['icon_p_hash_translation']),
'icon_shader': dict( output_names=['icon_shader_material', 'icon_material_shader'] ), 'icon_shader': dict(output_names=['icon_shader_material', 'icon_material_shader']),
'icon_canvas_item_shader_graph': dict( output_names=['icon_material_shader_graph'] ), 'icon_canvas_item_shader_graph': dict(output_names=['icon_material_shader_graph']),
'icon_color_pick': dict( theme_output_names= ['icon_color_pick'], avoid_self=True ), 'icon_color_pick': dict(theme_output_names=['icon_color_pick'], avoid_self=True),
'icon_play': dict( theme_output_names= ['icon_play'] ), 'icon_play': dict(theme_output_names=['icon_play']),
'icon_stop': dict( theme_output_names= ['icon_stop'] ), 'icon_stop': dict(theme_output_names=['icon_stop']),
'icon_zoom_less': dict( theme_output_names= ['icon_zoom_less'], avoid_self=True ), 'icon_zoom_less': dict(theme_output_names=['icon_zoom_less'], avoid_self=True),
'icon_zoom_reset': dict( theme_output_names= ['icon_zoom_reset'], avoid_self=True ), 'icon_zoom_reset': dict(theme_output_names=['icon_zoom_reset'], avoid_self=True),
'icon_snap': dict(theme_output_names=['icon_snap']) 'icon_snap': dict(theme_output_names=['icon_snap'])
} }

View File

@ -78,7 +78,7 @@ for fname in matches:
msg += l[pos] msg += l[pos]
pos += 1 pos += 1
location = os.path.relpath(fname).replace('\\','/') location = os.path.relpath(fname).replace('\\', '/')
if (line_nb): if (line_nb):
location += ":" + str(lc) location += ":" + str(lc)
@ -115,7 +115,7 @@ shutil.move("tools.pot", "tools/translations/tools.pot")
# TODO: Make that in a portable way, if we care; if not, kudos to Unix users # TODO: Make that in a portable way, if we care; if not, kudos to Unix users
if (os.name == "posix"): if (os.name == "posix"):
added = subprocess.check_output("git diff tools/translations/tools.pot | grep \+msgid | wc -l", shell = True) added = subprocess.check_output("git diff tools/translations/tools.pot | grep \+msgid | wc -l", shell=True)
removed = subprocess.check_output("git diff tools/translations/tools.pot | grep \\\-msgid | wc -l", shell = True) removed = subprocess.check_output("git diff tools/translations/tools.pot | grep \\\-msgid | wc -l", shell=True)
print("\n# Template changes compared to the staged status:") print("\n# Template changes compared to the staged status:")
print("# Additions: %s msgids.\n# Deletions: %s msgids." % (int(added), int(removed))) print("# Additions: %s msgids.\n# Deletions: %s msgids." % (int(added), int(removed)))

View File

@ -1,5 +1,5 @@
short_name="godot" short_name = "godot"
name="Godot Engine" name = "Godot Engine"
major=2 major = 2
minor=2 minor = 2
status="alpha" status = "alpha"