From 95ab459a4c712789605fa89bef406a4f7e11454e Mon Sep 17 00:00:00 2001 From: Ajay GunaShekar <86270081+agunashe@users.noreply.github.com> Date: Wed, 7 Jan 2026 14:35:25 -0800 Subject: [PATCH] Use static catch2.lib instead of catch2.dll (#2419) * Use static catch2.lib instead of catch2.dll Using catch2.dll incraeses execution time by 12x * handle debug option for static catch2 * SWDEV-573539 - skip atomics on windows since its taking a very long time to execute mlsejenkins needs newer cmake but compiler breaks with newer versions so skipping on windows can be a workaround for now --------- Co-authored-by: Joseph Macaranas <145489236+jayhawk-commits@users.noreply.github.com> --- projects/hip-tests/catch/CMakeLists.txt | 13 ++++++++++++- projects/hip-tests/catch/unit/CMakeLists.txt | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/hip-tests/catch/CMakeLists.txt b/projects/hip-tests/catch/CMakeLists.txt index e6e114e27a..37bedf755d 100644 --- a/projects/hip-tests/catch/CMakeLists.txt +++ b/projects/hip-tests/catch/CMakeLists.txt @@ -8,6 +8,9 @@ option(BUILD_UNIT_TESTS "Build unit tests" ON) option(BUILD_PERF_TESTS "Build perf tests" OFF) option(BUILD_STRESS_TESTS "Build stress tests" OFF) option(TEST_CLOCK_CYCLE "Option to use clock64" OFF) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -110,6 +113,14 @@ if(Catch2_FOUND) set(CATCH_ADD_TESTS_SCRIPT ${Catch2_DIR}/CatchAddTests.cmake) file(GLOB CATCH_LIBS "${Catch2_DIR}/../../*Catch2*") else() + # On Windows, ensure Catch2 uses the same MSVC runtime library and build configuration as our tests + if(WIN32) + set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries" FORCE) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" CACHE STRING "MSVC runtime library" FORCE) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(win_disable_warnings -fms-runtime-lib=static_dbg) + endif() + endif() # Setup catch2 manually include(FetchContent) FetchContent_Declare( @@ -165,7 +176,7 @@ endif() if(HIP_PLATFORM STREQUAL "amd") if(WIN32) - set(win_disable_warnings -Wno-ignored-attributes -Wno-microsoft-cast) + set(win_disable_warnings ${win_disable_warnings} -Wno-ignored-attributes -Wno-microsoft-cast) endif() add_compile_options(${HIP_PATH_OPT} -std=c++17 -x hip -Wall -Wextra -Wvla -Wno-deprecated -Wno-option-ignored -Wno-unused-parameter ${win_disable_warnings}) # -Werror) endif() diff --git a/projects/hip-tests/catch/unit/CMakeLists.txt b/projects/hip-tests/catch/unit/CMakeLists.txt index 2df795b18a..9a37ac90d5 100644 --- a/projects/hip-tests/catch/unit/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/CMakeLists.txt @@ -45,13 +45,13 @@ add_subdirectory(module) add_subdirectory(channelDescriptor) add_subdirectory(executionControl) add_subdirectory(vector_types) -add_subdirectory(atomics) add_subdirectory(complex) add_subdirectory(p2p) add_subdirectory(threadfence) add_subdirectory(virtualMemoryManagement) # TODO Rock build failures if(UNIX) + add_subdirectory(atomics) add_subdirectory(math) # TODO compute build failures add_subdirectory(deviceLib)