From aa1367595e6fc296fc42c95dfbf23f70de5528c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 15 Oct 2016 12:39:28 +0200 Subject: [PATCH] drivers: Refactor SCsub and drop redundant env_drivers clone The reordering of the SConscript includes allows to ensure that stuff like the builtin zlib headers will be available for libpng. Also moved glew back into global env, otherwise windows seems not to find it... Kind of shooting in the dark with this multi-env setup. (cherry picked from commit 248bc9159c0b515e3e276db644744161283881ef) --- drivers/SCsub | 65 ++++++++++++++++++++----------------- drivers/alsa/SCsub | 2 +- drivers/convex_decomp/SCsub | 5 +-- drivers/gl_context/SCsub | 11 ++----- drivers/gles2/SCsub | 4 ++- drivers/gles2/shaders/SCsub | 2 ++ drivers/nrex/SCsub | 8 ++--- drivers/png/SCsub | 23 ++++++------- drivers/pulseaudio/SCsub | 2 +- drivers/unix/SCsub | 2 +- drivers/windows/SCsub | 2 +- 11 files changed, 63 insertions(+), 63 deletions(-) diff --git a/drivers/SCsub b/drivers/SCsub index 2ad924ad1d8..c496f46a1f2 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -1,42 +1,47 @@ Import('env') -env_drivers = env.Clone() - env.drivers_sources=[] -#env.add_source_files(env.drivers_sources,"*.cpp") -Export('env_drivers') - -SConscript('unix/SCsub'); -SConscript('alsa/SCsub'); -SConscript('pulseaudio/SCsub'); -SConscript('windows/SCsub'); -SConscript('gles2/SCsub'); -SConscript('gl_context/SCsub'); - -SConscript("png/SCsub"); if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"): SConscript("zlib/SCsub"); +# OS drivers +SConscript('unix/SCsub'); +SConscript('windows/SCsub'); + +# Sounds drivers +SConscript('alsa/SCsub'); +SConscript('pulseaudio/SCsub'); if (env["platform"] == "windows"): SConscript("rtaudio/SCsub"); + +# Graphics drivers +SConscript('gles2/SCsub'); +SConscript('gl_context/SCsub'); + +# Core dependencies +SConscript("png/SCsub"); SConscript("nrex/SCsub"); + +# Tools override +# FIXME: Should likely be integrated in the tools/ codebase if (env["tools"]=="yes"): SConscript("convex_decomp/SCsub"); -num = 0 -cur_base = "" -total = len(env.drivers_sources) -max_src = 64 -list = [] -lib_list = [] - -import string - if env['vsproj']=="yes": env.AddToVSProject(env.drivers_sources) -if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created + +# Split drivers, this used to be needed for windows until separate builders for windows were created +# FIXME: Check if still needed now that the drivers were made more lightweight +if (env.split_drivers): + import string + + num = 0 + cur_base = "" + max_src = 64 + list = [] + lib_list = [] for f in env.drivers_sources: fname = "" @@ -48,14 +53,14 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until base = string.join(fname.split("/")[:2], "/") if base != cur_base and len(list) > max_src: if num > 0: - lib = env_drivers.Library("drivers"+str(num), list) + lib = env.Library("drivers"+str(num), list) lib_list.append(lib) list = [] num = num+1 cur_base = base list.append(f) - lib = env_drivers.Library("drivers"+str(num), list) + lib = env.Library("drivers"+str(num), list) lib_list.append(lib) if len(lib_list) > 0: @@ -63,15 +68,15 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until if os.name=='posix' and sys.platform=='msys': env.Replace(ARFLAGS=['rcsT']) - lib = env_drivers.Library("drivers_collated", lib_list) + lib = env.Library("drivers_collated", lib_list) lib_list = [lib] drivers_base=[] - env_drivers.add_source_files(drivers_base,"*.cpp") - lib_list.insert(0, env_drivers.Library("drivers", drivers_base)) + env.add_source_files(drivers_base,"*.cpp") + lib_list.insert(0, env.Library("drivers", drivers_base)) env.Prepend(LIBS=lib_list) else: - env_drivers.add_source_files(env.drivers_sources,"*.cpp") - lib = env_drivers.Library("drivers",env.drivers_sources) + env.add_source_files(env.drivers_sources,"*.cpp") + lib = env.Library("drivers",env.drivers_sources) env.Prepend(LIBS=[lib]) diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub index 9fbb467baa1..0582e01978f 100644 --- a/drivers/alsa/SCsub +++ b/drivers/alsa/SCsub @@ -1,5 +1,5 @@ Import('env') -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") Export('env') diff --git a/drivers/convex_decomp/SCsub b/drivers/convex_decomp/SCsub index 6699efef756..0582e01978f 100644 --- a/drivers/convex_decomp/SCsub +++ b/drivers/convex_decomp/SCsub @@ -1,4 +1,5 @@ Import('env') -Export('env'); -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") + +Export('env') diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index 9a158f08213..b05a96cb99c 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -1,7 +1,4 @@ Import('env') -Import('env_drivers') - -env_glew = env_drivers.Clone() if (env["platform"] in ["haiku","osx","windows","x11"]): # Thirdparty source files @@ -12,15 +9,13 @@ if (env["platform"] in ["haiku","osx","windows","x11"]): ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_glew.add_source_files(env.drivers_sources, thirdparty_sources) - env_glew.Append(CPPFLAGS = ['-DGLEW_STATIC']) - env_glew.Append(CPPPATH = [thirdparty_dir]) - # Also pass to global env, used by platform code + env.add_source_files(env.drivers_sources, thirdparty_sources) + env.Append(CPPFLAGS = ['-DGLEW_STATIC']) env.Append(CPPPATH = [thirdparty_dir]) env.Append(CPPFLAGS = ['-DGLEW_ENABLED']) # Godot source files -env_glew.add_source_files(env.drivers_sources, "*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") Export('env') diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub index a17335b41b3..89d7d86360e 100644 --- a/drivers/gles2/SCsub +++ b/drivers/gles2/SCsub @@ -1,5 +1,7 @@ Import('env') -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") SConscript("shaders/SCsub") + +Export('env') diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub index 38177d725fb..88445f34c1a 100644 --- a/drivers/gles2/shaders/SCsub +++ b/drivers/gles2/shaders/SCsub @@ -6,3 +6,5 @@ if env['BUILDERS'].has_key('GLSL120GLES'): env.GLSL120GLES('canvas_shadow.glsl'); env.GLSL120GLES('blur.glsl'); env.GLSL120GLES('copy.glsl'); + +Export('env') diff --git a/drivers/nrex/SCsub b/drivers/nrex/SCsub index a00c7b86f4f..0582e01978f 100644 --- a/drivers/nrex/SCsub +++ b/drivers/nrex/SCsub @@ -1,7 +1,5 @@ Import('env') -sources = [ - 'nrex.cpp', - 'regex.cpp', -] -env.add_source_files(env.drivers_sources, sources) +env.add_source_files(env.drivers_sources, "*.cpp") + +Export('env') diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 1ab42a6db98..d1dab15ed4a 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -1,8 +1,8 @@ Import('env') -Import('env_drivers') + +env_png = env.Clone() # Thirdparty source files - if (env["libpng"] == "builtin"): thirdparty_dir = "#thirdparty/libpng/" thirdparty_sources = [ @@ -26,24 +26,21 @@ if (env["libpng"] == "builtin"): # Currently .ASM filter_neon.S does not compile on NT. import os if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt": - env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) - env_neon = env_drivers.Clone(); + env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=2"]) + env_neon = env_png.Clone(); if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] - #env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) + #env_neon.Append(CPPFLAGS = ["-DPNG_ARM_NEON"]) thirdparty_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c")) thirdparty_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S")) else: - env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) + env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"]) - #env_drivers.add_source_files(env.drivers_sources, thirdparty_sources) + #env_png.add_source_files(env.drivers_sources, thirdparty_sources) env.drivers_sources += thirdparty_sources # Concatenation necessary for neon objects it seems? - env_drivers.Append(CPPPATH = [thirdparty_dir]) + env_png.Append(CPPPATH = [thirdparty_dir]) +# Godot source files +env_png.add_source_files(env.drivers_sources, "*.cpp") -# Godot's own source files - -env_drivers.add_source_files(env.drivers_sources, "*.cpp") - -Export('env_drivers') Export('env') diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub index 9fbb467baa1..0582e01978f 100644 --- a/drivers/pulseaudio/SCsub +++ b/drivers/pulseaudio/SCsub @@ -1,5 +1,5 @@ Import('env') -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") Export('env') diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub index 3d46a85cdf0..36a172025d3 100644 --- a/drivers/unix/SCsub +++ b/drivers/unix/SCsub @@ -10,6 +10,6 @@ f = open("os_unix_global_settings_path.cpp","wb") f.write(g_set_p) f.close() -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") Export('env') diff --git a/drivers/windows/SCsub b/drivers/windows/SCsub index 9fbb467baa1..0582e01978f 100644 --- a/drivers/windows/SCsub +++ b/drivers/windows/SCsub @@ -1,5 +1,5 @@ Import('env') -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") Export('env')