diff --git a/CMakeLists.txt b/CMakeLists.txt index dc30e0b67..9de080db4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,15 +47,23 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) +set(PLUGINS_INSTALL_DIR bin/plugins/input CACHE STRING "installs the plugins in the specified directory") +get_filename_component(ABSOLUTE_PLUGINS_INSTALL_DIR ${PLUGINS_INSTALL_DIR} ABSOLUTE) +message("Installing plugins to ${ABSOLUTE_PLUGINS_INSTALL_DIR}") +set(FONTS_INSTALL_DIR bin/fonts CACHE STRING "installs the fonts in the specified directory") +get_filename_component(ABSOLUTE_FONTS_INSTALL_DIR ${FONTS_INSTALL_DIR} ABSOLUTE) +message("Installing fonts to ${FONTS_INSTALL_DIR}") + + set(CMAKE_CXX_STANDARD 14) -find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) +find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) find_package(Freetype REQUIRED) find_package(harfbuzz CONFIG REQUIRED) if(USE_EXTERNAL_MAPBOX_GEOMETRY) - # provide a way to specify the include dirs with the CACHE VARIABLES + # this is used to provide a way to specify include dirs with CACHE VARIABLES if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS) message(STATUS "Searching for the include dir of mapbox/geometry.hpp") find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp" REQUIRED) @@ -179,16 +187,14 @@ endif() add_library(headers INTERFACE) add_library(mapnik::headers ALIAS headers) -# todo: mapbox includes need to included private. target_include_directories(headers INTERFACE $ + $ + $ + $ + $ + $ $ - ${MAPBOX_GEOMETRY_INCLUDE_DIRS} - ${MAPBOX_POLYLABEL_INCLUDE_DIRS} - ${MAPBOX_VARIANT_INCLUDE_DIRS} - ${MAPBOX_PROTOZERO_INCLUDE_DIRS} - $ - $ ) target_link_libraries(headers INTERFACE Boost::boost @@ -220,8 +226,12 @@ if(BUILD_TEST) add_subdirectory(test) endif() - +# start package mapnik include(CMakePackageConfigHelpers) + +# set the cmake targets install location +set(INSTALL_CMAKE_DIR lib/cmake) +set(INCLUDE_INSTALL_DIR include/) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" VERSION ${PROJECT_VERSION} @@ -230,20 +240,21 @@ write_basic_package_version_file( configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MapnikConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" - INSTALL_DESTINATION lib/cmake/mapnik + INSTALL_DESTINATION ${INSTALL_CMAKE_DIR} + PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" - DESTINATION lib/cmake/mapnik + DESTINATION ${INSTALL_CMAKE_DIR} ) install(EXPORT MapnikTargets FILE MapnikTargets.cmake NAMESPACE mapnik:: - DESTINATION lib/cmake/mapnik + DESTINATION ${INSTALL_CMAKE_DIR} ) install(DIRECTORY include/ TYPE INCLUDE) install(DIRECTORY deps/agg/include/ TYPE INCLUDE) -install(DIRECTORY fonts/ DESTINATION bin/fonts FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") +install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") diff --git a/cmake/MapnikConfig.cmake.in b/cmake/MapnikConfig.cmake.in index 4a1773f42..3075df2d9 100644 --- a/cmake/MapnikConfig.cmake.in +++ b/cmake/MapnikConfig.cmake.in @@ -1,5 +1,9 @@ @PACKAGE_INIT@ +set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" CACHE STRING "") +set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_PLUGINS_INSTALL_DIR@" CACHE STRING "") +set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "") + include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") check_required_components(mapnik) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index bc4aa0dc3..721b76195 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -35,8 +35,8 @@ target_link_libraries(mapnik-viewer PRIVATE ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini "[mapnik] -plugins_dir=plugins/input -fonts/1/dir=fonts" +plugins_dir=${ABSOLUTE_PLUGINS_INSTALL_DIR} +fonts/1/dir=${ABSOLUTE_FONTS_INSTALL_DIR}" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) install(TARGETS mapnik-viewer diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 4597cee15..bef173f84 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -22,7 +22,5 @@ set_target_properties(input-csv PROPERTIES SUFFIX ".input") #install(TARGETS input-csv DESTINATION bin/plugins/input) install(TARGETS input-csv - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) \ No newline at end of file diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 4c2919cc1..366b3f920 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") set_target_properties(input-gdal PROPERTIES SUFFIX ".input") install(TARGETS input-gdal - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 75bd7af2a..3e36629ea 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -16,7 +16,5 @@ set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf") set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") install(TARGETS input-geobuf - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input -) + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} +) \ No newline at end of file diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index d8f945e0c..26a0821a2 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson") set_target_properties(input-geojson PROPERTIES SUFFIX ".input") install(TARGETS input-geojson - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 034311c7e..c01c6bb5f 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -22,7 +22,5 @@ set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") set_target_properties(input-ogr PROPERTIES SUFFIX ".input") install(TARGETS input-ogr - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 20ae20760..a6166128d 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -21,7 +21,5 @@ set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster") set_target_properties(input-pgraster PROPERTIES SUFFIX ".input") install(TARGETS input-pgraster - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 3085e6246..ba3192a98 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis") set_target_properties(input-postgis PROPERTIES SUFFIX ".input") install(TARGETS input-postgis - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 557668536..2aed0fdc0 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -18,7 +18,5 @@ set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster") set_target_properties(input-raster PROPERTIES SUFFIX ".input") install(TARGETS input-raster - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 64beadd57..6753eb9de 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -21,7 +21,5 @@ set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape") set_target_properties(input-shape PROPERTIES SUFFIX ".input") install(TARGETS input-shape - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 8b4a57cff..439d19dfb 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite") set_target_properties(input-sqlite PROPERTIES SUFFIX ".input") install(TARGETS input-sqlite - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index f727a5e19..6b3ffb16f 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -18,7 +18,5 @@ set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson") set_target_properties(input-topojson PROPERTIES SUFFIX ".input") install(TARGETS input-topojson - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 400931134..a73a0f288 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,7 @@ project(mapnik-test) +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + include(FetchContent) include(CopyDllsForDebug) @@ -14,8 +16,6 @@ set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) add_library(Catch INTERFACE) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) - - add_executable(mapnik-test-unit unit/run.cpp unit/color/css_color.cpp diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index b6ec671bc..adb0c8409 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -1,3 +1,5 @@ +project(geometry_to_wkb) + add_executable(geometry_to_wkb main.cpp) target_link_libraries(geometry_to_wkb PRIVATE diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index b06de87b2..e2c8f2cfb 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -1,3 +1,7 @@ +project(mapnik-index) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(mapnik-index mapnik-index.cpp process_csv_file.cpp diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 0e2e6cd10..b8dde3cd6 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -1,3 +1,7 @@ +project(mapnik-render) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(mapnik-render mapnik-render.cpp) target_link_libraries(mapnik-render PRIVATE diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index eafa23289..7ecad8db9 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -1,3 +1,5 @@ +project(ogrindex) + add_executable(ogrindex ogrindex.cpp) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 3ba2f66bc..baa4ff156 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,4 +1,5 @@ - +project(pgsql2sqlite) +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) find_package(SQLite3 REQUIRED) find_package(PostgreSQL REQUIRED) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 92ab1594a..b1a555d77 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -1,3 +1,7 @@ +project(shapeindex) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(shapeindex shapeindex.cpp ) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index b0819685b..eb1021903 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -1,3 +1,7 @@ +project(svg2png) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(svg2png svg2png.cpp )