diff --git a/depends/Makefile b/depends/Makefile index d47abf3076..dd508880f1 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -45,6 +45,9 @@ MULTIPROCESS ?= LTO ?= FALLBACK_DOWNLOAD_PATH ?= http://dash-depends-sources.s3-website-us-west-2.amazonaws.com +C_STANDARD ?= c11 +CXX_STANDARD ?= c++17 + BUILD = $(shell ./config.guess) HOST ?= $(BUILD) PATCHES_PATH = $(BASEDIR)/patches diff --git a/depends/README.md b/depends/README.md index 308be7814a..10a6845410 100644 --- a/depends/README.md +++ b/depends/README.md @@ -103,6 +103,8 @@ The following can be set when running make: `make FOO=bar` - `BASE_CACHE`: Built packages will be placed here - `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 9029355460..b53966dcf8 100644 --- a/depends/hosts/android.mk +++ b/depends/hosts/android.mk @@ -6,6 +6,9 @@ android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++ 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 android_LDFLAGS += -flto diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index c8fe2c949c..cb9ba08bdb 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -111,15 +111,15 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ -Xclang -internal-externc-isystem -Xclang $(clang_resource_dir)/include \ -Xclang -internal-externc-isystem -Xclang $(OSX_SDK)/usr/include -darwin_CFLAGS=-pipe +darwin_CFLAGS=-pipe -std=$(C_STANDARD) +darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) darwin_CFLAGS += -flto +darwin_CXXFLAGS += -flto darwin_LDFLAGS += -flto endif -darwin_CXXFLAGS=$(darwin_CFLAGS) - darwin_release_CFLAGS=-O2 darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk index 853fa0f457..5351d0b900 100644 --- a/depends/hosts/freebsd.mk +++ b/depends/hosts/freebsd.mk @@ -1,12 +1,12 @@ -freebsd_CFLAGS=-pipe +freebsd_CFLAGS=-pipe -std=$(C_STANDARD) +freebsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) freebsd_CFLAGS += -flto +freebsd_CXXFLAGS += -flto freebsd_LDFLAGS += -flto endif -freebsd_CXXFLAGS=$(freebsd_CFLAGS) - freebsd_release_CFLAGS=-O2 freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) diff --git a/depends/hosts/linux.mk b/depends/hosts/linux.mk index 4ed565c6f8..3d1769052b 100644 --- a/depends/hosts/linux.mk +++ b/depends/hosts/linux.mk @@ -1,12 +1,12 @@ -linux_CFLAGS=-pipe +linux_CFLAGS=-pipe -std=$(C_STANDARD) +linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) linux_CFLAGS += -flto +linux_CXXFLAGS += -flto linux_LDFLAGS += -flto endif -linux_CXXFLAGS=$(linux_CFLAGS) - linux_release_CFLAGS=-O2 linux_release_CXXFLAGS=$(linux_release_CFLAGS) diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk index c781a1541b..4e448ab0c9 100644 --- a/depends/hosts/mingw32.mk +++ b/depends/hosts/mingw32.mk @@ -2,15 +2,15 @@ ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),) mingw32_CXX := $(host)-g++-posix endif -mingw32_CFLAGS=-pipe +mingw32_CFLAGS=-pipe -std=$(C_STANDARD) +mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) mingw32_CFLAGS += -flto +mingw32_CXXFLAGS += -flto mingw32_LDFLAGS += -flto endif -mingw32_CXXFLAGS=$(mingw32_CFLAGS) - mingw32_release_CFLAGS=-O2 mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS) diff --git a/depends/hosts/netbsd.mk b/depends/hosts/netbsd.mk index 9e48248b7e..8342dcc6ed 100644 --- a/depends/hosts/netbsd.mk +++ b/depends/hosts/netbsd.mk @@ -1,7 +1,9 @@ -netbsd_CFLAGS=-pipe +netbsd_CFLAGS=-pipe -std=$(C_STANDARD) +netbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) netbsd_CFLAGS += -flto +netbsd_CXXFLAGS += -flto netbsd_LDFLAGS += -flto endif diff --git a/depends/hosts/openbsd.mk b/depends/hosts/openbsd.mk index c4a629e021..d330e94d2e 100644 --- a/depends/hosts/openbsd.mk +++ b/depends/hosts/openbsd.mk @@ -1,8 +1,9 @@ -openbsd_CFLAGS=-pipe -openbsd_CXXFLAGS=$(openbsd_CFLAGS) +openbsd_CFLAGS=-pipe -std=$(C_STANDARD) +openbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD) ifneq ($(LTO),) openbsd_CFLAGS += -flto +openbsd_CXXFLAGS += -flto openbsd_LDFLAGS += -flto endif diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk index b578583764..be82b0d309 100644 --- a/depends/packages/bdb.mk +++ b/depends/packages/bdb.mk @@ -10,7 +10,6 @@ define $(package)_set_vars $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --enable-option-checking $(package)_config_opts_mingw32=--enable-mingw $(package)_cflags+=-Wno-error=implicit-function-declaration -Wno-error=format-security -Wno-error=implicit-int -$(package)_cxxflags+=-std=c++17 $(package)_cppflags_freebsd=-D_XOPEN_SOURCE=600 -D__BSD_VISIBLE=1 $(package)_cppflags_netbsd=-D_XOPEN_SOURCE=600 $(package)_cppflags_mingw32=-DUNICODE -D_UNICODE diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index d9c1253484..21e162c792 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -22,7 +22,6 @@ define $(package)_set_vars $(package)_cxxflags += -ffile-prefix-map=$($(package)_extract_dir)=/usr $(package)_config_opts_mingw32 += -DZMQ_WIN32_WINNT=0x0601 -DZMQ_HAVE_IPC=OFF $(package)_config_opts_mingw32 += -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres - $(package)_cxxflags+=-std=c++17 endef define $(package)_preprocess_cmds diff --git a/depends/patches/qt/mac-qmake.conf b/depends/patches/qt/mac-qmake.conf index 543407f853..cb94bf07b4 100644 --- a/depends/patches/qt/mac-qmake.conf +++ b/depends/patches/qt/mac-qmake.conf @@ -15,7 +15,7 @@ QMAKE_MAC_SDK.macosx.SDKVersion = $${MAC_SDK_VERSION} QMAKE_MAC_SDK.macosx.PlatformPath = /phony !host_build: QMAKE_CFLAGS += -target $${MAC_TARGET} !host_build: QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS -!host_build: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +!host_build: QMAKE_CXXFLAGS += -target $${MAC_TARGET} !host_build: QMAKE_LFLAGS += -target $${MAC_TARGET} QMAKE_AR = $${CROSS_COMPILE}ar cq QMAKE_RANLIB=$${CROSS_COMPILE}ranlib