Skip to content

Windows Installation (VS 2022)

Prerequisites

Install:

  • Visual Studio 2022 (Desktop development with C++)
  • CMake
  • Ninja
  • Git
  • Python 3

Use x64 Native Tools Command Prompt for VS 2022 or Developer PowerShell.

Clone Repository

git clone --recurse-submodules https://github.com/<your-org>/SPHinXsim.git
cd SPHinXsim

Install vcpkg

git clone https://github.com/microsoft/vcpkg.git ..\vcpkg
..\vcpkg\bootstrap-vcpkg.bat

Install C/C++ Dependencies

..\vcpkg\vcpkg.exe install --clean-after-build openblas[dynamic-arch] --allow-unsupported
..\vcpkg\vcpkg.exe install --clean-after-build `
  eigen3 `
  tbb `
  boost-program-options `
  boost-geometry `
  simbody `
  spdlog `
  gtest `
  pybind11 `
  vtk `
  nlohmann-json

Configure and Build

For a pip-first workflow, install directly from source (this builds C++ extensions via CMake):

$env:CMAKE_ARGS='-D CMAKE_TOOLCHAIN_FILE="' + "$pwd\..\vcpkg\scripts\buildsystems\vcpkg.cmake" + '" -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl'
python -m pip install -e ".[dev,visualization]"

Optional manual CMake workflow:

cmake --preset integrated-build-release-windows `
  -D CMAKE_TOOLCHAIN_FILE="$pwd\..\vcpkg\scripts\buildsystems\vcpkg.cmake" `
  -D Python3_EXECUTABLE="$(python -c "import sys; print(sys.executable)")"
cmake --build --preset integrated-build-release-windows --parallel

Install compiled C++ extension modules into the active Python environment (manual workflow only):

cmake --install build-integrated --prefix "$(python -c "import sys; print(sys.prefix)")"

Run Tests

Install Python package with dev dependencies:

python -m pip install -e ".[dev]"

To enable geometry preview (sphinxsim preview), also install:

python -m pip install -e ".[visualization]"

Run Python tests:

python -m pytest tests/ examples/ -v

Verify extension import explicitly:

python -c "from sphinxsim.bindings.loader import load_sphinxsys_core; print(load_sphinxsys_core().__name__)"

Run C++ simulation tests:

ctest --test-dir build-integrated --output-on-failure -R "test_(2d|3d)_simulation$"

Notes

  • If cl is not found, reopen a Visual Studio developer shell and rerun configure.
  • If CMake cache gets inconsistent, remove build-integrated and reconfigure.