Build instructions - neutronimaging/imagingsuite GitHub Wiki

Building imagingsuite requires the following steps

Prerequisites

Make sure that you have installed all the needed tools for building with your particular platform and have set the QTPATH environment variable (https://github.com/neutronimaging/imagingsuite/wiki/Prerequisites-for-building)

Clone repository

Navigate to the root folder for your local repositories and clone the following repositories from https://github.com/neutronimaging :

Imagingsuite

This is the main repository for core and algorithm libraries as well as applications like MuhRec.

git clone https://github.com/neutronimaging/imagingsuite.git

Note MuhRec and the tomography framework are planned to be moved to the muhrec repository.

TestData

The TestData repository is a collection of data used by unit tests. This repository is only needed if you want to run the unit tests.

git clone https://github.com/neutronimaging/TestData.git

Build instructions

Ensure that you are using your conda environment with the correct version of Python, Conan and CMake, if you opted to use conda environment for building (recommended). Navigate to the imagingsuite root folder and run conan with the profile corresponding to your platform. Profiles for Windows with Visual Studio 2022, Linux with gcc 11, MacOS Monterey with clang 14 and x64 arch and MacOS Sonoma with clang 15 and ARM arch are provided with the repository.

Run conan

Conan is run in the the root of the imagingsuite repository.

On Windows

For configurations not mentioned here, a new profile will need to be created manually. The correct profile is chosen when running the conan command as shown below for Windows:

conan build . --profile:all profiles\windows_msvc_17_release --build=missing

On MacOS 14 with ARM arch

conan build . --profile:all profiles/macos_arm_clang_15_release --build=missing

On MacOS 12 with x64 arch

conan build . --profile:all profiles/macos_x64_clang_14_release --build=missing

On Ubuntu

conan build . --profile:all profiles/linux_gcc_11_release --build=missing

Deployment

Windows

Following the build, the applications needs to be "deployed" by Qt to have the correct Qt dependencies (Not needed for Linux). To deploy the applications, navigate to the folder they have been built in (cd bin/Release for Windows and cd Release for MacOS) and run the corresponding Qtdeploy scripts:

${QTPATH}/bin/windeployqt muhrec.exe
${QTPATH}/bin/windeployqt imageviewer.exe

MacOS

Exchange "windeployqt" with "macdeployqt" for MacOS.

${QTPATH}/bin/macdeployqt Release/MuhRec.app
${QTPATH}/bin/macdeployqt Release/ImageViewer.app

The apps must also be signed

codesign --force --deep --sign - Release/MuhRec.app
codesign --force --deep --sign - Release/ImageViewer.app

Linux

On Linux the runpaths of the shared libraries needs to be amended to point to their current directory. This is most easily done with patchelf. Navigate to the lib directory: build-imagingsuite/Release/lib and run the following command:

patchelf --set-rpath '$ORIGIN' *.so*

Testing

If you want to run the test suite, it can now be done from the root build folder, which is "build-imagingsuite" for Windows and "build-imagingsuite/Release" for the other platforms, with the ctest command:

ctest --build-config Release

Testing requires that you ran the deployment in the Applications/Release folder.

Bundle

Finally you can bundle the built application into a distributable zip folder: Windows (in the root build directory, i.e. "build-imagingsuite")

7z a ../MuhRec-Windows.zip "bin/Release/*" -xr!t*.exe -xr!muhreccli.exe -xr!verticalslicer.exe

Linux (in the "build-imagingsuite/Release" directory)

zip -r ../../MuhRec-Linux.zip bin/* lib/* -x "bin/t*" -x "bin/verticalslicer" 

MacOS (in the "build-imagingsuite/Release" directory)

zip -r ../../MuhRec-MacOS-Arch.zip lib/* *.app/* -x "lib/*.dylib" -x "lib/*.h"