[CMake] remove obsolete statements/improve docs

[CMake] remove obsolete variables and improve docs

[CMake] remove proj env var
This commit is contained in:
Mathis Logemann 2021-11-14 23:37:21 +01:00
parent f0940c2075
commit 7a7a8125a9
23 changed files with 13 additions and 67 deletions

View file

@ -22,15 +22,13 @@ include(MapnikOption)
include(MapnikMinimumVersions) include(MapnikMinimumVersions)
include(MapnikFindPackage) include(MapnikFindPackage)
include(MapnikInstall) 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") include(CTest)
mapnik_option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" OFF) add_feature_info(BUILD_TESTING BUILD_TESTING "Adds tests")
mapnik_option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON)
mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON) 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) 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_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_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) mapnik_option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF)

View file

@ -1,5 +1,3 @@
project(mapnik-demo)
add_executable(mapnik-demo rundemo.cpp) add_executable(mapnik-demo rundemo.cpp)
set_target_properties(mapnik-demo PROPERTIES set_target_properties(mapnik-demo PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"

View file

@ -1,5 +1,3 @@
project(mapnik-viewer)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)

View file

@ -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). 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. 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 > cmake --build build --target install
``` ```
@ -64,20 +64,19 @@ This could look like this:
}, },
"configurePresets": [ "configurePresets": [
{ {
"name": "vcpkg-x64-win-debug", "name": "vcpkg",
"inherits": "windows-default-debug", "hidden": true,
"cacheVariables": { "cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake", "CMAKE_TOOLCHAIN_FILE": "<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake"
"ADDITIONAL_LIBARIES_PATHS":"<path-to-vcpkg>/installed/x64-windows/debug/bin"
} }
}
{
"name": "vcpkg-x64-win-debug",
"inherits": ["vcpkg", "windows-default-debug"]
}, },
{ {
"name": "vcpkg-x64-win-release", "name": "vcpkg-x64-win-release",
"inherits": "windows-default-release", "inherits": ["vcpkg", "windows-default-release"]
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake",
"ADDITIONAL_LIBARIES_PATHS":"<path-to-vcpkg>/installed/x64-windows/bin"
}
} }
] ]
} }

View file

@ -1,5 +1,3 @@
project(input-csv)
add_library(input-csv MODULE add_library(input-csv MODULE
csv_datasource.cpp csv_datasource.cpp
csv_featureset.cpp csv_featureset.cpp

View file

@ -1,5 +1,3 @@
project(input-gdal)
find_package(GDAL REQUIRED) find_package(GDAL REQUIRED)
add_library(input-gdal MODULE add_library(input-gdal MODULE

View file

@ -1,5 +1,3 @@
project(input-geobuf)
add_library(input-geobuf MODULE add_library(input-geobuf MODULE
geobuf_datasource.cpp geobuf_datasource.cpp
geobuf_featureset.cpp geobuf_featureset.cpp

View file

@ -1,5 +1,3 @@
project(input-geojson)
add_library(input-geojson MODULE add_library(input-geojson MODULE
geojson_datasource.cpp geojson_datasource.cpp
geojson_featureset.cpp geojson_featureset.cpp

View file

@ -1,5 +1,3 @@
project(input-ogr)
find_package(GDAL REQUIRED) find_package(GDAL REQUIRED)
add_library(input-ogr MODULE add_library(input-ogr MODULE

View file

@ -1,5 +1,3 @@
project(input-pgraster)
find_package(PostgreSQL REQUIRED) find_package(PostgreSQL REQUIRED)
add_library(input-pgraster MODULE add_library(input-pgraster MODULE

View file

@ -1,5 +1,3 @@
project(input-postgis)
find_package(PostgreSQL REQUIRED) find_package(PostgreSQL REQUIRED)
add_library(input-postgis MODULE add_library(input-postgis MODULE

View file

@ -1,5 +1,3 @@
project(input-raster)
add_library(input-raster MODULE add_library(input-raster MODULE
raster_datasource.cpp raster_datasource.cpp
raster_featureset.cpp raster_featureset.cpp

View file

@ -1,5 +1,3 @@
project(input-shape)
add_library(input-shape MODULE add_library(input-shape MODULE
dbfile.cpp dbfile.cpp
dbf_test.cpp dbf_test.cpp

View file

@ -1,5 +1,3 @@
project(input-sqlite)
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
add_library(input-sqlite MODULE add_library(input-sqlite MODULE

View file

@ -1,5 +1,3 @@
project(input-topojson)
add_library(input-topojson MODULE add_library(input-topojson MODULE
topojson_datasource.cpp topojson_datasource.cpp
topojson_featureset.cpp topojson_featureset.cpp

View file

@ -1,5 +1,3 @@
project(mapnik-test)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
find_package(PostgreSQL REQUIRED) 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}) 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/Catch.cmake")
include("${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.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") file(COPY "${mapnik_SOURCE_DIR}/demo/data" DESTINATION "${MAPNIK_OUTPUT_DIR}/demo")
add_dependencies(mapnik-test-unit mapnik-index shapeindex) 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) if(WIN32)
set(m_test_path "\$<JOIN:\$<SHELL_PATH:$<TARGET_FILE_DIR:mapnik-index>;$<TARGET_FILE_DIR:shapeindex>;$ENV{PATH}>,\\\\\\\\\;>") set(m_test_path "\$<JOIN:\$<SHELL_PATH:$<TARGET_FILE_DIR:mapnik-index>;$<TARGET_FILE_DIR:shapeindex>;$ENV{PATH}>,\\\\\\\\\;>")
else() else()
@ -223,7 +212,6 @@ catch_discover_tests(mapnik-test-unit
PROPERTIES PROPERTIES
ENVIRONMENT ENVIRONMENT
"PATH=${m_test_path}" "PATH=${m_test_path}"
${m_proj_test_env}
) )
catch_discover_tests(agg_rasterizer_integer_overflow_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}") catch_discover_tests(agg_rasterizer_integer_overflow_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}")
catch_discover_tests(datasource_registration_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}") catch_discover_tests(datasource_registration_test WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}")

View file

@ -1,5 +1,3 @@
project(geometry_to_wkb)
add_executable(geometry_to_wkb main.cpp) add_executable(geometry_to_wkb main.cpp)
target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik)

View file

@ -1,5 +1,3 @@
project(mapnik-index)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
add_executable(mapnik-index add_executable(mapnik-index

View file

@ -1,5 +1,3 @@
project(mapnik-render)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
add_executable(mapnik-render mapnik-render.cpp) add_executable(mapnik-render mapnik-render.cpp)

View file

@ -1,5 +1,3 @@
project(ogrindex)
add_executable(ogrindex ogrindex.cpp) add_executable(ogrindex ogrindex.cpp)
target_link_libraries(ogrindex PRIVATE mapnik::mapnik) target_link_libraries(ogrindex PRIVATE mapnik::mapnik)

View file

@ -1,4 +1,3 @@
project(pgsql2sqlite)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
find_package(PostgreSQL REQUIRED) find_package(PostgreSQL REQUIRED)

View file

@ -1,5 +1,3 @@
project(shapeindex)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
add_executable(shapeindex add_executable(shapeindex

View file

@ -1,5 +1,3 @@
project(svg2png)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options) find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
add_executable(svg2png add_executable(svg2png