forked from mapnik/mapnik
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mapnik#4191 from mathisloge/cmake-support
CMake build support
- Loading branch information
Showing
57 changed files
with
2,578 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
{ | ||
"version": 2, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 20, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "use-ninja", | ||
"hidden": true, | ||
"generator": "Ninja" | ||
}, | ||
{ | ||
"name": "default-build-dir", | ||
"hidden": true, | ||
"binaryDir": "${sourceDir}/build/${presetName}" | ||
}, | ||
{ | ||
"name": "debug-build", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug", | ||
"USE_DEBUG_OUTPUT": "ON", | ||
"USE_LOG": "ON", | ||
"USE_LOG_SEVERITY": "0" | ||
} | ||
}, | ||
{ | ||
"name": "release-build", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release", | ||
"USE_DEBUG_OUTPUT": "OFF", | ||
"USE_LOG": "OFF" | ||
} | ||
}, | ||
{ | ||
"name": "use-clang", | ||
"hidden": true, | ||
"inherits": [ | ||
"default-build-dir", | ||
"use-ninja" | ||
], | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "clang", | ||
"CMAKE_CXX_COMPILER": "clang++", | ||
"CMAKE_CXX_FLAGS": "-stdlib=libc++", | ||
"CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++", | ||
"CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libc++" | ||
} | ||
}, | ||
{ | ||
"name": "use-gcc", | ||
"hidden": true, | ||
"inherits": [ | ||
"default-build-dir", | ||
"use-ninja" | ||
], | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "gcc", | ||
"CMAKE_CXX_COMPILER": "g++" | ||
} | ||
}, | ||
{ | ||
"name": "use-msvc-cl", | ||
"hidden": true, | ||
"inherits": [ | ||
"default-build-dir", | ||
"use-ninja" | ||
], | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "cl", | ||
"CMAKE_CXX_COMPILER": "cl" | ||
} | ||
}, | ||
{ | ||
"name": "use-msvc-clang-cl", | ||
"hidden": true, | ||
"inherits": [ | ||
"default-build-dir", | ||
"use-ninja" | ||
], | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "clang-cl", | ||
"CMAKE_CXX_COMPILER": "clang-cl" | ||
} | ||
}, | ||
{ | ||
"name": "linux-clang-debug", | ||
"displayName": "Linux clang debug", | ||
"inherits": [ | ||
"use-clang", | ||
"debug-build" | ||
] | ||
}, | ||
{ | ||
"name": "linux-clang-release", | ||
"displayName": "Linux clang release", | ||
"inherits": [ | ||
"use-clang", | ||
"release-build" | ||
] | ||
}, | ||
{ | ||
"name": "linux-gcc-debug", | ||
"displayName": "Linux gcc debug", | ||
"inherits": [ | ||
"use-gcc", | ||
"debug-build" | ||
] | ||
}, | ||
{ | ||
"name": "linux-gcc-release", | ||
"displayName": "Linux gcc release", | ||
"inherits": [ | ||
"use-gcc", | ||
"release-build" | ||
] | ||
}, | ||
{ | ||
"name": "windows-arch-x64", | ||
"hidden": true, | ||
"architecture": { | ||
"value": "x64", | ||
"strategy": "external" | ||
}, | ||
"toolset": { | ||
"value": "host=x64", | ||
"strategy": "external" | ||
} | ||
}, | ||
{ | ||
"name": "windows-default", | ||
"displayName": "Windows x64 Debug", | ||
"hidden": true, | ||
"inherits": [ | ||
"use-msvc-cl", | ||
"windows-arch-x64" | ||
], | ||
"vendor": { | ||
"microsoft.com/VisualStudioSettings/CMake/1.0": { | ||
"hostOS": [ | ||
"Windows" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "windows-default-debug", | ||
"displayName": "Windows x64 Debug", | ||
"inherits": [ | ||
"windows-default", | ||
"debug-build" | ||
] | ||
}, | ||
{ | ||
"name": "windows-default-release", | ||
"displayName": "Windows x64 Release", | ||
"inherits": [ | ||
"windows-default", | ||
"release-build" | ||
] | ||
} | ||
], | ||
"buildPresets": [ | ||
{ | ||
"name": "windows-default", | ||
"configurePreset": "windows-default-debug" | ||
}, | ||
{ | ||
"name": "linux-default", | ||
"configurePreset": "linux-clang-debug" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
project(mapnik-benchmark) | ||
|
||
set(BENCHMARK_SRCS | ||
src/normalize_angle.cpp | ||
src/test_array_allocation.cpp | ||
src/test_expression_parse.cpp | ||
src/test_face_ptr_creation.cpp | ||
src/test_font_registration.cpp | ||
src/test_getline.cpp | ||
src/test_marker_cache.cpp | ||
src/test_noop_rendering.cpp | ||
src/test_numeric_cast_vs_static_cast.cpp | ||
src/test_offset_converter.cpp | ||
src/test_png_encoding1.cpp | ||
src/test_png_encoding2.cpp | ||
src/test_polygon_clipping_rendering.cpp | ||
src/test_polygon_clipping.cpp | ||
src/test_proj_transform1.cpp | ||
src/test_quad_tree.cpp | ||
src/test_rendering_shared_map.cpp | ||
src/test_rendering.cpp | ||
src/test_to_bool.cpp | ||
src/test_to_double.cpp | ||
src/test_to_int.cpp | ||
src/test_to_string1.cpp | ||
src/test_to_string2.cpp | ||
src/test_utf_encoding.cpp | ||
) | ||
function(mapnik_create_benchmark) | ||
get_filename_component(BENCHNAME ${ARGV0} NAME_WE) | ||
set(TARGET_NAME "mapnik-benchmark-${BENCHNAME}") | ||
add_executable(${TARGET_NAME} ${ARGV0}) | ||
target_include_directories(${TARGET_NAME} PRIVATE include) | ||
target_link_libraries(${TARGET_NAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik) | ||
|
||
mapnik_copy_dependencies(TARGETS ${TARGET_NAME}) | ||
endfunction() | ||
|
||
foreach(benchmark ${BENCHMARK_SRCS}) | ||
mapnik_create_benchmark(${benchmark}) | ||
endforeach() | ||
|
||
# we just need one target to reference the directory correctly. mapnik-benchmark-normalize_angle is just the first in BENCHMARK_SRCS | ||
mapnik_require_fonts(TARGET mapnik-benchmark-normalize_angle DESTINATION fonts) | ||
# copy all plugins | ||
mapnik_copy_plugins(TARGET mapnik-benchmark-normalize_angle | ||
DESTINATION plugins/input | ||
PLUGINS | ||
input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson | ||
) | ||
# copy all plugin dlls. | ||
mapnik_copy_dependencies(TARGETS mapnik-benchmark-normalize_angle | ||
PLUGINS | ||
input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This is a helper script to run BundleUtilities fixup_bundle as postbuild | ||
# for a target. The primary use case is to copy .DLLs to the build directory for | ||
# the Windows platform. It allows generator expressions to be used to determine | ||
# the binary location | ||
# | ||
# Usage : copy_dlls_for_debug TARGET LIBS DIRS | ||
# - TARGET : A cmake target | ||
# - See fixup_bundle for LIBS and DIRS arguments | ||
|
||
if(RUN_IT) | ||
# Script ran by the add_custom_command | ||
include(BundleUtilities) | ||
include(InstallRequiredSystemLibraries) | ||
string (REPLACE " " ";" TO_FIXUP_LIBS "${TO_FIXUP_LIBS}") | ||
string (REPLACE " " ";" TO_FIXUP_DIRS "${TO_FIXUP_DIRS}") | ||
#message(STATUS "${TO_FIXUP_FILE} ${TO_FIXUP_LIBS} ${TO_FIXUP_DIRS}") | ||
fixup_bundle("${TO_FIXUP_FILE}" "${TO_FIXUP_LIBS}" "${TO_FIXUP_DIRS}") | ||
# End of script ran by the add_custom_command | ||
else() | ||
|
||
set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE}) | ||
function(copy_dlls_for_debug) | ||
set(options) | ||
set(oneValueArgs) | ||
set(multiValueArgs TARGETS LIBS DIRS) | ||
cmake_parse_arguments(MAPNIK_COPY_DLLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
if(WIN32) | ||
foreach(_target IN LISTS MAPNIK_COPY_DLLS_TARGETS) | ||
add_custom_command( | ||
TARGET ${_target} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} ARGS -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE="$<TARGET_FILE:${_target}>" -DTO_FIXUP_LIBS:STRING="${MAPNIK_COPY_DLLS_LIBS}" -DTO_FIXUP_DIRS="${MAPNIK_COPY_DLLS_DIRS}" -P "${THIS_FILE}" | ||
COMMENT "Fixing up dependencies for ${_target}" | ||
) | ||
endforeach() | ||
endif(WIN32) | ||
endfunction() | ||
|
||
endif() |
Oops, something went wrong.