From de3481f6c26da58eb4e65a3063bf58a611c08ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 8 Oct 2018 16:09:35 +0300 Subject: [build] use polyfill It is not available anymore in newer STL versions, e.g. according to libc++'s TS deprecation policy: https://libcxx.llvm.org/TS_deprecation.html --- cmake/core.cmake | 7 ++++++- cmake/loop-darwin.cmake | 4 ++++ cmake/loop-uv.cmake | 1 + scripts/vendor/optional.sh | 29 +++++++++++++++++++++++++++ vendor/optional/LICENSE.txt | 23 +++++++++++++++++++++ vendor/optional/files.txt | 2 ++ vendor/optional/include/experimental/optional | 15 ++++++++++++++ vendor/optional/version.txt | 1 + 8 files changed, 81 insertions(+), 1 deletion(-) create mode 100755 scripts/vendor/optional.sh create mode 100644 vendor/optional/LICENSE.txt create mode 100644 vendor/optional/files.txt create mode 100644 vendor/optional/include/experimental/optional create mode 100644 vendor/optional/version.txt diff --git a/cmake/core.cmake b/cmake/core.cmake index 1b29b4fb08..ac92b4f22e 100644 --- a/cmake/core.cmake +++ b/cmake/core.cmake @@ -1,3 +1,5 @@ +add_vendor_target(optional INTERFACE) + # Modify cmake/core-files.txt to change the source files for this target. load_sources_list(MBGL_CORE_FILES cmake/core-files.txt) add_library(mbgl-core STATIC ${MBGL_CORE_FILES}) @@ -7,7 +9,10 @@ target_include_directories(mbgl-core PRIVATE src ) -target_link_libraries(mbgl-core PRIVATE codecvt) +target_link_libraries(mbgl-core + PUBLIC optional + PRIVATE codecvt +) target_add_mason_package(mbgl-core PUBLIC geometry) target_add_mason_package(mbgl-core PUBLIC variant) diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake index ef79eef01b..9bb8565060 100644 --- a/cmake/loop-darwin.cmake +++ b/cmake/loop-darwin.cmake @@ -7,6 +7,10 @@ target_include_directories(mbgl-loop-darwin PRIVATE src ) +target_link_libraries(mbgl-loop-darwin + PUBLIC optional +) + create_source_groups(mbgl-loop-darwin) set_target_properties(mbgl-loop-darwin PROPERTIES FOLDER "Core") diff --git a/cmake/loop-uv.cmake b/cmake/loop-uv.cmake index e1d3166b63..da502e799d 100644 --- a/cmake/loop-uv.cmake +++ b/cmake/loop-uv.cmake @@ -7,6 +7,7 @@ target_sources(mbgl-loop-uv INTERFACE ) target_include_directories(mbgl-loop-uv INTERFACE + optional ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src ) diff --git a/scripts/vendor/optional.sh b/scripts/vendor/optional.sh new file mode 100755 index 0000000000..4f65835cc0 --- /dev/null +++ b/scripts/vendor/optional.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +source "$(dirname "${BASH_SOURCE[0]}")/common.sh" + +NAME=optional +VERSION=fe8fcaf41f271307936289d26846738182946150 +ROOT=optional-lite-$VERSION + +download "https://github.com/martinmoene/optional-lite/archive/$VERSION.tar.gz" +init +extract_gzip "$ROOT/include" "$ROOT/LICENSE.txt" +mkdir -p "include/experimental" +cat << EOF > "include/experimental/optional" +#pragma once + +#include + +namespace std { +namespace experimental { + +template +using optional = nonstd::optional; + +using nullopt_t = nonstd::nullopt_t; +constexpr nullopt_t nullopt = nonstd::nullopt; + +} // namespace experimental +} // namespace std +EOF +file_list include -type f diff --git a/vendor/optional/LICENSE.txt b/vendor/optional/LICENSE.txt new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/vendor/optional/LICENSE.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/vendor/optional/files.txt b/vendor/optional/files.txt new file mode 100644 index 0000000000..3974a6e6cc --- /dev/null +++ b/vendor/optional/files.txt @@ -0,0 +1,2 @@ +include/experimental/optional +include/nonstd/optional.hpp diff --git a/vendor/optional/include/experimental/optional b/vendor/optional/include/experimental/optional new file mode 100644 index 0000000000..32ecf657d6 --- /dev/null +++ b/vendor/optional/include/experimental/optional @@ -0,0 +1,15 @@ +#pragma once + +#include + +namespace std { +namespace experimental { + +template +using optional = nonstd::optional; + +using nullopt_t = nonstd::nullopt_t; +constexpr nullopt_t nullopt = nonstd::nullopt; + +} // namespace experimental +} // namespace std diff --git a/vendor/optional/version.txt b/vendor/optional/version.txt new file mode 100644 index 0000000000..f41276a151 --- /dev/null +++ b/vendor/optional/version.txt @@ -0,0 +1 @@ +fe8fcaf41f271307936289d26846738182946150 -- cgit v1.2.1