Merge pull request #4248 from mathisloge/cmake-fix
[CMake] Simplify install, add min versions and PkgConfig
This commit is contained in:
commit
a1a3a712dd
33 changed files with 368 additions and 251 deletions
104
CMakeLists.txt
104
CMakeLists.txt
|
@ -17,6 +17,7 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}")
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
include(MapnikMinimumVersions)
|
||||||
include(MapnikFindPackage)
|
include(MapnikFindPackage)
|
||||||
include(MapnikCopyDependencies)
|
include(MapnikCopyDependencies)
|
||||||
include(MapnikInstall)
|
include(MapnikInstall)
|
||||||
|
@ -95,24 +96,14 @@ set(CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD
|
||||||
set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json")
|
set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json")
|
||||||
message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}")
|
message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}")
|
||||||
|
|
||||||
if(WIN32)
|
include(GNUInstallDirs)
|
||||||
set(DEFAULT_BIN_DIR bin)
|
# See for more details: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html
|
||||||
set(DEFAULT_LIB_DIR lib)
|
set(MAPNIK_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "Install directory for binaries")
|
||||||
set(DEFAULT_ARCHIVE_DIR lib)
|
set(MAPNIK_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for libraries")
|
||||||
else()
|
set(MAPNIK_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for archives")
|
||||||
include(GNUInstallDirs)
|
set(MAPNIK_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Install directory for the headers")
|
||||||
set(DEFAULT_BIN_DIR ${CMAKE_INSTALL_BINDIR})
|
set(MAPNIK_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets")
|
||||||
set(DEFAULT_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
|
set(MAPNIK_PKGCONF_DIR ${MAPNIK_LIB_DIR}/pkgconfig CACHE STRING "Install directory for the .pc files for pkg-config")
|
||||||
set(DEFAULT_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#runtime-output-artifacts
|
|
||||||
set(MAPNIK_BIN_DIR ${DEFAULT_BIN_DIR} CACHE STRING "Install directory for binaries")
|
|
||||||
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#library-output-artifacts
|
|
||||||
set(MAPNIK_LIB_DIR ${DEFAULT_LIB_DIR} CACHE STRING "Install directory for libraries")
|
|
||||||
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#archive-output-artifacts
|
|
||||||
set(MAPNIK_ARCHIVE_DIR ${DEFAULT_ARCHIVE_DIR} CACHE STRING "Install directory for archives")
|
|
||||||
|
|
||||||
set(INSTALL_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets")
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input)
|
set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input)
|
||||||
|
@ -144,7 +135,7 @@ endif()
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
mapnik_find_threads()
|
mapnik_find_threads()
|
||||||
mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data)
|
mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data)
|
||||||
mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex)
|
mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS filesystem system regex)
|
||||||
if(USE_BOOST_REGEX_ICU_WORKAROUND)
|
if(USE_BOOST_REGEX_ICU_WORKAROUND)
|
||||||
message(STATUS "using boost regex workaround")
|
message(STATUS "using boost regex workaround")
|
||||||
set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES)
|
set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||||
|
@ -153,15 +144,14 @@ endif()
|
||||||
mapnik_find_package(Freetype REQUIRED)
|
mapnik_find_package(Freetype REQUIRED)
|
||||||
|
|
||||||
# try to find harfbuzz with the native configuration and fallback to our "own" FindHarfBuzz
|
# try to find harfbuzz with the native configuration and fallback to our "own" FindHarfBuzz
|
||||||
set(HARFBUZZ_MINIMUM_VERSION 0.9.34)
|
mapnik_find_package(harfbuzz ${HARFBUZZ_MIN_VERSION} CONFIG QUIET)
|
||||||
mapnik_find_package(harfbuzz CONFIG QUIET)
|
|
||||||
if(harfbuzz_FOUND)
|
if(harfbuzz_FOUND)
|
||||||
message(STATUS "Found harfbuzz native cmake")
|
message(STATUS "Found harfbuzz native cmake")
|
||||||
list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz)
|
list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz)
|
||||||
else()
|
else()
|
||||||
# we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details
|
# we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details
|
||||||
message(STATUS "Fallback to FindHarfBuzz")
|
message(STATUS "Fallback to FindHarfBuzz")
|
||||||
mapnik_find_package(HarfBuzz ${HARFBUZZ_MINIMUM_VERSION} REQUIRED COMPONENTS ICU)
|
mapnik_find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED COMPONENTS ICU)
|
||||||
list(APPEND MAPNIK_OPTIONAL_LIBS HarfBuzz::HarfBuzz HarfBuzz::ICU)
|
list(APPEND MAPNIK_OPTIONAL_LIBS HarfBuzz::HarfBuzz HarfBuzz::ICU)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -229,6 +219,7 @@ endif()
|
||||||
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
||||||
set_property(GLOBAL PROPERTY TARGETS "")
|
set_property(GLOBAL PROPERTY TARGETS "")
|
||||||
set_property(GLOBAL PROPERTY PLUGINS "")
|
set_property(GLOBAL PROPERTY PLUGINS "")
|
||||||
|
set_property(GLOBAL PROPERTY MAPNIK_UTILITIES "")
|
||||||
|
|
||||||
if(USE_GLIBC_WORKAROUND)
|
if(USE_GLIBC_WORKAROUND)
|
||||||
message("using glibc workaround")
|
message("using glibc workaround")
|
||||||
|
@ -308,11 +299,11 @@ endif()
|
||||||
|
|
||||||
if(USE_PROJ)
|
if(USE_PROJ)
|
||||||
#https://proj.org/development/cmake.html
|
#https://proj.org/development/cmake.html
|
||||||
mapnik_find_package(PROJ QUIET)
|
mapnik_find_package(PROJ ${PROJ_MIN_VERSION} QUIET)
|
||||||
# currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config
|
# currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config
|
||||||
if(NOT PROJ_FOUND)
|
if(NOT PROJ_FOUND)
|
||||||
message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...")
|
message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...")
|
||||||
pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj)
|
pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj>=${PROJ_MIN_VERSION})
|
||||||
string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}")
|
string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}")
|
||||||
set(PROJ_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
set(PROJ_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}")
|
set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||||
|
@ -322,7 +313,7 @@ if(USE_PROJ)
|
||||||
message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}")
|
message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}")
|
||||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION})
|
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION})
|
||||||
list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES})
|
list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES})
|
||||||
list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS})
|
list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE $<BUILD_INTERFACE:${PROJ_INCLUDE_DIRS}>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_GRID_RENDERER)
|
if(USE_GRID_RENDERER)
|
||||||
|
@ -367,15 +358,7 @@ target_link_libraries(core INTERFACE
|
||||||
)
|
)
|
||||||
target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS})
|
target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS})
|
||||||
|
|
||||||
install(TARGETS core
|
mapnik_install(core)
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(deps)
|
add_subdirectory(deps)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -391,60 +374,25 @@ if(BUILD_TEST)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# start package mapnik
|
# start package mapnik
|
||||||
include(CMakePackageConfigHelpers)
|
include(MapnikExport)
|
||||||
|
include(MapnikExportPkgConfig)
|
||||||
|
|
||||||
# set the cmake targets install location
|
install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
set(INCLUDE_INSTALL_DIR include/)
|
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
write_basic_package_version_file(
|
install(DIRECTORY deps/mapnik DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
|
||||||
VERSION ${PROJECT_VERSION}
|
|
||||||
COMPATIBILITY SameMajorVersion
|
|
||||||
)
|
|
||||||
|
|
||||||
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
|
||||||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
|
||||||
INSTALL_DESTINATION ${INSTALL_CMAKE_DIR}
|
|
||||||
PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
|
||||||
DESTINATION ${INSTALL_CMAKE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake"
|
|
||||||
DESTINATION ${INSTALL_CMAKE_DIR}/Modules
|
|
||||||
)
|
|
||||||
|
|
||||||
install(EXPORT MapnikTargets
|
|
||||||
FILE mapnikTargets.cmake
|
|
||||||
NAMESPACE mapnik::
|
|
||||||
DESTINATION ${INSTALL_CMAKE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY include/ TYPE INCLUDE)
|
|
||||||
install(DIRECTORY deps/agg/include/ TYPE INCLUDE)
|
|
||||||
install(DIRECTORY deps/mapnik TYPE INCLUDE)
|
|
||||||
install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")
|
install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")
|
||||||
|
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY)
|
if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL)
|
if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO)
|
if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_EXTERNAL_MAPBOX_VARIANT)
|
if(NOT USE_EXTERNAL_MAPBOX_VARIANT)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ TYPE INCLUDE)
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
mapnik_install_targets()
|
mapnik_install_targets()
|
||||||
|
|
|
@ -9,4 +9,6 @@ macro(get_mapnik_version)
|
||||||
|
|
||||||
string(REGEX MATCH "MAPNIK_PATCH_VERSION ([0-9]*)" _ ${VERSION_FILE})
|
string(REGEX MATCH "MAPNIK_PATCH_VERSION ([0-9]*)" _ ${VERSION_FILE})
|
||||||
set(MAPNIK_PATCH_VERSION ${CMAKE_MATCH_1})
|
set(MAPNIK_PATCH_VERSION ${CMAKE_MATCH_1})
|
||||||
|
|
||||||
|
set(MAPNIK_VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
57
cmake/MapnikExport.cmake
Normal file
57
cmake/MapnikExport.cmake
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
# export mapnik configuration
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||||
|
VERSION ${MAPNIK_VERSION}
|
||||||
|
COMPATIBILITY ExactVersion
|
||||||
|
)
|
||||||
|
get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||||
|
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
||||||
|
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||||
|
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
PATH_VARS MAPNIK_INCLUDE_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES MAPNIK_UTILITIES
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# install our modules, so that the expected target names are found.
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake"
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}/Modules
|
||||||
|
)
|
||||||
|
|
||||||
|
install(EXPORT MapnikTargets
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
FILE mapnikTargets.cmake
|
||||||
|
NAMESPACE mapnik::
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Create configuration dependend files for the plugin install dirs.
|
||||||
|
# some package managers are using different paths per configuration.
|
||||||
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type)
|
||||||
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l)
|
||||||
|
set(_mapnik_plugin_file_name "mapnikPlugins-${_build_type}")
|
||||||
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake.in "set(MAPNIK_PLUGINS_DIR_${_build_type_l} \"@PACKAGE_PLUGINS_INSTALL_DIR@\" CACHE STRING \"\")\n")
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
configure_package_config_file(
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake
|
||||||
|
PATH_VARS PLUGINS_INSTALL_DIR
|
||||||
|
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
)
|
57
cmake/MapnikExportPkgConfig.cmake
Normal file
57
cmake/MapnikExportPkgConfig.cmake
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
function(create_pkg_config_file _target _lib_name _description)
|
||||||
|
string(CONFIGURE [[
|
||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
includedir=${prefix}/include
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
|
||||||
|
Name: @_lib_name@
|
||||||
|
Description: @_description@
|
||||||
|
Version: @MAPNIK_VERSION@
|
||||||
|
Libs: -L"${libdir}" -l$<TARGET_FILE_PREFIX:@_target@>$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
|
||||||
|
Cflags: -I"${includedir}" ]]
|
||||||
|
_contents @ONLY)
|
||||||
|
|
||||||
|
file(GENERATE
|
||||||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||||
|
CONTENT "${_contents}"
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||||
|
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(create_pkg_config_file_mapnik _lib_name _description)
|
||||||
|
get_target_property(_compile_defs core INTERFACE_COMPILE_DEFINITIONS)
|
||||||
|
string(JOIN " -D" _str_compile_defs ${_compile_defs})
|
||||||
|
if(_str_compile_defs)
|
||||||
|
set(_str_compile_defs "-D${_str_compile_defs}")
|
||||||
|
endif()
|
||||||
|
string(CONFIGURE [[
|
||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
includedir=${prefix}/include
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
|
||||||
|
Name: @_lib_name@
|
||||||
|
Description: @_description@
|
||||||
|
Version: @MAPNIK_VERSION@
|
||||||
|
Requires: libmapnikwkt libmapnikjson
|
||||||
|
Libs: -L"${libdir}" -l$<TARGET_FILE_PREFIX:mapnik>$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX> -l$<TARGET_FILE_PREFIX:json>$<TARGET_FILE_BASE_NAME:json>$<TARGET_PROPERTY:json,$<CONFIG>_POSTFIX> -l$<TARGET_FILE_PREFIX:wkt>$<TARGET_FILE_BASE_NAME:wkt>$<TARGET_PROPERTY:wkt,$<CONFIG>_POSTFIX>
|
||||||
|
Cflags: -I"${includedir}" @_str_compile_defs@]]
|
||||||
|
_contents @ONLY)
|
||||||
|
file(GENERATE
|
||||||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||||
|
CONTENT "${_contents}"
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}.pc
|
||||||
|
DESTINATION ${MAPNIK_PKGCONF_DIR}
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
create_pkg_config_file(wkt libmapnikwkt "wkt library")
|
||||||
|
create_pkg_config_file(json libmapnikjson "json library")
|
||||||
|
create_pkg_config_file_mapnik("libmapnik" "mapnik library")
|
|
@ -1,63 +1,97 @@
|
||||||
function(mapnik_install)
|
#
|
||||||
set(options ALREADY_INSTALLED IS_PLUGIN)
|
# Install library targets that consuming users need.
|
||||||
set(oneValueArgs TARGET)
|
#
|
||||||
set(multiValueArgs)
|
function(mapnik_install _target)
|
||||||
cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
install(TARGETS ${_target}
|
||||||
|
EXPORT MapnikTargets
|
||||||
if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN)
|
INCLUDES DESTINATION ${MAPNIK_INCLUDE_DIR}
|
||||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||||
|
COMPONENT MapnikRuntime
|
||||||
|
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||||
|
COMPONENT MapnikRuntime
|
||||||
|
NAMELINK_COMPONENT MapnikDevelopment
|
||||||
|
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||||
|
COMPONENT MapnikDevelopment
|
||||||
)
|
)
|
||||||
elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN)
|
get_target_property(TARGET_TYPE "${_target}" TYPE)
|
||||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
if (TARGET_TYPE STREQUAL "SHARED_LIBRARY")
|
||||||
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
set_property(GLOBAL APPEND PROPERTY TARGETS ${_target})
|
||||||
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
||||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
if(NOT MAPNIK_INSTALL_IS_PLUGIN)
|
|
||||||
message(STATUS "${MAPNIK_INSTALL_TARGET}")
|
|
||||||
get_target_property(TARGET_TYPE "${MAPNIK_INSTALL_TARGET}" TYPE)
|
|
||||||
if (TARGET_TYPE STREQUAL "EXECUTABLE")
|
|
||||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
|
||||||
list(APPEND MAPNIK_INSTALLED_TARGETS ${MAPNIK_INSTALL_TARGET})
|
|
||||||
set_property(GLOBAL PROPERTY TARGETS ${MAPNIK_INSTALLED_TARGETS})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
|
||||||
list(APPEND MAPNIK_INSTALLED_PLUGINS ${MAPNIK_INSTALL_TARGET})
|
|
||||||
set_property(GLOBAL PROPERTY PLUGINS ${MAPNIK_INSTALLED_PLUGINS})
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install plugins
|
||||||
|
#
|
||||||
|
function(mapnik_install_plugin _target)
|
||||||
|
install(TARGETS ${_target}
|
||||||
|
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
COMPONENT MapnikPluginRuntime
|
||||||
|
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
COMPONENT MapnikPluginRuntime
|
||||||
|
NAMELINK_COMPONENT MapnikPluginDevelopment
|
||||||
|
ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||||
|
COMPONENT MapnikPluginDevelopment
|
||||||
|
)
|
||||||
|
set_property(GLOBAL APPEND PROPERTY PLUGINS ${_target})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install executables. These are available via COMPONENTS in find_package
|
||||||
|
#
|
||||||
|
function(mapnik_install_utility _target)
|
||||||
|
set(_target_name "mapnikUtilityTargets_${_target}")
|
||||||
|
install(TARGETS ${_target}
|
||||||
|
EXPORT ${_target_name}
|
||||||
|
INCLUDES DESTINATION ${MAPNIK_INCLUDE_DIR}
|
||||||
|
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||||
|
COMPONENT MapnikRuntime
|
||||||
|
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||||
|
COMPONENT MapnikRuntime
|
||||||
|
NAMELINK_COMPONENT MapnikDevelopment
|
||||||
|
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||||
|
COMPONENT MapnikDevelopment
|
||||||
|
)
|
||||||
|
install(EXPORT ${_target_name}
|
||||||
|
FILE ${_target_name}.cmake
|
||||||
|
NAMESPACE mapnik::
|
||||||
|
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||||
|
)
|
||||||
|
set_property(GLOBAL APPEND PROPERTY MAPNIK_UTILITIES ${_target})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function(mapnik_install_targets)
|
function(mapnik_install_targets)
|
||||||
if(INSTALL_DEPENDENCIES AND WIN32)
|
if(INSTALL_DEPENDENCIES AND WIN32)
|
||||||
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
||||||
cmake_policy(SET CMP0087 NEW)
|
cmake_policy(SET CMP0087 NEW)
|
||||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
get_property(_installed_utilities GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
get_property(_installed_targets GLOBAL PROPERTY TARGETS)
|
||||||
set(INTERNAL_TARGETS "")
|
get_property(_installed_plugins GLOBAL PROPERTY PLUGINS)
|
||||||
set(INTERNAL_PLUGINS "")
|
set(_internal_executables "")
|
||||||
|
set(_internal_libraries "")
|
||||||
|
|
||||||
foreach(_target IN LISTS MAPNIK_INSTALLED_TARGETS)
|
foreach(_target IN LISTS _installed_utilities)
|
||||||
list(APPEND INTERNAL_TARGETS "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
list(APPEND _internal_executables "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(_target IN LISTS MAPNIK_INSTALLED_PLUGINS)
|
foreach(_target IN LISTS _installed_targets)
|
||||||
list(APPEND INTERNAL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
list(APPEND _internal_libraries "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||||
|
endforeach()
|
||||||
|
foreach(_target IN LISTS _installed_plugins)
|
||||||
|
list(APPEND _internal_libraries "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||||
endforeach()
|
endforeach()
|
||||||
# all other executables get auto detected and fixed.
|
# all other executables get auto detected and fixed.
|
||||||
list(GET INTERNAL_TARGETS 0 INTERNAL_TARGETS)
|
if(_internal_executables)
|
||||||
|
list(GET _internal_executables 0 _internal_executables)
|
||||||
|
endif()
|
||||||
|
|
||||||
INSTALL(CODE "
|
INSTALL(CODE "
|
||||||
message(STATUS \"${INTERNAL_TARGETS}\")
|
message(STATUS \"${_internal_executables}\")
|
||||||
message(STATUS \"${INTERNAL_PLUGINS}\")
|
message(STATUS \"${_internal_libraries}\")
|
||||||
|
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||||
" COMPONENT Runtime)
|
" COMPONENT MapnikRuntime)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
3
cmake/MapnikMinimumVersions.cmake
Normal file
3
cmake/MapnikMinimumVersions.cmake
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
set(BOOST_MIN_VERSION 1.61)
|
||||||
|
set(HARFBUZZ_MIN_VERSION 0.9.34)
|
||||||
|
set(PROJ_MIN_VERSION 7.2.0)
|
|
@ -1,7 +1,6 @@
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" CACHE STRING "")
|
set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_MAPNIK_INCLUDE_DIR@" CACHE STRING "")
|
||||||
set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_PLUGINS_INSTALL_DIR@" CACHE STRING "")
|
|
||||||
set_and_check(MAPNIK_FONTS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "")
|
set_and_check(MAPNIK_FONTS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/")
|
||||||
|
@ -9,7 +8,43 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/")
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
@MAPNIK_DEPENDENCIES@
|
@MAPNIK_DEPENDENCIES@
|
||||||
|
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/mapnikTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/mapnikTargets.cmake")
|
||||||
|
|
||||||
check_required_components(mapnik)
|
set(_supported_components @MAPNIK_UTILITIES@)
|
||||||
|
foreach(_comp ${mapnik_FIND_COMPONENTS})
|
||||||
|
if (NOT _comp IN_LIST _supported_components)
|
||||||
|
set(mapnik_FOUND False)
|
||||||
|
set(mapnik_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
||||||
|
endif()
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/mapnikUtilityTargets_${_comp}.cmake")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
|
get_filename_component(_plugin_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
file(GLOB CONFIG_FILES "${_plugin_dir}/mapnikPlugins-*.cmake")
|
||||||
|
foreach(f ${CONFIG_FILES})
|
||||||
|
include(${f})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
function(mapnik_find_plugin_dir PLUGIN_DIR)
|
||||||
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l)
|
||||||
|
set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_build_config}}")
|
||||||
|
# only release has more then one configuration
|
||||||
|
if(NOT _plugin_dir)
|
||||||
|
set(_all_rel_cfgs RELEASE RELWITHDEBINFO MINSIZEREL)
|
||||||
|
list(FIND _all_rel_cfgs ${_build_config} _is_rel_cfg)
|
||||||
|
# check if the current configuration is a known release configuration
|
||||||
|
if(${_is_rel_cfg} GREATER_EQUAL 0)
|
||||||
|
foreach(_rel_cfg IN LISTS _all_rel_cfgs)
|
||||||
|
set(_plugin_dir "${MAPNIK_PLUGINS_DIR_${_rel_cfg}}")
|
||||||
|
if(_plugin_dir)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(NOT _plugin_dir)
|
||||||
|
message(WARNING "Could not find a plugin install dir for configuration ${_build_type_l}")
|
||||||
|
endif()
|
||||||
|
set(${PLUGIN_DIR} ${_plugin_dir} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
|
@ -4,7 +4,6 @@ add_executable(mapnik-demo rundemo.cpp)
|
||||||
|
|
||||||
target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik)
|
target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik)
|
||||||
|
|
||||||
mapnik_install(TARGET mapnik-demo)
|
|
||||||
mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape)
|
mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape)
|
||||||
mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts)
|
mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts)
|
||||||
mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape)
|
mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape)
|
||||||
|
|
|
@ -61,7 +61,7 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin)
|
||||||
mapnik_install(TARGET mapnik-viewer)
|
mapnik_install_utility(mapnik-viewer)
|
||||||
|
|
||||||
mapnik_copy_dependencies(
|
mapnik_copy_dependencies(
|
||||||
TARGETS
|
TARGETS
|
||||||
|
|
|
@ -34,10 +34,16 @@ All targets:
|
||||||
* `mapnik::wkt`: wkt support for libmapnik.
|
* `mapnik::wkt`: wkt support for libmapnik.
|
||||||
|
|
||||||
All mapnik executables and targets are exported within `mapnikTargets.cmake`.
|
All mapnik executables and targets are exported within `mapnikTargets.cmake`.
|
||||||
|
|
||||||
The plugin dir is available in the variable `MAPNIK_PLUGINS_DIR`.
|
|
||||||
The font path is is available in the variable `MAPNIK_FONTS_DIR`.
|
The font path is is available in the variable `MAPNIK_FONTS_DIR`.
|
||||||
|
|
||||||
|
The install location of the plugins might be configuration dependent.
|
||||||
|
For each configuration there exists a variable `MAPNIK_PLUGINS_DIR_<CONFIGURATION>` where `<CONFIGURATION>` is one of `CMAKE_BUILD_TYPE` as upper case.
|
||||||
|
There is a function exported which you can use to query the plugin dir for known typical configurations:
|
||||||
|
```
|
||||||
|
mapnik_find_plugin_dir(MAPNIK_PLUGINS_DIR)
|
||||||
|
```
|
||||||
|
`MAPNIK_PLUGINS_DIR` will contain then the plugin dir. If a path could not be found, a warning is printed.
|
||||||
|
|
||||||
## Recommendations
|
## Recommendations
|
||||||
|
|
||||||
If you target a specific platform, it is recommended to create a toolchain file and set all the options and library path that you would normally set via cmd line options.
|
If you target a specific platform, it is recommended to create a toolchain file and set all the options and library path that you would normally set via cmd line options.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
set(_plugin_prefix "")
|
||||||
|
set(_plugin_suffix ".input")
|
||||||
|
|
||||||
if(USE_PLUGIN_INPUT_CSV)
|
if(USE_PLUGIN_INPUT_CSV)
|
||||||
message(STATUS "using input plugin csv")
|
message(STATUS "using input plugin csv")
|
||||||
add_subdirectory(csv)
|
add_subdirectory(csv)
|
||||||
|
|
|
@ -7,15 +7,15 @@ add_library(input-csv MODULE
|
||||||
csv_inline_featureset.cpp
|
csv_inline_featureset.cpp
|
||||||
csv_utils.cpp
|
csv_utils.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::csv ALIAS input-csv)
|
|
||||||
|
|
||||||
target_link_libraries(input-csv PRIVATE
|
target_link_libraries(input-csv PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::wkt
|
mapnik::wkt
|
||||||
mapnik::json
|
mapnik::json
|
||||||
)
|
)
|
||||||
set_target_properties(input-csv PROPERTIES PREFIX "")
|
set_target_properties(input-csv PROPERTIES
|
||||||
set_target_properties(input-csv PROPERTIES OUTPUT_NAME "csv")
|
OUTPUT_NAME "csv"
|
||||||
set_target_properties(input-csv PROPERTIES SUFFIX ".input")
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET input-csv IS_PLUGIN)
|
mapnik_install_plugin(input-csv)
|
||||||
|
|
|
@ -6,15 +6,15 @@ add_library(input-gdal MODULE
|
||||||
gdal_datasource.cpp
|
gdal_datasource.cpp
|
||||||
gdal_featureset.cpp
|
gdal_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::gdal ALIAS input-gdal)
|
|
||||||
|
|
||||||
target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIRS})
|
target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIRS})
|
||||||
target_link_libraries(input-gdal PRIVATE
|
target_link_libraries(input-gdal PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
${GDAL_LIBRARIES}
|
${GDAL_LIBRARIES}
|
||||||
)
|
)
|
||||||
set_target_properties(input-gdal PROPERTIES PREFIX "")
|
set_target_properties(input-gdal PROPERTIES
|
||||||
set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal")
|
OUTPUT_NAME "gdal"
|
||||||
set_target_properties(input-gdal PROPERTIES SUFFIX ".input")
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET input-gdal IS_PLUGIN)
|
mapnik_install_plugin(input-gdal)
|
||||||
|
|
|
@ -4,12 +4,11 @@ add_library(input-geobuf MODULE
|
||||||
geobuf_datasource.cpp
|
geobuf_datasource.cpp
|
||||||
geobuf_featureset.cpp
|
geobuf_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::geobuf ALIAS input-geobuf)
|
|
||||||
|
|
||||||
target_link_libraries(input-geobuf PRIVATE mapnik::mapnik)
|
target_link_libraries(input-geobuf PRIVATE mapnik::mapnik)
|
||||||
|
set_target_properties(input-geobuf PROPERTIES
|
||||||
|
OUTPUT_NAME "geobuf"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-geobuf PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-geobuf)
|
||||||
set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf")
|
|
||||||
set_target_properties(input-geobuf PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-geobuf IS_PLUGIN)
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ add_library(input-geojson MODULE
|
||||||
geojson_index_featureset.cpp
|
geojson_index_featureset.cpp
|
||||||
geojson_memory_index_featureset.cpp
|
geojson_memory_index_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::geojson ALIAS input-geojson)
|
|
||||||
|
|
||||||
target_link_libraries(input-geojson PRIVATE
|
target_link_libraries(input-geojson PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::json
|
mapnik::json
|
||||||
)
|
)
|
||||||
|
set_target_properties(input-geojson PROPERTIES
|
||||||
|
OUTPUT_NAME "geojson"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-geojson PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-geojson)
|
||||||
set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson")
|
|
||||||
set_target_properties(input-geojson PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-geojson IS_PLUGIN)
|
|
||||||
|
|
|
@ -8,15 +8,15 @@ add_library(input-ogr MODULE
|
||||||
ogr_featureset.cpp
|
ogr_featureset.cpp
|
||||||
ogr_index_featureset.cpp
|
ogr_index_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::ogr ALIAS input-ogr)
|
|
||||||
|
|
||||||
target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIRS})
|
target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIRS})
|
||||||
target_link_libraries(input-ogr PRIVATE
|
target_link_libraries(input-ogr PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
${GDAL_LIBRARIES}
|
${GDAL_LIBRARIES}
|
||||||
)
|
)
|
||||||
set_target_properties(input-ogr PROPERTIES PREFIX "")
|
set_target_properties(input-ogr PROPERTIES
|
||||||
set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr")
|
OUTPUT_NAME "ogr"
|
||||||
set_target_properties(input-ogr PROPERTIES SUFFIX ".input")
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET input-ogr IS_PLUGIN)
|
mapnik_install_plugin(input-ogr)
|
||||||
|
|
|
@ -7,15 +7,13 @@ add_library(input-pgraster MODULE
|
||||||
pgraster_featureset.cpp
|
pgraster_featureset.cpp
|
||||||
pgraster_wkb_reader.cpp
|
pgraster_wkb_reader.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::pgraster ALIAS input-pgraster)
|
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(input-pgraster PRIVATE
|
target_link_libraries(input-pgraster PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
PostgreSQL::PostgreSQL
|
PostgreSQL::PostgreSQL
|
||||||
)
|
)
|
||||||
set_target_properties(input-pgraster PROPERTIES PREFIX "")
|
set_target_properties(input-pgraster PROPERTIES
|
||||||
set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster")
|
OUTPUT_NAME "pgraster"
|
||||||
set_target_properties(input-pgraster PROPERTIES SUFFIX ".input")
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
mapnik_install(TARGET input-pgraster IS_PLUGIN)
|
)
|
||||||
|
mapnik_install_plugin(input-pgraster)
|
||||||
|
|
|
@ -6,15 +6,14 @@ add_library(input-postgis MODULE
|
||||||
postgis_datasource.cpp
|
postgis_datasource.cpp
|
||||||
postgis_featureset.cpp
|
postgis_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::postgis ALIAS input-postgis)
|
|
||||||
|
|
||||||
target_link_libraries(input-postgis PRIVATE
|
target_link_libraries(input-postgis PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
PostgreSQL::PostgreSQL
|
PostgreSQL::PostgreSQL
|
||||||
)
|
)
|
||||||
|
set_target_properties(input-postgis PROPERTIES
|
||||||
|
OUTPUT_NAME "postgis"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-postgis PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-postgis)
|
||||||
set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis")
|
|
||||||
set_target_properties(input-postgis PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-postgis IS_PLUGIN)
|
|
||||||
|
|
|
@ -5,12 +5,11 @@ add_library(input-raster MODULE
|
||||||
raster_featureset.cpp
|
raster_featureset.cpp
|
||||||
raster_info.cpp
|
raster_info.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::raster ALIAS input-raster)
|
|
||||||
|
|
||||||
target_link_libraries(input-raster PRIVATE mapnik::mapnik)
|
target_link_libraries(input-raster PRIVATE mapnik::mapnik)
|
||||||
|
set_target_properties(input-raster PROPERTIES
|
||||||
|
OUTPUT_NAME "raster"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-raster PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-raster)
|
||||||
set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster")
|
|
||||||
set_target_properties(input-raster PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-raster IS_PLUGIN)
|
|
||||||
|
|
|
@ -8,12 +8,11 @@ add_library(input-shape MODULE
|
||||||
shape_index_featureset.cpp
|
shape_index_featureset.cpp
|
||||||
shape_io.cpp shape_utils.cpp
|
shape_io.cpp shape_utils.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::shape ALIAS input-shape)
|
|
||||||
|
|
||||||
target_link_libraries(input-shape PRIVATE mapnik::mapnik)
|
target_link_libraries(input-shape PRIVATE mapnik::mapnik)
|
||||||
|
set_target_properties(input-shape PROPERTIES
|
||||||
|
OUTPUT_NAME "shape"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-shape PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-shape)
|
||||||
set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape")
|
|
||||||
set_target_properties(input-shape PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-shape IS_PLUGIN)
|
|
||||||
|
|
|
@ -7,14 +7,14 @@ add_library(input-sqlite MODULE
|
||||||
sqlite_featureset.cpp
|
sqlite_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite)
|
add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite)
|
||||||
|
|
||||||
target_link_libraries(input-sqlite PRIVATE
|
target_link_libraries(input-sqlite PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
SQLite::SQLite3
|
SQLite::SQLite3
|
||||||
)
|
)
|
||||||
|
set_target_properties(input-sqlite PROPERTIES
|
||||||
|
OUTPUT_NAME "sqlite"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-sqlite PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-sqlite)
|
||||||
set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite")
|
|
||||||
set_target_properties(input-sqlite PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-sqlite IS_PLUGIN)
|
|
||||||
|
|
|
@ -5,14 +5,14 @@ add_library(input-topojson MODULE
|
||||||
topojson_featureset.cpp
|
topojson_featureset.cpp
|
||||||
)
|
)
|
||||||
add_library(mapnik::plugin::input::topojson ALIAS input-topojson)
|
add_library(mapnik::plugin::input::topojson ALIAS input-topojson)
|
||||||
|
|
||||||
target_link_libraries(input-topojson PRIVATE
|
target_link_libraries(input-topojson PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
mapnik::json
|
mapnik::json
|
||||||
)
|
)
|
||||||
|
set_target_properties(input-topojson PROPERTIES
|
||||||
|
OUTPUT_NAME "topojson"
|
||||||
|
PREFIX "${_plugin_prefix}"
|
||||||
|
SUFFIX "${_plugin_suffix}"
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(input-topojson PROPERTIES PREFIX "")
|
mapnik_install_plugin(input-topojson)
|
||||||
set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson")
|
|
||||||
set_target_properties(input-topojson PROPERTIES SUFFIX ".input")
|
|
||||||
|
|
||||||
mapnik_install(TARGET input-topojson IS_PLUGIN)
|
|
||||||
|
|
|
@ -293,6 +293,10 @@ set_target_properties(mapnik PROPERTIES
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "mapnik"
|
OUTPUT_NAME "mapnik"
|
||||||
PREFIX "lib"
|
PREFIX "lib"
|
||||||
|
IMPORT_PREFIX "lib" # for the archive on dll platforms
|
||||||
|
VERSION ${MAPNIK_VERSION}
|
||||||
|
# see https://github.com/mapnik/mapnik/pull/4248#issuecomment-925596509 => ABI compability only with the full version
|
||||||
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
@ -303,14 +307,4 @@ if(MSVC)
|
||||||
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS mapnik
|
mapnik_install(mapnik)
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
mapnik_install(TARGET mapnik ALREADY_INSTALLED)
|
|
||||||
|
|
|
@ -28,17 +28,10 @@ set_target_properties(json PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "json"
|
OUTPUT_NAME "json"
|
||||||
PREFIX "libmapnik-"
|
PREFIX "libmapnik"
|
||||||
|
VERSION ${MAPNIK_VERSION}
|
||||||
|
# see mapnik target for explanation
|
||||||
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS json
|
mapnik_install(json)
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
mapnik_install(TARGET json)
|
|
||||||
|
|
|
@ -20,17 +20,10 @@ set_target_properties(wkt PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||||
OUTPUT_NAME "wkt"
|
OUTPUT_NAME "wkt"
|
||||||
PREFIX "libmapnik-"
|
PREFIX "libmapnik"
|
||||||
|
VERSION ${MAPNIK_VERSION}
|
||||||
|
# see mapnik target for explanation
|
||||||
|
SOVERSION ${MAPNIK_VERSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS wkt
|
mapnik_install(wkt)
|
||||||
EXPORT MapnikTargets
|
|
||||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
|
||||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
|
||||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
|
||||||
INCLUDES DESTINATION include/
|
|
||||||
PUBLIC_HEADER DESTINATION include/
|
|
||||||
COMPONENT mapnik
|
|
||||||
)
|
|
||||||
|
|
||||||
mapnik_install(TARGET wkt)
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project(mapnik-test)
|
project(mapnik-test)
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
find_package(PostgreSQL REQUIRED)
|
find_package(PostgreSQL REQUIRED)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
|
@ -4,4 +4,4 @@ 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)
|
||||||
|
|
||||||
mapnik_install(TARGET geometry_to_wkb)
|
mapnik_install_utility(geometry_to_wkb)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project(mapnik-index)
|
project(mapnik-index)
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
|
|
||||||
add_executable(mapnik-index
|
add_executable(mapnik-index
|
||||||
mapnik-index.cpp
|
mapnik-index.cpp
|
||||||
|
@ -15,4 +15,4 @@ target_link_libraries(mapnik-index PRIVATE
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET mapnik-index)
|
mapnik_install_utility(mapnik-index)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project(mapnik-render)
|
project(mapnik-render)
|
||||||
|
|
||||||
find_package(Boost 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)
|
||||||
|
|
||||||
|
@ -9,4 +9,4 @@ target_link_libraries(mapnik-render PRIVATE
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET mapnik-render)
|
mapnik_install_utility(mapnik-render)
|
||||||
|
|
|
@ -4,4 +4,4 @@ add_executable(ogrindex ogrindex.cpp)
|
||||||
|
|
||||||
target_link_libraries(ogrindex PRIVATE mapnik::mapnik)
|
target_link_libraries(ogrindex PRIVATE mapnik::mapnik)
|
||||||
|
|
||||||
mapnik_install(TARGET ogrindex)
|
mapnik_install_utility(ogrindex)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project(pgsql2sqlite)
|
project(pgsql2sqlite)
|
||||||
find_package(Boost 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)
|
||||||
|
|
||||||
|
@ -16,4 +16,4 @@ target_link_libraries(pgsql2sqlite PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET pgsql2sqlite)
|
mapnik_install_utility(pgsql2sqlite)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project(shapeindex)
|
project(shapeindex)
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
|
|
||||||
add_executable(shapeindex
|
add_executable(shapeindex
|
||||||
shapeindex.cpp
|
shapeindex.cpp
|
||||||
|
@ -12,4 +12,4 @@ target_link_libraries(shapeindex PRIVATE
|
||||||
mapnik::mapnik
|
mapnik::mapnik
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET shapeindex)
|
mapnik_install_utility(shapeindex)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project(svg2png)
|
project(svg2png)
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||||
|
|
||||||
add_executable(svg2png
|
add_executable(svg2png
|
||||||
svg2png.cpp
|
svg2png.cpp
|
||||||
|
@ -12,4 +12,4 @@ target_link_libraries(svg2png PRIVATE
|
||||||
mapnik::agg
|
mapnik::agg
|
||||||
)
|
)
|
||||||
|
|
||||||
mapnik_install(TARGET svg2png)
|
mapnik_install_utility(svg2png)
|
||||||
|
|
Loading…
Reference in a new issue