install dependencies. Required for windows (and ?macos?). Needs testing on linux.
This commit is contained in:
parent
1929fbc0ba
commit
e1fa32f21f
26 changed files with 113 additions and 101 deletions
|
@ -17,10 +17,12 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}")
|
|||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(MapnikFindPackage)
|
||||
include(MapnikCopyDependencies)
|
||||
include(MapnikInstall)
|
||||
|
||||
set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully")
|
||||
option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" ON)
|
||||
option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON)
|
||||
option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON)
|
||||
|
||||
option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON)
|
||||
option(BUILD_TEST "builds the tests" ON)
|
||||
|
@ -177,6 +179,9 @@ endif()
|
|||
set(MAPNIK_COMPILE_DEFS "")
|
||||
set(MAPNIK_OPTIONAL_LIBS "")
|
||||
set(MAPNIK_OPTIONAL_LIBS_INCLUDE "")
|
||||
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
||||
set_property(GLOBAL PROPERTY TARGETS "")
|
||||
set_property(GLOBAL PROPERTY PLUGINS "")
|
||||
|
||||
if(USE_BIGINT)
|
||||
message(STATUS "uses BIGINT")
|
||||
|
@ -331,3 +336,5 @@ install(EXPORT MapnikTargets
|
|||
install(DIRECTORY include/ TYPE INCLUDE)
|
||||
install(DIRECTORY deps/agg/include/ TYPE INCLUDE)
|
||||
install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")
|
||||
|
||||
mapnik_install_targets()
|
||||
|
|
|
@ -33,20 +33,23 @@ function(mapnik_create_benchmark)
|
|||
target_include_directories(${TARGET_NAME} PRIVATE include)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik)
|
||||
|
||||
# it might be possible that some buildsystems generate different directories. So invoke the scripts for all benchmarks
|
||||
mapnik_copy_plugins(TARGET ${TARGET_NAME}
|
||||
DESTINATION plugins/input
|
||||
PLUGINS
|
||||
input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson
|
||||
)
|
||||
mapnik_require_fonts(TARGET ${TARGET_NAME} mapnik-test-unit DESTINATION fonts)
|
||||
|
||||
mapnik_copy_dependencies(TARGETS ${TARGET_NAME}
|
||||
PLUGINS
|
||||
input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson
|
||||
)
|
||||
mapnik_copy_dependencies(TARGETS ${TARGET_NAME})
|
||||
endfunction()
|
||||
|
||||
foreach(benchmark ${BENCHMARK_SRCS})
|
||||
mapnik_create_benchmark(${benchmark})
|
||||
endforeach()
|
||||
|
||||
# we just need one target to reference the directory correctly. mapnik-benchmark-normalize_angle is just the first in BENCHMARK_SRCS
|
||||
mapnik_require_fonts(TARGET mapnik-benchmark-normalize_angle DESTINATION fonts)
|
||||
# copy all plugins
|
||||
mapnik_copy_plugins(TARGET mapnik-benchmark-normalize_angle
|
||||
DESTINATION plugins/input
|
||||
PLUGINS
|
||||
input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson
|
||||
)
|
||||
# copy all plugin dlls.
|
||||
mapnik_copy_dependencies(TARGETS mapnik-benchmark-normalize_angle
|
||||
PLUGINS
|
||||
input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson
|
||||
)
|
||||
|
|
61
cmake/MapnikInstall.cmake
Normal file
61
cmake/MapnikInstall.cmake
Normal file
|
@ -0,0 +1,61 @@
|
|||
function(mapnik_install)
|
||||
set(options ALREADY_INSTALLED IS_PLUGIN)
|
||||
set(oneValueArgs TARGET)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND NOT ${MAPNIK_INSTALL_IS_PLUGIN})
|
||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
elseif(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND ${MAPNIK_INSTALL_IS_PLUGIN})
|
||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
endif()
|
||||
if(NOT ${MAPNIK_INSTALL_IS_PLUGIN})
|
||||
message(STATUS "${MAPNIK_INSTALL_TARGET}")
|
||||
get_target_property(TARGET_TYPE "${MAPNIK_INSTALL_TARGET}" TYPE)
|
||||
if (TARGET_TYPE STREQUAL "EXECUTABLE")
|
||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
||||
list(APPEND MAPNIK_INSTALLED_TARGETS ${MAPNIK_INSTALL_TARGET})
|
||||
set_property(GLOBAL PROPERTY TARGETS ${MAPNIK_INSTALLED_TARGETS})
|
||||
endif()
|
||||
else()
|
||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
||||
list(APPEND MAPNIK_INSTALLED_PLUGINS ${MAPNIK_INSTALL_TARGET})
|
||||
set_property(GLOBAL PROPERTY PLUGINS ${MAPNIK_INSTALLED_PLUGINS})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(mapnik_install_targets)
|
||||
if(INSTALL_DEPENDENCIES)
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
||||
cmake_policy(SET CMP0087 NEW)
|
||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
||||
set(INTERNAL_TARGETS "")
|
||||
set(INTERNAL_PLUGINS "")
|
||||
|
||||
foreach(_target IN LISTS MAPNIK_INSTALLED_TARGETS)
|
||||
list(APPEND INTERNAL_TARGETS "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||
endforeach()
|
||||
foreach(_target IN LISTS MAPNIK_INSTALLED_PLUGINS)
|
||||
list(APPEND INTERNAL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||
endforeach()
|
||||
# all other executables get auto detected and fixed.
|
||||
list(GET INTERNAL_TARGETS 0 INTERNAL_TARGETS)
|
||||
|
||||
INSTALL(CODE "
|
||||
message(STATUS \"${INTERNAL_TARGETS}\")
|
||||
message(STATUS \"${INTERNAL_PLUGINS}\")
|
||||
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||
" COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
endfunction()
|
|
@ -4,12 +4,7 @@ add_executable(mapnik-demo rundemo.cpp)
|
|||
|
||||
target_link_libraries(mapnik-demo PRIVATE mapnik::core mapnik::agg mapnik::mapnik)
|
||||
|
||||
install(TARGETS mapnik-demo
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET mapnik-demo)
|
||||
mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape)
|
||||
mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts)
|
||||
mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape)
|
||||
|
|
|
@ -39,11 +39,7 @@ plugins_dir=${PLUGINS_INSTALL_DIR}
|
|||
fonts/1/dir=${FONTS_INSTALL_DIR}"
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin)
|
||||
install(TARGETS mapnik-viewer
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
mapnik_install(TARGET mapnik-viewer)
|
||||
|
||||
mapnik_copy_dependencies(
|
||||
TARGETS
|
||||
|
|
|
@ -23,3 +23,5 @@ set_target_properties(input-csv PROPERTIES SUFFIX ".input")
|
|||
install(TARGETS input-csv
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET input-csv IS_PLUGIN)
|
||||
|
|
|
@ -18,6 +18,4 @@ set_target_properties(input-gdal PROPERTIES PREFIX "")
|
|||
set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal")
|
||||
set_target_properties(input-gdal PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-gdal
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-gdal IS_PLUGIN)
|
||||
|
|
|
@ -14,6 +14,4 @@ set_target_properties(input-geobuf PROPERTIES PREFIX "")
|
|||
set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf")
|
||||
set_target_properties(input-geobuf PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-geobuf
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-geobuf IS_PLUGIN)
|
||||
|
|
|
@ -18,6 +18,4 @@ set_target_properties(input-geojson PROPERTIES PREFIX "")
|
|||
set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson")
|
||||
set_target_properties(input-geojson PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-geojson
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-geojson IS_PLUGIN)
|
||||
|
|
|
@ -20,6 +20,4 @@ set_target_properties(input-ogr PROPERTIES PREFIX "")
|
|||
set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr")
|
||||
set_target_properties(input-ogr PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-ogr
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-ogr IS_PLUGIN)
|
||||
|
|
|
@ -19,6 +19,4 @@ set_target_properties(input-pgraster PROPERTIES PREFIX "")
|
|||
set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster")
|
||||
set_target_properties(input-pgraster PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-pgraster
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-pgraster IS_PLUGIN)
|
||||
|
|
|
@ -18,6 +18,4 @@ set_target_properties(input-postgis PROPERTIES PREFIX "")
|
|||
set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis")
|
||||
set_target_properties(input-postgis PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-postgis
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-postgis IS_PLUGIN)
|
||||
|
|
|
@ -16,6 +16,4 @@ set_target_properties(input-raster PROPERTIES PREFIX "")
|
|||
set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster")
|
||||
set_target_properties(input-raster PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-raster
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-raster IS_PLUGIN)
|
||||
|
|
|
@ -19,6 +19,4 @@ set_target_properties(input-shape PROPERTIES PREFIX "")
|
|||
set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape")
|
||||
set_target_properties(input-shape PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-shape
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-shape IS_PLUGIN)
|
||||
|
|
|
@ -18,6 +18,4 @@ set_target_properties(input-sqlite PROPERTIES PREFIX "")
|
|||
set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite")
|
||||
set_target_properties(input-sqlite PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-sqlite
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-sqlite IS_PLUGIN)
|
||||
|
|
|
@ -16,6 +16,4 @@ set_target_properties(input-topojson PROPERTIES PREFIX "")
|
|||
set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson")
|
||||
set_target_properties(input-topojson PROPERTIES SUFFIX ".input")
|
||||
|
||||
install(TARGETS input-topojson
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
)
|
||||
mapnik_install(TARGET input-topojson IS_PLUGIN)
|
||||
|
|
|
@ -303,3 +303,5 @@ install(TARGETS mapnik
|
|||
INCLUDES DESTINATION include/
|
||||
PUBLIC_HEADER DESTINATION include/
|
||||
)
|
||||
|
||||
mapnik_install(TARGET mapnik ALREADY_INSTALLED)
|
||||
|
|
|
@ -26,9 +26,4 @@ target_include_directories(json PRIVATE
|
|||
)
|
||||
target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB})
|
||||
|
||||
install(TARGETS json
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
mapnik_install(TARGET json)
|
||||
|
|
|
@ -18,9 +18,4 @@ target_include_directories(wkt PRIVATE
|
|||
)
|
||||
target_link_libraries(wkt PRIVATE mapnik::core)
|
||||
|
||||
install(TARGETS wkt
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
mapnik_install(TARGET wkt)
|
||||
|
|
|
@ -7,9 +7,4 @@ target_link_libraries(geometry_to_wkb PRIVATE
|
|||
mapnik::mapnik
|
||||
)
|
||||
|
||||
install(TARGETS geometry_to_wkb
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
mapnik_install(TARGET geometry_to_wkb)
|
||||
|
|
|
@ -15,9 +15,5 @@ target_link_libraries(mapnik-index PRIVATE
|
|||
mapnik::wkt
|
||||
Boost::program_options
|
||||
)
|
||||
install(TARGETS mapnik-index
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET mapnik-index)
|
||||
|
|
|
@ -9,9 +9,5 @@ target_link_libraries(mapnik-render PRIVATE
|
|||
mapnik::mapnik
|
||||
Boost::program_options
|
||||
)
|
||||
install(TARGETS mapnik-render
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET mapnik-render)
|
||||
|
|
|
@ -11,3 +11,5 @@ install(TARGETS ogrindex
|
|||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET mapnik-ogrindex)
|
||||
|
|
|
@ -17,9 +17,4 @@ target_link_libraries(pgsql2sqlite PRIVATE
|
|||
mapnik::mapnik
|
||||
)
|
||||
|
||||
install(TARGETS pgsql2sqlite
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
mapnik_install(TARGET pgsql2sqlite)
|
||||
|
|
|
@ -12,9 +12,5 @@ target_link_libraries(shapeindex PRIVATE
|
|||
mapnik::core
|
||||
mapnik::mapnik
|
||||
)
|
||||
install(TARGETS shapeindex
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET shapeindex)
|
||||
|
|
|
@ -12,9 +12,5 @@ target_link_libraries(svg2png PRIVATE
|
|||
mapnik::mapnik
|
||||
mapnik::agg
|
||||
)
|
||||
install(TARGETS svg2png
|
||||
EXPORT MapnikTargets
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
|
||||
mapnik_install(TARGET svg2png)
|
||||
|
|
Loading…
Reference in a new issue