[CMake] improve pkg-config export
add needed libs pkg-conf: move libmapnikjson and libmapnikjson to m_requires make pkg multi config aware update proj min ver correct prefix use the correct output name add import prefixes, just in case
This commit is contained in:
parent
4695c42b51
commit
aa903c675f
3 changed files with 51 additions and 16 deletions
|
@ -8,26 +8,58 @@ libdir=${exec_prefix}/lib
|
||||||
Name: @_lib_name@
|
Name: @_lib_name@
|
||||||
Description: @_description@
|
Description: @_description@
|
||||||
Version: @MAPNIK_VERSION@
|
Version: @MAPNIK_VERSION@
|
||||||
Libs: -L"${libdir}" -l$<TARGET_FILE_PREFIX:@_target@>$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
|
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
|
||||||
Cflags: -I"${includedir}" ]]
|
Cflags: -I"${includedir}" ]]
|
||||||
_contents @ONLY)
|
_contents @ONLY)
|
||||||
|
|
||||||
file(GENERATE
|
file(GENERATE
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
||||||
CONTENT "${_contents}"
|
CONTENT "${_contents}"
|
||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
||||||
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
||||||
|
RENAME ${_lib_name}.pc
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(create_pkg_config_file_mapnik _lib_name _description)
|
function(create_pkg_config_file_mapnik _lib_name _description)
|
||||||
get_target_property(_compile_defs core INTERFACE_COMPILE_DEFINITIONS)
|
get_target_property(m_compile_defs core INTERFACE_COMPILE_DEFINITIONS)
|
||||||
string(JOIN " -D" _str_compile_defs ${_compile_defs})
|
string(JOIN " -D" m_str_compile_defs ${m_compile_defs})
|
||||||
if(_str_compile_defs)
|
if(m_str_compile_defs)
|
||||||
set(_str_compile_defs "-D${_str_compile_defs}")
|
set(m_str_compile_defs "-D${m_str_compile_defs}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(m_requires
|
||||||
|
libmapnikwkt
|
||||||
|
libmapnikjson
|
||||||
|
icu-uc
|
||||||
|
icu-i18n
|
||||||
|
harfbuzz
|
||||||
|
freetype2
|
||||||
|
)
|
||||||
|
if(USE_LIBXML2)
|
||||||
|
list(APPEND m_requires libxml-2.0)
|
||||||
|
endif()
|
||||||
|
if(USE_PNG)
|
||||||
|
list(APPEND m_requires libpng)
|
||||||
|
endif()
|
||||||
|
if(USE_JPEG)
|
||||||
|
list(APPEND m_requires libjpeg)
|
||||||
|
endif()
|
||||||
|
if(USE_TIFF)
|
||||||
|
list(APPEND m_requires libtiff-4)
|
||||||
|
endif()
|
||||||
|
if(USE_WEBP)
|
||||||
|
list(APPEND m_requires libwebp)
|
||||||
|
endif()
|
||||||
|
if(USE_CAIRO)
|
||||||
|
list(APPEND m_requires cairo)
|
||||||
|
endif()
|
||||||
|
if(USE_PROJ)
|
||||||
|
list(APPEND m_requires "proj >= ${PROJ_MIN_VERSION}")
|
||||||
|
endif()
|
||||||
|
string(JOIN " " m_requires ${m_requires})
|
||||||
string(CONFIGURE [[
|
string(CONFIGURE [[
|
||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
|
@ -37,17 +69,18 @@ libdir=${exec_prefix}/lib
|
||||||
Name: @_lib_name@
|
Name: @_lib_name@
|
||||||
Description: @_description@
|
Description: @_description@
|
||||||
Version: @MAPNIK_VERSION@
|
Version: @MAPNIK_VERSION@
|
||||||
Requires: libmapnikwkt libmapnikjson
|
Requires: @m_requires@
|
||||||
Libs: -L"${libdir}" -l$<TARGET_FILE_PREFIX:mapnik>$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX> -l$<TARGET_FILE_PREFIX:json>$<TARGET_FILE_BASE_NAME:json>$<TARGET_PROPERTY:json,$<CONFIG>_POSTFIX> -l$<TARGET_FILE_PREFIX:wkt>$<TARGET_FILE_BASE_NAME:wkt>$<TARGET_PROPERTY:wkt,$<CONFIG>_POSTFIX>
|
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX>
|
||||||
Cflags: -I"${includedir}" @_str_compile_defs@]]
|
Cflags: -I"${includedir}" @m_str_compile_defs@]]
|
||||||
_contents @ONLY)
|
_contents @ONLY)
|
||||||
file(GENERATE
|
file(GENERATE
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
||||||
CONTENT "${_contents}"
|
CONTENT "${_contents}"
|
||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
||||||
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
||||||
|
RENAME ${_lib_name}.pc
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,9 @@ target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB})
|
||||||
set_target_properties(json PROPERTIES
|
set_target_properties(json PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "json"
|
OUTPUT_NAME "mapnikjson"
|
||||||
PREFIX "libmapnik"
|
PREFIX "lib"
|
||||||
|
IMPORT_PREFIX "lib"
|
||||||
VERSION ${MAPNIK_VERSION}
|
VERSION ${MAPNIK_VERSION}
|
||||||
# see mapnik target for explanation
|
# see mapnik target for explanation
|
||||||
SOVERSION ${MAPNIK_VERSION}
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
|
|
|
@ -19,8 +19,9 @@ target_link_libraries(wkt PRIVATE mapnik::core)
|
||||||
set_target_properties(wkt PROPERTIES
|
set_target_properties(wkt PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "wkt"
|
OUTPUT_NAME "mapnikwkt"
|
||||||
PREFIX "libmapnik"
|
PREFIX "lib"
|
||||||
|
IMPORT_PREFIX "lib"
|
||||||
VERSION ${MAPNIK_VERSION}
|
VERSION ${MAPNIK_VERSION}
|
||||||
# see mapnik target for explanation
|
# see mapnik target for explanation
|
||||||
SOVERSION ${MAPNIK_VERSION}
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
|
|
Loading…
Reference in a new issue