-
Notifications
You must be signed in to change notification settings - Fork 11
Build instructions
Building imagingsuite requires the following steps
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)
Navigate to the root folder for your local repositories and clone the following repositories from https://github.com/neutronimaging :
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.
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
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.
Conan is run in the the root of the imagingsuite repository.
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
conan build . --profile:all profiles/macos_arm_clang_15_release --build=missing
conan build . --profile:all profiles/macos_x64_clang_14_release --build=missing
conan build . --profile:all profiles/linux_gcc_11_release --build=missing
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
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
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*
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.
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"
Copy bindings and shared libraries to the package folder:
cd Release/lib
cp *.dylib ../../../imagingsuite/package/pymuhrec
cp *.so ../../../imagingsuite/package/pymuhrec
cd imagingsuite/package
export _PYTHON_HOST_PLATFORM="macosx-14.0-arm64"
export ARCHFLAGS="-arch arm64"
This only needs to be done once
conda create --name testenv
conda activate testing
conda install numpy matplotlib scipy scikit-image astropy pytest
pip install build
Activate the environment if it wasn't done already
conda activate testing
And build
python -m build
cd imaingsuite/package/dist
pip install *.whl
pip install pytest
pytest imagingsuite/package/tests

