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(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(MapnikMinimumVersions)
|
||||
include(MapnikFindPackage)
|
||||
include(MapnikCopyDependencies)
|
||||
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")
|
||||
message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}")
|
||||
|
||||
if(WIN32)
|
||||
set(DEFAULT_BIN_DIR bin)
|
||||
set(DEFAULT_LIB_DIR lib)
|
||||
set(DEFAULT_ARCHIVE_DIR lib)
|
||||
else()
|
||||
include(GNUInstallDirs)
|
||||
set(DEFAULT_BIN_DIR ${CMAKE_INSTALL_BINDIR})
|
||||
set(DEFAULT_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
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")
|
||||
include(GNUInstallDirs)
|
||||
# See for more details: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html
|
||||
set(MAPNIK_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "Install directory for binaries")
|
||||
set(MAPNIK_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for libraries")
|
||||
set(MAPNIK_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Install directory for archives")
|
||||
set(MAPNIK_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Install directory for the headers")
|
||||
set(MAPNIK_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets")
|
||||
set(MAPNIK_PKGCONF_DIR ${MAPNIK_LIB_DIR}/pkgconfig CACHE STRING "Install directory for the .pc files for pkg-config")
|
||||
|
||||
if(WIN32)
|
||||
set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input)
|
||||
|
@ -144,7 +135,7 @@ endif()
|
|||
find_package(PkgConfig)
|
||||
mapnik_find_threads()
|
||||
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)
|
||||
message(STATUS "using boost regex workaround")
|
||||
set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||
|
@ -153,15 +144,14 @@ endif()
|
|||
mapnik_find_package(Freetype REQUIRED)
|
||||
|
||||
# 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 CONFIG QUIET)
|
||||
mapnik_find_package(harfbuzz ${HARFBUZZ_MIN_VERSION} CONFIG QUIET)
|
||||
if(harfbuzz_FOUND)
|
||||
message(STATUS "Found harfbuzz native cmake")
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz)
|
||||
else()
|
||||
# we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details
|
||||
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)
|
||||
endif()
|
||||
|
||||
|
@ -229,6 +219,7 @@ endif()
|
|||
# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope
|
||||
set_property(GLOBAL PROPERTY TARGETS "")
|
||||
set_property(GLOBAL PROPERTY PLUGINS "")
|
||||
set_property(GLOBAL PROPERTY MAPNIK_UTILITIES "")
|
||||
|
||||
if(USE_GLIBC_WORKAROUND)
|
||||
message("using glibc workaround")
|
||||
|
@ -308,11 +299,11 @@ endif()
|
|||
|
||||
if(USE_PROJ)
|
||||
#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
|
||||
if(NOT PROJ_FOUND)
|
||||
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}")
|
||||
set(PROJ_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||
|
@ -322,7 +313,7 @@ if(USE_PROJ)
|
|||
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_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()
|
||||
|
||||
if(USE_GRID_RENDERER)
|
||||
|
@ -367,15 +358,7 @@ target_link_libraries(core INTERFACE
|
|||
)
|
||||
target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS})
|
||||
|
||||
install(TARGETS 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
|
||||
)
|
||||
mapnik_install(core)
|
||||
|
||||
add_subdirectory(deps)
|
||||
add_subdirectory(src)
|
||||
|
@ -391,60 +374,25 @@ if(BUILD_TEST)
|
|||
endif()
|
||||
|
||||
# start package mapnik
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(MapnikExport)
|
||||
include(MapnikExportPkgConfig)
|
||||
|
||||
# set the cmake targets install location
|
||||
set(INCLUDE_INSTALL_DIR include/)
|
||||
write_basic_package_version_file(
|
||||
"${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 include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
install(DIRECTORY deps/mapnik DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*")
|
||||
|
||||
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()
|
||||
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()
|
||||
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()
|
||||
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()
|
||||
|
||||
mapnik_install_targets()
|
||||
|
|
|
@ -9,4 +9,6 @@ macro(get_mapnik_version)
|
|||
|
||||
string(REGEX MATCH "MAPNIK_PATCH_VERSION ([0-9]*)" _ ${VERSION_FILE})
|
||||
set(MAPNIK_PATCH_VERSION ${CMAKE_MATCH_1})
|
||||
|
||||
set(MAPNIK_VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION})
|
||||
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)
|
||||
set(oneValueArgs TARGET)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN)
|
||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
||||
LIBRARY DESTINATION ${MAPNIK_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR}
|
||||
RUNTIME DESTINATION ${MAPNIK_BIN_DIR}
|
||||
)
|
||||
elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN)
|
||||
install(TARGETS ${MAPNIK_INSTALL_TARGET}
|
||||
LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
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})
|
||||
#
|
||||
# Install library targets that consuming users need.
|
||||
#
|
||||
function(mapnik_install _target)
|
||||
install(TARGETS ${_target}
|
||||
EXPORT MapnikTargets
|
||||
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
|
||||
)
|
||||
get_target_property(TARGET_TYPE "${_target}" TYPE)
|
||||
if (TARGET_TYPE STREQUAL "SHARED_LIBRARY")
|
||||
set_property(GLOBAL APPEND PROPERTY TARGETS ${_target})
|
||||
endif()
|
||||
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)
|
||||
if(INSTALL_DEPENDENCIES AND WIN32)
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0087.html
|
||||
cmake_policy(SET CMP0087 NEW)
|
||||
get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS)
|
||||
get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS)
|
||||
set(INTERNAL_TARGETS "")
|
||||
set(INTERNAL_PLUGINS "")
|
||||
get_property(_installed_utilities GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||
get_property(_installed_targets GLOBAL PROPERTY TARGETS)
|
||||
get_property(_installed_plugins GLOBAL PROPERTY PLUGINS)
|
||||
set(_internal_executables "")
|
||||
set(_internal_libraries "")
|
||||
|
||||
foreach(_target IN LISTS MAPNIK_INSTALLED_TARGETS)
|
||||
list(APPEND INTERNAL_TARGETS "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||
foreach(_target IN LISTS _installed_utilities)
|
||||
list(APPEND _internal_executables "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||
endforeach()
|
||||
foreach(_target IN LISTS MAPNIK_INSTALLED_PLUGINS)
|
||||
list(APPEND INTERNAL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$<TARGET_FILE_NAME:${_target}>")
|
||||
foreach(_target IN LISTS _installed_targets)
|
||||
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()
|
||||
# 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 "
|
||||
message(STATUS \"${INTERNAL_TARGETS}\")
|
||||
message(STATUS \"${INTERNAL_PLUGINS}\")
|
||||
message(STATUS \"${_internal_executables}\")
|
||||
message(STATUS \"${_internal_libraries}\")
|
||||
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||
" COMPONENT Runtime)
|
||||
fixup_bundle(\"${_internal_executables}\" \"${_internal_libraries}\" \"${ADDITIONAL_LIBARIES_PATHS}\")
|
||||
" COMPONENT MapnikRuntime)
|
||||
endif()
|
||||
|
||||
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@
|
||||
|
||||
set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" CACHE STRING "")
|
||||
set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_PLUGINS_INSTALL_DIR@" CACHE STRING "")
|
||||
set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_MAPNIK_INCLUDE_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/")
|
||||
|
@ -9,7 +8,43 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/")
|
|||
include(CMakeFindDependencyMacro)
|
||||
@MAPNIK_DEPENDENCIES@
|
||||
|
||||
|
||||
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)
|
||||
|
||||
mapnik_install(TARGET mapnik-demo)
|
||||
mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape)
|
||||
mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts)
|
||||
mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape)
|
||||
|
|
|
@ -61,7 +61,7 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
|||
endif()
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin)
|
||||
mapnik_install(TARGET mapnik-viewer)
|
||||
mapnik_install_utility(mapnik-viewer)
|
||||
|
||||
mapnik_copy_dependencies(
|
||||
TARGETS
|
||||
|
|
|
@ -34,10 +34,16 @@ All targets:
|
|||
* `mapnik::wkt`: wkt support for libmapnik.
|
||||
|
||||
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 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
|
||||
|
||||
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)
|
||||
message(STATUS "using input plugin csv")
|
||||
add_subdirectory(csv)
|
||||
|
|
|
@ -7,15 +7,15 @@ add_library(input-csv MODULE
|
|||
csv_inline_featureset.cpp
|
||||
csv_utils.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::csv ALIAS input-csv)
|
||||
|
||||
target_link_libraries(input-csv PRIVATE
|
||||
mapnik::mapnik
|
||||
mapnik::wkt
|
||||
mapnik::json
|
||||
)
|
||||
set_target_properties(input-csv PROPERTIES PREFIX "")
|
||||
set_target_properties(input-csv PROPERTIES OUTPUT_NAME "csv")
|
||||
set_target_properties(input-csv PROPERTIES SUFFIX ".input")
|
||||
set_target_properties(input-csv PROPERTIES
|
||||
OUTPUT_NAME "csv"
|
||||
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_featureset.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::gdal ALIAS input-gdal)
|
||||
|
||||
target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIRS})
|
||||
target_link_libraries(input-gdal PRIVATE
|
||||
mapnik::mapnik
|
||||
${GDAL_LIBRARIES}
|
||||
)
|
||||
set_target_properties(input-gdal PROPERTIES PREFIX "")
|
||||
set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal")
|
||||
set_target_properties(input-gdal PROPERTIES SUFFIX ".input")
|
||||
set_target_properties(input-gdal PROPERTIES
|
||||
OUTPUT_NAME "gdal"
|
||||
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_featureset.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::geobuf ALIAS input-geobuf)
|
||||
|
||||
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 "")
|
||||
set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf")
|
||||
set_target_properties(input-geobuf PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-geobuf IS_PLUGIN)
|
||||
mapnik_install_plugin(input-geobuf)
|
||||
|
|
|
@ -6,15 +6,14 @@ add_library(input-geojson MODULE
|
|||
geojson_index_featureset.cpp
|
||||
geojson_memory_index_featureset.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::geojson ALIAS input-geojson)
|
||||
|
||||
target_link_libraries(input-geojson PRIVATE
|
||||
mapnik::mapnik
|
||||
mapnik::json
|
||||
)
|
||||
set_target_properties(input-geojson PROPERTIES
|
||||
OUTPUT_NAME "geojson"
|
||||
PREFIX "${_plugin_prefix}"
|
||||
SUFFIX "${_plugin_suffix}"
|
||||
)
|
||||
|
||||
set_target_properties(input-geojson PROPERTIES PREFIX "")
|
||||
set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson")
|
||||
set_target_properties(input-geojson PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-geojson IS_PLUGIN)
|
||||
mapnik_install_plugin(input-geojson)
|
||||
|
|
|
@ -8,15 +8,15 @@ add_library(input-ogr MODULE
|
|||
ogr_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_link_libraries(input-ogr PRIVATE
|
||||
mapnik::mapnik
|
||||
${GDAL_LIBRARIES}
|
||||
)
|
||||
set_target_properties(input-ogr PROPERTIES PREFIX "")
|
||||
set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr")
|
||||
set_target_properties(input-ogr PROPERTIES SUFFIX ".input")
|
||||
set_target_properties(input-ogr PROPERTIES
|
||||
OUTPUT_NAME "ogr"
|
||||
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_wkb_reader.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::pgraster ALIAS input-pgraster)
|
||||
|
||||
|
||||
target_link_libraries(input-pgraster PRIVATE
|
||||
mapnik::mapnik
|
||||
PostgreSQL::PostgreSQL
|
||||
)
|
||||
set_target_properties(input-pgraster PROPERTIES PREFIX "")
|
||||
set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster")
|
||||
set_target_properties(input-pgraster PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-pgraster IS_PLUGIN)
|
||||
set_target_properties(input-pgraster PROPERTIES
|
||||
OUTPUT_NAME "pgraster"
|
||||
PREFIX "${_plugin_prefix}"
|
||||
SUFFIX "${_plugin_suffix}"
|
||||
)
|
||||
mapnik_install_plugin(input-pgraster)
|
||||
|
|
|
@ -6,15 +6,14 @@ add_library(input-postgis MODULE
|
|||
postgis_datasource.cpp
|
||||
postgis_featureset.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::postgis ALIAS input-postgis)
|
||||
|
||||
target_link_libraries(input-postgis PRIVATE
|
||||
mapnik::mapnik
|
||||
PostgreSQL::PostgreSQL
|
||||
)
|
||||
set_target_properties(input-postgis PROPERTIES
|
||||
OUTPUT_NAME "postgis"
|
||||
PREFIX "${_plugin_prefix}"
|
||||
SUFFIX "${_plugin_suffix}"
|
||||
)
|
||||
|
||||
set_target_properties(input-postgis PROPERTIES PREFIX "")
|
||||
set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis")
|
||||
set_target_properties(input-postgis PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-postgis IS_PLUGIN)
|
||||
mapnik_install_plugin(input-postgis)
|
||||
|
|
|
@ -5,12 +5,11 @@ add_library(input-raster MODULE
|
|||
raster_featureset.cpp
|
||||
raster_info.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::raster ALIAS input-raster)
|
||||
|
||||
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 "")
|
||||
set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster")
|
||||
set_target_properties(input-raster PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-raster IS_PLUGIN)
|
||||
mapnik_install_plugin(input-raster)
|
||||
|
|
|
@ -8,12 +8,11 @@ add_library(input-shape MODULE
|
|||
shape_index_featureset.cpp
|
||||
shape_io.cpp shape_utils.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::shape ALIAS input-shape)
|
||||
|
||||
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 "")
|
||||
set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape")
|
||||
set_target_properties(input-shape PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-shape IS_PLUGIN)
|
||||
mapnik_install_plugin(input-shape)
|
||||
|
|
|
@ -7,14 +7,14 @@ add_library(input-sqlite MODULE
|
|||
sqlite_featureset.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite)
|
||||
|
||||
target_link_libraries(input-sqlite PRIVATE
|
||||
mapnik::mapnik
|
||||
SQLite::SQLite3
|
||||
)
|
||||
set_target_properties(input-sqlite PROPERTIES
|
||||
OUTPUT_NAME "sqlite"
|
||||
PREFIX "${_plugin_prefix}"
|
||||
SUFFIX "${_plugin_suffix}"
|
||||
)
|
||||
|
||||
set_target_properties(input-sqlite PROPERTIES PREFIX "")
|
||||
set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite")
|
||||
set_target_properties(input-sqlite PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-sqlite IS_PLUGIN)
|
||||
mapnik_install_plugin(input-sqlite)
|
||||
|
|
|
@ -5,14 +5,14 @@ add_library(input-topojson MODULE
|
|||
topojson_featureset.cpp
|
||||
)
|
||||
add_library(mapnik::plugin::input::topojson ALIAS input-topojson)
|
||||
|
||||
target_link_libraries(input-topojson PRIVATE
|
||||
mapnik::mapnik
|
||||
mapnik::json
|
||||
)
|
||||
set_target_properties(input-topojson PROPERTIES
|
||||
OUTPUT_NAME "topojson"
|
||||
PREFIX "${_plugin_prefix}"
|
||||
SUFFIX "${_plugin_suffix}"
|
||||
)
|
||||
|
||||
set_target_properties(input-topojson PROPERTIES PREFIX "")
|
||||
set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson")
|
||||
set_target_properties(input-topojson PROPERTIES SUFFIX ".input")
|
||||
|
||||
mapnik_install(TARGET input-topojson IS_PLUGIN)
|
||||
mapnik_install_plugin(input-topojson)
|
||||
|
|
|
@ -293,6 +293,10 @@ set_target_properties(mapnik PROPERTIES
|
|||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "mapnik"
|
||||
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)
|
||||
|
@ -303,14 +307,4 @@ if(MSVC)
|
|||
target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910")
|
||||
endif()
|
||||
|
||||
install(TARGETS 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)
|
||||
mapnik_install(mapnik)
|
||||
|
|
|
@ -28,17 +28,10 @@ set_target_properties(json PROPERTIES
|
|||
POSITION_INDEPENDENT_CODE ON
|
||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "json"
|
||||
PREFIX "libmapnik-"
|
||||
PREFIX "libmapnik"
|
||||
VERSION ${MAPNIK_VERSION}
|
||||
# see mapnik target for explanation
|
||||
SOVERSION ${MAPNIK_VERSION}
|
||||
)
|
||||
|
||||
install(TARGETS 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)
|
||||
mapnik_install(json)
|
||||
|
|
|
@ -20,17 +20,10 @@ set_target_properties(wkt PROPERTIES
|
|||
POSITION_INDEPENDENT_CODE ON
|
||||
DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}"
|
||||
OUTPUT_NAME "wkt"
|
||||
PREFIX "libmapnik-"
|
||||
PREFIX "libmapnik"
|
||||
VERSION ${MAPNIK_VERSION}
|
||||
# see mapnik target for explanation
|
||||
SOVERSION ${MAPNIK_VERSION}
|
||||
)
|
||||
|
||||
install(TARGETS 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)
|
||||
mapnik_install(wkt)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
project(mapnik-test)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
||||
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
|
||||
include(FetchContent)
|
||||
|
|
|
@ -4,4 +4,4 @@ add_executable(geometry_to_wkb main.cpp)
|
|||
|
||||
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)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
||||
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||
|
||||
add_executable(mapnik-index
|
||||
mapnik-index.cpp
|
||||
|
@ -15,4 +15,4 @@ target_link_libraries(mapnik-index PRIVATE
|
|||
Boost::program_options
|
||||
)
|
||||
|
||||
mapnik_install(TARGET mapnik-index)
|
||||
mapnik_install_utility(mapnik-index)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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)
|
||||
|
||||
|
@ -9,4 +9,4 @@ target_link_libraries(mapnik-render PRIVATE
|
|||
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)
|
||||
|
||||
mapnik_install(TARGET ogrindex)
|
||||
mapnik_install_utility(ogrindex)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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(PostgreSQL REQUIRED)
|
||||
|
||||
|
@ -16,4 +16,4 @@ target_link_libraries(pgsql2sqlite PRIVATE
|
|||
mapnik::mapnik
|
||||
)
|
||||
|
||||
mapnik_install(TARGET pgsql2sqlite)
|
||||
mapnik_install_utility(pgsql2sqlite)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
project(shapeindex)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
||||
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||
|
||||
add_executable(shapeindex
|
||||
shapeindex.cpp
|
||||
|
@ -12,4 +12,4 @@ target_link_libraries(shapeindex PRIVATE
|
|||
mapnik::mapnik
|
||||
)
|
||||
|
||||
mapnik_install(TARGET shapeindex)
|
||||
mapnik_install_utility(shapeindex)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
project(svg2png)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
||||
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
|
||||
|
||||
add_executable(svg2png
|
||||
svg2png.cpp
|
||||
|
@ -12,4 +12,4 @@ target_link_libraries(svg2png PRIVATE
|
|||
mapnik::agg
|
||||
)
|
||||
|
||||
mapnik_install(TARGET svg2png)
|
||||
mapnik_install_utility(svg2png)
|
||||
|
|
Loading…
Reference in a new issue