Add static libraries to Linux amalgamation (#3699)
This commit is contained in:
33
platform/linux/cmake/find_static_library.cmake
Normal file
33
platform/linux/cmake/find_static_library.cmake
Normal file
@@ -0,0 +1,33 @@
|
||||
function(find_static_library result_var)
|
||||
# Usage: find_static_library(VAR_NAME NAMES name1 [name2 ...])
|
||||
set(options)
|
||||
set(one_value_args)
|
||||
set(multi_value_args NAMES)
|
||||
cmake_parse_arguments(FSL "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
|
||||
|
||||
if(NOT FSL_NAMES)
|
||||
message(FATAL_ERROR "find_static_library: NAMES argument required")
|
||||
endif()
|
||||
|
||||
# Clear any previous cached result for this variable
|
||||
unset(${result_var} CACHE)
|
||||
|
||||
# Temporarily force CMake to look only for .a
|
||||
set(_old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
|
||||
# Invoke find_library using the caller's var name
|
||||
find_library(${result_var} NAMES ${FSL_NAMES})
|
||||
|
||||
# Restore original suffix list
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_old_suffixes})
|
||||
|
||||
# Check result
|
||||
if(NOT ${result_var})
|
||||
message(FATAL_ERROR
|
||||
"find_static_library: could not find any of [${FSL_NAMES}] as a .a")
|
||||
endif()
|
||||
|
||||
message(STATUS
|
||||
"find_static_library: Found static [${FSL_NAMES}] -> ${${result_var}}")
|
||||
endfunction()
|
||||
@@ -184,6 +184,16 @@ target_link_libraries(
|
||||
# Bundle system provided libraries
|
||||
if(MLN_CORE_INCLUDE_DEPS AND NOT MLN_USE_BUILTIN_ICU AND NOT "${ARMERGE}" STREQUAL "ARMERGE-NOTFOUND")
|
||||
message(STATUS "Found armerge: ${ARMERGE}")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/find_static_library.cmake)
|
||||
find_static_library(PNG_STATIC_LIB NAMES png)
|
||||
find_static_library(ZLIB_STATIC_LIB NAMES z)
|
||||
find_static_library(JPEG_STATIC_LIB NAMES jpeg)
|
||||
find_static_library(WEBP_STATIC_LIB NAMES webp)
|
||||
find_static_library(CURL_STATIC_LIB NAMES curl)
|
||||
find_static_library(UV_STATIC_LIB NAMES uv)
|
||||
find_static_library(OPENSSL_STATIC_LIB NAMES ssl)
|
||||
find_static_library(SQLITE_STATIC_LIB NAMES sqlite3)
|
||||
|
||||
add_custom_command(
|
||||
TARGET mbgl-core
|
||||
POST_BUILD
|
||||
@@ -192,6 +202,14 @@ if(MLN_CORE_INCLUDE_DEPS AND NOT MLN_USE_BUILTIN_ICU AND NOT "${ARMERGE}" STREQU
|
||||
${ICUUC_LIBRARY_DIRS}/libicuuc.a
|
||||
${ICUUC_LIBRARY_DIRS}/libicudata.a
|
||||
${ICUI18N_LIBRARY_DIRS}/libicui18n.a
|
||||
${PNG_STATIC_LIB}
|
||||
${ZLIB_STATIC_LIB}
|
||||
${JPEG_STATIC_LIB}
|
||||
${WEBP_STATIC_LIB}
|
||||
${CURL_STATIC_LIB}
|
||||
${UV_STATIC_LIB}
|
||||
${OPENSSL_STATIC_LIB}
|
||||
${SQLITE_STATIC_LIB}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user