summaryrefslogtreecommitdiff
path: root/config/windows.config
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-04 20:01:57 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-07-13 19:58:02 +0530
commitfa882a86894d0f12bb5a4f6dfe0cc9da3fe20f45 (patch)
tree0463bb4b73013a0ed14c5740ddcdf8662d772525 /config/windows.config
parentaf2001dbe0447564598f8f933c4aaca34a541507 (diff)
cerbero: Merge msvc toolchain envs instead of overwriting
This fixes the bug where `PATH` was getting overwritten instead of being prepended to the existing value, which caused build tools and installed tools to not be found.
Diffstat (limited to 'config/windows.config')
-rw-r--r--config/windows.config27
1 files changed, 19 insertions, 8 deletions
diff --git a/config/windows.config b/config/windows.config
index 0fb2c470..3c2e35ef 100644
--- a/config/windows.config
+++ b/config/windows.config
@@ -38,7 +38,7 @@ if not mingw_perl_prefix:
def cmd(command):
return '%s-%s' % (host, command)
-export_msvc = ('CERBERO_MSVC_SHELL' in os.environ) and (platform == Platform.WINDOWS)
+export_msvc = ('CERBERO_EXPORT_MSVC' in os.environ) and (platform == Platform.WINDOWS)
# Default GCC compiler flags
if not export_msvc:
@@ -94,14 +94,25 @@ if platform == Platform.WINDOWS:
from cerbero.ide.vs.env import vcvarsall, get_msvc_env, append_path
# Contains only the env vars that MSVC needs, including any existing vars
# that were appended/prepended and have new values
- msvc_toolchain_env = get_msvc_env(vcvarsall, arch, target_arch)
+ msvc_toolchain_env = {}
+ for key, value in get_msvc_env(vcvarsall, arch, target_arch).items():
+ if key in ('PATH', 'PATHEXT', 'INCLUDE', 'LIB'):
+ sep = separator
+ else:
+ sep = ' '
+ msvc_toolchain_env.update({key: [value, sep]})
# We want the MSVC compiler and linker to find the headers and libraries
# provided by recipes built by us, so append to INCLUDE and LIB.
# NOTE: We do not want to add the MinGW toolchain paths here
- msvc_toolchain_env['INCLUDE'] = append_path(msvc_toolchain_env['INCLUDE'],
- os.path.join(prefix, 'include'))
- msvc_toolchain_env['LIB'] = append_path(msvc_toolchain_env['LIB'],
- os.path.join(prefix, 'lib' + lib_suffix))
+ msvc_toolchain_env['INCLUDE'][0] = append_path(msvc_toolchain_env['INCLUDE'][0],
+ os.path.join(prefix, 'include'))
+ msvc_toolchain_env['LIB'][0] = append_path(msvc_toolchain_env['LIB'][0],
+ os.path.join(prefix, 'lib' + lib_suffix))
if export_msvc:
- for var, val in msvc_toolchain_env.items():
- os.environ[var] = val
+ for var, (val, sep) in msvc_toolchain_env.items():
+ if var not in os.environ or not os.environ[var]:
+ os.environ[var] = val
+ else:
+ os.environ[var] = '{}{}{}'.format(val, sep, os.environ[var])
+ # Don't set this twice
+ del os.environ['CERBERO_EXPORT_MSVC']