Build and Package SlicerSALT
This document summarizes how to build and package SlicerSALT on Linux, macOS and Windows.
SlicerSALT is a custom Slicer application. Reading the 3D Slicer Developer Documentation may help answer additional questions.
The initial source files were created using KitwareMedical/SlicerCustomAppTemplate.
Prerequisites
Review and install the
3D SlicerprerequisitesSetup your git account:
Create a Github account.
Setup your SSH keys following these instructions at the exception of
step 2where you should NOT enter a passphrase.Setup your git username and your git email.
Checkout
GNU/Linux systems & macOS
mkdir ~/Projects
cd ~/Projects
git clone https://github.com/Kitware/SlicerSALT.git SS
Windows
Start Git Bash
Checkout the source code into a directory
C:\W\by typing the following commands:
cd /c
mkdir W
cd /c/W
git clone https://github.com/Kitware/SlicerSALT.git SS
:warning: use short source and build directory names to avoid the maximum path length limitation.
Build
GNU/Linux systems
cd ~/Projects/SSR
cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DQt5_DIR:PATH=/path/to/Qt/lib/cmake/Qt5 \
../SS
macOS
mkdir ~/Projects
cd ~/Projects
cmake \
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13 \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DQt5_DIR:PATH=/path/to/Qt/lib/cmake/Qt5 \
../SS
Windows
Option 1: CMake GUI and Visual Studio (Recommended)
Start CMake GUI, select source directory
C:\W\SSand set build directory toC:\W\SSR.Add an entry
Qt5_DIRpointing toC:/Qt/${QT_VERSION}/${COMPILER}/lib/cmake/Qt5.Generate the project.
Open
C:\W\SSR\{{cookiecutter.project_name}}.sln, selectReleaseand build the project.
Option 2: Command Line
Start the Command Line Prompt
Configure and build the project in
C:\W\SSRby typing the following commands:
cd C:\W\
mkdir SSR
cd SSR
cmake -G "Visual Studio 16 2019" -A x64 -DQt5_DIR:PATH=`C:/Qt/${QT_VERSION}/${COMPILER}/lib/cmake/Qt5 ..\SS
cmake --build . --config Release -- /maxcpucount:4
Package
:warning: Creating distributable packages is only supported for Release builds.
GNU/Linux systems & macOS
cd ~/Projects/SSR/Slicer-build
make package
macOS
:warning: SlicerSALT will only create a valid package that will run on machines other than it’s built on if Qt was built from source.
cd ~/Projects/SSR/Slicer-build
make package
Windows
Install NSIS 2
Option 1: CMake and Visual Studio
In the
C:\W\SSR\Slicer-builddirectory, openSlicer.slnand build thePACKAGEtarget
Option 2: Command Line
Start the Command Line Prompt
Build the
PACKAGEtarget by typing the following commands:
cd C:\W\SSR\Slicer-build
cmake --build . --config Release --target PACKAGE