summaryrefslogtreecommitdiff
path: root/config/windows.config
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-04-04 23:39:53 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-05-26 17:06:15 +0530
commit98dae50166486a951fcb0ac3309835017a25cecc (patch)
tree324f566b2be98d8f3562a427a6802df1d8787c62 /config/windows.config
parent59bd06df48d0fa85c5e96b53ea528918934cd62e (diff)
cerbero: Refactor variant handling in platform config files
While parsing config files such as the platform config files, we were exposing variants as an unresolved `list` of "operations" that will enable or disable the variant once they've all been resolved This is buggy because it means that platform config files have no way to know whether a variant has actually been disabled or enabled by the user. Now we always parse variants into the `Variants` object before parsing all configuration files. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/480>
Diffstat (limited to 'config/windows.config')
-rw-r--r--config/windows.config18
1 files changed, 6 insertions, 12 deletions
diff --git a/config/windows.config b/config/windows.config
index d6bf61e7..aac941bd 100644
--- a/config/windows.config
+++ b/config/windows.config
@@ -9,12 +9,6 @@ from cerbero.config import Architecture, Platform
# used later.
allow_system_libs = False
-# We currently don't use Visual Studio by default anywhere
-if 'visualstudio' not in variants:
- variants.append('novisualstudio')
-if 'uwp' not in variants:
- variants.append('nouwp')
-
if platform == Platform.WINDOWS:
separator = ';'
if target_arch == Architecture.X86:
@@ -67,7 +61,7 @@ def cmd(command, args='', wrapper=''):
target_winver = '0x0601'
# Default GCC compiler flags
-if not for_shell or 'novisualstudio' in variants:
+if not for_shell or not variants.visualstudio:
env['CFLAGS'] = arch_flags
env['CPPFLAGS'] = arch_flags
env['CASFLAGS'] = arch_flags
@@ -76,7 +70,7 @@ if not for_shell or 'novisualstudio' in variants:
else:
env['CFLAGS'] = ''
env['CPPFLAGS'] = ''
- if 'uwp' in variants:
+ if variants.uwp:
# Target distro for UWP is Windows 10
target_winver = '0x0A00'
# Setting WINAPI_FAMILY to APP allows us to get link-time errors for
@@ -105,7 +99,7 @@ env['DLLTOOL'] = cmd('dlltool', dlltool_flags)
# Ensure that we never accidentally use MSYS/MinGW objc/c++ compilers
env['OBJC'] = 'false'
env['OBJCXX'] = 'false'
-if not for_shell or 'novisualstudio' in variants:
+if not for_shell or not variants.visualstudio:
env['LIBRARY_PATH'] = "{0}/lib{1}".format(prefix, lib_suffix)
env['CC'] = cmd('gcc', arch_flags, ccache)
env['CXX'] = cmd('g++', arch_flags, ccache)
@@ -139,13 +133,13 @@ if platform == Platform.WINDOWS:
# Only use one process to make the build more reliable.
allow_parallel_build = False
-if platform == Platform.WINDOWS and 'visualstudio' in variants:
+if platform == Platform.WINDOWS and variants.visualstudio:
from cerbero.ide.vs.env import 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
# FIXME: Use EnvVarOp class from cerbero/build/build.py
msvc_toolchain_env = {}
- env, msvc_version = get_msvc_env(arch, target_arch, 'uwp' in variants,
+ env, msvc_version = get_msvc_env(arch, target_arch, variants.uwp,
vs_install_version, vs_install_path)
for key, value in env.items():
if key in ('PATH', 'PATHEXT', 'INCLUDE', 'LIB'):
@@ -161,7 +155,7 @@ if platform == Platform.WINDOWS and 'visualstudio' in variants:
msvc_toolchain_env['LIB'][0] = append_path(msvc_toolchain_env['LIB'][0],
os.path.join(prefix, 'lib' + lib_suffix))
msvc_toolchain_env['WINDRES'] = ['rc', '']
- if 'uwp' in variants:
+ if variants.uwp:
meson_cross_properties['needs_exe_wrapper'] = 'true'
# If no BOM is found from source file, msvc assumes the file is encoded