diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ce7fe86f..6d76303d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,15 +22,13 @@ include(MapnikOption) include(MapnikMinimumVersions) include(MapnikFindPackage) include(MapnikInstall) -include(CTest) -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") -mapnik_option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" OFF) -mapnik_option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON) +include(CTest) +add_feature_info(BUILD_TESTING BUILD_TESTING "Adds tests") + mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON) mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) -add_feature_info(BUILD_TESTING BUILD_TESTING "Adds tests") mapnik_option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF) mapnik_option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF) mapnik_option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF) diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 36e36d634..ee9e79af5 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -1,5 +1,3 @@ -project(mapnik-demo) - add_executable(mapnik-demo rundemo.cpp) set_target_properties(mapnik-demo PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index dcd4c5a58..cbe348291 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -1,5 +1,3 @@ -project(mapnik-viewer) - find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index 2c646b2d3..20f9144be 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -13,9 +13,9 @@ Make sure that all dependencies are installed. All available cmake options are listed at the top of [CMakeLists.txt](../CMakeLists.txt). Pass your options while configuring e.g.: `cmake -DBUILD_DEMO_VIEWER=OFF ..` to disable the build of the demo viewer application. -To quickstart open a console in the root mapnik dir and execute the following commands: (Pass all options and dependency dirs after `-DBUILD_TEST=OFF`) +To quickstart open a console in the root mapnik dir and execute the following commands: (Pass all options and dependency dirs after `-DBUILD_TESTING=OFF`) ``` -> cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=OFF +> cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF > cmake --build build --target install ``` @@ -64,20 +64,19 @@ This could look like this: }, "configurePresets": [ { - "name": "vcpkg-x64-win-debug", - "inherits": "windows-default-debug", + "name": "vcpkg", + "hidden": true, "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "/scripts/buildsystems/vcpkg.cmake", - "ADDITIONAL_LIBARIES_PATHS":"/installed/x64-windows/debug/bin" + "CMAKE_TOOLCHAIN_FILE": "/scripts/buildsystems/vcpkg.cmake" } + } + { + "name": "vcpkg-x64-win-debug", + "inherits": ["vcpkg", "windows-default-debug"] }, { "name": "vcpkg-x64-win-release", - "inherits": "windows-default-release", - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "/scripts/buildsystems/vcpkg.cmake", - "ADDITIONAL_LIBARIES_PATHS":"/installed/x64-windows/bin" - } + "inherits": ["vcpkg", "windows-default-release"] } ] } diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 846870eb9..dcc966157 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-csv) - add_library(input-csv MODULE csv_datasource.cpp csv_featureset.cpp diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index ece9db01c..746953a3c 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-gdal) - find_package(GDAL REQUIRED) add_library(input-gdal MODULE diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index faf9a0ef1..870b603d9 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-geobuf) - add_library(input-geobuf MODULE geobuf_datasource.cpp geobuf_featureset.cpp diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 60f5db98d..e32dcfcb1 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-geojson) - add_library(input-geojson MODULE geojson_datasource.cpp geojson_featureset.cpp diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 87917a9f0..f460eb033 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-ogr) - find_package(GDAL REQUIRED) add_library(input-ogr MODULE diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 5fdd60208..f7ac4ff66 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-pgraster) - find_package(PostgreSQL REQUIRED) add_library(input-pgraster MODULE diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 18d2ebf05..796e0c90e 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-postgis) - find_package(PostgreSQL REQUIRED) add_library(input-postgis MODULE diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index c7bcc4c73..c7426ea3a 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-raster) - add_library(input-raster MODULE raster_datasource.cpp raster_featureset.cpp diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index bc2f6c438..6d9a9a7d1 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-shape) - add_library(input-shape MODULE dbfile.cpp dbf_test.cpp diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 682978347..984bdfd1b 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-sqlite) - find_package(SQLite3 REQUIRED) add_library(input-sqlite MODULE diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 3ff00894c..fd2b4994b 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -1,5 +1,3 @@ -project(input-topojson) - add_library(input-topojson MODULE topojson_datasource.cpp topojson_featureset.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4d28b9cc9..847511f49 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,3 @@ -project(mapnik-test) - find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(PostgreSQL REQUIRED) @@ -194,7 +192,6 @@ target_link_libraries(mapnik-test-visual PRIVATE ) target_include_directories(mapnik-test-visual PRIVATE "${catch2_SOURCE_DIR}/single_include/catch2" ${CMAKE_CURRENT_BINARY_DIR}) -include(CTest) include("${catch2_SOURCE_DIR}/contrib/Catch.cmake") include("${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake") @@ -204,14 +201,6 @@ file(COPY unit/data DESTINATION "${MAPNIK_OUTPUT_DIR}/test/unit") file(COPY "${mapnik_SOURCE_DIR}/demo/data" DESTINATION "${MAPNIK_OUTPUT_DIR}/demo") add_dependencies(mapnik-test-unit mapnik-index shapeindex) -set(m_proj_test_env "") -if(DEFINED PROJ_LIB) - set(m_proj_test_env "PROJ_LIB=${PROJ_LIB}") -elseif(DEFINED ENV{PROJ_LIB}) - set(m_proj_test_env "PROJ_LIB=$ENV{PROJ_LIB}") -endif() -message(STATUS "using proj lib for unit tests: ${m_proj_test_env}") - if(WIN32) set(m_test_path "\$;$;$ENV{PATH}>,\\\\\\\\\;>") else() @@ -223,7 +212,6 @@ catch_discover_tests(mapnik-test-unit PROPERTIES ENVIRONMENT "PATH=${m_test_path}" - ${m_proj_test_env} ) catch_discover_tests(agg_rasterizer_integer_overflow_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}") catch_discover_tests(datasource_registration_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}") diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index 09b395bff..518f4ac9a 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -1,5 +1,3 @@ -project(geometry_to_wkb) - add_executable(geometry_to_wkb main.cpp) target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index fb3e2ae05..ec6ce97eb 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -1,5 +1,3 @@ -project(mapnik-index) - find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(mapnik-index diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 09ff8d744..27ccfbe8d 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -1,5 +1,3 @@ -project(mapnik-render) - find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(mapnik-render mapnik-render.cpp) diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index b3c750dca..69f27cdd6 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -1,5 +1,3 @@ -project(ogrindex) - add_executable(ogrindex ogrindex.cpp) target_link_libraries(ogrindex PRIVATE mapnik::mapnik) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index e4540f37f..6def100c0 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,4 +1,3 @@ -project(pgsql2sqlite) find_package(Boost ${BOOST_MIN_VERSION} 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 eef6169d0..d39ca3f04 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -1,5 +1,3 @@ -project(shapeindex) - find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(shapeindex diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index 1f95d2827..dc239cd2b 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -1,5 +1,3 @@ -project(svg2png) - find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) add_executable(svg2png