From a65c0939fd1adc616275ad01996917fab89a7b9c Mon Sep 17 00:00:00 2001 From: Rhody Lugo Date: Tue, 28 Nov 2017 16:27:57 -0400 Subject: [PATCH] disable caching for targets using helper functions --- SConstruct | 4 ++++ core/SCsub | 3 +-- drivers/SCsub | 3 +-- editor/SCsub | 3 +-- main/SCsub | 3 +-- main/tests/SCsub | 3 +-- methods.py | 27 +++++++++++++++++++-------- modules/SCsub | 3 +-- modules/freetype/SCsub | 3 +-- modules/gdnative/SCsub | 3 +-- modules/recast/SCsub | 3 +-- modules/svg/SCsub | 3 +-- platform/SCsub | 3 +-- platform/android/SCsub | 3 +-- platform/haiku/SCsub | 2 +- platform/iphone/SCsub | 3 +-- platform/javascript/SCsub | 2 +- platform/osx/SCsub | 3 +-- platform/server/SCsub | 3 +-- platform/uwp/SCsub | 3 +-- platform/windows/SCsub | 3 +-- platform/x11/SCsub | 3 +-- scene/SCsub | 3 +-- servers/SCsub | 3 +-- 24 files changed, 45 insertions(+), 50 deletions(-) diff --git a/SConstruct b/SConstruct index 7c171c8015..17c809c179 100644 --- a/SConstruct +++ b/SConstruct @@ -121,6 +121,10 @@ 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__.split_lib = methods.split_lib +env_base.__class__.add_shared_library = methods.add_shared_library +env_base.__class__.add_library = methods.add_library +env_base.__class__.add_program = methods.add_program + env_base["x86_libtheora_opt_gcc"] = False env_base["x86_libtheora_opt_vc"] = False diff --git a/core/SCsub b/core/SCsub index be2034409e..1545bc8aeb 100644 --- a/core/SCsub +++ b/core/SCsub @@ -105,7 +105,6 @@ SConscript('helper/SCsub') # Build it all as a library -lib = env.Library("core", env.core_sources) -env.NoCache(lib) +lib = env.add_library("core", env.core_sources) env.Prepend(LIBS=[lib]) Export('env') diff --git a/drivers/SCsub b/drivers/SCsub index d96d0ed7a9..daa5ff623b 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -45,6 +45,5 @@ if env.split_drivers: env.split_lib("drivers") else: env.add_source_files(env.drivers_sources, "*.cpp") - lib = env.Library("drivers", env.drivers_sources) - env.NoCache(lib) + lib = env.add_library("drivers", env.drivers_sources) env.Prepend(LIBS=[lib]) diff --git a/editor/SCsub b/editor/SCsub index 8a0e36b4a3..8f87e12cb9 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -474,8 +474,7 @@ if env['tools']: SConscript('import/SCsub') SConscript('plugins/SCsub') - lib = env.Library("editor", env.editor_sources) - env.NoCache(lib) + lib = env.add_library("editor", env.editor_sources) env.Prepend(LIBS=[lib]) Export('env') diff --git a/main/SCsub b/main/SCsub index 74a350ea01..2cc617fc2c 100644 --- a/main/SCsub +++ b/main/SCsub @@ -56,6 +56,5 @@ env.Command("#main/app_icon.gen.h", "#main/app_icon.png", make_app_icon) SConscript('tests/SCsub') -lib = env.Library("main", env.main_sources) -env.NoCache(lib) +lib = env.add_library("main", env.main_sources) env.Prepend(LIBS=[lib]) diff --git a/main/tests/SCsub b/main/tests/SCsub index bb44e9e5da..26a0819ee8 100644 --- a/main/tests/SCsub +++ b/main/tests/SCsub @@ -9,6 +9,5 @@ Export('env') # SConscript('math/SCsub'); -lib = env.Library("tests", env.tests_sources) -env.NoCache(lib) +lib = env.add_library("tests", env.tests_sources) env.Prepend(LIBS=[lib]) diff --git a/methods.py b/methods.py index 0bf5c01462..e861303e63 100644 --- a/methods.py +++ b/methods.py @@ -1495,30 +1495,26 @@ def split_lib(self, libname): base = string.join(fname.split("/")[:2], "/") if base != cur_base and len(list) > max_src: if num > 0: - lib = env.Library(libname + str(num), list) - env.NoCache(lib) + lib = env.add_library(libname + str(num), list) lib_list.append(lib) list = [] num = num + 1 cur_base = base list.append(f) - lib = env.Library(libname + str(num), list) - env.NoCache(lib) + lib = env.add_library(libname + str(num), list) lib_list.append(lib) if len(lib_list) > 0: import os, sys if os.name == 'posix' and sys.platform == 'msys': env.Replace(ARFLAGS=['rcsT']) - lib = env.Library(libname + "_collated", lib_list) - env.NoCache(lib) + lib = env.add_library(libname + "_collated", lib_list) lib_list = [lib] lib_base = [] env.add_source_files(lib_base, "*.cpp") - lib = env.Library(libname, lib_base) - env.NoCache(lib) + lib = env.add_library(libname, lib_base) lib_list.insert(0, lib) env.Prepend(LIBS=lib_list) @@ -1757,3 +1753,18 @@ def precious_program(env, program, sources, **args): program = env.ProgramOriginal(program, sources, **args) env.Precious(program) return program + +def add_shared_library(env, name, sources, **args): + library = env.SharedLibrary(name, sources, **args) + env.NoCache(library) + return library + +def add_library(env, name, sources, **args): + library = env.Library(name, sources, **args) + env.NoCache(library) + return library + +def add_program(env, name, sources, **args): + program = env.Program(name, sources, **args) + env.NoCache(program) + return program diff --git a/modules/SCsub b/modules/SCsub index ea8b58b8c5..e3c535e981 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -17,7 +17,6 @@ for x in env.module_list: env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"]) SConscript(x + "/SCsub") -lib = env_modules.Library("modules", env.modules_sources) -env_modules.NoCache(lib) +lib = env_modules.add_library("modules", env.modules_sources) env.Prepend(LIBS=[lib]) diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 9169c7d674..f69b632e76 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -68,8 +68,7 @@ if env['builtin_freetype']: if env['builtin_libpng']: env.Append(CPPPATH=["#thirdparty/libpng"]) - lib = env.Library("freetype_builtin", thirdparty_sources) - env.NoCache(lib) + lib = env.add_library("freetype_builtin", thirdparty_sources) # Needs to be appended to arrive after libscene in the linker call, # but we don't want it to arrive *after* system libs, so manual hack # LIBS contains first SCons Library objects ("SCons.Node.FS.File object") diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 1641d26cbf..fd11c8d094 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -248,5 +248,4 @@ if ARGUMENTS.get('gdnative_wrapper', False): if not env.msvc: gd_wrapper_env.Append(CCFLAGS=['-fPIC']) - lib = gd_wrapper_env.Library("#bin/gdnative_wrapper_code", [gensource]) - gd_wrapper_env.NoCache(lib) + lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource]) diff --git a/modules/recast/SCsub b/modules/recast/SCsub index 335ab6c16e..530df9a37c 100644 --- a/modules/recast/SCsub +++ b/modules/recast/SCsub @@ -24,8 +24,7 @@ if env['builtin_recast']: env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"]) - lib = env.Library("recast_builtin", thirdparty_sources) - env.NoCache(lib) + lib = env.add_library("recast_builtin", thirdparty_sources) env.Append(LIBS=[lib]) # Godot source files diff --git a/modules/svg/SCsub b/modules/svg/SCsub index 1b71fbeca4..e12abac8c1 100644 --- a/modules/svg/SCsub +++ b/modules/svg/SCsub @@ -12,8 +12,7 @@ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] # env.add_source_files(env.modules_sources, thirdparty_sources) -lib = env.Library("svg_builtin", thirdparty_sources) -env.NoCache(lib) +lib = env.add_library("svg_builtin", thirdparty_sources) # Needs to be appended to arrive after libscene in the linker call, # but we don't want it to arrive *after* system libs, so manual hack diff --git a/platform/SCsub b/platform/SCsub index a362371f93..e624f8e90f 100644 --- a/platform/SCsub +++ b/platform/SCsub @@ -25,8 +25,7 @@ f.write(unreg_apis) f.close() platform_sources.append('register_platform_apis.gen.cpp') -lib = env.Library('platform', platform_sources) -env.NoCache(lib) +lib = env.add_library('platform', platform_sources) env.Prepend(LIBS=lib) Export('env') diff --git a/platform/android/SCsub b/platform/android/SCsub index 74349cb0ad..0cd91276ef 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -144,8 +144,7 @@ manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattrib pp_baseout.write(manifest) -lib = env_android.SharedLibrary("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"]) -env_android.NoCache(lib) +lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"]) lib_arch_dir = '' if env['android_arch'] == 'armv6': diff --git a/platform/haiku/SCsub b/platform/haiku/SCsub index d0c244a194..592f56bbbf 100644 --- a/platform/haiku/SCsub +++ b/platform/haiku/SCsub @@ -12,7 +12,7 @@ common_haiku = [ 'audio_driver_media_kit.cpp' ] -target = env.Program( +target = env.add_program( '#bin/godot', ['godot_haiku.cpp'] + common_haiku ) diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub index 5903934d7d..6b5f30dc41 100644 --- a/platform/iphone/SCsub +++ b/platform/iphone/SCsub @@ -17,8 +17,7 @@ iphone_lib = [ ] env_ios = env.Clone() -ios_lib = env_ios.Library('iphone', iphone_lib) -env_ios.NoCache(ios_lib) +ios_lib = env_ios.add_library('iphone', iphone_lib) def combine_libs(target=None, source=None, env=None): lib_path = target[0].srcnode().abspath diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index 8d505a5829..05992ebac8 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -22,7 +22,7 @@ for x in javascript_files: env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_main_after_fs_sync','_send_notification']\""]) target_dir = env.Dir("#bin") -build = env.Program(['#bin/godot', target_dir.File('godot' + env['PROGSUFFIX'] + '.wasm')], javascript_objects, PROGSUFFIX=env['PROGSUFFIX'] + '.js'); +build = env.add_program(['#bin/godot', target_dir.File('godot' + env['PROGSUFFIX'] + '.wasm')], javascript_objects, PROGSUFFIX=env['PROGSUFFIX'] + '.js'); js_libraries = [] js_libraries.append(env.File('http_request.js')) diff --git a/platform/osx/SCsub b/platform/osx/SCsub index 16223654cc..cb88bc470a 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -16,8 +16,7 @@ files = [ 'power_osx.cpp', ] -prog = env.Program('#bin/godot', files) -env.NoCache(prog) +prog = env.add_program('#bin/godot', files) if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": env.AddPostAction(prog, make_debug) diff --git a/platform/server/SCsub b/platform/server/SCsub index 9e7bfda123..30d8cc8064 100644 --- a/platform/server/SCsub +++ b/platform/server/SCsub @@ -7,5 +7,4 @@ common_server = [\ "os_server.cpp",\ ] -prog = env.Program('#bin/godot_server', ['godot_server.cpp'] + common_server) -env.NoCache(prog) +prog = env.add_program('#bin/godot_server', ['godot_server.cpp'] + common_server) diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub index ba375428a5..f0d69fef33 100644 --- a/platform/uwp/SCsub +++ b/platform/uwp/SCsub @@ -19,8 +19,7 @@ files = [ if "build_angle" in env and env["build_angle"]: cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None)) -prog = env.Program('#bin/godot', files) -env.NoCache(prog) +prog = env.add_program('#bin/godot', files) if "build_angle" in env and env["build_angle"]: env.Depends(prog, [cmd]) diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 2fdb801c2e..5a253d5db5 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -28,8 +28,7 @@ obj = env.RES(restarget, 'godot_res.rc') common_win.append(obj) -prog = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"]) -env.NoCache(prog) +prog = env.add_program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"]) # Microsoft Visual Studio Project Generation if env['vsproj']: diff --git a/platform/x11/SCsub b/platform/x11/SCsub index 1eeee8380f..6378553638 100644 --- a/platform/x11/SCsub +++ b/platform/x11/SCsub @@ -17,8 +17,7 @@ common_x11 = [ "power_x11.cpp", ] -prog = env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11) -env.NoCache(prog) +prog = env.add_program('#bin/godot', ['godot_x11.cpp'] + common_x11) if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": env.AddPostAction(prog, make_debug) diff --git a/scene/SCsub b/scene/SCsub index bec1b40ed6..5d81e818ba 100644 --- a/scene/SCsub +++ b/scene/SCsub @@ -30,8 +30,7 @@ SConscript('resources/SCsub') # Build it all as a library -lib = env.Library("scene", env.scene_sources) -env.NoCache(lib) +lib = env.add_library("scene", env.scene_sources) env.Prepend(LIBS=[lib]) Export('env') diff --git a/servers/SCsub b/servers/SCsub index ad43faf72e..252a18ffd3 100644 --- a/servers/SCsub +++ b/servers/SCsub @@ -13,7 +13,6 @@ SConscript('physics_2d/SCsub') SConscript('visual/SCsub') SConscript('audio/SCsub') -lib = env.Library("servers", env.servers_sources) -env.NoCache(lib) +lib = env.add_library("servers", env.servers_sources) env.Prepend(LIBS=[lib])