Skip to content

Commit 31ba69a

Browse files
committed
Update CMake for new tests
1 parent 2b466e1 commit 31ba69a

3 files changed

Lines changed: 395 additions & 228 deletions

File tree

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,27 @@ if(MSVC)
105105
add_compile_options(/wd4251) # class needs to have dll-interface
106106
endif()
107107

108+
# --------------------------------------------------
109+
# Global output directory structure
110+
# --------------------------------------------------
111+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
112+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
113+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
114+
115+
# Replicate for multi-config generators (e.g. Visual Studio, Xcode, Ninja Multi-Config)
116+
if(CMAKE_CONFIGURATION_TYPES)
117+
foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
118+
string(TOUPPER "${cfg}" cfg_uc)
119+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${cfg_uc} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
120+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${cfg_uc} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
121+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${cfg_uc} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
122+
endforeach()
123+
endif()
124+
125+
# Category-specific output folders
126+
set(HYDROCHRONO_DEMO_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/demos CACHE PATH "Output directory for demo executables")
127+
set(HYDROCHRONO_TEST_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests CACHE PATH "Output directory for test executables")
128+
108129
# =======================
109130
# HydroChrono Library
110131
# =======================

tests/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
find_package(Python3 COMPONENTS Interpreter REQUIRED)
22

33
# Set global output directory for all test executables
4-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
4+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${HYDROCHRONO_TEST_OUTPUT_DIR})
5+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${HYDROCHRONO_TEST_OUTPUT_DIR})
6+
7+
if(CMAKE_CONFIGURATION_TYPES)
8+
foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
9+
string(TOUPPER "${cfg}" cfg_uc)
10+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${cfg_uc} ${HYDROCHRONO_TEST_OUTPUT_DIR})
11+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${cfg_uc} ${HYDROCHRONO_TEST_OUTPUT_DIR})
12+
endforeach()
13+
endif()
514

615
# Legacy Tests Configuration
716
# =========================

0 commit comments

Comments
 (0)