summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-11-21 16:43:22 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-11-22 15:54:26 +0100
commitbf7ab7ba2b1ca952a62cef12d578795a332a12cd (patch)
tree4e4d30edb621be09af1aeeaf3dabb706e06f0525
parentdff218c30e6628eb0fb9bd0023c05cceb16132cd (diff)
downloadqtlocation-mapboxgl-bf7ab7ba2b1ca952a62cef12d578795a332a12cd.tar.gz
[build] reduce framework size for Release builds on macOS
-rw-r--r--cmake/loop-darwin.cmake2
-rw-r--r--cmake/mbgl.cmake5
-rw-r--r--platform/ios/toolchain.cmake7
-rw-r--r--platform/macos/config.cmake2
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj4
5 files changed, 13 insertions, 7 deletions
diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake
index 16bc62537c..7884c80a69 100644
--- a/cmake/loop-darwin.cmake
+++ b/cmake/loop-darwin.cmake
@@ -4,6 +4,8 @@ add_library(mbgl-loop STATIC
platform/darwin/src/timer.cpp
)
+set_xcode_property(mbgl-loop GCC_SYMBOLS_PRIVATE_EXTERN YES)
+
target_compile_options(mbgl-loop
PRIVATE -fPIC
PRIVATE -fvisibility-inlines-hidden
diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake
index f20f49004c..b2b959e6c1 100644
--- a/cmake/mbgl.cmake
+++ b/cmake/mbgl.cmake
@@ -35,6 +35,11 @@ function(create_source_groups target)
endforeach()
endfunction()
+# This little macro lets you set any XCode specific property
+macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
+ set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
+endmacro (set_xcode_property)
+
function(_write_xcconfig_var target var)
get_property(result TARGET ${target} PROPERTY INTERFACE_${var} SET)
if (result)
diff --git a/platform/ios/toolchain.cmake b/platform/ios/toolchain.cmake
index 60dbac07c7..512b46b6d9 100644
--- a/platform/ios/toolchain.cmake
+++ b/platform/ios/toolchain.cmake
@@ -113,13 +113,6 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-# This little macro lets you set any XCode specific property
-macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
- set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
-endmacro (set_xcode_property)
-
-
# This macro lets you find executable programs on the host system
macro (find_host_package)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake
index b1f31d4ed9..74dd5ebf31 100644
--- a/platform/macos/config.cmake
+++ b/platform/macos/config.cmake
@@ -8,6 +8,8 @@ mason_use(benchmark VERSION 1.0.0)
include(cmake/loop-darwin.cmake)
macro(mbgl_platform_core)
+ set_xcode_property(mbgl-core GCC_SYMBOLS_PRIVATE_EXTERN YES)
+
target_sources(mbgl-core
# File source
PRIVATE platform/darwin/src/http_file_source.mm
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index 194d543f82..8528ed0be9 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -1486,11 +1486,14 @@
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
+ DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
+ DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
+ GCC_SYMBOLS_PRIVATE_EXTERN = YES;
HEADER_SEARCH_PATHS = (
"$(mbgl_core_INCLUDE_DIRECTORIES)",
"$(mbgl_loop_INCLUDE_DIRECTORIES)",
@@ -1505,6 +1508,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL;
PRODUCT_NAME = Mapbox;
SKIP_INSTALL = YES;
+ STRIP_STYLE = "non-global";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};