From e3789e219aa141f3a801d73111fea41f0ea09c33 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 12:24:34 +0100 Subject: [PATCH] build utilities correctly --- CMakeLists.txt | 15 ++++++--- demo/CMakeLists.txt | 11 +++++++ demo/c++/CMakeLists.txt | 11 +++++++ demo/viewer/CMakeLists.txt | 46 ++++++++++++++++++++++++++++ utils/CMakeLists.txt | 2 +- utils/geometry_to_wkb/CMakeLists.txt | 5 ++- utils/ogrindex/CMakeLists.txt | 4 ++- utils/pgsql2sqlite/CMakeLists.txt | 16 ++++++++-- utils/shapeindex/CMakeLists.txt | 7 ++++- utils/svg2png/CMakeLists.txt | 7 ++++- 10 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 demo/CMakeLists.txt create mode 100644 demo/c++/CMakeLists.txt create mode 100644 demo/viewer/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 16c470478..b2b5c971f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,11 @@ option(USE_PLUGIN_INPUT_SHAPE "adds plugin input shape" ON) option(USE_PLUGIN_INPUT_SQLITE "adds plugin input sqlite" ON) option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON) +option(BUILD_DEMO_VIEWER "builds the demo viewer" ON) +option(BUILD_DEMO_CPP "builds the demo c++ application" ON) + + + set(CXX_STANDARD 17) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) @@ -181,9 +186,8 @@ install(TARGETS headers add_subdirectory(deps) add_subdirectory(src) add_subdirectory(plugins) -#add_subdirectory(utils) -#add_subdirectory(utils) -#add_subdirectory(plugins) +add_subdirectory(utils) +add_subdirectory(demo) include(CMakePackageConfigHelpers) @@ -209,5 +213,6 @@ install(EXPORT MapnikTargets DESTINATION lib/cmake/mapnik ) -install(DIRECTORY include/ DESTINATION include) -install(DIRECTORY deps/agg/include/ DESTINATION include) \ No newline at end of file +install(DIRECTORY include/ TYPE INCLUDE) +install(DIRECTORY deps/agg/include/ TYPE INCLUDE) +install(DIRECTORY fonts/ DESTINATION bin/fonts FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt new file mode 100644 index 000000000..96556acb3 --- /dev/null +++ b/demo/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15.0) + +if(BUILD_DEMO_VIEWER) + message(STATUS "Building demo viewer") + add_subdirectory(viewer) +endif() + +if(BUILD_DEMO_CPP) + message(STATUS "Building c++ demo app") + add_subdirectory(c++) +endif() \ No newline at end of file diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt new file mode 100644 index 000000000..84627451b --- /dev/null +++ b/demo/c++/CMakeLists.txt @@ -0,0 +1,11 @@ +project(mapnik-demo) + +add_executable(mapnik-demo rundemo.cpp) + +target_link_libraries(mapnik-demo PRIVATE mapnik::headers mapnik::agg mapnik::mapnik) + +install(TARGETS mapnik-demo + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt new file mode 100644 index 000000000..bc4aa0dc3 --- /dev/null +++ b/demo/viewer/CMakeLists.txt @@ -0,0 +1,46 @@ +project(mapnik-viewer) + +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +add_executable(mapnik-viewer + about_dialog.cpp + info_dialog.cpp + layerdelegate.cpp + layerlistmodel.cpp + layerwidget.cpp + layer_info_dialog.cpp + main.cpp + mainwindow.cpp + mapwidget.cpp + styles_model.cpp + forms/about.ui + forms/info.ui + forms/layer_info.ui + mapnik_viewer.qrc +) + +set_target_properties(mapnik-viewer PROPERTIES + AUTOUIC_SEARCH_PATHS forms + AUTORCC ON + AUTOUIC ON + AUTOMOC ON +) + + +target_link_libraries(mapnik-viewer PRIVATE + Qt5::Widgets + mapnik::headers + mapnik::agg + mapnik::mapnik +) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini +"[mapnik] +plugins_dir=plugins/input +fonts/1/dir=fonts" +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) +install(TARGETS mapnik-viewer + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 8ad98aeb5..1d60b6d18 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15.0) add_subdirectory(geometry_to_wkb) add_subdirectory(mapnik-index) add_subdirectory(mapnik-render) -add_subdirectory(ogrindex) +# add_subdirectory(ogrindex) # missing include file shapeindex/quadtree.hpp add_subdirectory(pgsql2sqlite) add_subdirectory(shapeindex) add_subdirectory(svg2png) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index 12cc699a3..b6ec671bc 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -1,6 +1,9 @@ add_executable(geometry_to_wkb main.cpp) -target_link_libraries(geometry_to_wkb PRIVATE mapnik::headers mapnik::mapnik) +target_link_libraries(geometry_to_wkb PRIVATE + mapnik::headers + mapnik::mapnik +) install(TARGETS geometry_to_wkb EXPORT MapnikTargets diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 0575f26b7..eafa23289 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -1,7 +1,9 @@ add_executable(ogrindex ogrindex.cpp) + target_link_libraries(ogrindex PRIVATE mapnik::headers mapnik::mapnik) + install(TARGETS ogrindex EXPORT MapnikTargets RUNTIME DESTINATION bin -) \ No newline at end of file +) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 29569a904..3ba2f66bc 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,10 +1,22 @@ + +find_package(SQLite3 REQUIRED) +find_package(PostgreSQL REQUIRED) + add_executable(pgsql2sqlite main.cpp sqlite.cpp ) -target_link_libraries(pgsql2sqlite PRIVATE mapnik::headers mapnik::mapnik) +target_include_directories(pgsql2sqlite PRIVATE ../../plugins/input/postgis) +target_link_libraries(pgsql2sqlite PRIVATE + SQLite::SQLite3 + PostgreSQL::PostgreSQL + Boost::program_options + mapnik::headers + mapnik::mapnik +) + install(TARGETS pgsql2sqlite EXPORT MapnikTargets RUNTIME DESTINATION bin -) \ No newline at end of file +) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 15ebf477c..92ab1594a 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -2,7 +2,12 @@ add_executable(shapeindex shapeindex.cpp ) -target_link_libraries(shapeindex PRIVATE mapnik::headers mapnik::mapnik) +target_include_directories(shapeindex PRIVATE ../../plugins/input/shape) +target_link_libraries(shapeindex PRIVATE + Boost::program_options + mapnik::headers + mapnik::mapnik +) install(TARGETS shapeindex EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index feb84e80a..b0819685b 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -2,7 +2,12 @@ add_executable(svg2png svg2png.cpp ) -target_link_libraries(svg2png PRIVATE mapnik::headers mapnik::mapnik) +target_link_libraries(svg2png PRIVATE + Boost::program_options + mapnik::headers + mapnik::mapnik + mapnik::agg +) install(TARGETS svg2png EXPORT MapnikTargets RUNTIME DESTINATION bin