add an option to disable plugin and font copying

This commit is contained in:
Mathis Logemann 2021-04-09 15:53:21 +02:00
parent 02f78e4ce5
commit 1929fbc0ba
2 changed files with 28 additions and 24 deletions

View file

@ -18,8 +18,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(MapnikFindPackage)
include(MapnikCopyDependencies)
set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully")
option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (currently only windows) to the executable directory" ON)
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")
option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" ON)
option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON)
option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON)
option(BUILD_TEST "builds the tests" ON)

View file

@ -28,31 +28,34 @@ function(mapnik_copy_dependencies)
endfunction()
function(mapnik_copy_plugins)
set(options)
set(oneValueArgs TARGET DESTINATION)
set(multiValueArgs PLUGINS)
cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# copy_if_different requires a existing directory.
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION})
foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS)
#message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}")
if(TARGET ${PLUGIN})
add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${PLUGIN}>" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/)
else()
message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.")
endif()
endforeach()
if(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES)
set(options)
set(oneValueArgs TARGET DESTINATION)
set(multiValueArgs PLUGINS)
cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# copy_if_different requires a existing directory.
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION})
foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS)
#message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}")
if(TARGET ${PLUGIN})
add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${PLUGIN}>" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/)
else()
message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.")
endif()
endforeach()
endif()
endfunction()
function(mapnik_require_fonts)
set(options)
set(oneValueArgs TARGET DESTINATION)
set(multiValueArgs)
cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES)
set(options)
set(oneValueArgs TARGET DESTINATION)
set(multiValueArgs)
cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/)
add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/)
endif()
endfunction()