Always define NOMINMAX and friends globally

Repeating this every time is worse than defining them in the compiler
command line.
This commit is contained in:
Robbert van der Helm
2021-05-11 02:22:39 +02:00
parent 5577c4bfd8
commit af299f3c66
4 changed files with 20 additions and 35 deletions
+20 -19
View File
@@ -48,11 +48,21 @@ compiler_options = [
'-msse2',
]
wine_compiler_options = [
# Some stuff from `windows.h` results in conflicting definitions
'-DNOMINMAX',
# Winsock conflicts with the Posix sockets API. Before Wine 6.8 there was a
# `WINE_NOWINSOCK` that would exclude just `winsock.h` from `windows.h`, but
# they got rid of that so we now need to explicitly define the ifdef guards
'-D__WINE_WINSOCKAPI_STDLIB_H',
'-D_WINSOCKAPI_',
]
# NOTE: GCC doesn't 8-byte align doubles in structs on x86 for ABI-compatibilty
# reasons, but MSVC++ does. We need to force this same alignment to be
# ABI-compatible with 32-bit binaries created with MSVC++ on Windows.
wine_32bit_compiler_options = ['-m32', '-malign-double']
wine_64bit_compiler_options = ['-m64']
wine_32bit_compiler_options = wine_compiler_options + ['-m32', '-malign-double']
wine_64bit_compiler_options = wine_compiler_options + ['-m64']
# Enable addition assertions on the STL containers during debug builds
if get_option('buildtype') == 'debug'
@@ -209,20 +219,11 @@ if with_vst3
error('Error while trying to patch the VST3 SDK:\n' + patch_result.stderr())
endif
vst3_wine_compiler_options = [
# Some stuff from `windows.h` results in conflicting definitions
'-DNOMINMAX',
# Winsock conflicts with the Posix sockets API. Before Wine 6.8 there was a
# `WINE_NOWINSOCK` that would exclude just `winsock.h` from `windows.h`, but
# they got rid of that so we now need to explicitly define the ifdef guards
'-D__WINE_WINSOCKAPI_STDLIB_H',
'-D_WINSOCKAPI_',
]
vst3_base_wine_64bit = static_library(
'vst3_base_wine_64bit',
vst3.get_variable('base_sources'),
native : false,
cpp_args : vst3_compiler_options + vst3_wine_compiler_options + wine_64bit_compiler_options + [ '-Wno-cpp'],
cpp_args : vst3_compiler_options + wine_64bit_compiler_options + [ '-Wno-cpp'],
include_directories : vst3_include_dir,
override_options : ['warning_level=0'],
)
@@ -230,7 +231,7 @@ if with_vst3
'vst3_pluginterfaces_wine_64bit',
vst3.get_variable('pluginterfaces_sources'),
native : false,
cpp_args : vst3_compiler_options + vst3_wine_compiler_options + wine_64bit_compiler_options,
cpp_args : vst3_compiler_options + wine_64bit_compiler_options,
include_directories : vst3_include_dir,
override_options : ['warning_level=0'],
)
@@ -239,7 +240,7 @@ if with_vst3
vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_hosting_sources'),
native : false,
link_with : [vst3_base_wine_64bit, vst3_pluginterfaces_wine_64bit],
cpp_args : vst3_compiler_options + vst3_wine_compiler_options + wine_64bit_compiler_options + ['-Wno-multichar'],
cpp_args : vst3_compiler_options + wine_64bit_compiler_options + ['-Wno-multichar'],
include_directories : vst3_include_dir,
override_options : ['warning_level=0'],
)
@@ -249,7 +250,7 @@ if with_vst3
# This does mean that we now have a lot of defines in our code, but the
# alternative would be patching every location in the SDK where they include
# `windows.h`
compile_args : vst3_compiler_options + vst3_wine_compiler_options,
compile_args : vst3_compiler_options + wine_64bit_compiler_options,
)
# And another time for the 32-bit version
@@ -258,7 +259,7 @@ if with_vst3
'vst3_base_wine_32bit',
vst3.get_variable('base_sources'),
native : false,
cpp_args : vst3_compiler_options + vst3_wine_compiler_options + wine_32bit_compiler_options + ['-Wno-cpp'],
cpp_args : vst3_compiler_options + wine_32bit_compiler_options + ['-Wno-cpp'],
include_directories : vst3_include_dir,
override_options : ['warning_level=0'],
)
@@ -266,7 +267,7 @@ if with_vst3
'vst3_pluginterfaces_wine_32bit',
vst3.get_variable('pluginterfaces_sources'),
native : false,
cpp_args : vst3_compiler_options + vst3_wine_compiler_options + wine_32bit_compiler_options,
cpp_args : vst3_compiler_options + wine_32bit_compiler_options,
include_directories : vst3_include_dir,
override_options : ['warning_level=0'],
)
@@ -275,7 +276,7 @@ if with_vst3
vst3.get_variable('sdk_common_sources') + vst3.get_variable('sdk_hosting_sources'),
native : false,
link_with : [vst3_base_wine_32bit, vst3_pluginterfaces_wine_32bit],
cpp_args : vst3_compiler_options + vst3_wine_compiler_options + wine_32bit_compiler_options + ['-Wno-multichar'],
cpp_args : vst3_compiler_options + wine_32bit_compiler_options + ['-Wno-multichar'],
include_directories : vst3_include_dir,
override_options : ['warning_level=0'],
)
@@ -285,7 +286,7 @@ if with_vst3
# This does mean that we now have a lot of defines in our code, but the
# alternative would be patching every location in the SDK where they include
# `windows.h`
compile_args : vst3_compiler_options + vst3_wine_compiler_options,
compile_args : vst3_compiler_options + wine_32bit_compiler_options,
)
endif
endif