Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Make C++17 be the default (C++14 is still the minimum for now) #4022

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ help:
@echo " STOP_ON_WARNING=0 Do not stop building if compiler warns"
@echo " OPENIMAGEIO_SITE=xx Use custom site build mods"
@echo " MYCC=xx MYCXX=yy Use custom compilers"
@echo " CMAKE_CXX_STANDARD=14 C++ standard to build with (default is 14)"
@echo " CMAKE_CXX_STANDARD=14 C++ standard to build with (default is 17)"
@echo " USE_LIBCPLUSPLUS=1 For clang, use libc++"
@echo " GLIBCXX_USE_CXX11_ABI=1 For gcc, use the new string ABI"
@echo " EXTRA_CPP_ARGS= Additional args to the C++ command"
Expand Down
4 changes: 2 additions & 2 deletions site/spi/Makefile-bits
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ ifeq (${SP_OS}, rhel7)
SPI_COMPILER_PLATFORM ?= gcc-6.3
ifeq (${SPI_COMPILER_PLATFORM},gcc-6.3)
SPCOMP2_COMPILER ?= gcc63
CMAKE_CXX_STANDARD ?= 14
CMAKE_CXX_STANDARD ?= 17
LLVM_VERSION ?= 12.0.1
endif
SP_PLATFORM ?= linux
else ifeq (${platform}, macosx)
# Generic OSX machines (including LG's laptop)
COMPILER ?= clang
SPCOMP2_COMPILER ?= clang
CMAKE_CXX_STANDARD ?= 14
CMAKE_CXX_STANDARD ?= 17
SP_OS ?= macosx
SP_PLATFORM ?= macosx
else
Expand Down
9 changes: 6 additions & 3 deletions src/cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ message (STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
###########################################################################
# C++ language standard
#
set (CMAKE_CXX_STANDARD 14 CACHE STRING
"C++ standard to build with (14, 17, 20, etc.)")
set (CMAKE_CXX_MINIMUM 14)
set (CMAKE_CXX_STANDARD 17 CACHE STRING
"C++ standard to build with (14, 17, 20, etc.) Minimum is ${CMAKE_CXX_MINIMUM}.")
set (DOWNSTREAM_CXX_STANDARD 14 CACHE STRING
"C++ minimum standard to impose on downstream clients")
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
message (STATUS "Building with C++${CMAKE_CXX_STANDARD}, downstream minimum C++${DOWNSTREAM_CXX_STANDARD}")

if (CMAKE_CXX_STANDARD VERSION_LESS CMAKE_CXX_MINIMUM)
message (ERROR "C++${CMAKE_CXX_STANDARD} is not supported, minimum is C++${CMAKE_CXX_MINIMUM}")
endif ()

###########################################################################
# Figure out which compiler we're using
Expand Down