From 71a5096240d015de566a35962590269745dc352e Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Mon, 15 Jan 2024 09:05:44 -0600 Subject: [PATCH 1/3] turn off sanitizers for msvc debug copy sanitizer bin required for msvc --- Dependencies.cmake | 4 ++-- cmake/Sanitizers.cmake | 6 +++++- src/ftxui_sample/CMakeLists.txt | 12 ++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Dependencies.cmake b/Dependencies.cmake index a84378d2..253991e3 100644 --- a/Dependencies.cmake +++ b/Dependencies.cmake @@ -9,7 +9,7 @@ function(myproject_setup_dependencies) # already been provided to us by a parent project if(NOT TARGET fmtlib::fmtlib) - cpmaddpackage("gh:fmtlib/fmt#9.1.0") + cpmaddpackage("gh:fmtlib/fmt#10.2.1") endif() if(NOT TARGET spdlog::spdlog) @@ -17,7 +17,7 @@ function(myproject_setup_dependencies) NAME spdlog VERSION - 1.11.0 + 1.13.0 GITHUB_REPOSITORY "gabime/spdlog" OPTIONS diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake index e238fa21..94e994dc 100644 --- a/cmake/Sanitizers.cmake +++ b/cmake/Sanitizers.cmake @@ -45,7 +45,11 @@ function( endif() elseif(MSVC) if(${ENABLE_SANITIZER_ADDRESS}) - list(APPEND SANITIZERS "address") + if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + message(WARNING "MSVC only supports address sanitizer in release builds") + else() + list(APPEND SANITIZERS "address") + endif() endif() if(${ENABLE_SANITIZER_LEAK} OR ${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR} diff --git a/src/ftxui_sample/CMakeLists.txt b/src/ftxui_sample/CMakeLists.txt index fc5c65e2..de02fbd8 100644 --- a/src/ftxui_sample/CMakeLists.txt +++ b/src/ftxui_sample/CMakeLists.txt @@ -17,3 +17,15 @@ target_link_system_libraries( ftxui::component) target_include_directories(intro PRIVATE "${CMAKE_BINARY_DIR}/configured_files/include") + +if(MSVC AND myproject_ENABLE_SANITIZER_ADDRESS) + cmake_path(GET CMAKE_CXX_COMPILER PARENT_PATH MSVC_TOOLS_DIR) + install( + FILES + "${MSVC_TOOLS_DIR}/clang_rt.asan_dbg_dynamic-x86_64.dll" + "${MSVC_TOOLS_DIR}/clang_rt.asan_dbg_dynamic-x86_64.pdb" + "${MSVC_TOOLS_DIR}/clang_rt.asan_dynamic-x86_64.dll" + "${MSVC_TOOLS_DIR}/clang_rt.asan_dynamic-x86_64.pdb" + TYPE BIN + ) +endif() From ec044522916159f458bb568e2f8eeff4640e1433 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Mon, 15 Jan 2024 09:08:53 -0600 Subject: [PATCH 2/3] move sanitizer install to Sanitizers.cmake --- cmake/Sanitizers.cmake | 9 +++++++++ src/ftxui_sample/CMakeLists.txt | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake index 94e994dc..71f572ad 100644 --- a/cmake/Sanitizers.cmake +++ b/cmake/Sanitizers.cmake @@ -49,6 +49,15 @@ function( message(WARNING "MSVC only supports address sanitizer in release builds") else() list(APPEND SANITIZERS "address") + cmake_path(GET CMAKE_CXX_COMPILER PARENT_PATH MSVC_TOOLS_DIR) + install( + FILES + "${MSVC_TOOLS_DIR}/clang_rt.asan_dbg_dynamic-x86_64.dll" + "${MSVC_TOOLS_DIR}/clang_rt.asan_dbg_dynamic-x86_64.pdb" + "${MSVC_TOOLS_DIR}/clang_rt.asan_dynamic-x86_64.dll" + "${MSVC_TOOLS_DIR}/clang_rt.asan_dynamic-x86_64.pdb" + TYPE BIN + ) endif() endif() if(${ENABLE_SANITIZER_LEAK} diff --git a/src/ftxui_sample/CMakeLists.txt b/src/ftxui_sample/CMakeLists.txt index de02fbd8..cd57fcdb 100644 --- a/src/ftxui_sample/CMakeLists.txt +++ b/src/ftxui_sample/CMakeLists.txt @@ -18,14 +18,3 @@ target_link_system_libraries( target_include_directories(intro PRIVATE "${CMAKE_BINARY_DIR}/configured_files/include") -if(MSVC AND myproject_ENABLE_SANITIZER_ADDRESS) - cmake_path(GET CMAKE_CXX_COMPILER PARENT_PATH MSVC_TOOLS_DIR) - install( - FILES - "${MSVC_TOOLS_DIR}/clang_rt.asan_dbg_dynamic-x86_64.dll" - "${MSVC_TOOLS_DIR}/clang_rt.asan_dbg_dynamic-x86_64.pdb" - "${MSVC_TOOLS_DIR}/clang_rt.asan_dynamic-x86_64.dll" - "${MSVC_TOOLS_DIR}/clang_rt.asan_dynamic-x86_64.pdb" - TYPE BIN - ) -endif() From 792ce81acdb509958ff1a93c80273275200ec261 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Mon, 15 Jan 2024 10:39:26 -0600 Subject: [PATCH 3/3] Back to prior version of dependencies --- Dependencies.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dependencies.cmake b/Dependencies.cmake index 253991e3..a84378d2 100644 --- a/Dependencies.cmake +++ b/Dependencies.cmake @@ -9,7 +9,7 @@ function(myproject_setup_dependencies) # already been provided to us by a parent project if(NOT TARGET fmtlib::fmtlib) - cpmaddpackage("gh:fmtlib/fmt#10.2.1") + cpmaddpackage("gh:fmtlib/fmt#9.1.0") endif() if(NOT TARGET spdlog::spdlog) @@ -17,7 +17,7 @@ function(myproject_setup_dependencies) NAME spdlog VERSION - 1.13.0 + 1.11.0 GITHUB_REPOSITORY "gabime/spdlog" OPTIONS