summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-03-02 06:01:09 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2019-03-02 07:53:56 +0530
commit5ca6b3ccd472c21f364409244cdddc52db729fe0 (patch)
tree02985a6f6010de7ecdc017523b708cd92df3062b /config
parentb2a05b214a7c469c56d15be3525dd151c350f78e (diff)
cerbero: Use variant for export MSVC shell
We were using a separate winXX-msvc-shell.cbc configuration file to signal to the main configuration file that we want to export for an MSVC shell on Windows. This meant that people had to first know that they were supposed to use this, and then know that they could chain it with other configuration files to get a shell with, f.ex., a different prefix. We already have a mechanism for picking msvc vs mingw shell: the variant. So now we use that.
Diffstat (limited to 'config')
-rw-r--r--config/win32-msvc-shell.cbc9
-rw-r--r--config/win64-msvc-shell.cbc9
-rw-r--r--config/windows.config20
3 files changed, 11 insertions, 27 deletions
diff --git a/config/win32-msvc-shell.cbc b/config/win32-msvc-shell.cbc
deleted file mode 100644
index 12eceedb..00000000
--- a/config/win32-msvc-shell.cbc
+++ /dev/null
@@ -1,9 +0,0 @@
-# Please also edit win64-msvc-shell.cbc when updating this file
-
-from cerbero.config import Architecture
-
-target_arch = Architecture.X86
-
-# When set, we export the msvc toolchain in windows.config instead of when
-# building the recipe, and there won't be any MinGW toolchain paths
-os.environ['CERBERO_EXPORT_MSVC'] = '1'
diff --git a/config/win64-msvc-shell.cbc b/config/win64-msvc-shell.cbc
deleted file mode 100644
index f49c8340..00000000
--- a/config/win64-msvc-shell.cbc
+++ /dev/null
@@ -1,9 +0,0 @@
-# Please also edit win32-msvc-shell.cbc when updating this file
-
-from cerbero.config import Architecture
-
-target_arch = Architecture.X86_64
-
-# When set, we export the msvc toolchain in windows.config instead of when
-# building the recipe, and there won't be any MinGW toolchain paths
-os.environ['CERBERO_EXPORT_MSVC'] = '1'
diff --git a/config/windows.config b/config/windows.config
index c9affbb6..9ff2d170 100644
--- a/config/windows.config
+++ b/config/windows.config
@@ -8,7 +8,13 @@ from cerbero.config import Architecture, Platform
# We don't want anything from mingw or msys detected in configure and
# used later.
-allow_system_libs=False
+allow_system_libs = False
+
+# We currently don't use Visual Studio by default anywhere
+if 'visualstudio' not in variants:
+ variants.append('novisualstudio')
+elif for_shell and msvc_export_for_shell is None:
+ msvc_export_for_shell = '1'
if platform == Platform.WINDOWS:
separator = ';'
@@ -39,7 +45,7 @@ def cmd(command):
return '%s-%s' % (host, command)
# Default GCC compiler flags
-if 'CERBERO_EXPORT_MSVC' not in os.environ:
+if not msvc_export_for_shell:
os.environ['CFLAGS'] = '-Wall -g -O2 '
os.environ['CXXFLAGS'] = '-Wall -g -O2 '
os.environ['OBJCFLAGS'] = '-Wall -g -O2 '
@@ -54,7 +60,7 @@ os.environ['CXXFLAGS']=os.environ['CFLAGS']
os.environ['PERL'] = 'perl'
os.environ['NM']= cmd('nm')
os.environ['DLLTOOL']= cmd('dlltool')
-if 'CERBERO_EXPORT_MSVC' not in os.environ:
+if not msvc_export_for_shell:
os.environ['LIBRARY_PATH'] = "{0}/lib{1}".format(prefix, lib_suffix)
os.environ['CC']= '%s%s' % (ccache, cmd('gcc'))
os.environ['CXX']= '%s%s' % (ccache, cmd('g++'))
@@ -88,10 +94,6 @@ if platform == Platform.WINDOWS:
os.environ['ACLOCAL'] = 'aclocal-1.11'
- # We currently don't use Visual Studio by default on Windows
- if 'visualstudio' not in variants:
- variants.append('novisualstudio')
-
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
@@ -116,14 +118,14 @@ if platform == Platform.WINDOWS:
# add them to CFLAGS.
mingw_toolchain_env = {'CPPFLAGS': ('-I%s/%s/include/directx' % (toolchain_prefix, host), ' ')}
# Export the env for a shell
- if os.environ.get('CERBERO_EXPORT_MSVC', None) == '1':
+ if msvc_export_for_shell == '1':
for var, (val, sep) in msvc_toolchain_env.items():
if var == 'PATH':
os.environ[var] = '{}{}{}'.format(val, sep, os.environ[var])
else:
os.environ[var] = val
# Don't set this twice
- os.environ['CERBERO_EXPORT_MSVC'] = '2'
+ msvc_export_for_shell = '2'
else:
# For cross-mingw, we need to set this in the env so it's added to the
# cross file before Meson is run.