install utilities
This commit is contained in:
parent
35ea6f2a56
commit
f1ed49edec
13 changed files with 108 additions and 67 deletions
|
@ -218,6 +218,7 @@ endif()
|
||||||
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
||||||
set_property(GLOBAL PROPERTY TARGETS "")
|
set_property(GLOBAL PROPERTY TARGETS "")
|
||||||
set_property(GLOBAL PROPERTY PLUGINS "")
|
set_property(GLOBAL PROPERTY PLUGINS "")
|
||||||
|
set_property(GLOBAL PROPERTY MAPNIK_UTILITIES "")
|
||||||
|
|
||||||
if(USE_GLIBC_WORKAROUND)
|
if(USE_GLIBC_WORKAROUND)
|
||||||
message("using glibc workaround")
|
message("using glibc workaround")
|
||||||
|
@ -372,43 +373,7 @@ if(BUILD_TEST)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# start package mapnik
|
# start package mapnik
|
||||||
include(CMakePackageConfigHelpers)
|
include(MapnikExport)
|
||||||
|
|
||||||
# set the cmake targets install location
|
|
||||||
set(INCLUDE_INSTALL_DIR include/)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
|
||||||
VERSION ${PROJECT_VERSION}
|
|
||||||
COMPATIBILITY SameMajorVersion
|
|
||||||
)
|
|
||||||
|
|
||||||
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
|
||||||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
|
||||||
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
|
||||||
PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
|
||||||
DESTINATION ${MAPNIK_CMAKE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake"
|
|
||||||
DESTINATION ${MAPNIK_CMAKE_DIR}/Modules
|
|
||||||
)
|
|
||||||
|
|
||||||
install(EXPORT MapnikTargets
|
|
||||||
DESTINATION ${MAPNIK_CMAKE_DIR}
|
|
||||||
FILE mapnikTargets.cmake
|
|
||||||
NAMESPACE mapnik::
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
|
|
38
cmake/MapnikExport.cmake
Normal file
38
cmake/MapnikExport.cmake
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
# set the cmake targets install location
|
||||||
|
set(INCLUDE_INSTALL_DIR include/)
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion
|
||||||
|
)
|
||||||
|
get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||||
|
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
||||||
|
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||||
|
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES MAPNIK_UTILITIES
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake"
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}/Modules
|
||||||
|
)
|
||||||
|
|
||||||
|
install(EXPORT MapnikTargets
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
FILE mapnikTargets.cmake
|
||||||
|
NAMESPACE mapnik::
|
||||||
|
)
|
|
@ -1,3 +1,6 @@
|
||||||
|
#
|
||||||
|
# Install library targets that consuming users need.
|
||||||
|
#
|
||||||
function(mapnik_install _target)
|
function(mapnik_install _target)
|
||||||
install(TARGETS ${_target}
|
install(TARGETS ${_target}
|
||||||
EXPORT MapnikTargets
|
EXPORT MapnikTargets
|
||||||
|
@ -11,13 +14,14 @@ function(mapnik_install _target)
|
||||||
COMPONENT MapnikDevelopment
|
COMPONENT MapnikDevelopment
|
||||||
)
|
)
|
||||||
get_target_property(TARGET_TYPE "${_target}" TYPE)
|
get_target_property(TARGET_TYPE "${_target}" TYPE)
|
||||||
if (TARGET_TYPE STREQUAL "EXECUTABLE")
|
if (TARGET_TYPE STREQUAL "SHARED_LIBRARY")
|
||||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
set_property(GLOBAL APPEND PROPERTY TARGETS ${_target})
|
||||||
list(APPEND MAPNIK_INSTALLED_TARGETS ${_target})
|
|
||||||
set_property(GLOBAL PROPERTY TARGETS ${MAPNIK_INSTALLED_TARGETS})
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install plugins
|
||||||
|
#
|
||||||
function(mapnik_install_plugin _target)
|
function(mapnik_install_plugin _target)
|
||||||
install(TARGETS ${_target}
|
install(TARGETS ${_target}
|
||||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
@ -28,36 +32,65 @@ function(mapnik_install_plugin _target)
|
||||||
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
COMPONENT MapnikPluginDevelopment
|
COMPONENT MapnikPluginDevelopment
|
||||||
)
|
)
|
||||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
set_property(GLOBAL APPEND PROPERTY PLUGINS ${_target})
|
||||||
list(APPEND MAPNIK_INSTALLED_PLUGINS ${_target})
|
|
||||||
set_property(GLOBAL PROPERTY PLUGINS ${MAPNIK_INSTALLED_PLUGINS})
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install executables. These are available via COMPONENTS in find_package
|
||||||
|
#
|
||||||
|
function(mapnik_install_utility _target)
|
||||||
|
set(_target_name "MapnikUtility_${_target}_Targets")
|
||||||
|
install(TARGETS ${_target}
|
||||||
|
EXPORT ${_target_name}
|
||||||
|
INCLUDES DESTINATION ${MAPNIK_INCLUDE_DIR}
|
||||||
|
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||||
|
COMPONENT MapnikRuntime
|
||||||
|
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||||
|
COMPONENT MapnikRuntime
|
||||||
|
NAMELINK_COMPONENT MapnikDevelopment
|
||||||
|
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||||
|
COMPONENT MapnikDevelopment
|
||||||
|
)
|
||||||
|
install(EXPORT ${_target_name}
|
||||||
|
FILE ${_target_name}.cmake
|
||||||
|
NAMESPACE mapnik::
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
)
|
||||||
|
set_property(GLOBAL APPEND PROPERTY MAPNIK_UTILITIES ${_target})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function(mapnik_install_targets)
|
function(mapnik_install_targets)
|
||||||
if(INSTALL_DEPENDENCIES AND WIN32)
|
if(INSTALL_DEPENDENCIES AND WIN32)
|
||||||
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
||||||
cmake_policy(SET CMP0087 NEW)
|
cmake_policy(SET CMP0087 NEW)
|
||||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
get_property(_installed_utilities GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
get_property(_installed_targets GLOBAL PROPERTY TARGETS)
|
||||||
set(INTERNAL_TARGETS "")
|
get_property(_installed_plugins GLOBAL PROPERTY PLUGINS)
|
||||||
set(INTERNAL_PLUGINS "")
|
set(_internal_executables "")
|
||||||
|
set(_internal_libraries "")
|
||||||
|
|
||||||
foreach(_target IN LISTS MAPNIK_INSTALLED_TARGETS)
|
foreach(_target IN LISTS _installed_utilities)
|
||||||
list(APPEND INTERNAL_TARGETS "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
list(APPEND _internal_executables "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(_target IN LISTS MAPNIK_INSTALLED_PLUGINS)
|
foreach(_target IN LISTS _installed_targets)
|
||||||
list(APPEND INTERNAL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
list(APPEND _internal_libraries "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||||
|
endforeach()
|
||||||
|
foreach(_target IN LISTS _installed_plugins)
|
||||||
|
list(APPEND _internal_libraries "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||||
endforeach()
|
endforeach()
|
||||||
# all other executables get auto detected and fixed.
|
# all other executables get auto detected and fixed.
|
||||||
list(GET INTERNAL_TARGETS 0 INTERNAL_TARGETS)
|
if(_internal_executables)
|
||||||
|
list(GET _internal_executables 0 _internal_executables)
|
||||||
|
endif()
|
||||||
|
|
||||||
INSTALL(CODE "
|
INSTALL(CODE "
|
||||||
message(STATUS \"${INTERNAL_TARGETS}\")
|
message(STATUS \"${_internal_executables}\")
|
||||||
message(STATUS \"${INTERNAL_PLUGINS}\")
|
message(STATUS \"${_internal_libraries}\")
|
||||||
|
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||||
" COMPONENT MapnikRuntime)
|
" COMPONENT MapnikRuntime)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/")
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
@MAPNIK_DEPENDENCIES@
|
@MAPNIK_DEPENDENCIES@
|
||||||
|
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/mapnikTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/mapnikTargets.cmake")
|
||||||
|
|
||||||
check_required_components(mapnik)
|
set(_supported_components @MAPNIK_UTILITIES@)
|
||||||
|
foreach(_comp ${mapnik_FIND_COMPONENTS})
|
||||||
|
if (NOT _comp IN_LIST _supported_components)
|
||||||
|
set(mapnik_FOUND False)
|
||||||
|
set(mapnik_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
||||||
|
endif()
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/MapnikUtility_${_comp}_Targets.cmake")
|
||||||
|
endforeach()
|
||||||
|
|
|
@ -4,7 +4,6 @@ add_executable(mapnik-demo rundemo.cpp)
|
||||||
|
|
||||||
target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik)
|
target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik)
|
||||||
|
|
||||||
mapnik_install(mapnik-demo)
|
|
||||||
mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape)
|
mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape)
|
||||||
mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts)
|
mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts)
|
||||||
mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape)
|
mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape)
|
||||||
|
|
|
@ -61,7 +61,7 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin)
|
||||||
mapnik_install(mapnik-viewer)
|
mapnik_install_utility(mapnik-viewer)
|
||||||
|
|
||||||
mapnik_copy_dependencies(
|
mapnik_copy_dependencies(
|
||||||
TARGETS
|
TARGETS
|
||||||
|
|
|
@ -4,4 +4,4 @@ add_executable(geometry_to_wkb main.cpp)
|
||||||
|
|
||||||
target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik)
|
target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik)
|
||||||
|
|
||||||
mapnik_install(geometry_to_wkb)
|
mapnik_install_utility(geometry_to_wkb)
|
||||||
|
|
|
@ -15,4 +15,4 @@ target_link_libraries(mapnik-index PRIVATE
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(mapnik-index)
|
mapnik_install_utility(mapnik-index)
|
||||||
|
|
|
@ -9,4 +9,4 @@ target_link_libraries(mapnik-render PRIVATE
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(mapnik-render)
|
mapnik_install_utility(mapnik-render)
|
||||||
|
|
|
@ -4,4 +4,4 @@ add_executable(ogrindex ogrindex.cpp)
|
||||||
|
|
||||||
target_link_libraries(ogrindex PRIVATE mapnik::mapnik)
|
target_link_libraries(ogrindex PRIVATE mapnik::mapnik)
|
||||||
|
|
||||||
mapnik_install(ogrindex)
|
mapnik_install_utility(ogrindex)
|
||||||
|
|
|
@ -16,4 +16,4 @@ target_link_libraries(pgsql2sqlite PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(pgsql2sqlite)
|
mapnik_install_utility(pgsql2sqlite)
|
||||||
|
|
|
@ -12,4 +12,4 @@ target_link_libraries(shapeindex PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(shapeindex)
|
mapnik_install_utility(shapeindex)
|
||||||
|
|
|
@ -12,4 +12,4 @@ target_link_libraries(svg2png PRIVATE
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(svg2png)
|
mapnik_install_utility(svg2png)
|
||||||
|
|
Loading…
Reference in a new issue