Skip to content

Commit

Permalink
build: move from c++11 to c++17
Browse files Browse the repository at this point in the history
Moving from cpp 11 to cpp 17 will allow us to use modern features like
filesystem support, optional, any, execution policies and improved
templates.

Signed-off-by: Nathan Gauër <brioche@google.com>
  • Loading branch information
Keenuts committed Jan 19, 2023
1 parent bb1c885 commit 09b62c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ include(GNUInstallDirs)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Require at least C++11
# Require at least C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
endif()
if(${CMAKE_CXX_STANDARD} LESS 11)
message(FATAL_ERROR "SPIRV-Tools requires C++11 or later, but is configured for C++${CMAKE_CXX_STANDARD})")
if(${CMAKE_CXX_STANDARD} LESS 17)
message(FATAL_ERROR "SPIRV-Tools requires C++17 or later, but is configured for C++${CMAKE_CXX_STANDARD})")
endif()
set(CMAKE_CXX_EXTENSIONS OFF)


option(ENABLE_RTTI "Enables RTTI" OFF)
Expand Down Expand Up @@ -189,10 +190,9 @@ function(spvtools_default_compile_options TARGET)
target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS})

if (${COMPILER_IS_LIKE_GNU})
target_compile_options(${TARGET} PRIVATE -std=c++11 -fno-exceptions)
target_compile_options(${TARGET} PRIVATE
-Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion
-Wno-sign-conversion)
-Wno-sign-conversion -fno-exceptions)

if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ On Windows
- Visual Studio 2019
- Visual Studio 2022

Other compilers or later versions may work, but they are not tested.
Note: Visual Studio 2017 has an incomplete c++17 support. We might stop
testing it soon. Other compilers or later versions may work, but they are not
tested.

### CMake options

Expand Down Expand Up @@ -499,7 +501,7 @@ The script requires Chromium's

### Usage

The internals of the library use C++11 features, and are exposed via both a C
The internals of the library use C++17 features, and are exposed via both a C
and C++ API.

In order to use the library from an application, the include path should point
Expand Down

0 comments on commit 09b62c0

Please sign in to comment.