Browse Source

SCons: Always use env.Prepend for CPPPATH

Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).
Rémi Verschelde 6 years ago
parent
commit
d52b70fb5e

+ 1 - 1
SConstruct

@@ -189,7 +189,7 @@ Help(opts.GenerateHelpText(env_base))  # generate help
 
 
 # add default include paths
 # add default include paths
 
 
-env_base.Append(CPPPATH=['#editor', '#'])
+env_base.Prepend(CPPPATH=['#', '#editor'])
 
 
 # configure ENV for platform
 # configure ENV for platform
 env_base.platform_exporters = platform_exporters
 env_base.platform_exporters = platform_exporters

+ 4 - 4
core/SCsub

@@ -80,9 +80,9 @@ if env['builtin_zlib']:
 	]
 	]
 	thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
 	thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
 
 
-	env_thirdparty.Append(CPPPATH=[thirdparty_zlib_dir])
+	env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
 	# Needs to be available in main env too
 	# Needs to be available in main env too
-	env.Append(CPPPATH=[thirdparty_zlib_dir])
+	env.Prepend(CPPPATH=[thirdparty_zlib_dir])
 
 
 	env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
 	env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
 
 
@@ -128,9 +128,9 @@ if env['builtin_zstd']:
     ]
     ]
     thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
     thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
 
 
-    env_thirdparty.Append(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
+    env_thirdparty.Prepend(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
     env_thirdparty.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
     env_thirdparty.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
-    env.Append(CPPPATH=thirdparty_zstd_dir)
+    env.Prepend(CPPPATH=thirdparty_zstd_dir)
     # Also needed in main env includes will trigger warnings
     # Also needed in main env includes will trigger warnings
     env.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
     env.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
 
 

+ 1 - 1
drivers/gl_context/SCsub

@@ -10,7 +10,7 @@ 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.Append(CPPPATH=[thirdparty_dir])
+    env.Prepend(CPPPATH=[thirdparty_dir])
 
 
     env.Append(CPPFLAGS=['-DGLAD_ENABLED'])
     env.Append(CPPFLAGS=['-DGLAD_ENABLED'])
     env.Append(CPPFLAGS=['-DGLES_OVER_GL'])
     env.Append(CPPFLAGS=['-DGLES_OVER_GL'])

+ 2 - 2
drivers/png/SCsub

@@ -26,9 +26,9 @@ if env['builtin_libpng']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_png.Append(CPPPATH=[thirdparty_dir])
+    env_png.Prepend(CPPPATH=[thirdparty_dir])
     # Needed for drivers includes and in platform/javascript
     # Needed for drivers includes and in platform/javascript
-    env.Append(CPPPATH=[thirdparty_dir])
+    env.Prepend(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

+ 13 - 13
modules/assimp/SCsub

@@ -4,19 +4,19 @@ Import('env')
 Import('env_modules')
 Import('env_modules')
 
 
 env_assimp = env_modules.Clone()
 env_assimp = env_modules.Clone()
-env_assimp.Append(CPPPATH=['#thirdparty/assimp'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/include'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
-env_assimp.Append(CPPPATH=['#thirdparty/misc'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/'])
-env_assimp.Append(CPPPATH=['#thirdparty/zlib/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
-env_assimp.Append(CPPPATH=['.'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/misc'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/zlib/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
+env_assimp.Prepend(CPPPATH=['.'])
 #env_assimp.Append(CPPFLAGS=['-DASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
 #env_assimp.Append(CPPFLAGS=['-DASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
 env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_BOOST_WORKAROUND'])
 env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_BOOST_WORKAROUND'])
 env_assimp.Append(CPPFLAGS=['-DOPENDDLPARSER_BUILD'])
 env_assimp.Append(CPPFLAGS=['-DOPENDDLPARSER_BUILD'])

+ 1 - 1
modules/bullet/SCsub

@@ -186,7 +186,7 @@ if env['builtin_bullet']:
 
 
     thirdparty_sources = [thirdparty_dir + file for file in bullet2_src]
     thirdparty_sources = [thirdparty_dir + file for file in bullet2_src]
 
 
-    env_bullet.Append(CPPPATH=[thirdparty_dir])
+    env_bullet.Prepend(CPPPATH=[thirdparty_dir])
     # if env['target'] == "debug" or env['target'] == "release_debug":
     # if env['target'] == "debug" or env['target'] == "release_debug":
     #     env_bullet.Append(CPPFLAGS=['-DBT_DEBUG'])
     #     env_bullet.Append(CPPFLAGS=['-DBT_DEBUG'])
 
 

+ 1 - 1
modules/cvtt/SCsub

@@ -14,7 +14,7 @@ if env['builtin_squish']:
 
 
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_cvtt.Append(CPPPATH=[thirdparty_dir])
+    env_cvtt.Prepend(CPPPATH=[thirdparty_dir])
 
 
     env_thirdparty = env_cvtt.Clone()
     env_thirdparty = env_cvtt.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 1 - 1
modules/enet/SCsub

@@ -21,7 +21,7 @@ if env['builtin_enet']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_enet.Append(CPPPATH=[thirdparty_dir])
+    env_enet.Prepend(CPPPATH=[thirdparty_dir])
     env_enet.Append(CPPFLAGS=["-DGODOT_ENET"])
     env_enet.Append(CPPFLAGS=["-DGODOT_ENET"])
 
 
     env_thirdparty = env_enet.Clone()
     env_thirdparty = env_enet.Clone()

+ 1 - 1
modules/etc/SCsub

@@ -27,7 +27,7 @@ thirdparty_sources = [
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-env_etc.Append(CPPPATH=[thirdparty_dir])
+env_etc.Prepend(CPPPATH=[thirdparty_dir])
 
 
 # upstream uses c++11
 # upstream uses c++11
 if not env.msvc:
 if not env.msvc:

+ 3 - 3
modules/freetype/SCsub

@@ -68,9 +68,9 @@ if env['builtin_freetype']:
         sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
         sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
     thirdparty_sources += [sfnt]
     thirdparty_sources += [sfnt]
 
 
-    env_freetype.Append(CPPPATH=[thirdparty_dir + "/include"])
+    env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
     # Also needed in main env for scene/
     # Also needed in main env for scene/
-    env.Append(CPPPATH=[thirdparty_dir + "/include"])
+    env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
 
 
     env_freetype.Append(CPPFLAGS=['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG'])
     env_freetype.Append(CPPFLAGS=['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG'])
     if (env['target'] != 'release'):
     if (env['target'] != 'release'):
@@ -78,7 +78,7 @@ if env['builtin_freetype']:
 
 
     # Also requires libpng headers
     # Also requires libpng headers
     if env['builtin_libpng']:
     if env['builtin_libpng']:
-        env_freetype.Append(CPPPATH=["#thirdparty/libpng"])
+        env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"])
 
 
     env_thirdparty = env_freetype.Clone()
     env_thirdparty = env_freetype.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 2 - 2
modules/gdnative/SCsub

@@ -12,7 +12,7 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp")
 env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
 env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
 env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
 env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
 
 
-env_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
 
 
 Export('env_gdnative')
 Export('env_gdnative')
 
 
@@ -36,7 +36,7 @@ if ARGUMENTS.get('gdnative_wrapper', False):
     gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code))
     gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code))
 
 
     gd_wrapper_env = env.Clone()
     gd_wrapper_env = env.Clone()
-    gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
+    gd_wrapper_env.Prepend(CPPPATH=['#modules/gdnative/include/'])
 
 
     if gd_wrapper_env['use_lto']:
     if gd_wrapper_env['use_lto']:
         if not env.msvc:
         if not env.msvc:

+ 1 - 1
modules/gdnative/videodecoder/SCsub

@@ -5,5 +5,5 @@ Import('env_modules')
 
 
 env_vsdecoder_gdnative = env_modules.Clone()
 env_vsdecoder_gdnative = env_modules.Clone()
 
 
-env_vsdecoder_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_vsdecoder_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
 env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp')
 env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp')

+ 1 - 1
modules/jpg/SCsub

@@ -13,7 +13,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.Append(CPPPATH=[thirdparty_dir])
+env_jpg.Prepend(CPPPATH=[thirdparty_dir])
 
 
 env_thirdparty = env_jpg.Clone()
 env_thirdparty = env_jpg.Clone()
 env_thirdparty.disable_warnings()
 env_thirdparty.disable_warnings()

+ 2 - 2
modules/mono/build_scripts/mono_configure.py

@@ -70,7 +70,7 @@ def configure(env, env_mono):
         mono_lib_path = os.path.join(mono_root, 'lib')
         mono_lib_path = os.path.join(mono_root, 'lib')
 
 
         env.Append(LIBPATH=mono_lib_path)
         env.Append(LIBPATH=mono_lib_path)
-        env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+        env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
 
 
         if mono_static:
         if mono_static:
             lib_suffix = Environment()['LIBSUFFIX']
             lib_suffix = Environment()['LIBSUFFIX']
@@ -153,7 +153,7 @@ def configure(env, env_mono):
             mono_lib_path = os.path.join(mono_root, 'lib')
             mono_lib_path = os.path.join(mono_root, 'lib')
 
 
             env.Append(LIBPATH=mono_lib_path)
             env.Append(LIBPATH=mono_lib_path)
-            env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+            env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
 
 
             mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a')
             mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a')
 
 

+ 1 - 1
modules/ogg/SCsub

@@ -14,7 +14,7 @@ if env['builtin_libogg']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_ogg.Append(CPPPATH=[thirdparty_dir])
+    env_ogg.Prepend(CPPPATH=[thirdparty_dir])
 
 
     env_thirdparty = env_ogg.Clone()
     env_thirdparty = env_ogg.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 1 - 1
modules/opensimplex/SCsub

@@ -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_opensimplex.Append(CPPPATH=[thirdparty_dir])
+env_opensimplex.Prepend(CPPPATH=[thirdparty_dir])
 
 
 env_thirdparty = env_opensimplex.Clone()
 env_thirdparty = env_opensimplex.Clone()
 env_thirdparty.disable_warnings()
 env_thirdparty.disable_warnings()

+ 2 - 2
modules/opus/SCsub

@@ -206,7 +206,7 @@ if env['builtin_opus']:
 
 
     # also requires libogg
     # also requires libogg
     if env['builtin_libogg']:
     if env['builtin_libogg']:
-        env_opus.Append(CPPPATH=["#thirdparty/libogg"])
+        env_opus.Prepend(CPPPATH=["#thirdparty/libogg"])
 
 
     env_opus.Append(CPPFLAGS=["-DHAVE_CONFIG_H"])
     env_opus.Append(CPPFLAGS=["-DHAVE_CONFIG_H"])
 
 
@@ -218,7 +218,7 @@ if env['builtin_opus']:
         "silk/fixed",
         "silk/fixed",
         "silk/float",
         "silk/float",
     ]
     ]
-    env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+    env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
 
 
     if env["platform"] == "android":
     if env["platform"] == "android":
         if ("android_arch" in env and env["android_arch"] in ["armv6", "armv7"]):
         if ("android_arch" in env and env["android_arch"] in ["armv6", "armv7"]):

+ 1 - 1
modules/pvr/SCsub

@@ -17,7 +17,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.Append(CPPPATH=[thirdparty_dir])
+env_pvr.Prepend(CPPPATH=[thirdparty_dir])
 
 
 env_thirdparty = env_pvr.Clone()
 env_thirdparty = env_pvr.Clone()
 env_thirdparty.disable_warnings()
 env_thirdparty.disable_warnings()

+ 1 - 1
modules/recast/SCsub

@@ -23,7 +23,7 @@ if env['builtin_recast']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_recast.Append(CPPPATH=[thirdparty_dir + "/Include"])
+    env_recast.Prepend(CPPPATH=[thirdparty_dir + "/Include"])
 
 
     env_thirdparty = env_recast.Clone()
     env_thirdparty = env_recast.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 1 - 1
modules/regex/SCsub

@@ -46,7 +46,7 @@ if env['builtin_pcre2']:
 
 
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_regex.Append(CPPPATH=[thirdparty_dir])
+    env_regex.Prepend(CPPPATH=[thirdparty_dir])
     env_regex.Append(CPPFLAGS=thirdparty_flags)
     env_regex.Append(CPPFLAGS=thirdparty_flags)
 
 
     def pcre2_builtin(width):
     def pcre2_builtin(width):

+ 1 - 1
modules/squish/SCsub

@@ -22,7 +22,7 @@ if env['builtin_squish']:
 
 
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_squish.Append(CPPPATH=[thirdparty_dir])
+    env_squish.Prepend(CPPPATH=[thirdparty_dir])
 
 
     env_thirdparty = env_squish.Clone()
     env_thirdparty = env_squish.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 2 - 2
modules/svg/SCsub

@@ -12,10 +12,10 @@ thirdparty_sources = [
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-env_svg.Append(CPPPATH=[thirdparty_dir])
+env_svg.Prepend(CPPPATH=[thirdparty_dir])
 # FIXME: Needed in editor/editor_themes.cpp for now, but ideally there
 # FIXME: Needed in editor/editor_themes.cpp for now, but ideally there
 # shouldn't be a dependency on modules/ and its own 3rd party deps.
 # shouldn't be a dependency on modules/ and its own 3rd party deps.
-env.Append(CPPPATH=[thirdparty_dir])
+env.Prepend(CPPPATH=[thirdparty_dir])
 env.Append(CPPFLAGS=["-DSVG_ENABLED"])
 env.Append(CPPFLAGS=["-DSVG_ENABLED"])
 
 
 env_thirdparty = env_svg.Clone()
 env_thirdparty = env_svg.Clone()

+ 3 - 3
modules/theora/SCsub

@@ -70,13 +70,13 @@ if env['builtin_libtheora']:
 
 
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_theora.Append(CPPPATH=[thirdparty_dir])
+    env_theora.Prepend(CPPPATH=[thirdparty_dir])
 
 
     # also requires libogg and libvorbis
     # also requires libogg and libvorbis
     if env['builtin_libogg']:
     if env['builtin_libogg']:
-        env_theora.Append(CPPPATH=["#thirdparty/libogg"])
+        env_theora.Prepend(CPPPATH=["#thirdparty/libogg"])
     if env['builtin_libvorbis']:
     if env['builtin_libvorbis']:
-        env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
+        env_theora.Prepend(CPPPATH=["#thirdparty/libvorbis"])
 
 
     env_thirdparty = env_theora.Clone()
     env_thirdparty = env_theora.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 1 - 1
modules/tinyexr/SCsub

@@ -13,7 +13,7 @@ thirdparty_sources = [
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-env_tinyexr.Append(CPPPATH=[thirdparty_dir])
+env_tinyexr.Prepend(CPPPATH=[thirdparty_dir])
 
 
 env_thirdparty = env_tinyexr.Clone()
 env_thirdparty = env_tinyexr.Clone()
 env_thirdparty.disable_warnings()
 env_thirdparty.disable_warnings()

+ 1 - 1
modules/upnp/SCsub

@@ -25,7 +25,7 @@ if env['builtin_miniupnpc']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_upnp.Append(CPPPATH=[thirdparty_dir])
+    env_upnp.Prepend(CPPPATH=[thirdparty_dir])
     env_upnp.Append(CPPFLAGS=["-DMINIUPNP_STATICLIB"])
     env_upnp.Append(CPPFLAGS=["-DMINIUPNP_STATICLIB"])
 
 
     env_thirdparty = env_upnp.Clone()
     env_thirdparty = env_upnp.Clone()

+ 1 - 1
modules/vhacd/SCsub

@@ -24,7 +24,7 @@ thirdparty_sources = [
 
 
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-env_vhacd.Append(CPPPATH=[thirdparty_dir+"/inc"])
+env_vhacd.Prepend(CPPPATH=[thirdparty_dir + "/inc"])
 env_vhacd.Append(CPPFLAGS=["-DGODOT_ENET"])
 env_vhacd.Append(CPPFLAGS=["-DGODOT_ENET"])
 
 
 # upstream uses c++11
 # upstream uses c++11

+ 2 - 2
modules/vorbis/SCsub

@@ -40,11 +40,11 @@ if env['builtin_libvorbis']:
 
 
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_vorbis.Append(CPPPATH=[thirdparty_dir])
+    env_vorbis.Prepend(CPPPATH=[thirdparty_dir])
 
 
     # also requires libogg
     # also requires libogg
     if env['builtin_libogg']:
     if env['builtin_libogg']:
-        env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
+        env_vorbis.Prepend(CPPPATH=["#thirdparty/libogg"])
 
 
     env_thirdparty = env_vorbis.Clone()
     env_thirdparty = env_vorbis.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 5 - 5
modules/webm/SCsub

@@ -15,7 +15,7 @@ thirdparty_sources = [
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-env_webm.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
+env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
 
 
 # upstream uses c++11
 # upstream uses c++11
 if (not env_webm.msvc):
 if (not env_webm.msvc):
@@ -23,14 +23,14 @@ if (not env_webm.msvc):
 
 
 # also requires libogg, libvorbis and libopus
 # also requires libogg, libvorbis and libopus
 if env['builtin_libogg']:
 if env['builtin_libogg']:
-    env_webm.Append(CPPPATH=["#thirdparty/libogg"])
+    env_webm.Prepend(CPPPATH=["#thirdparty/libogg"])
 if env['builtin_libvorbis']:
 if env['builtin_libvorbis']:
-    env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
+    env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"])
 if env['builtin_opus']:
 if env['builtin_opus']:
-    env_webm.Append(CPPPATH=["#thirdparty/opus"])
+    env_webm.Prepend(CPPPATH=["#thirdparty/opus"])
 
 
 if env['builtin_libvpx']:
 if env['builtin_libvpx']:
-    env_webm.Append(CPPPATH=["#thirdparty/libvpx"])
+    env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"])
     SConscript("libvpx/SCsub")
     SConscript("libvpx/SCsub")
 
 
 env_thirdparty = env_webm.Clone()
 env_thirdparty = env_webm.Clone()

+ 2 - 2
modules/webm/libvpx/SCsub

@@ -256,7 +256,7 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
 
 
 env_libvpx = env_modules.Clone()
 env_libvpx = env_modules.Clone()
 env_libvpx.disable_warnings()
 env_libvpx.disable_warnings()
-env_libvpx.Append(CPPPATH=[libvpx_dir])
+env_libvpx.Prepend(CPPPATH=[libvpx_dir])
 
 
 webm_multithread = env["platform"] != 'javascript'
 webm_multithread = env["platform"] != 'javascript'
 
 
@@ -380,7 +380,7 @@ if webm_cpu_x86:
 elif webm_cpu_arm:
 elif webm_cpu_arm:
     env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
     env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
     if env["platform"] == 'android':
     if env["platform"] == 'android':
-        env_libvpx.Append(CPPPATH=[libvpx_dir + "third_party/android"])
+        env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"])
         env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
         env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
 
 
     env_libvpx_neon = env_libvpx.Clone()
     env_libvpx_neon = env_libvpx.Clone()

+ 1 - 1
modules/webp/SCsub

@@ -126,7 +126,7 @@ if env['builtin_libwebp']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
 
 
-    env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
+    env_webp.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
 
 
     env_thirdparty = env_webp.Clone()
     env_thirdparty = env_webp.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()

+ 1 - 2
modules/webrtc/SCsub

@@ -10,7 +10,6 @@ use_gdnative = env_webrtc["module_gdnative_enabled"]
 
 
 if use_gdnative: # GDNative is retained in Javascript for export compatibility
 if use_gdnative: # GDNative is retained in Javascript for export compatibility
     env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED'])
     env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED'])
-    gdnative_includes = ["#modules/gdnative/include/"]
-    env_webrtc.Append(CPPPATH=gdnative_includes)
+    env_webrtc.Prepend(CPPPATH=["#modules/gdnative/include/"])
 
 
 env_webrtc.add_source_files(env.modules_sources, "*.cpp")
 env_webrtc.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 3
modules/websocket/SCsub

@@ -75,7 +75,7 @@ if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # alrea
     else: # Unix socket
     else: # Unix socket
         thirdparty_sources += Glob(thirdparty_dir + "lib/plat/unix/*.c")
         thirdparty_sources += Glob(thirdparty_dir + "lib/plat/unix/*.c")
 
 
-    env_lws.Append(CPPPATH=[thirdparty_dir + 'include/'])
+    env_lws.Prepend(CPPPATH=[thirdparty_dir + 'include/'])
 
 
     if env['builtin_mbedtls']:
     if env['builtin_mbedtls']:
         mbedtls_includes = "#thirdparty/mbedtls/include"
         mbedtls_includes = "#thirdparty/mbedtls/include"
@@ -85,14 +85,14 @@ if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # alrea
     env_lws.Prepend(CPPPATH=wrapper_includes)
     env_lws.Prepend(CPPPATH=wrapper_includes)
 
 
     if env["platform"] == "windows" or env["platform"] == "uwp":
     if env["platform"] == "windows" or env["platform"] == "uwp":
-        env_lws.Append(CPPPATH=[helper_dir])
+        env_lws.Prepend(CPPPATH=[helper_dir])
 
 
     if env["platform"] == "uwp":
     if env["platform"] == "uwp":
         env_lws.Append(CPPFLAGS=["/DLWS_MINGW_SUPPORT"])
         env_lws.Append(CPPFLAGS=["/DLWS_MINGW_SUPPORT"])
 
 
     env_thirdparty = env_lws.Clone()
     env_thirdparty = env_lws.Clone()
     env_thirdparty.disable_warnings()
     env_thirdparty.disable_warnings()
-    env_thirdparty.Append(CPPPATH=[thirdparty_dir + 'lib/'])
+    env_thirdparty.Prepend(CPPPATH=[thirdparty_dir + 'lib/'])
     env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
     env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
 
 
 env_lws.add_source_files(env.modules_sources, "*.cpp")
 env_lws.add_source_files(env.modules_sources, "*.cpp")

+ 1 - 1
modules/xatlas_unwrap/SCsub

@@ -13,7 +13,7 @@ if env['builtin_xatlas']:
     ]
     ]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
     thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-    env_xatlas_unwrap.Append(CPPPATH=[thirdparty_dir])
+    env_xatlas_unwrap.Prepend(CPPPATH=[thirdparty_dir])
 
 
     # upstream uses c++11
     # upstream uses c++11
     if (not env.msvc):
     if (not env.msvc):

+ 1 - 1
platform/android/detect.py

@@ -299,7 +299,7 @@ def configure(env):
     env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
     env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
                         '/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
                         '/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
 
 
-    env.Append(CPPPATH=['#platform/android'])
+    env.Prepend(CPPPATH=['#platform/android'])
     env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL'])
     env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL'])
     env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl'])
     env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl'])
 
 

+ 2 - 2
platform/haiku/detect.py

@@ -137,7 +137,7 @@ def configure(env):
 
 
     if not env['builtin_miniupnpc']:
     if not env['builtin_miniupnpc']:
         # No pkgconfig file so far, hardcode default paths.
         # No pkgconfig file so far, hardcode default paths.
-        env.Append(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
+        env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
         env.Append(LIBS=["miniupnpc"])
         env.Append(LIBS=["miniupnpc"])
 
 
     # On Linux wchar_t should be 32-bits
     # On Linux wchar_t should be 32-bits
@@ -147,7 +147,7 @@ def configure(env):
 
 
     ## Flags
     ## Flags
 
 
-    env.Append(CPPPATH=['#platform/haiku'])
+    env.Prepend(CPPPATH=['#platform/haiku'])
     env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
     env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
     env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
     env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
     # env.Append(CPPFLAGS=['-DFREETYPE_ENABLED'])
     # env.Append(CPPFLAGS=['-DFREETYPE_ENABLED'])

+ 5 - 5
platform/iphone/detect.py

@@ -165,12 +165,12 @@ def configure(env):
     if env['icloud']:
     if env['icloud']:
         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.Prepend(CPPPATH=['$IPHONESDK/usr/include',
+                         '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
+                         '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
+                         ])
 
 
     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(CPPPATH=['#platform/iphone'])
+    env.Prepend(CPPPATH=['#platform/iphone'])
     env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DCOREAUDIO_ENABLED'])
     env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DCOREAUDIO_ENABLED'])

+ 1 - 1
platform/javascript/detect.py

@@ -103,7 +103,7 @@ def configure(env):
 
 
     ## Compile flags
     ## Compile flags
 
 
-    env.Append(CPPPATH=['#platform/javascript'])
+    env.Prepend(CPPPATH=['#platform/javascript'])
     env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED'])
     env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED'])
 
 
     # No multi-threading (SharedArrayBuffer) available yet,
     # No multi-threading (SharedArrayBuffer) available yet,

+ 1 - 1
platform/osx/detect.py

@@ -126,7 +126,7 @@ def configure(env):
 
 
     ## Flags
     ## Flags
 
 
-    env.Append(CPPPATH=['#platform/osx'])
+    env.Prepend(CPPPATH=['#platform/osx'])
     env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'])
     env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'])
     env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo'])
     env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo'])
     env.Append(LIBS=['pthread'])
     env.Append(LIBS=['pthread'])

+ 2 - 2
platform/server/detect.py

@@ -201,7 +201,7 @@ def configure(env):
 
 
     if not env['builtin_miniupnpc']:
     if not env['builtin_miniupnpc']:
         # No pkgconfig file so far, hardcode default paths.
         # No pkgconfig file so far, hardcode default paths.
-        env.Append(CPPPATH=["/usr/include/miniupnpc"])
+        env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
         env.Append(LIBS=["miniupnpc"])
         env.Append(LIBS=["miniupnpc"])
 
 
     # On Linux wchar_t should be 32-bits
     # On Linux wchar_t should be 32-bits
@@ -215,7 +215,7 @@ def configure(env):
     if not env['builtin_zlib']:
     if not env['builtin_zlib']:
         env.ParseConfig('pkg-config zlib --cflags --libs')
         env.ParseConfig('pkg-config zlib --cflags --libs')
 
 
-    env.Append(CPPPATH=['#platform/server'])
+    env.Prepend(CPPPATH=['#platform/server'])
     env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
     env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
 
 
     if (platform.system() == "Darwin"):
     if (platform.system() == "Darwin"):

+ 2 - 2
platform/uwp/detect.py

@@ -77,7 +77,7 @@ def configure(env):
 
 
     # ANGLE
     # ANGLE
     angle_root = os.getenv("ANGLE_SRC_PATH")
     angle_root = os.getenv("ANGLE_SRC_PATH")
-    env.Append(CPPPATH=[angle_root + '/include'])
+    env.Prepend(CPPPATH=[angle_root + '/include'])
     jobs = str(env.GetOption("num_jobs"))
     jobs = str(env.GetOption("num_jobs"))
     angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
     angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
 
 
@@ -137,7 +137,7 @@ def configure(env):
 
 
     ## Compile flags
     ## Compile flags
 
 
-    env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
+    env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows'])
     env.Append(CPPFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
     env.Append(CPPFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
     env.Append(CPPFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
     env.Append(CPPFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
     winver = "0x0602" # Windows 8 is the minimum target for UWP build
     winver = "0x0602" # Windows 8 is the minimum target for UWP build

+ 3 - 3
platform/windows/detect.py

@@ -201,7 +201,7 @@ def configure_msvc(env, manual_msvc_config):
     env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++
     env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++
     if manual_msvc_config: # should be automatic if SCons found it
     if manual_msvc_config: # should be automatic if SCons found it
         if os.getenv("WindowsSdkDir") is not None:
         if os.getenv("WindowsSdkDir") is not None:
-            env.Append(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
+            env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
         else:
         else:
             print("Missing environment variable: WindowsSdkDir")
             print("Missing environment variable: WindowsSdkDir")
 
 
@@ -239,7 +239,7 @@ def configure_msvc(env, manual_msvc_config):
             env.AppendUnique(LINKFLAGS=['/LTCG'])
             env.AppendUnique(LINKFLAGS=['/LTCG'])
 
 
     if manual_msvc_config:
     if manual_msvc_config:
-        env.Append(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
+        env.Prepend(CPPPATH=[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(";")])
 
 
     # Incremental linking fix
     # Incremental linking fix
@@ -342,7 +342,7 @@ def configure_mingw(env):
 
 
 def configure(env):
 def configure(env):
     # At this point the env has been set up with basic tools/compilers.
     # At this point the env has been set up with basic tools/compilers.
-    env.Append(CPPPATH=['#platform/windows'])
+    env.Prepend(CPPPATH=['#platform/windows'])
 
 
     print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
     print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
 
 

+ 2 - 2
platform/x11/detect.py

@@ -275,7 +275,7 @@ def configure(env):
 
 
     if not env['builtin_miniupnpc']:
     if not env['builtin_miniupnpc']:
         # No pkgconfig file so far, hardcode default paths.
         # No pkgconfig file so far, hardcode default paths.
-        env.Append(CPPPATH=["/usr/include/miniupnpc"])
+        env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
         env.Append(LIBS=["miniupnpc"])
         env.Append(LIBS=["miniupnpc"])
 
 
     # On Linux wchar_t should be 32-bits
     # On Linux wchar_t should be 32-bits
@@ -316,7 +316,7 @@ def configure(env):
     if not env['builtin_zlib']:
     if not env['builtin_zlib']:
         env.ParseConfig('pkg-config zlib --cflags --libs')
         env.ParseConfig('pkg-config zlib --cflags --libs')
 
 
-    env.Append(CPPPATH=['#platform/x11'])
+    env.Prepend(CPPPATH=['#platform/x11'])
     env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
     env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
     env.Append(LIBS=['GL', 'pthread'])
     env.Append(LIBS=['GL', 'pthread'])