From c85f8462fd62a0de0ea04d773475ec1074629778 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 22 Apr 2022 15:10:49 +0200 Subject: [PATCH] [CMake] fixes for windows (WIP) --- benchmark/CMakeLists.txt | 1 + demo/c++/CMakeLists.txt | 1 + demo/viewer/CMakeLists.txt | 1 + plugins/input/CMakeLists.txt | 1 + src/CMakeLists.txt | 1 + src/json/CMakeLists.txt | 1 + src/mapnik.cpp | 2 ++ src/wkt/CMakeLists.txt | 1 + test/CMakeLists.txt | 5 +++++ test/visual/CMakeLists.txt | 1 + utils/geometry_to_wkb/CMakeLists.txt | 1 + utils/mapnik-index/CMakeLists.txt | 1 + utils/mapnik-render/CMakeLists.txt | 1 + utils/ogrindex/CMakeLists.txt | 1 + utils/pgsql2sqlite/CMakeLists.txt | 1 + utils/shapeindex/CMakeLists.txt | 1 + utils/svg2png/CMakeLists.txt | 1 + 17 files changed, 22 insertions(+) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 87809b55e..9aefc6b29 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -37,6 +37,7 @@ function(mapnik_create_benchmark) RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" OUTPUT_NAME "${BENCHNAME}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) endfunction() diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index ee9e79af5..fdf365528 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -3,6 +3,7 @@ set_target_properties(mapnik-demo PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index cbe348291..b1e2355ae 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -43,6 +43,7 @@ set_target_properties(mapnik-viewer PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-viewer PRIVATE diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 500e8248c..dbc06c835 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -21,6 +21,7 @@ macro(add_plugin_target plugin_target output_name) LIBRARY_OUTPUT_DIRECTORY "${_plugin_library_output}" RUNTIME_OUTPUT_DIRECTORY "${_plugin_runtime_output}" ARCHIVE_OUTPUT_DIRECTORY "${_plugin_archive_output}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_plugin(${plugin_target}) endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbbbcefe3..6bf3714ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,6 +54,7 @@ set_target_properties(mapnik PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) if(MSVC) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index bdda4a042..0444942fc 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -35,6 +35,7 @@ set_target_properties(json PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install(json) diff --git a/src/mapnik.cpp b/src/mapnik.cpp index 0a67bce34..9dbe3a8e0 100644 --- a/src/mapnik.cpp +++ b/src/mapnik.cpp @@ -40,6 +40,7 @@ void register_image_readers() } } // namespace mapnik +#if !defined(MAPNIK_STATIC_PLUGINS) || !defined(_WIN32) namespace { class AutoSetup final { @@ -48,3 +49,4 @@ class AutoSetup final }; AutoSetup auto_setup{}; } // namespace +#endif diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 7cb0db1fd..562cc67e9 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -27,6 +27,7 @@ set_target_properties(wkt PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install(wkt) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a7aa3f98e..d1c98cc08 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -104,6 +104,7 @@ set_target_properties(mapnik-test-unit PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-test-unit PUBLIC Catch2::Catch2 @@ -123,6 +124,7 @@ set_target_properties(agg_rasterizer_integer_overflow_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC Catch2::Catch2 @@ -137,6 +139,7 @@ set_target_properties(datasource_registration_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(datasource_registration_test PUBLIC Catch2::Catch2 @@ -150,6 +153,7 @@ set_target_properties(font_registration_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(font_registration_test PUBLIC Catch2::Catch2 @@ -165,6 +169,7 @@ set_target_properties(map_xml_test PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(map_xml_test PUBLIC Catch2::Catch2 diff --git a/test/visual/CMakeLists.txt b/test/visual/CMakeLists.txt index a1d561c7e..582fff51b 100644 --- a/test/visual/CMakeLists.txt +++ b/test/visual/CMakeLists.txt @@ -8,6 +8,7 @@ set_target_properties(mapnik-test-visual PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) target_link_libraries(mapnik-test-visual PRIVATE Catch2::Catch2 diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index 518f4ac9a..c858d692f 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -4,6 +4,7 @@ target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) set_target_properties(geometry_to_wkb PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(geometry_to_wkb) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index ec6ce97eb..897747288 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -15,6 +15,7 @@ target_link_libraries(mapnik-index PRIVATE set_target_properties(mapnik-index PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(mapnik-index) diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 27ccfbe8d..974a8990b 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -9,6 +9,7 @@ target_link_libraries(mapnik-render PRIVATE set_target_properties(mapnik-render PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(mapnik-render) diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 69f27cdd6..564783771 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -4,6 +4,7 @@ target_link_libraries(ogrindex PRIVATE mapnik::mapnik) set_target_properties(ogrindex PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(ogrindex) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 6def100c0..b5264ae60 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -17,6 +17,7 @@ target_link_libraries(pgsql2sqlite PRIVATE set_target_properties(pgsql2sqlite PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(pgsql2sqlite) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index d39ca3f04..386ebd3c0 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(shapeindex PRIVATE set_target_properties(shapeindex PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(shapeindex) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index dc239cd2b..34ee18462 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(svg2png PRIVATE set_target_properties(svg2png PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" ) mapnik_install_utility(svg2png)