diff options
author | Clemens Wasser <clemens.wasser@gmail.com> | 2022-12-11 20:15:48 +0100 |
---|---|---|
committer | Clemens Wasser <clemens.wasser@gmail.com> | 2022-12-11 20:15:48 +0100 |
commit | 32abf5341f4accfdd3900305976d39cb2479f5e3 (patch) | |
tree | 6a8e381932e637c7f36231fa6325b6a7bbe9a1e9 | |
parent | b62e989bef2a3136747acfc494dc316539550b82 (diff) | |
download | ink-stroke-modeler-32abf5341f4accfdd3900305976d39cb2479f5e3.tar.gz |
Update C++ std requirement from 17 to 20
The C++20 feature designated initializers was already used in types.h,
resulting in a C7555 compilation error on MSVC
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | workspace.bzl | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a4102..e9f929d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.19) Project(InkStrokeModeler VERSION 0.1 LANGUAGES CXX) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) option(INK_STROKE_MODELER_BUILD_TESTING "Build tests and testonly libraries" ON) option(INK_STROKE_MODELER_ENABLE_INSTALL "Enable install rule" ON) @@ -83,9 +83,9 @@ else() FetchContent_MakeAvailable(absl) endif() -if(CMAKE_CXX_STANDARD LESS 17) +if(CMAKE_CXX_STANDARD LESS 20) message(FATAL_ERROR - "${PROJECT_NAME} requires CMAKE_CXX_STANDARD >= 17 (got: ${CMAKE_CXX_STANDARD})") + "${PROJECT_NAME} requires CMAKE_CXX_STANDARD >= 20 (got: ${CMAKE_CXX_STANDARD})") endif() include_directories("${CMAKE_SOURCE_DIR}") @@ -46,12 +46,12 @@ if you want to use a local checkout of Ink Stroke Modeler instead, use the [`local_repository`](https://bazel.build/reference/be/workspace#local_repository) workspace rule instead of `git_repository`. -Since Ink Stroke Modler requires C++17, it must be built with -`--cxxopt='-std=c++17'` (or similar indicating a newer version). You can put the +Since Ink Stroke Modler requires C++20, it must be built with +`--cxxopt='-std=c++20'` (or similar indicating a newer version). You can put the following in your project's `.bazelrc` to use this by default: ```none -build --cxxopt='-std=c++17' +build --cxxopt='-std=c++20' ``` Then you can include the following in your targets' `deps`: @@ -81,10 +81,10 @@ submodule: git submodule add https://github.com/google/ink-stroke-modeler ``` -And then include it in your `CMakeLists.txt`, requiring at least C++17: +And then include it in your `CMakeLists.txt`, requiring at least C++20: ```cmake -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) # If you want to use installed (or already fetched) versions of Abseil and/or # GTest (for example, if you've installed libabsl-dev and libgtest-dev), add: diff --git a/workspace.bzl b/workspace.bzl index 00fc679..1c41b3e 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -40,11 +40,11 @@ local_repository( path = "path/to/ink-stroke-modeler", ) -Ink Stroke Modeler requires C++17. This is not currently the default for Bazel, ---cxxopt='-std=c++17' (or newer) is required. You can put the following in +Ink Stroke Modeler requires C++20. This is not currently the default for Bazel, +--cxxopt='-std=c++20' (or newer) is required. You can put the following in .bazelrc at your project's root: -build --cxxopt='-std=c++17' +build --cxxopt='-std=c++20' """ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") |