[CMake] unify and simplify install commands.; Add Components to targets
This commit is contained in:
parent
9d4d7fd273
commit
25774ac82a
5 changed files with 37 additions and 76 deletions
|
@ -95,24 +95,13 @@ set(CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD
|
||||||
set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json")
|
set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json")
|
||||||
message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}")
|
message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}")
|
||||||
|
|
||||||
if(WIN32)
|
include(GNUInstallDirs)
|
||||||
set(DEFAULT_BIN_DIR bin)
|
# See for more details: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html
|
||||||
set(DEFAULT_LIB_DIR lib)
|
set(MAPNIK_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "Install directory for binaries")
|
||||||
set(DEFAULT_ARCHIVE_DIR lib)
|
set(MAPNIK_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for libraries")
|
||||||
else()
|
set(MAPNIK_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for archives")
|
||||||
include(GNUInstallDirs)
|
set(MAPNIK_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Install directory for archives")
|
||||||
set(DEFAULT_BIN_DIR ${CMAKE_INSTALL_BINDIR})
|
set(MAPNIK_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets")
|
||||||
set(DEFAULT_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
set(DEFAULT_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#runtime-output-artifacts
|
|
||||||
set(MAPNIK_BIN_DIR ${DEFAULT_BIN_DIR} CACHE STRING "Install directory for binaries")
|
|
||||||
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#library-output-artifacts
|
|
||||||
set(MAPNIK_LIB_DIR ${DEFAULT_LIB_DIR} CACHE STRING "Install directory for libraries")
|
|
||||||
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#archive-output-artifacts
|
|
||||||
set(MAPNIK_ARCHIVE_DIR ${DEFAULT_ARCHIVE_DIR} CACHE STRING "Install directory for archives")
|
|
||||||
|
|
||||||
set(INSTALL_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets")
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input)
|
set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input)
|
||||||
|
@ -367,15 +356,7 @@ target_link_libraries(core INTERFACE
|
||||||
)
|
)
|
||||||
target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS})
|
target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS})
|
||||||
|
|
||||||
install(TARGETS core
|
mapnik_install(TARGET core)
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(deps)
|
add_subdirectory(deps)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -404,7 +385,7 @@ write_basic_package_version_file(
|
||||||
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
||||||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||||
INSTALL_DESTINATION ${INSTALL_CMAKE_DIR}
|
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES
|
PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -412,7 +393,7 @@ install(
|
||||||
FILES
|
FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||||
DESTINATION ${INSTALL_CMAKE_DIR}
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
@ -420,31 +401,31 @@ install(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake"
|
||||||
DESTINATION ${INSTALL_CMAKE_DIR}/Modules
|
DESTINATION ${MAPNIK_CMAKE_DIR}/Modules
|
||||||
)
|
)
|
||||||
|
|
||||||
install(EXPORT MapnikTargets
|
install(EXPORT MapnikTargets
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
FILE mapnikTargets.cmake
|
FILE mapnikTargets.cmake
|
||||||
NAMESPACE mapnik::
|
NAMESPACE mapnik::
|
||||||
DESTINATION ${INSTALL_CMAKE_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY include/ TYPE INCLUDE)
|
install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
install(DIRECTORY deps/agg/include/ TYPE INCLUDE)
|
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
install(DIRECTORY deps/mapnik TYPE INCLUDE)
|
install(DIRECTORY deps/mapnik DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")
|
install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")
|
||||||
|
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY)
|
if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL)
|
if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO)
|
if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_VARIANT)
|
if(NOT USE_EXTERNAL_MAPBOX_VARIANT)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
mapnik_install_targets()
|
mapnik_install_targets()
|
||||||
|
|
|
@ -6,15 +6,25 @@ function(mapnik_install)
|
||||||
|
|
||||||
if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN)
|
if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN)
|
||||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
EXPORT MapnikTargets
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
INCLUDES DESTINATION ${MAPNIK_INCLUDE_DIR}
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_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
|
||||||
)
|
)
|
||||||
elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN)
|
elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN)
|
||||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
||||||
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
||||||
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
||||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
COMPONENT MapnikPluginRuntime
|
||||||
|
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
COMPONENT MapnikPluginRuntime
|
||||||
|
NAMELINK_COMPONENT MapnikPluginDevelopment
|
||||||
|
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
COMPONENT MapnikPluginDevelopment
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(NOT MAPNIK_INSTALL_IS_PLUGIN)
|
if(NOT MAPNIK_INSTALL_IS_PLUGIN)
|
||||||
|
@ -56,7 +66,7 @@ function(mapnik_install_targets)
|
||||||
|
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||||
" COMPONENT Runtime)
|
" COMPONENT MapnikRuntime)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -303,14 +303,4 @@ if(MSVC)
|
||||||
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS mapnik
|
mapnik_install(TARGET mapnik)
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
mapnik_install(TARGET mapnik ALREADY_INSTALLED)
|
|
||||||
|
|
|
@ -31,14 +31,4 @@ set_target_properties(json PROPERTIES
|
||||||
PREFIX "libmapnik-"
|
PREFIX "libmapnik-"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS json
|
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
mapnik_install(TARGET json)
|
mapnik_install(TARGET json)
|
||||||
|
|
|
@ -23,14 +23,4 @@ set_target_properties(wkt PROPERTIES
|
||||||
PREFIX "libmapnik-"
|
PREFIX "libmapnik-"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS wkt
|
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
mapnik_install(TARGET wkt)
|
mapnik_install(TARGET wkt)
|
||||||
|
|
Loading…
Reference in a new issue