diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-07-29 11:18:57 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-07-29 18:36:08 +0300 |
commit | 6f0cda8c8b8e7831f04ae5e00b13387107dcad9b (patch) | |
tree | 985607080970868ae8204cb5ef6a37b0d75bdcfc | |
parent | 41e30343f7c9772ba0a3dfa1497dd5657b18aca1 (diff) | |
download | qtlocation-mapboxgl-6f0cda8c8b8e7831f04ae5e00b13387107dcad9b.tar.gz |
[build] Use mapbox-base optional
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | cmake/core.cmake | 1 | ||||
-rw-r--r-- | cmake/loop-darwin.cmake | 2 | ||||
-rw-r--r-- | cmake/vendor.cmake | 1 | ||||
-rw-r--r-- | misc/buck/mapbox-gl-native/BUCK | 1 | ||||
-rw-r--r-- | platform/android/config.cmake | 8 | ||||
-rw-r--r-- | platform/default/src/mbgl/storage/sqlite3.cpp | 26 | ||||
-rwxr-xr-x | scripts/generate-file-lists.js | 3 | ||||
-rw-r--r-- | src/csscolorparser/csscolorparser.cpp | 2 | ||||
-rw-r--r-- | src/csscolorparser/csscolorparser.hpp | 8 | ||||
m--------- | vendor/mapbox-base | 0 | ||||
-rw-r--r-- | vendor/mapbox-base-files.json | 1 | ||||
m--------- | vendor/optional | 0 | ||||
-rw-r--r-- | vendor/optional-files.json | 8 | ||||
-rw-r--r-- | vendor/optional.cmake | 5 |
15 files changed, 22 insertions, 47 deletions
diff --git a/.gitmodules b/.gitmodules index 98ca7d9899..185a92c41f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,9 +49,6 @@ [submodule "vendor/icu"] path = vendor/icu url = https://github.com/unicode-org/icu.git -[submodule "vendor/optional"] - path = vendor/optional - url = https://github.com/mapbox/Optional.git [submodule "vendor/boost"] path = vendor/boost url = https://github.com/mapbox/mapbox-gl-native-boost.git diff --git a/cmake/core.cmake b/cmake/core.cmake index 7f70f65557..abb55d174a 100644 --- a/cmake/core.cmake +++ b/cmake/core.cmake @@ -31,7 +31,6 @@ target_link_libraries(mbgl-core PUBLIC mapbox-base geojson.hpp ${ICU_LIBRARY} - optional polylabel protozero rapidjson diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake index 46d8f9edc0..9e52639c52 100644 --- a/cmake/loop-darwin.cmake +++ b/cmake/loop-darwin.cmake @@ -8,7 +8,7 @@ target_include_directories(mbgl-loop-darwin ) target_link_libraries(mbgl-loop-darwin PUBLIC - optional + mapbox-base ) create_source_groups(mbgl-loop-darwin) diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake index a59c5921b3..aa986aaf5e 100644 --- a/cmake/vendor.cmake +++ b/cmake/vendor.cmake @@ -16,7 +16,6 @@ include(${CMAKE_SOURCE_DIR}/vendor/icu.cmake) include(${CMAKE_SOURCE_DIR}/vendor/jni.hpp.cmake) include(${CMAKE_SOURCE_DIR}/vendor/kdbush.hpp.cmake) include(${CMAKE_SOURCE_DIR}/vendor/nunicode.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/optional.cmake) include(${CMAKE_SOURCE_DIR}/vendor/pixelmatch-cpp.cmake) include(${CMAKE_SOURCE_DIR}/vendor/polylabel.cmake) include(${CMAKE_SOURCE_DIR}/vendor/protozero.cmake) diff --git a/misc/buck/mapbox-gl-native/BUCK b/misc/buck/mapbox-gl-native/BUCK index b3dd038a83..ed264e9756 100644 --- a/misc/buck/mapbox-gl-native/BUCK +++ b/misc/buck/mapbox-gl-native/BUCK @@ -49,7 +49,6 @@ mbgl_vendor_library("jni.hpp") mbgl_vendor_library("kdbush.hpp") mbgl_vendor_library("mapbox-base") mbgl_vendor_library("sqlite") -mbgl_vendor_library("optional") mbgl_vendor_library("pixelmatch-cpp") mbgl_vendor_library("polylabel") mbgl_vendor_library("protozero") diff --git a/platform/android/config.cmake b/platform/android/config.cmake index dd75bb3b5b..4bd628fcdd 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -136,8 +136,8 @@ target_include_directories(example-custom-layer PRIVATE include ) -target_link_libraries(example-custom-layer - PRIVATE optional - PRIVATE -llog - PRIVATE -lGLESv2 +target_link_libraries(example-custom-layer PRIVATE + mapbox-base + -llog + -lGLESv2 ) diff --git a/platform/default/src/mbgl/storage/sqlite3.cpp b/platform/default/src/mbgl/storage/sqlite3.cpp index 7596ca34a4..665e23b437 100644 --- a/platform/default/src/mbgl/storage/sqlite3.cpp +++ b/platform/default/src/mbgl/storage/sqlite3.cpp @@ -6,10 +6,10 @@ #include <cstring> #include <cstdio> #include <chrono> -#include <optional.hpp> #include <mbgl/util/traits.hpp> #include <mbgl/util/logging.hpp> +#include <mbgl/util/optional.hpp> namespace mapbox { namespace sqlite { @@ -98,10 +98,6 @@ public: int64_t changes = 0; }; -template <typename T> -using optional = std::experimental::optional<T>; - - #ifndef NDEBUG void logSqlMessage(void *, const int err, const char *msg) { mbgl::Log::Record(mbgl::EventSeverity::Debug, mbgl::Event::Database, err, "%s", msg); @@ -309,7 +305,7 @@ void Query::bind( stmt.impl->check(sqlite3_bind_int64(stmt.impl->stmt, offset, std::chrono::system_clock::to_time_t(value))); } -template <> void Query::bind(int offset, optional<std::string> value) { +template <> void Query::bind(int offset, mbgl::optional<std::string> value) { if (!value) { bind(offset, nullptr); } else { @@ -320,7 +316,7 @@ template <> void Query::bind(int offset, optional<std::string> value) { template <> void Query::bind( int offset, - optional<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> value) { + mbgl::optional<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> value) { if (!value) { bind(offset, nullptr); } else { @@ -387,39 +383,39 @@ Query::get(int offset) { std::chrono::system_clock::from_time_t(sqlite3_column_int64(stmt.impl->stmt, offset))); } -template <> optional<int64_t> Query::get(int offset) { +template <> mbgl::optional<int64_t> Query::get(int offset) { assert(stmt.impl); if (sqlite3_column_type(stmt.impl->stmt, offset) == SQLITE_NULL) { - return optional<int64_t>(); + return mbgl::nullopt; } else { return get<int64_t>(offset); } } -template <> optional<double> Query::get(int offset) { +template <> mbgl::optional<double> Query::get(int offset) { assert(stmt.impl); if (sqlite3_column_type(stmt.impl->stmt, offset) == SQLITE_NULL) { - return optional<double>(); + return mbgl::nullopt; } else { return get<double>(offset); } } -template <> optional<std::string> Query::get(int offset) { +template <> mbgl::optional<std::string> Query::get(int offset) { assert(stmt.impl); if (sqlite3_column_type(stmt.impl->stmt, offset) == SQLITE_NULL) { - return optional<std::string>(); + return mbgl::nullopt; } else { return get<std::string>(offset); } } template <> -optional<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> +mbgl::optional<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> Query::get(int offset) { assert(stmt.impl); if (sqlite3_column_type(stmt.impl->stmt, offset) == SQLITE_NULL) { - return {}; + return mbgl::nullopt; } else { return get<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>>( offset); diff --git a/scripts/generate-file-lists.js b/scripts/generate-file-lists.js index 2138d876be..2100928438 100755 --- a/scripts/generate-file-lists.js +++ b/scripts/generate-file-lists.js @@ -138,8 +138,7 @@ generateFileList('vendor/geojson.hpp-files.json', [ 'vendor/geojson.hpp' ], vend generateFileList('vendor/icu-files.json', [ 'vendor/icu' ], vendorRegex, [ "include/**/*.h", "src/*.h", "src/*.cpp" ]); generateFileList('vendor/jni.hpp-files.json', [ 'vendor/jni.hpp' ], vendorRegex, [ "include/**/*.hpp", ":!:include/jni/string_conversion.hpp" ]); generateFileList('vendor/kdbush.hpp-files.json', [ 'vendor/kdbush.hpp' ], vendorRegex, [ "include/*.hpp" ]); -generateFileList('vendor/mapbox-base-files.json', [ 'vendor/mapbox-base/libs/geometry.hpp', 'vendor/mapbox-base/libs/variant' ], vendorRegex, [ "include/*.hpp", "include/**/*.hpp" ]); -generateFileList('vendor/optional-files.json', [ 'vendor/optional' ], vendorRegex, [ "optional.hpp" ]); +generateFileList('vendor/mapbox-base-files.json', [ 'vendor/mapbox-base/libs/geometry.hpp', 'vendor/mapbox-base/libs/variant', 'vendor/mapbox-base/libs/optional' ], vendorRegex, [ "include/*.hpp", "include/**/*.hpp", "optional.hpp" ]); generateFileList('vendor/pixelmatch-cpp-files.json', [ 'vendor/pixelmatch-cpp' ], vendorRegex, [ "include/**/*.hpp" ]); generateFileList('vendor/polylabel-files.json', [ 'vendor/polylabel' ], vendorRegex, [ "include/**/*.hpp" ]); generateFileList('vendor/protozero-files.json', [ 'vendor/protozero' ], vendorRegex, [ "include/**/*.hpp" ]); diff --git a/src/csscolorparser/csscolorparser.cpp b/src/csscolorparser/csscolorparser.cpp index 106dae6cef..0de921b265 100644 --- a/src/csscolorparser/csscolorparser.cpp +++ b/src/csscolorparser/csscolorparser.cpp @@ -176,7 +176,7 @@ std::vector<std::string> split(const std::string& s, char delim) { return elems; } -optional<Color> parse(const std::string& css_str) { +mbgl::optional<Color> parse(const std::string& css_str) { std::string str = css_str; // Remove all whitespace, not compliant, but should just be more accepting. diff --git a/src/csscolorparser/csscolorparser.hpp b/src/csscolorparser/csscolorparser.hpp index b6bc5570f9..88b916620e 100644 --- a/src/csscolorparser/csscolorparser.hpp +++ b/src/csscolorparser/csscolorparser.hpp @@ -25,15 +25,13 @@ #ifndef CSS_COLOR_PARSER_CPP #define CSS_COLOR_PARSER_CPP +#include <mbgl/util/optional.hpp> + #include <string> #include <cmath> -#include <optional.hpp> namespace CSSColorParser { -template <class T> -using optional = std::experimental::optional<T>; - struct Color { inline Color() { } @@ -52,7 +50,7 @@ inline bool operator!=(const Color& lhs, const Color& rhs) { return !(lhs == rhs); } -optional<Color> parse(const std::string& css_str); +mbgl::optional<Color> parse(const std::string& css_str); } // namespace CSSColorParser diff --git a/vendor/mapbox-base b/vendor/mapbox-base -Subproject 5a24532b9363f2871bc26377e7901dd87faef6d +Subproject 13fa9eced82977791d814a7d549b2b6929b82b3 diff --git a/vendor/mapbox-base-files.json b/vendor/mapbox-base-files.json index dc12c3647b..2e952b9661 100644 --- a/vendor/mapbox-base-files.json +++ b/vendor/mapbox-base-files.json @@ -17,6 +17,7 @@ "mapbox/geometry/point_arithmetic.hpp": "vendor/mapbox-base/libs/geometry.hpp/include/mapbox/geometry/point_arithmetic.hpp", "mapbox/geometry/polygon.hpp": "vendor/mapbox-base/libs/geometry.hpp/include/mapbox/geometry/polygon.hpp", "mapbox/geometry_io.hpp": "vendor/mapbox-base/libs/geometry.hpp/include/mapbox/geometry_io.hpp", + "optional.hpp": "vendor/mapbox-base/libs/optional/optional.hpp", "mapbox/optional.hpp": "vendor/mapbox-base/libs/variant/include/mapbox/optional.hpp", "mapbox/recursive_wrapper.hpp": "vendor/mapbox-base/libs/variant/include/mapbox/recursive_wrapper.hpp", "mapbox/variant.hpp": "vendor/mapbox-base/libs/variant/include/mapbox/variant.hpp", diff --git a/vendor/optional b/vendor/optional deleted file mode 160000 -Subproject f6249e7fdcb80131c390a083f1621d96023e72e diff --git a/vendor/optional-files.json b/vendor/optional-files.json deleted file mode 100644 index 4d62a8903c..0000000000 --- a/vendor/optional-files.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "//": "This file is generated. Do not edit. Regenerate it with scripts/generate-file-lists.js", - "sources": [], - "public_headers": { - "optional.hpp": "vendor/optional/optional.hpp" - }, - "private_headers": {} -} diff --git a/vendor/optional.cmake b/vendor/optional.cmake deleted file mode 100644 index f4b379d3df..0000000000 --- a/vendor/optional.cmake +++ /dev/null @@ -1,5 +0,0 @@ -add_library(optional INTERFACE) - -target_include_directories(optional SYSTEM INTERFACE - ${CMAKE_SOURCE_DIR}/vendor/optional -) |