From 64c75b442c4d387e4867757abf49462c561e5955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 25 Sep 2017 21:35:04 +0200 Subject: [build] split out DefaultFileSource and dependents to a separate target We don't want to link it into the node bindings, so keep it in a separate target --- cmake/core-files.cmake | 2 -- cmake/filesource.cmake | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ cmake/mbgl.cmake | 10 +++++++++ cmake/node.cmake | 2 +- 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 cmake/filesource.cmake (limited to 'cmake') diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index c34a0724f4..04f0f7116d 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -309,8 +309,6 @@ set(MBGL_CORE_FILES include/mbgl/storage/resource_transform.hpp include/mbgl/storage/response.hpp src/mbgl/storage/asset_file_source.hpp - src/mbgl/storage/file_source_request.cpp - src/mbgl/storage/file_source_request.hpp src/mbgl/storage/http_file_source.hpp src/mbgl/storage/local_file_source.hpp src/mbgl/storage/network_status.cpp diff --git a/cmake/filesource.cmake b/cmake/filesource.cmake new file mode 100644 index 0000000000..bb1b4e8c05 --- /dev/null +++ b/cmake/filesource.cmake @@ -0,0 +1,57 @@ +add_library(mbgl-filesource STATIC + # File source + include/mbgl/storage/default_file_source.hpp + platform/default/default_file_source.cpp + platform/default/mbgl/storage/file_source_request.hpp + platform/default/file_source_request.cpp + include/mbgl/storage/online_file_source.hpp + platform/default/online_file_source.cpp + src/mbgl/storage/http_file_source.hpp + src/mbgl/storage/asset_file_source.hpp + platform/default/asset_file_source.cpp + src/mbgl/storage/local_file_source.hpp + platform/default/local_file_source.cpp + + # Offline + include/mbgl/storage/offline.hpp + platform/default/mbgl/storage/offline.cpp + platform/default/mbgl/storage/offline_database.hpp + platform/default/mbgl/storage/offline_database.cpp + platform/default/mbgl/storage/offline_download.hpp + platform/default/mbgl/storage/offline_download.cpp + + # Database + platform/default/sqlite3.hpp +) + +target_add_mason_package(mbgl-filesource PUBLIC geometry) +target_add_mason_package(mbgl-filesource PUBLIC variant) +target_add_mason_package(mbgl-filesource PUBLIC any) +target_add_mason_package(mbgl-filesource PRIVATE rapidjson) +target_add_mason_package(mbgl-filesource PRIVATE boost) +target_add_mason_package(mbgl-filesource PRIVATE geojson) + +set_xcode_property(mbgl-filesource GCC_SYMBOLS_PRIVATE_EXTERN YES) + +target_compile_options(mbgl-filesource + PRIVATE -fPIC + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-filesource + PRIVATE include + PRIVATE src + PRIVATE platform/default +) + +target_link_libraries(mbgl-filesource + PUBLIC mbgl-core +) + +mbgl_filesource() + +create_source_groups(mbgl-filesource) + +xcode_create_scheme(TARGET mbgl-filesource) + +initialize_xcode_cxx_build_settings(mbgl-filesource) diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake index 7f7d820a68..d853950c0d 100644 --- a/cmake/mbgl.cmake +++ b/cmake/mbgl.cmake @@ -95,6 +95,16 @@ function(_get_xcconfig_property target var) get_property(result TARGET ${target} PROPERTY INTERFACE_${var} SET) if (result) get_property(result TARGET ${target} PROPERTY INTERFACE_${var}) + if (var STREQUAL "LINK_LIBRARIES") + # Remove target names from the list of linker flags, since Xcode can't deal with them. + set(link_flags) + foreach(item IN LISTS result) + if (NOT TARGET ${item}) + list(APPEND link_flags ${item}) + endif() + endforeach() + set(result "${link_flags}") + endif() string(REPLACE ";-framework " ";-framework;" result "${result}") string(REPLACE ";" "\" \"" result "${result}") string(REPLACE "-" "_" target "${target}") diff --git a/cmake/node.cmake b/cmake/node.cmake index 5a6c7595ad..c256b13f93 100644 --- a/cmake/node.cmake +++ b/cmake/node.cmake @@ -65,7 +65,7 @@ xcode_create_scheme( TYPE node NAME "node tests" ARGS - "`npm bin tape`/tape platform/node/test/js/**/*.test.js" + "node_modules/.bin/tape platform/node/test/js/**/*.test.js" ) xcode_create_scheme( -- cgit v1.2.1