Skip to content

Commit 9a8085e

Browse files
author
Ubuntu
committed
Enable Linux build: updated CMakeLists and YAML parser
1 parent a1c22f7 commit 9a8085e

2 files changed

Lines changed: 21 additions & 24 deletions

File tree

CMakeLists.txt

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,8 @@ endif()
175175

176176
# ── HDF5 Integration ──
177177
# 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)
178+
179+
find_package(HDF5 REQUIRED COMPONENTS CXX)
191180

192181
# ---- Eigen: support both CONFIG and module modes ----
193182
find_package(Eigen3 QUIET CONFIG)
@@ -619,9 +608,14 @@ if(HC_INSTALL_DEV_KIT)
619608
)
620609
endif()
621610

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")
611+
if(MSVC)
612+
# Windows: Enable debug symbols in Release builds with MSVC
613+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /O2")
614+
else()
615+
# Non-MSVC (Linux, macOS): Use -g for debug symbols
616+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -O2")
617+
endif()
618+
625619

626620
# ──────────────────────────────────────────────────────────────────────────────
627621
# 7.1 Runtime installer and ZIP packaging for releases
@@ -750,12 +744,15 @@ if(HC_INSTALL_DEV_DEMOS)
750744
FILES_MATCHING PATTERN "demo_*.exe")
751745
endif()
752746

747+
753748
# 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)
749+
include(InstallRequiredSystemLibraries)
750+
set(CPACK_GENERATOR "ZIP")
751+
set(CPACK_PACKAGE_NAME "HydroChrono")
752+
set(CPACK_COMPONENTS_ALL runtime python-tests dev-demos)
753+
include(CPack)
754+
755+
759756

760757
# Optionally include Python runtime DLL if Chrono::Parsers depends on it
761758
find_package(Python3 QUIET COMPONENTS Interpreter)
@@ -768,4 +765,4 @@ if(Python3_Interpreter_FOUND OR Python3_FOUND)
768765
install(FILES "${_PY_DLL_PATH}" DESTINATION bin COMPONENT runtime)
769766
endif()
770767
endif()
771-
endif()
768+
endif()

src/hydro_yaml_parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ YAMLHydroData ReadHydroYAML(const std::string& hydro_file_path) {
388388
t += step;
389389
}
390390
if (inclusive) {
391-
if (std::fabs((data.waves.period_values.empty() ? start : data.waves.period_values.back()) - stop) > eps) {
391+
if (std::abs((data.waves.period_values.empty() ? start : data.waves.period_values.back()) - stop) > eps) {
392392
// add last if not already close to stop and within tolerance by stepping once more would overshoot but inclusive means include stop
393393
data.waves.period_values.push_back(stop);
394394
} else {
@@ -458,4 +458,4 @@ YAMLHydroData ReadHydroYAML(const std::string& hydro_file_path) {
458458
}
459459

460460
return data;
461-
}
461+
}

0 commit comments

Comments
 (0)