1. Building From Source#
Note
The build instructions here are for general users who just want to build OpenSim Creator.
Because everyone’s C++ build environment is slightly different, there are
no catch-all build instructions that will work for everyone. Instead, we
recommend reading + running the automated build scripts (located at scripts/
in the source tree), or reading Development Environment, which
concretely covers tips-and-tricks for Visual Studio or QtCreator.
1.1. Building on Windows (10 or newer)#
1.1.1. Windows Environment Setup#
The OpenSim Creator build requires that the development environment has git,
a C++-20 compiler, cmake, WiX (if packaging an installer), and python. These
days, the Visual Studio installer provides the C++ compiler and cmake. Here is a
step-by-step guide for setting up a typical development environment:
- Get
git: Download and install
gitfrom https://git-scm.com/downloadsMake sure to add it to the
PATH. Usually, the installer asks if you want this. If it doesn’t ask, then you may need to add it manually (google: “Modify windows PATH”, add yourgitinstall, which defaults toC:\Program Files\Git\bin).Verify it’s installed by opening a terminal (
Shift+Right-Click->Open Powershell window here) and rungit
- Get
- Get Visual Studio >=2022 (C++ compiler - note: Visual Studio is not the same as Visual Studio Code):
Download and install it from https://visualstudio.microsoft.com/downloads/
Make sure to select C/C++ development in the installer wizard when it asks you which parts you would like to install
- Get
WiX(can be disabled with -DOSC_CONFIGURE_PACKAGING=OFF, builds the.msiinstaller): Download and install WiX3 (e.g.
wix314.exe) from wixtoolset/wix3Avoid using newer WiX versions because GitHub runner images etc. currently still use WiX3 (see: actions/runner-images)
- Get
- Get
pythonandpip: Download from https://www.python.org/downloads/
Make sure
pythonandpipare added to thePATH(the installer usually prompts this)Verify they are installed by opening a terminal (
Shift+Right-Click->Open Powershell window here) and runpython --helpandpip --help
- Get
- Clone the
opensim-creatorsource code repository: Open a terminal,
cdto your workspace directory (e.g.Desktop), and rungit clone https://github.com/ComputationalBiomechanicsLab/opensim-creatorThe resulting
opensim-creatordirectory should contain all necessary source code to build the project (incl. third_party code etc.)
- Clone the
- Create a local python virtual environment with
pipdependencies installed into it: Open a terminal,
cdto theopensim-creatordirectoryRun
python .\scripts\setup_venv.py, which is roughly equivalent topython -m venv .venv/followed bypip install -r requirements/all_requirements.txt
- Create a local python virtual environment with
1.1.2. Windows Build#
Assuming your environment has been set up correctly (explained above), the easiest way to build OpenSim Creator is with an end-to-end build script. The steps are:
Open a PowerShell terminal (
Shift+Right-Click->Open Powershell window here)Either
cdinto theopensim-creatordirectory (if cloned when you setup the environment, above), or clone it withgit clone https://github.com/ComputationalBiomechanicsLab/opensim-creator.Run
./scripts/ci_build_windows.bat Development
1.2. Building on MacOS (Sonoma or newer)#
1.2.1. MacOS Enrivonment Setup#
- Get
brew: Go to https://brew.sh/ and follow installation instructions
- Get
- Get
git: Can be installed via
brew:brew install git
- Get
- Get C++23-compatible compiler (e.g.
clangvia brew, or newer XCodes): OpenSim Creator is a C++23 project, so you’ll have to use a more recent XCode (>=15), or install a newer
clangfrom brew (e.g.brew install clang)
- Get C++23-compatible compiler (e.g.
- Get
cmake: Can be installed via
brew:brew install cmake
- Get
- Get
pythonandpip: Can be installed via
brew:brew install python
- Get
- Clone the
opensim-creatorsource code repository: Open a terminal,
cdto your workspace directory (e.g.Desktop), and rungit clone https://github.com/ComputationalBiomechanicsLab/opensim-creatorThe resulting
opensim-creatordirectory should contain all necessary source code to build the project (incl. third_party code etc.)
- Clone the
- Create a local python virtual environment with
pipdependencies installed into it: Open a terminal,
cdto theopensim-creatordirectoryRun
python .\scripts\setup_venv.py, which is roughly equivalent topython -m venv .venv/followed bypip install -r requirements/all_requirements.txt
- Create a local python virtual environment with
1.2.2. MacOS Build#
- Build OpenSim Creator in a terminal:
If you have multiple C++ compilers, make sure that the
CCandCXXenvironment variables point to compilers that are compatible with C++23. E.g.export CXX=$(brew --prefix llvm@15)/bin/clang++Run the build script:
./scripts/ci_build_unix.sh Development
1.3. Building on Ubuntu (22.04 or newer)#
1.3.1. Ubuntu Environment Setup#
- Get
git: Install
gitvia your package manager (e.g.apt-get install git)
- Get
- Use
gitto get OpenSim Creator’s (+ dependencies’) source code: Clone
opensim-creator:git clone https://github.com/ComputationalBiomechanicsLab/opensim-creatorcdinto the source dir:cd opensim-creatorThe remaining build steps are performed in the source directory
- Use
- Get
aptdependencies: aptdependencies are listed in thedocker/directory with an_apt.txtsuffixFor example, if you’re on Ubuntu 22.04, you could run
apt-get install $(sed 's/#.*//' "docker/ubuntu22_apt.txt" | xargs)to install the necessary Ubuntu 22.04 apt dependencies
- Get
- Setup Python Get python libraries:
cdinto theopensim-creatorsource directory (if you haven’t already)Install all necessary python libraries into your current python environment with
pip install -r requirements/all_requirements.txt
1.3.2. Ubuntu Build#
- Build OpenSim Creator from source:
cdinto theopensim-creatorsource directory (if you haven’t already)Run the build script, you can use the
CCandCXXenvironment variables to choose your C++ compiler if you’re using the non-default one, e.g.CC=gcc-12 CXX=g++-12 ./scripts/ci_build_unix.sh Development