summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-10-15 12:39:28 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-10-15 18:10:18 +0200
commit248bc9159c0b515e3e276db644744161283881ef (patch)
tree88cb5af9ad9382c8643ec810d5d0a9b8370d7e4b
parentedbc0c0d0bed169b3c07ef0f504b97936f0dab37 (diff)
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.
-rw-r--r--drivers/SCsub59
-rw-r--r--drivers/alsa/SCsub2
-rw-r--r--drivers/convex_decomp/SCsub5
-rw-r--r--drivers/gl_context/SCsub11
-rw-r--r--drivers/gles2/SCsub4
-rw-r--r--drivers/gles2/shaders/SCsub2
-rw-r--r--drivers/nrex/SCsub8
-rw-r--r--drivers/png/SCsub23
-rw-r--r--drivers/pulseaudio/SCsub2
-rw-r--r--drivers/unix/SCsub2
-rw-r--r--drivers/windows/SCsub2
11 files changed, 60 insertions, 60 deletions
diff --git a/drivers/SCsub b/drivers/SCsub
index 2ad924ad1d..c496f46a1f 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')
+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');
-SConscript('windows/SCsub');
+if (env["platform"] == "windows"):
+ SConscript("rtaudio/SCsub");
+
+# Graphics drivers
SConscript('gles2/SCsub');
SConscript('gl_context/SCsub');
+# Core dependencies
SConscript("png/SCsub");
-if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
- SConscript("zlib/SCsub");
-
-if (env["platform"] == "windows"):
- SConscript("rtaudio/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 9fbb467baa..0582e01978 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 6699efef75..0582e01978 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 9a158f0821..b05a96cb99 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 a17335b41b..89d7d86360 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 38177d725f..88445f34c1 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 a00c7b86f4..0582e01978 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 1ab42a6db9..d1dab15ed4 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -1,8 +1,8 @@
Import('env')
-Import('env_drivers')
-# Thirdparty source files
+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])
-
-
-# Godot's own source files
+ env_png.Append(CPPPATH = [thirdparty_dir])
-env_drivers.add_source_files(env.drivers_sources, "*.cpp")
+# Godot source files
+env_png.add_source_files(env.drivers_sources, "*.cpp")
-Export('env_drivers')
Export('env')
diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub
index 9fbb467baa..0582e01978 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 3d46a85cdf..36a172025d 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 9fbb467baa..0582e01978 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')