[CMake] better logging of feature options. Output log files for better help management. ; get started with mapnik-config
This commit is contained in:
parent
59f7a61661
commit
dea63374f4
5 changed files with 96 additions and 77 deletions
115
CMakeLists.txt
115
CMakeLists.txt
|
@ -17,72 +17,77 @@ 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(FeatureSummary)
|
||||
include(MapnikOption)
|
||||
include(MapnikMinimumVersions)
|
||||
include(MapnikFindPackage)
|
||||
include(MapnikCopyDependencies)
|
||||
include(MapnikInstall)
|
||||
|
||||
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" OFF)
|
||||
option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON)
|
||||
option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON)
|
||||
mapnik_option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" OFF)
|
||||
mapnik_option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON)
|
||||
mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON)
|
||||
|
||||
option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON)
|
||||
option(BUILD_TEST "builds the tests" ON)
|
||||
option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF)
|
||||
option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF)
|
||||
option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF)
|
||||
option(USE_EXTERNAL_MAPBOX_VARIANT "Use a external mapnik/variant. If off, use the submodule" OFF)
|
||||
option(USE_JPEG "adds jpeg support" ON)
|
||||
option(USE_PNG "adds png support" ON)
|
||||
option(USE_TIFF "adds tiff support" ON)
|
||||
option(USE_WEBP "adds webp support" ON)
|
||||
option(USE_LIBXML2 "adds libxml2 support" ON)
|
||||
option(USE_CAIRO "adds the cairo renderer" ON)
|
||||
option(USE_PROJ "adds proj support" ON)
|
||||
option(USE_GRID_RENDERER "adds grid renderer" ON)
|
||||
option(USE_SVG_RENDERER "adds svg renderer" ON)
|
||||
option(USE_BIGINT "uses 64 bit instead of 32" ON)
|
||||
option(USE_MEMORY_MAPPED_FILE "uses file cache" ON)
|
||||
option(USE_MULTITHREADED "enables the multithreaded features (threadsafe)" ON)
|
||||
option(USE_NO_ATEXIT "disable atexit" OFF)
|
||||
option(USE_NO_DLCLOSE "disable dlclose" OFF)
|
||||
option(USE_DEBUG_OUTPUT "enables some debug messages for development" OFF)
|
||||
option(USE_LOG "enables logging output. See log severity level." OFF)
|
||||
mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON)
|
||||
mapnik_option(BUILD_TEST "builds the tests" ON)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_VARIANT "Use a external mapnik/variant. If off, use the submodule" OFF)
|
||||
mapnik_option(USE_JPEG "adds jpeg support" ON)
|
||||
mapnik_option(USE_PNG "adds png support" ON)
|
||||
mapnik_option(USE_TIFF "adds tiff support" ON)
|
||||
mapnik_option(USE_WEBP "adds webp support" ON)
|
||||
mapnik_option(USE_LIBXML2 "adds libxml2 support" ON)
|
||||
mapnik_option(USE_CAIRO "adds the cairo renderer" ON)
|
||||
mapnik_option(USE_PROJ "adds proj support" ON)
|
||||
mapnik_option(USE_GRID_RENDERER "adds grid renderer" ON)
|
||||
mapnik_option(USE_SVG_RENDERER "adds svg renderer" ON)
|
||||
mapnik_option(USE_BIGINT "uses 64 bit instead of 32" ON)
|
||||
mapnik_option(USE_MEMORY_MAPPED_FILE "uses file cache" ON)
|
||||
mapnik_option(USE_MULTITHREADED "enables the multithreaded features (threadsafe)" ON)
|
||||
mapnik_option(USE_NO_ATEXIT "disable atexit" OFF)
|
||||
mapnik_option(USE_NO_DLCLOSE "disable dlclose" OFF)
|
||||
mapnik_option(USE_DEBUG_OUTPUT "enables some debug messages for development" OFF)
|
||||
mapnik_option(USE_LOG "enables logging output. See log severity level." OFF)
|
||||
# 0 = debug
|
||||
# 1 = warn
|
||||
# 2 = error
|
||||
# 3 = none
|
||||
set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON")
|
||||
option(USE_STATS "Enable statistics reporting" OFF)
|
||||
mapnik_option(USE_STATS "Enable statistics reporting" OFF)
|
||||
|
||||
option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON)
|
||||
option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON)
|
||||
option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON)
|
||||
option(USE_PLUGIN_INPUT_GEOJSON "adds plugin input geojson" ON)
|
||||
option(USE_PLUGIN_INPUT_OGR "adds plugin input ogr" ON)
|
||||
option(USE_PLUGIN_INPUT_PGRASTER "adds plugin input pgraster" ON)
|
||||
option(USE_PLUGIN_INPUT_POSTGIS "adds plugin input postgis" ON)
|
||||
option(USE_PLUGIN_INPUT_RASTER "adds plugin input raster" ON)
|
||||
option(USE_PLUGIN_INPUT_SHAPE "adds plugin input shape" ON)
|
||||
option(USE_PLUGIN_INPUT_SQLITE "adds plugin input sqlite" ON)
|
||||
option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_GEOJSON "adds plugin input geojson" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_OGR "adds plugin input ogr" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_PGRASTER "adds plugin input pgraster" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_POSTGIS "adds plugin input postgis" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_RASTER "adds plugin input raster" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_SHAPE "adds plugin input shape" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_SQLITE "adds plugin input sqlite" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON)
|
||||
|
||||
option(BUILD_DEMO_VIEWER "builds the demo viewer" ON)
|
||||
option(BUILD_DEMO_CPP "builds the demo c++ application" ON)
|
||||
mapnik_option(BUILD_DEMO_VIEWER "builds the demo viewer" ON)
|
||||
mapnik_option(BUILD_DEMO_CPP "builds the demo c++ application" ON)
|
||||
|
||||
option(BUILD_BENCHMARK "builds benchmark project" ON)
|
||||
mapnik_option(BUILD_BENCHMARK "builds benchmark project" ON)
|
||||
|
||||
option(BUILD_UTILITY_GEOMETRY_TO_WKB "builds the utility program geometry_to_wkb" ON)
|
||||
option(BUILD_UTILITY_MAPNIK_INDEX "builds the utility program mapnik_index" ON)
|
||||
option(BUILD_UTILITY_MAPNIK_RENDER "builds the utility program mapnik_render" ON)
|
||||
option(BUILD_UTILITY_OGRINDEX "builds the utility program ogrindex" OFF)
|
||||
option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON)
|
||||
option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON)
|
||||
option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON)
|
||||
mapnik_option(BUILD_UTILITY_GEOMETRY_TO_WKB "builds the utility program geometry_to_wkb" ON)
|
||||
mapnik_option(BUILD_UTILITY_MAPNIK_INDEX "builds the utility program mapnik_index" ON)
|
||||
mapnik_option(BUILD_UTILITY_MAPNIK_RENDER "builds the utility program mapnik_render" ON)
|
||||
mapnik_option(BUILD_UTILITY_OGRINDEX "builds the utility program ogrindex" OFF)
|
||||
mapnik_option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON)
|
||||
mapnik_option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON)
|
||||
mapnik_option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON)
|
||||
|
||||
option(USE_BOOST_REGEX_ICU_WORKAROUND "if you don't use your system libraries and get double linked icu libraries set this to ON" OFF)
|
||||
option(USE_GLIBC_WORKAROUND "see https://github.com/mapnik/mapnik/pull/3792 if you building with libstdc++-4.9" OFF)
|
||||
mapnik_option(USE_BOOST_REGEX_ICU_WORKAROUND "if you don't use your system libraries and get double linked icu libraries set this to ON" OFF)
|
||||
mapnik_option(USE_GLIBC_WORKAROUND "see https://github.com/mapnik/mapnik/pull/3792 if you building with libstdc++-4.9" OFF)
|
||||
|
||||
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
||||
feature_summary(FILENAME "${CMAKE_CURRENT_BINARY_DIR}/features.log" WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++14 is minimum.")
|
||||
message(STATUS "Using c++${CMAKE_CXX_STANDARD}")
|
||||
|
@ -222,42 +227,34 @@ set_property(GLOBAL PROPERTY PLUGINS "")
|
|||
set_property(GLOBAL PROPERTY MAPNIK_UTILITIES "")
|
||||
|
||||
if(USE_GLIBC_WORKAROUND)
|
||||
message("using glibc workaround")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_ENABLE_GLIBC_WORKAROUND)
|
||||
endif()
|
||||
|
||||
if(USE_BIGINT)
|
||||
message(STATUS "uses BIGINT")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS BIGINT)
|
||||
endif()
|
||||
|
||||
if(USE_MEMORY_MAPPED_FILE)
|
||||
message(STATUS "uses MAPNIK_MEMORY_MAPPED_FILE")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE)
|
||||
endif()
|
||||
|
||||
if(USE_NO_ATEXIT)
|
||||
message(STATUS "uses MAPNIK_NO_ATEXIT")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_NO_ATEXIT)
|
||||
endif()
|
||||
|
||||
if(USE_NO_DLCLOSE)
|
||||
message(STATUS "uses MAPNIK_NO_DLCLOSE")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_NO_DLCLOSE)
|
||||
endif()
|
||||
|
||||
if(USE_DEBUG_OUTPUT)
|
||||
message(STATUS "enabled debug outputs")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_DEBUG)
|
||||
endif()
|
||||
|
||||
if(USE_LOG)
|
||||
message(STATUS "logging enabled with level ${USE_LOG_SEVERITY}")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_LOG MAPNIK_DEFAULT_LOG_SEVERITY=${USE_LOG_SEVERITY})
|
||||
endif()
|
||||
|
||||
if(USE_STATS)
|
||||
message(STATUS "adding statistics")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATS)
|
||||
endif()
|
||||
|
||||
|
@ -319,12 +316,10 @@ if(USE_PROJ)
|
|||
endif()
|
||||
|
||||
if(USE_GRID_RENDERER)
|
||||
message(STATUS "Using grid renderer")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS GRID_RENDERER)
|
||||
endif()
|
||||
|
||||
if(USE_SVG_RENDERER)
|
||||
message(STATUS "Using svg renderer")
|
||||
list(APPEND MAPNIK_COMPILE_DEFS SVG_RENDERER)
|
||||
endif()
|
||||
|
||||
|
@ -375,6 +370,8 @@ if(BUILD_TEST)
|
|||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
feature_summary(FILENAME "${CMAKE_CURRENT_BINARY_DIR}/packages.log" WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND INCLUDE_QUIET_PACKAGES)
|
||||
|
||||
# start package mapnik
|
||||
include(MapnikExport)
|
||||
include(MapnikExportPkgConfig)
|
||||
|
|
4
cmake/MapnikOption.cmake
Normal file
4
cmake/MapnikOption.cmake
Normal file
|
@ -0,0 +1,4 @@
|
|||
macro(mapnik_option _name)
|
||||
option(${ARGN})
|
||||
add_feature_info("${ARGV0}" ${ARGV0} "${ARGV1}")
|
||||
endmacro()
|
|
@ -2,46 +2,35 @@ set(_plugin_prefix "")
|
|||
set(_plugin_suffix ".input")
|
||||
|
||||
if(USE_PLUGIN_INPUT_CSV)
|
||||
message(STATUS "using input plugin csv")
|
||||
add_subdirectory(csv)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_GDAL)
|
||||
message(STATUS "using input plugin gdal")
|
||||
add_subdirectory(gdal)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_GEOBUF)
|
||||
message(STATUS "using input plugin geobuf")
|
||||
add_subdirectory(geobuf)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_GEOJSON)
|
||||
message(STATUS "using input plugin geojson")
|
||||
add_subdirectory(geojson)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_OGR)
|
||||
message(STATUS "using input plugin ogr")
|
||||
add_subdirectory(ogr)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_PGRASTER)
|
||||
message(STATUS "using input plugin pgraster")
|
||||
add_subdirectory(pgraster)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_POSTGIS)
|
||||
message(STATUS "using input plugin postgis")
|
||||
add_subdirectory(postgis)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_RASTER)
|
||||
message(STATUS "using input plugin raster")
|
||||
add_subdirectory(raster)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_SHAPE)
|
||||
message(STATUS "using input plugin shape")
|
||||
add_subdirectory(shape)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_SQLITE)
|
||||
message(STATUS "using input plugin sqlite")
|
||||
add_subdirectory(sqlite)
|
||||
endif()
|
||||
if(USE_PLUGIN_INPUT_TOPOJSON)
|
||||
message(STATUS "using input plugin topojson")
|
||||
add_subdirectory(topojson)
|
||||
endif()
|
||||
|
|
|
@ -1,29 +1,24 @@
|
|||
if(BUILD_UTILITY_GEOMETRY_TO_WKB)
|
||||
message(STATUS "building utility geometry_to_wkb")
|
||||
add_subdirectory(geometry_to_wkb)
|
||||
endif()
|
||||
if(BUILD_UTILITY_MAPNIK_INDEX)
|
||||
message(STATUS "building utility mapnik-index")
|
||||
add_subdirectory(mapnik-index)
|
||||
endif()
|
||||
if(BUILD_UTILITY_MAPNIK_RENDER)
|
||||
message(STATUS "building utility mapnik-render")
|
||||
add_subdirectory(mapnik-render)
|
||||
endif()
|
||||
if(BUILD_UTILITY_OGRINDEX)
|
||||
message(STATUS "building utility ogrindex")
|
||||
message(WARNING "can't build ogrindex currently due to some bugs")
|
||||
#add_subdirectory(ogrindex) # missing include file shapeindex/quadtree.hpp
|
||||
endif()
|
||||
if(BUILD_UTILITY_PGSQL2SQLITE)
|
||||
message(STATUS "building utility pgsql2sqlite")
|
||||
add_subdirectory(pgsql2sqlite)
|
||||
endif()
|
||||
if(BUILD_UTILITY_SHAPEINDEX)
|
||||
message(STATUS "building utility shapeindex")
|
||||
add_subdirectory(shapeindex)
|
||||
endif()
|
||||
if(BUILD_UTILITY_SVG2PNG)
|
||||
message(STATUS "building utility svg2png")
|
||||
add_subdirectory(svg2png)
|
||||
endif()
|
||||
|
||||
add_subdirectory(mapnik-config)
|
||||
|
|
34
utils/mapnik-config/CMakeLists.txt
Normal file
34
utils/mapnik-config/CMakeLists.txt
Normal file
|
@ -0,0 +1,34 @@
|
|||
# to keep compability with SCons we need to read the file and replace the values.
|
||||
file(READ mapnik-config.template.sh _template)
|
||||
|
||||
string(REPLACE "CONFIG_MAPNIK_VERSION=\"unknown\"" "CONFIG_MAPNIK_VERSION=\"${CMAKE_PROJECT_VERSION}\"" _template ${_template})
|
||||
string(REPLACE "CONFIG_MAPNIK_VERSION_STRING=\"unknown\"" "CONFIG_MAPNIK_VERSION_STRING=\"${CMAKE_PROJECT_VERSION}\"" _template ${_template})
|
||||
|
||||
get_filename_component(_cxx_compiler ${CMAKE_CXX_COMPILER} NAME_WE)
|
||||
string(REPLACE "CONFIG_CXX=\"c++\"" "CONFIG_CXX=\"${_cxx_compiler}\"" _template ${_template})
|
||||
|
||||
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}")
|
||||
string(REPLACE "CONFIG_DEFINES=" "CONFIG_DEFINES=\"${_str_compile_defs}\"" _template ${_template})
|
||||
endif()
|
||||
|
||||
|
||||
execute_process(COMMAND git rev-list --max-count=1 HEAD OUTPUT_VARIABLE _git_rev ERROR_VARIABLE _git_rev_err WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
execute_process(COMMAND git describe HEAD OUTPUT_VARIABLE _git_desc ERROR_VARIABLE _git_desc_err WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
message(STATUS "mapnik-config: _git_rev: ${_git_rev}")
|
||||
message(STATUS "mapnik-config: _git_rev_err: ${_git_rev_err}")
|
||||
message(STATUS "mapnik-config: _git_desc: ${_git_desc}")
|
||||
message(STATUS "mapnik-config: _git_desc_err: ${_git_desc_err}")
|
||||
if(NOT _git_rev_err)
|
||||
string(REGEX REPLACE "\n$" "" _git_rev "${_git_rev}")
|
||||
string(REPLACE "CONFIG_GIT_REVISION=\"N/A\"" "CONFIG_GIT_REVISION=\"${_git_rev}\"" _template ${_template})
|
||||
endif()
|
||||
if(NOT _git_desc_err)
|
||||
string(REGEX REPLACE "\n$" "" _git_desc "${_git_desc}")
|
||||
string(REPLACE "CONFIG_GIT_DESCRIBE=\"\${CONFIG_MAPNIK_VERSION_STRING}\"" "CONFIG_GIT_DESCRIBE=\"${_git_desc}\"" _template ${_template})
|
||||
endif()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/mapnik-config" ${_template})
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mapnik-config" DESTINATION ${MAPNIK_BIN_DIR} COMPONENT MapnikRuntime)
|
Loading…
Reference in a new issue