[build] Make csscolorparser and parsedate vendors

They have a different license from the rest of the code
and this will make it explicit. Also the script for generating
the license will dectect them correctly.
This commit is contained in:
Thiago Marcos P. Santos
2020-02-26 16:08:23 +02:00
parent 242b719f0c
commit 427d785848
11 changed files with 114 additions and 22 deletions

View File

@@ -265,8 +265,6 @@ add_library(
${PROJECT_SOURCE_DIR}/include/mbgl/util/work_request.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/util/work_task.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/util/work_task_impl.hpp
${PROJECT_SOURCE_DIR}/src/csscolorparser/csscolorparser.cpp
${PROJECT_SOURCE_DIR}/src/csscolorparser/csscolorparser.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/actor/mailbox.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/actor/scheduler.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/algorithm/update_renderables.hpp
@@ -799,8 +797,6 @@ add_library(
${PROJECT_SOURCE_DIR}/src/mbgl/util/version.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/version.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/work_request.cpp
${PROJECT_SOURCE_DIR}/src/parsedate/parsedate.cpp
${PROJECT_SOURCE_DIR}/src/parsedate/parsedate.hpp
)
if(MBGL_WITH_OPENGL)
@@ -933,10 +929,12 @@ target_include_directories(
PUBLIC ${PROJECT_SOURCE_DIR}/include
)
include(${PROJECT_SOURCE_DIR}/vendor/mapbox-base.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/boost.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/csscolorparser.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/earcut.hpp.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/eternal.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/mapbox-base.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/parsedate.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/polylabel.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/protozero.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/unique_resource.cmake)
@@ -952,8 +950,10 @@ target_link_libraries(
Mapbox::Base::geojson-vt-cpp
mbgl-compiler-options
mbgl-vendor-boost
mbgl-vendor-csscolorparser
mbgl-vendor-earcut.hpp
mbgl-vendor-eternal
mbgl-vendor-parsedate
mbgl-vendor-polylabel
mbgl-vendor-protozero
mbgl-vendor-unique_resource

View File

@@ -10,17 +10,13 @@ target_compile_definitions(
include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/sqlite.cmake)
# cmake-format: off
target_compile_options(mbgl-vendor-csscolorparser PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
target_compile_options(mbgl-vendor-icu PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
target_compile_options(
mbgl-vendor-sqlite
PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>
)
target_compile_options(
mbgl-compiler-options
INTERFACE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>
)
target_compile_options(mbgl-vendor-parsedate PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
target_compile_options(mbgl-vendor-sqlite PRIVATE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
target_compile_options(mbgl-compiler-options INTERFACE $<$<CONFIG:Release>:-Oz> $<$<CONFIG:Release>:-Qunused-arguments> $<$<CONFIG:Release>:-flto>)
# cmake-format: on
target_link_libraries(
mbgl-compiler-options

View File

@@ -80,7 +80,9 @@ include(${PROJECT_SOURCE_DIR}/platform/ios/ccache.cmake)
include(${PROJECT_SOURCE_DIR}/platform/ios/ios-test-runners.cmake)
initialize_ios_target(mbgl-core)
initialize_ios_target(mbgl-vendor-csscolorparser)
initialize_ios_target(mbgl-vendor-icu)
initialize_ios_target(mbgl-vendor-parsedate)
target_link_libraries(
mbgl-core

27
vendor/csscolorparser.cmake vendored Normal file
View File

@@ -0,0 +1,27 @@
if(TARGET mbgl-vendor-csscolorparser)
return()
endif()
add_library(
mbgl-vendor-csscolorparser STATIC
${CMAKE_CURRENT_LIST_DIR}/csscolorparser/csscolorparser.cpp
)
target_link_libraries(
mbgl-vendor-csscolorparser
PRIVATE Mapbox::Base::optional mbgl-compiler-options
)
target_include_directories(
mbgl-vendor-csscolorparser SYSTEM
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/csscolorparser
)
set_target_properties(
mbgl-vendor-csscolorparser
PROPERTIES
INTERFACE_MAPBOX_NAME "csscolorparser"
INTERFACE_MAPBOX_URL "https://github.com/mapbox/css-color-parser-cpp"
INTERFACE_MAPBOX_AUTHOR "Dean McNamee and Konstantin Käfer"
INTERFACE_MAPBOX_LICENSE ${CMAKE_CURRENT_LIST_DIR}/csscolorparser/LICENSE
)

20
vendor/csscolorparser/LICENSE vendored Normal file
View File

@@ -0,0 +1,20 @@
(c) Dean McNamee <dean@gmail.com>, 2012.
(c) Konstantin Käfer <mail@kkaefer.com>, 2014.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

View File

@@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
#include "csscolorparser.hpp"
#include "csscolorparser/csscolorparser.hpp"
#include <cstdint>
#include <vector>
@@ -176,7 +176,7 @@ std::vector<std::string> split(const std::string& s, char delim) {
return elems;
}
mbgl::optional<Color> parse(const std::string& css_str) {
std::experimental::optional<Color> parse(const std::string& css_str) {
std::string str = css_str;
// Remove all whitespace, not compliant, but should just be more accepting.

View File

@@ -25,7 +25,7 @@
#ifndef CSS_COLOR_PARSER_CPP
#define CSS_COLOR_PARSER_CPP
#include <mbgl/util/optional.hpp>
#include <optional.hpp>
#include <string>
#include <cmath>
@@ -50,7 +50,7 @@ inline bool operator!=(const Color& lhs, const Color& rhs) {
return !(lhs == rhs);
}
mbgl::optional<Color> parse(const std::string& css_str);
std::experimental::optional<Color> parse(const std::string& css_str);
} // namespace CSSColorParser

27
vendor/parsedate.cmake vendored Normal file
View File

@@ -0,0 +1,27 @@
if(TARGET mbgl-vendor-parsedate)
return()
endif()
add_library(
mbgl-vendor-parsedate STATIC
${CMAKE_CURRENT_LIST_DIR}/parsedate/parsedate.cpp
)
target_link_libraries(
mbgl-vendor-parsedate
PRIVATE mbgl-compiler-options
)
target_include_directories(
mbgl-vendor-parsedate SYSTEM
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/parsedate
)
set_target_properties(
mbgl-vendor-parsedate
PROPERTIES
INTERFACE_MAPBOX_NAME "parsedate"
INTERFACE_MAPBOX_URL "https://curl.haxx.se"
INTERFACE_MAPBOX_AUTHOR "Daniel Stenberg and others"
INTERFACE_MAPBOX_LICENSE ${CMAKE_CURRENT_LIST_DIR}/parsedate/COPYING
)

22
vendor/parsedate/COPYING vendored Normal file
View File

@@ -0,0 +1,22 @@
COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1996 - 2020, Daniel Stenberg, <daniel@haxx.se>, and many
contributors, see the THANKS file.
All rights reserved.
Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.
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 AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

View File

@@ -73,9 +73,7 @@
*/
#include "parsedate.hpp"
#include "parsedate/parsedate.hpp"
#ifdef __cplusplus
extern "C" {