sim: Use c++14 for LIBCXX
The compiler default varies among the environment. Especially, the default std version for xcode clang doesn't work for libcxx. This commit just ensures to use the consistent std version among compilers. we can come up with a more sophisticated way to control the version later if desiable. clang/macOS (from xcode): spacetanuki% c++ -dM -E -x c++ /dev/null | grep __cplusplus #define __cplusplus 199711L spacetanuki% c++ --version Apple clang version 11.0.0 (clang-1100.0.33.17) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin spacetanuki% clang/macOS (from homebrew): spacetanuki% /usr/local/Cellar/llvm/11.0.0/bin/clang++ -dM -E -x c++ /dev/null | grep __cplusplus #define __cplusplus 201402L spacetanuki% /usr/local/Cellar/llvm/11.0.0/bin/clang++ --version clang version 11.0.0 Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /usr/local/Cellar/llvm/11.0.0/bin spacetanuki% gcc/ubuntu: root@477d94753e9b:/# c++ -dM -E -x c++ /dev/null | grep __cplusplus #define __cplusplus 201402L root@477d94753e9b:/# c++ --version c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. root@477d94753e9b:/#
This commit is contained in:
parent
27a49331fc
commit
4e6adefc2b
|
@ -106,6 +106,15 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) \
|
|||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
ifeq ($(CONFIG_LIBCXX),y)
|
||||
# Why c++14?
|
||||
# * libcxx seems to require c++11.
|
||||
# * The compiler defaults varies:
|
||||
# clang/macOS (from xcode): 199711L
|
||||
# gcc/ubuntu: 201402L
|
||||
# * There is a precedent to use c++14.
|
||||
# (boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs)
|
||||
CXXFLAGS += -std=c++14
|
||||
|
||||
ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
# macOS uses libc++abi
|
||||
CXXFLAGS += -DLIBCXX_BUILDING_LIBCXXABI
|
||||
|
|
Loading…
Reference in New Issue