build utilities correctly

This commit is contained in:
Mathis Logemann 2020-11-21 12:24:34 +01:00
parent f390a830ae
commit e3789e219a
10 changed files with 112 additions and 12 deletions

View file

@ -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)
install(DIRECTORY include/ TYPE INCLUDE)
install(DIRECTORY deps/agg/include/ TYPE INCLUDE)
install(DIRECTORY fonts/ DESTINATION bin/fonts FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")

11
demo/CMakeLists.txt Normal file
View file

@ -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()

11
demo/c++/CMakeLists.txt Normal file
View file

@ -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
)

View file

@ -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
)

View file

@ -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)

View file

@ -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

View file

@ -1,6 +1,8 @@
add_executable(ogrindex ogrindex.cpp)
target_link_libraries(ogrindex PRIVATE mapnik::headers mapnik::mapnik)
install(TARGETS ogrindex
EXPORT MapnikTargets
RUNTIME DESTINATION bin

View file

@ -1,9 +1,21 @@
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

View file

@ -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

View file

@ -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