add a thingy in meson to guess c++ std
since meson doesn't yet support cpp_std=c++2a or c++20 for msvc++, only gcc (and the older version we support doesn't have c++20 either), default to none and add some minimal logic which will guess it for whatever compiler we're using people can still override the standard manually, in which case our guess logic will not be usedmaster
parent
e254000f5f
commit
3124f8a487
|
@ -110,7 +110,7 @@ compilers include:
|
|||
|
||||
* GCC 10
|
||||
* Clang 11
|
||||
* Visual Studio 2019
|
||||
* Microsoft Visual C++ 2019
|
||||
|
||||
Older versions of GCC and Clang may work, with no guarantees.
|
||||
|
||||
|
|
22
meson.build
22
meson.build
|
@ -1,8 +1,8 @@
|
|||
project('libcubescript', ['cpp'],
|
||||
version: '0.1.0',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized', 'cpp_std=c++2a',
|
||||
'warning_level=3', 'cpp_rtti=false'
|
||||
'buildtype=debugoptimized', 'warning_level=3', 'cpp_rtti=false',
|
||||
'cpp_std=none'
|
||||
],
|
||||
meson_version: '>=0.50'
|
||||
)
|
||||
|
@ -29,6 +29,24 @@ if get_option('buildtype') != 'plain'
|
|||
endif
|
||||
endif
|
||||
|
||||
# Meson does not support C++20 std in a portable way in this version
|
||||
# unless specified explicitly, have our own logic which will guess it
|
||||
if get_option('cpp_std') == 'none'
|
||||
if cxx.has_argument('-std=c++20')
|
||||
# modern gcc/clang
|
||||
extra_cxxflags += '-std=c++20'
|
||||
elif cxx.has_argument('-std=c++2a')
|
||||
# older gcc/clang
|
||||
extra_cxxflags += '-std=c++2a'
|
||||
elif cxx.has_argument('/std:c++20')
|
||||
# future msvc++? not supported anywhere yet
|
||||
extra_cxxflags += '/std:c++20'
|
||||
elif cxx.has_argument('/std:c++latest')
|
||||
# msvc++ 2019
|
||||
extra_cxxflags += '/std:c++latest'
|
||||
endif
|
||||
endif
|
||||
|
||||
subdir('src')
|
||||
subdir('tools')
|
||||
|
||||
|
|
Loading…
Reference in New Issue