Skip to content

Commit a7d9f4b

Browse files
committed
improve build.ps1 script
- handle \\ in paths - update old hardcoded irrlicht path - add some docs
1 parent b78f138 commit a7d9f4b

5 files changed

Lines changed: 33 additions & 17 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,18 @@ endfunction()
281281
function(configure_test_environment)
282282
# Set up DLL search paths for Windows testing
283283
set(CHRONO_DLL_DIR "${Chrono_DIR}/../bin/Release")
284-
set(IRRLICHT_DLL_DIR "C:/libs/irrlicht-1.8.4/bin/Win64-VisualStudio")
285-
set(TEST_ENVIRONMENT "PATH=${CHRONO_DLL_DIR};${IRRLICHT_DLL_DIR};$ENV{PATH}" PARENT_SCOPE)
284+
# Derive Irrlicht DLL dir from Irrlicht_ROOT provided by user config
285+
set(IRRLICHT_DLL_DIR "")
286+
if(DEFINED Irrlicht_ROOT AND EXISTS "${Irrlicht_ROOT}/bin/Win64-VisualStudio")
287+
set(IRRLICHT_DLL_DIR "${Irrlicht_ROOT}/bin/Win64-VisualStudio")
288+
elseif(DEFINED Irrlicht_ROOT AND EXISTS "${Irrlicht_ROOT}/bin")
289+
set(IRRLICHT_DLL_DIR "${Irrlicht_ROOT}/bin")
290+
endif()
291+
if(IRRLICHT_DLL_DIR)
292+
set(TEST_ENVIRONMENT "PATH=${CHRONO_DLL_DIR};${IRRLICHT_DLL_DIR};$ENV{PATH}" PARENT_SCOPE)
293+
else()
294+
set(TEST_ENVIRONMENT "PATH=${CHRONO_DLL_DIR};$ENV{PATH}" PARENT_SCOPE)
295+
endif()
286296
endfunction()
287297

288298
# ── Main HydroChrono Library ──

build.ps1

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Load-Configuration {
4444

4545
# Non-sensitive default values only
4646
$defaultConfig = @{
47-
ScriptVersion = "2.1"
47+
ScriptVersion = "2.2"
4848
DefaultBuildType = "Release"
4949
DefaultYamlRunner = "ON"
5050
RuntimeLibrary = "MultiThreaded`$<`$<CONFIG:Debug>:Debug>DLL"
@@ -362,7 +362,7 @@ function Initialize-BuildDirectory {
362362
function Configure-CMake {
363363
Write-Section "Configuring CMake"
364364

365-
$env:CMAKE_MODULE_PATH = $Config.CMakeModulePath
365+
$env:CMAKE_MODULE_PATH = ($Config.CMakeModulePath -replace '\\','/')
366366

367367
Write-Subsection "Build Configuration"
368368
Write-Info "Runtime library: MultiThreaded DLL (for Chrono compatibility)"
@@ -558,13 +558,19 @@ function Show-SuccessSummary {
558558
function Get-BuildArguments {
559559
param([string]$YamlRunner, [string]$BuildType)
560560

561+
$chronoDir = ($Config.ChronoDir -replace '\\','/')
562+
$hdf5Dir = ($Config.Hdf5Dir -replace '\\','/')
563+
$pythonRoot = ($Config.PythonRoot -replace '\\','/')
564+
$eigenDir = ($Config.EigenDir -replace '\\','/')
565+
$irrlicht = ($Config.IrrlichtDir -replace '\\','/')
566+
561567
return @(
562568
"..",
563-
"-DChrono_DIR=`"$($Config.ChronoDir)`"",
564-
"-DHDF5_DIR=`"$($Config.Hdf5Dir)`"",
565-
"-DPython3_ROOT_DIR=`"$($Config.PythonRoot)`"",
566-
"-DEIGEN3_INCLUDE_DIR=`"$($Config.EigenDir)`"",
567-
"-DIrrlicht_ROOT=`"$($Config.IrrlichtDir)`"",
569+
"-DChrono_DIR=`"$chronoDir`"",
570+
"-DHDF5_DIR=`"$hdf5Dir`"",
571+
"-DPython3_ROOT_DIR=`"$pythonRoot`"",
572+
"-DEIGEN3_INCLUDE_DIR=`"$eigenDir`"",
573+
"-DIrrlicht_ROOT=`"$irrlicht`"",
568574
"-DHYDROCHRONO_ENABLE_YAML_RUNNER=`"$YamlRunner`"",
569575
"-DCMAKE_BUILD_TYPE=`"$BuildType`"",
570576
"-DCMAKE_MSVC_RUNTIME_LIBRARY=`"$($Config.RuntimeLibrary)`""

docs/_main_pages/developer_docs/build_instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ This page provides instructions on how to build HydroChrono and its associated d
1515
Before attempting to build HydroChrono, ensure you have installed and built all of the required [prerequisites](/developer_docs/prerequisites). The exact versions listed in the prerequisites are essential for proper functionality.
1616

1717
- CMake 3.16 or higher
18-
- A C++ compiler (Visual Studio 2019 or higher, or GCC through MinGW/MSYS2)
19-
- Project Chrono (built from source, tested with v9.0.0 and v9.0.1)
18+
- A C++ compiler (Visual Studio 2022 or higher, or GCC through MinGW/MSYS2)
19+
- Project Chrono (built from source, tested with latest version of main (30th Sep 2025))
2020
- HDF5 1.10.8 or higher
2121
- Python 3.8 or higher (with numpy and matplotlib)
2222

docs/_main_pages/developer_docs/prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For detailed instructions on how to install and build Chrono, please refer to th
1818

1919
Below are the necessary dependencies and the recommended versions:
2020

21-
- C++ Compiler (Visual Studio 2019 recommended)
21+
- C++ Compiler (Visual Studio 2022 recommended)
2222
- Eigen3 (3.4.0 recommended)
2323
- Irrlicht Engine (1.8.4)
2424
- CMake (3.18.2 or newer recommended)

tests/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ endif()
1818
# Note: Regression tests are now handled in tests/regression/CMakeLists.txt
1919
# and included directly from the main CMakeLists.txt
2020

21-
# Set common test properties, including the PATH environment variable
22-
# This ensures that test executables can find required DLLs (Chrono, Irrlicht, etc.)
23-
set(CHRONO_DLL_DIR "${Chrono_DIR}/../bin/Release")
24-
set(IRRLICHT_DLL_DIR "C:/libs/irrlicht-1.8.4/bin/Win64-VisualStudio")
25-
set(TEST_ENVIRONMENT "PATH=${CHRONO_DLL_DIR};${IRRLICHT_DLL_DIR};$ENV{PATH}")
21+
# Expect TEST_ENVIRONMENT to be configured by top-level configure_test_environment().
22+
# Provide a minimal fallback to avoid failures if not defined.
23+
if(NOT DEFINED TEST_ENVIRONMENT)
24+
set(TEST_ENVIRONMENT "PATH=$ENV{PATH}")
25+
endif()
2626

2727
# Unit Tests
2828
# ==========

0 commit comments

Comments
 (0)