diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-01-14 17:27:05 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-01-14 18:07:30 +0200 |
commit | 7652be37e8bf5f891975c2ffdd7d2c1de5a334e2 (patch) | |
tree | 95ccda290b9818bb19b195e660602adae88b7fb9 | |
parent | 5de84bbb3d01e93c3f3e3b27956177d3e1e1d003 (diff) | |
download | qtlocation-mapboxgl-7652be37e8bf5f891975c2ffdd7d2c1de5a334e2.tar.gz |
temporary add flag for cpp 17upstream/alexshalamov_use_cpp17_opt_var
-rw-r--r-- | include/mbgl/util/optional.hpp | 14 | ||||
-rw-r--r-- | next/CMakeLists.txt | 16 |
2 files changed, 28 insertions, 2 deletions
diff --git a/include/mbgl/util/optional.hpp b/include/mbgl/util/optional.hpp index e0a3786a77..171c509b2f 100644 --- a/include/mbgl/util/optional.hpp +++ b/include/mbgl/util/optional.hpp @@ -1,5 +1,18 @@ #pragma once +#if __has_include(<optional>) && __cplusplus >= 201703L +#include <optional> + +namespace mbgl { + +template <typename T> +using optional = std::optional<T>; + +using nullopt_t = std::nullopt_t; +constexpr nullopt_t nullopt = std::nullopt; + +} // namespace mbgl +#else #include <optional.hpp> namespace mbgl { @@ -11,3 +24,4 @@ using nullopt_t = std::experimental::nullopt_t; constexpr nullopt_t nullopt = std::experimental::nullopt; } // namespace mbgl +#endif diff --git a/next/CMakeLists.txt b/next/CMakeLists.txt index 1950a1144a..9d611745cc 100644 --- a/next/CMakeLists.txt +++ b/next/CMakeLists.txt @@ -22,6 +22,7 @@ option(MBGL_WITH_CORE_ONLY "Build only the core bits, no platform code" OFF) option(MBGL_WITH_COVERAGE "Enable code coverage collection" OFF) option(MBGL_WITH_QT "Build Mapbox GL Qt bindings" OFF) option(MBGL_WITH_SANITIZER "Use [address|thread|undefined] here" OFF) +option(MBGL_CXX_17 "C++ version" OFF) add_library( mbgl-compiler-options INTERFACE @@ -64,7 +65,11 @@ target_link_libraries( cmake_policy(SET CMP0063 NEW) set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD 14) +if (MBGL_CXX_17) + set(CMAKE_CXX_STANDARD 17) +else() + set(CMAKE_CXX_STANDARD 14) +endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_C_EXTENSIONS OFF) @@ -953,13 +958,20 @@ target_link_libraries( Mapbox::Base::Extras::rapidjson Mapbox::Base::geojson.hpp Mapbox::Base::geometry.hpp - Mapbox::Base::optional Mapbox::Base::typewrapper Mapbox::Base::value Mapbox::Base::variant Mapbox::Base::weak ) +if (NOT MBGL_CXX_17) +target_link_libraries( + mbgl-core + PUBLIC + Mapbox::Base::optional +) +endif() + set_property(TARGET mbgl-core PROPERTY FOLDER Core) add_library( |