From f7595f1354f4618436fdab232000dc152bff315a Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 9 Sep 2021 14:21:01 +0800 Subject: [PATCH] build: add and use CXX_STANDARD in depends --- depends/Makefile | 1 + depends/README.md | 1 + depends/hosts/android.mk | 1 + depends/hosts/darwin.mk | 2 +- depends/hosts/freebsd.mk | 2 +- depends/hosts/linux.mk | 2 +- depends/hosts/mingw32.mk | 2 +- depends/hosts/netbsd.mk | 2 +- depends/hosts/openbsd.mk | 2 +- depends/packages/bdb.mk | 1 - depends/packages/zeromq.mk | 1 - 11 files changed, 9 insertions(+), 8 deletions(-) diff --git a/depends/Makefile b/depends/Makefile index a0bd177a795..5a1c472a15b 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -46,6 +46,7 @@ LTO ?= FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources C_STANDARD ?= c11 +CXX_STANDARD ?= c++17 BUILD = $(shell ./config.guess) HOST ?= $(BUILD) diff --git a/depends/README.md b/depends/README.md index de3bc84b805..66e1ddc4eb9 100644 --- a/depends/README.md +++ b/depends/README.md @@ -97,6 +97,7 @@ The following can be set when running make: `make FOO=bar` - `SDK_PATH`: Path where SDKs can be found (used by macOS) - `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up - `C_STANDARD`: Set the C standard version used. Defaults to `c11`. +- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++17`. - `NO_QT`: Don't download/build/cache Qt and its dependencies - `NO_QR`: Don't download/build/cache packages needed for enabling qrencode - `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ diff --git a/depends/hosts/android.mk b/depends/hosts/android.mk index b5ca179b3d9..b53966dcf8a 100644 --- a/depends/hosts/android.mk +++ b/depends/hosts/android.mk @@ -7,6 +7,7 @@ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang endif android_CFLAGS=-std=$(C_STANDARD) +android_CXXFLAGS=-std=$(CXX_STANDARD) ifneq ($(LTO),) android_CFLAGS += -flto diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index ca31403d4d6..8507e285328 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -110,7 +110,7 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ -Xclang -internal-externc-isystem$(OSX_SDK)/usr/include darwin_CFLAGS=-pipe -std=$(C_STANDARD) -darwin_CXXFLAGS=-pipe +darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) darwin_CFLAGS += -flto diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk index b4dcc61c2f9..5351d0b9009 100644 --- a/depends/hosts/freebsd.mk +++ b/depends/hosts/freebsd.mk @@ -1,5 +1,5 @@ freebsd_CFLAGS=-pipe -std=$(C_STANDARD) -freebsd_CXXFLAGS=-pipe +freebsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) freebsd_CFLAGS += -flto diff --git a/depends/hosts/linux.mk b/depends/hosts/linux.mk index d32d7e84ab9..b101043439d 100644 --- a/depends/hosts/linux.mk +++ b/depends/hosts/linux.mk @@ -1,5 +1,5 @@ linux_CFLAGS=-pipe -std=$(C_STANDARD) -linux_CXXFLAGS=-pipe +linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) linux_CFLAGS += -flto diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk index 24a25a27881..b98f9ab7acc 100644 --- a/depends/hosts/mingw32.mk +++ b/depends/hosts/mingw32.mk @@ -3,7 +3,7 @@ mingw32_CXX := $(host)-g++-posix endif mingw32_CFLAGS=-pipe -std=$(C_STANDARD) -mingw32_CXXFLAGS=-pipe +mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) mingw32_CFLAGS += -flto diff --git a/depends/hosts/netbsd.mk b/depends/hosts/netbsd.mk index a0cf6b10578..8342dcc6ede 100644 --- a/depends/hosts/netbsd.mk +++ b/depends/hosts/netbsd.mk @@ -1,5 +1,5 @@ netbsd_CFLAGS=-pipe -std=$(C_STANDARD) -netbsd_CXXFLAGS=-pipe +netbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) netbsd_CFLAGS += -flto diff --git a/depends/hosts/openbsd.mk b/depends/hosts/openbsd.mk index 35788726932..d330e94d2ed 100644 --- a/depends/hosts/openbsd.mk +++ b/depends/hosts/openbsd.mk @@ -1,5 +1,5 @@ openbsd_CFLAGS=-pipe -std=$(C_STANDARD) -openbsd_CXXFLAGS=-pipe +openbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) openbsd_CFLAGS += -flto diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk index dc536fd3991..80c7ce84290 100644 --- a/depends/packages/bdb.mk +++ b/depends/packages/bdb.mk @@ -15,7 +15,6 @@ $(package)_config_opts_netbsd=--with-pic $(package)_config_opts_openbsd=--with-pic $(package)_config_opts_android=--with-pic $(package)_cflags+=-Wno-error=implicit-function-declaration -$(package)_cxxflags+=-std=c++17 $(package)_cppflags_mingw32=-DUNICODE -D_UNICODE endef diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index c74ae15b313..267ed112531 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -16,7 +16,6 @@ define $(package)_set_vars $(package)_config_opts_netbsd=--with-pic $(package)_config_opts_openbsd=--with-pic $(package)_config_opts_android=--with-pic - $(package)_cxxflags+=-std=c++17 endef define $(package)_preprocess_cmds