This guide covers setting up StochFit for development on Windows, Linux, and macOS, including optional GPU acceleration (CUDA on Windows/Linux, Metal on macOS).
- Windows: Download from https://git-scm.com/
- Linux:
sudo apt install git(Ubuntu/Debian) orsudo yum install git(RedHat/CentOS) - macOS:
xcode-select --install(Xcode command line tools)
- Windows/macOS: Download from https://cmake.org/download/
- Linux:
sudo apt install cmake(Ubuntu/Debian)
- Windows: Visual Studio 2022 Community (free) — install "Desktop development with C++"
- Linux:
sudo apt install build-essential(GCC + make) - macOS:
xcode-select --install(Clang)
- Download LTS from https://nodejs.org/
- Verify:
node --version && npm --version
- Download Visual Studio 2022 Community (free)
- Run installer → select "Desktop development with C++"
- Ensure MSVC v143+ and Windows 11 SDK are included
- Restart after installation
git clone https://github.com/yourusername/stochfit.git
cd stochfitcmake --preset windows --freshThis automatically:
- Downloads vcpkg and dependencies (LAPACK, OpenMP, GTest)
- Detects CUDA Toolkit if installed (optional, requires NVIDIA GPU)
- Configures Ninja build system with MSVC
cmake --build build --parallelProduces:
build/bin/stochfit.dll— core fitting librarybuild/bin/levmardll.dll— Levenberg-Marquardt librarybuild/bin/mirefl.exe— console toolbuild/bin/stochfit_tests.exe— unit tests
./build/bin/stochfit_tests.execmake --build build --target guiProduces packaged Electron app in build/electron/ (e.g., StochFit.exe)
Ubuntu/Debian:
sudo apt update
sudo apt install -y build-essential cmake git python3-devRedHat/CentOS:
sudo yum groupinstall -y "Development Tools"
sudo yum install -y cmake git python3-develgit clone https://github.com/yourusername/stochfit.git
cd stochfitcmake --preset default --freshThis automatically:
- Downloads vcpkg and dependencies
- Detects CUDA if present (optional, requires NVIDIA GPU + CUDA Toolkit)
- Uses system compiler (GCC/Clang)
cmake --build build --parallelProduces:
build/bin/libstochfit.so— core fitting librarybuild/bin/liblevmardll.so— Levenberg-Marquardt librarybuild/bin/mirefl— console toolbuild/bin/stochfit_tests— unit tests
./build/bin/stochfit_testscmake --build build --target guiProduces packaged Electron app in build/electron/
xcode-select --install/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"git clone https://github.com/yourusername/stochfit.git
cd stochfitcmake --preset default --freshThis automatically:
- Downloads vcpkg and dependencies
- Detects Metal GPU support (macOS 10.15+)
- Uses Clang compiler
cmake --build build --parallelProduces:
build/bin/libstochfit.dylib— core fitting librarybuild/bin/liblevmardll.dylib— Levenberg-Marquardt librarybuild/bin/mirefl— console toolbuild/bin/stochfit_tests— unit tests
./build/bin/stochfit_testscmake --build build --target guiProduces packaged Electron app in build/electron/ (e.g., StochFit.app)
Requirements:
- NVIDIA GPU with compute capability ≥ 7.5 (Turing+: RTX 3050, 4060, 4080, etc.)
- NVIDIA CUDA Toolkit 11.2+ installed on system (required; not installed via vcpkg)
Important: The build system does NOT install CUDA for you. You must download and install the CUDA Toolkit separately from NVIDIA.
Windows:
- Download CUDA Toolkit from https://developer.nvidia.com/cuda-downloads
- Run installer with default options (adds
nvccto PATH automatically) - Verify installation:
nvcc --version(should print version 11.2+) - Reconfigure:
cmake --preset windows --fresh - Build output should show:
-- CUDA GPU acceleration enabled - Rebuild:
cmake --build build --parallel
Linux:
- Download CUDA Toolkit from https://developer.nvidia.com/cuda-downloads or use package manager
# Ubuntu 22.04 example: wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt update sudo apt install cuda-toolkit - Verify:
nvcc --version - Reconfigure:
cmake --preset default --fresh - Rebuild:
cmake --build build --parallel
If CUDA is not found, CMake will print CUDA not found — GPU acceleration disabled and continue with CPU-only build.
Metal GPU support is automatically enabled on macOS 10.15+ if the Metal framework is available (included with Xcode). No additional installation needed.
After building, verify the installation:
# C++ components built
ls -lh build/bin/
# Tests pass
./build/bin/stochfit_tests
# GUI available
ls -lh build/electron/- Windows: Add CMake to PATH or use installer with PATH option
- Linux/macOS:
which cmake— if empty, reinstall
- Check internet connection
- Try:
cmake --preset windows --fresh(forces clean download)
- Install Node.js from https://nodejs.org/
- Verify:
npm --version - Then:
cmake --build build --target gui
- Install CUDA Toolkit from https://developer.nvidia.com/cuda-downloads
- Ensure CUDA is in PATH:
nvcc --version - Reconfigure:
cmake --preset windows --fresh
- Update Xcode:
xcode-select --install - Or update via App Store
- Edit code in
src/,include/, orgui/ - Rebuild C++:
cmake --build build --parallel - Rebuild GUI (if you changed TypeScript):
cmake --build build --target gui - Run tests:
./build/bin/stochfit_tests(C++) or tests in GUI app - Commit:
git add -A && git commit -m "..."
Debug build (slower, better error messages):
- Windows:
cmake --preset windows-debug --fresh && cmake --build build - Linux/macOS:
cmake --preset debug --fresh && cmake --build build
Release is the default in CMakePresets.json.