[build] reduce framework size for Release builds on macOS

This commit is contained in:
Konstantin Käfer
2016-11-21 16:43:22 +01:00
parent dff218c30e
commit bf7ab7ba2b
5 changed files with 13 additions and 7 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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 = "";
};