diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-08-25 14:45:38 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-08-26 13:03:49 +0800 |
commit | 4cd3fb78ee74ba8c1c06ba88d179777fa04e8bc1 (patch) | |
tree | a4d044994dccca9d31312acdf52362dcc567d184 | |
parent | 5bb84516689d562f6065f1859148371df2a6b0bc (diff) | |
download | gjs-4cd3fb78ee74ba8c1c06ba88d179777fa04e8bc1.tar.gz |
meson: Bring back Visual Studio build support
After applying the workarounds in the sources, we can now restore support for
builds that are done using Visual Studio. Builds on Windows are now supported
both via Visual Studio and clang-cl.
-rw-r--r-- | meson.build | 41 | ||||
-rw-r--r-- | meson_options.txt | 2 |
2 files changed, 28 insertions, 15 deletions
diff --git a/meson.build b/meson.build index 06860da0..783de568 100644 --- a/meson.build +++ b/meson.build @@ -25,23 +25,36 @@ endif cxx = meson.get_compiler('cpp') cc = meson.get_compiler('c') -add_project_arguments(cxx.get_supported_arguments([ - '-fno-strict-aliasing', - +if cc.get_id() == 'msvc' + add_project_arguments(cxx.get_supported_arguments([ + '-utf-8', # Use UTF-8 mode + '/Zc:externConstexpr', # Required for 'extern constexpr' on MSVC + + # Ignore spurious compiler warnings for things that GLib and SpiderMonkey + # header files commonly do + '-FImsvc_recommended_pragmas.h', + '-EHsc', + '-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS', # Don't worry about the C++17 deprecations + '-wd4099', + '-wd4251', + '-wd4291', + '-wd4800', + ]), language: ['cpp', 'c']) +else # Ignore spurious compiler warnings for things that GLib and SpiderMonkey - # header files commonly do - '-Wno-variadic-macros', # GLib uses these in header files - '-Wno-missing-field-initializers', # SpiderMonkey JSClass, among others -]), language: 'cpp') - -add_project_arguments(cc.get_supported_arguments([ - '-Wno-typedef-redefinition', # GLib does this in header files -]), language: 'c') + # header files commonly do + add_project_arguments(cxx.get_supported_arguments([ + '-fno-strict-aliasing', + '-Wno-variadic-macros', # GLib uses these in header files + '-Wno-missing-field-initializers', # SpiderMonkey JSClass, among others + ]), language: 'cpp') + + add_project_arguments(cc.get_supported_arguments([ + '-Wno-typedef-redefinition', # GLib does this in header files + ]), language: 'c') +endif if cc.get_argument_syntax() == 'msvc' - if cc.get_id() == 'msvc' - error('Buliding GJS with Visual Studio compilers is no longer supported. Please use `clang-cl`.') - endif add_project_arguments(cxx.get_supported_arguments([ '-Dssize_t=gssize', # Windows SDK/MSVC headers do not come with ssize_t '-DNOMINMAX', # We don't want 'min' or 'max' to interfere diff --git a/meson_options.txt b/meson_options.txt index edf61ca3..825ba77a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,7 +16,7 @@ option('dtrace', type: 'boolean', value: false, option('systemtap', type: 'boolean', value: false, description: 'Include systemtap trace support (requires -Ddtrace=true)') option('bsymbolic_functions', type: 'boolean', value: true, - description: 'Link with -Bsymbolic-functions linker flag used to avoid intra-library PLT jumps, if supported; not used for clang-cl builds') + description: 'Link with -Bsymbolic-functions linker flag used to avoid intra-library PLT jumps, if supported; not used for Visual Studio and clang-cl builds') option('spidermonkey_rtti', type: 'boolean', value: false, description: 'Needs to match SpiderMonkey\'s config option') option('skip_dbus_tests', type: 'boolean', value: false, |