@@ -20,7 +20,7 @@ endif()
2020# ═══════════════════════════════════════════════════════════════════════════════
2121
2222project (HydroChrono
23- VERSION 0.3
23+ VERSION 0.3.1
2424 DESCRIPTION "Hydrodynamics for Project Chrono."
2525 LANGUAGES CXX
2626)
@@ -147,11 +147,27 @@ endif()
147147
148148# Now we can find Chrono (which assumes Irrlicht::Irrlicht already exists)
149149find_package (Chrono CONFIG REQUIRED )
150+ message (STATUS "Chrono core targets: ${Chrono_LIBRARIES} " )
151+
152+ if (EXISTS "${Chrono_DIR} /ChronoTargets.cmake" )
153+ include ("${Chrono_DIR} /ChronoTargets.cmake" )
154+ message (STATUS "Manually included ChronoTargets.cmake from ${Chrono_DIR} " )
155+ endif ()
156+
150157
151158# Verify required Chrono targets are available
152159if (NOT TARGET Chrono::Chrono_core)
153160 message (FATAL_ERROR "Chrono::Chrono_core target not found. Ensure Chrono was built with modern CMake target exports." )
154161endif ()
162+ # Find OpenMP first to ensure OpenMP::OpenMP_CXX is available
163+ find_package (OpenMP REQUIRED )
164+
165+ if (OpenMP_CXX_FOUND)
166+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} " )
167+ endif ()
168+
169+ # Then include Chrono
170+ find_package (Chrono REQUIRED PATHS /usr/local/lib/cmake/Chrono )
155171
156172# Enable Irrlicht support if requested and available
157173if (HYDROCHRONO_ENABLE_IRRLICHT)
@@ -175,19 +191,8 @@ endif()
175191
176192# ── HDF5 Integration ──
177193# Prefer config package at provided root; avoid environment/registry
178- if (DEFINED HDF5_DIR AND NOT DEFINED HDF5_ROOT)
179- set (HDF5_ROOT "${HDF5_DIR} " )
180- endif ()
181- set (HDF5_ROOT "${HDF5_ROOT} " CACHE PATH "HDF5 root directory" )
182- if (DEFINED HDF5_ROOT)
183- # Prepend so our supplied root wins
184- if (CMAKE_PREFIX_PATH )
185- set (CMAKE_PREFIX_PATH "${HDF5_ROOT} ;${CMAKE_PREFIX_PATH} " )
186- else ()
187- set (CMAKE_PREFIX_PATH "${HDF5_ROOT} " )
188- endif ()
189- endif ()
190- find_package (HDF5 CONFIG REQUIRED COMPONENTS CXX )
194+
195+ find_package (HDF5 REQUIRED COMPONENTS CXX )
191196
192197# ---- Eigen: support both CONFIG and module modes ----
193198find_package (Eigen3 QUIET CONFIG )
@@ -220,8 +225,6 @@ if (NOT HC_CHRONO_INCLUDE_DIRS AND DEFINED Chrono_DIR)
220225endif ()
221226
222227
223-
224-
225228#-----------------------------------------------------------------------------
226229# Fix for VS 2017 15.8 and newer to handle alignment specification with Eigen
227230#-----------------------------------------------------------------------------
@@ -619,9 +622,14 @@ if(HC_INSTALL_DEV_KIT)
619622 )
620623endif ()
621624
622- # ── Debug Symbols in Release Mode ──
623- # Keep debug symbols in Release builds for better profiling and crash analysis
624- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /O2" )
625+ if (MSVC )
626+ # Windows: Enable debug symbols in Release builds with MSVC
627+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /O2" )
628+ else ()
629+ # Non-MSVC (Linux, macOS): Use -g for debug symbols
630+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -O2" )
631+ endif ()
632+
625633
626634# ──────────────────────────────────────────────────────────────────────────────
627635# 7.1 Runtime installer and ZIP packaging for releases
@@ -750,12 +758,15 @@ if(HC_INSTALL_DEV_DEMOS)
750758 FILES_MATCHING PATTERN "demo_*.exe" )
751759endif ()
752760
761+
753762# MSVC runtime DLLs and ZIP packaging via CPack
754- include (InstallRequiredSystemLibraries )
755- set (CPACK_GENERATOR "ZIP" )
756- set (CPACK_PACKAGE_NAME "HydroChrono" )
757- set (CPACK_COMPONENTS_ALL runtime python-tests dev-demos)
758- include (CPack )
763+ include (InstallRequiredSystemLibraries )
764+ set (CPACK_GENERATOR "ZIP" )
765+ set (CPACK_PACKAGE_NAME "HydroChrono" )
766+ set (CPACK_COMPONENTS_ALL runtime python-tests dev-demos)
767+ include (CPack )
768+
769+
759770
760771# Optionally include Python runtime DLL if Chrono::Parsers depends on it
761772find_package (Python3 QUIET COMPONENTS Interpreter )
@@ -768,4 +779,4 @@ if(Python3_Interpreter_FOUND OR Python3_FOUND)
768779 install (FILES "${_PY_DLL_PATH} " DESTINATION bin COMPONENT runtime )
769780 endif ()
770781 endif ()
771- endif ()
782+ endif ()
0 commit comments