Skip to content

Commit

Permalink
Merge branch 'master' into issue758_linuxdeploy
Browse files Browse the repository at this point in the history
  • Loading branch information
anderskaestner committed Jan 13, 2025
2 parents 1384718 + 6a97718 commit 012491c
Show file tree
Hide file tree
Showing 22 changed files with 679 additions and 729 deletions.
71 changes: 52 additions & 19 deletions .github/workflows/Build-multi-OS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
cl: 17
build_type: Release
build_root: build-imagingsuite
- os: ubuntu-latest
- os: ubuntu-22.04
c_compiler: gcc
cpp_compiler: g++
gcc: 11
Expand Down Expand Up @@ -149,16 +149,38 @@ jobs:
- name: Ammend shared libraries runpaths
if: ${{ runner.os == 'Linux' }}
working-directory: build-imagingsuite/Release/lib
working-directory: build-imagingsuite/Release
shell: bash
run: patchelf --set-rpath '$ORIGIN' *.so*
run: |
patchelf --set-rpath '$ORIGIN' lib/*.so*
patchelf --set-rpath '$ORIGIN:$ORIGIN/../../lib' PlugIns/BackProjectors/*.so*
patchelf --set-rpath '$ORIGIN:$ORIGIN/../../lib' PlugIns/Preprocessors/*.so*
- name: Test
id: tests
working-directory: ${{ matrix.build_root }}
shell: bash
#Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
#See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
# The seperation of module files into seperate folders breaks the ctest test discovery, copy temprarily to the root folder for testing
run: |
if [ "${RUNNER_OS}" == "Windows" ]; then
cp ./bin/Release/PlugIns/Preprocessors/* ./bin/Release/PlugIns/BackProjectors/* ./bin/Release/
elif [ "${RUNNER_OS}" == "Linux" ]; then
cp ./PlugIns/Preprocessors/* ./PlugIns/BackProjectors/* ./lib/
elif [ "${RUNNER_OS}" == "macOS" ]; then
cp ./lib/Preprocessors/* ./lib/BackProjectors/* ./lib/
fi
ctest --build-config ${{ matrix.build_type }}
if [ "${RUNNER_OS}" == "Windows" ]; then
rm ./bin/Release/*Modules.dll ./bin/Release/*Projectors.dll
elif [ "${RUNNER_OS}" == "Linux" ]; then
rm lib/*Modules.so lib/*Projectors.so
elif [ "${RUNNER_OS}" == "macOS" ]; then
rm -r lib/*Modules.dylib lib/*Projectors.dylib lib/sse2neon
fi
continue-on-error: true

- name: Archive test results
Expand All @@ -168,22 +190,33 @@ jobs:
name: ${{runner.os}}-${{runner.arch}}-test-results
path: ${{ matrix.build_root }}/Testing

- name: Compress artifact
shell: bash
working-directory: ${{ matrix.build_root }}
run: |
if [ "${RUNNER_OS}" == "Windows" ]; then
7z a ../MuhRec-${{runner.os}}-${{runner.arch}}.zip "bin/Release/*" -xr!t*.exe -xr!muhreccli.exe -xr!verticalslicer.exe
elif [ "${RUNNER_OS}" == "Linux" ]; then
zip -r ../../MuhRec-${{runner.os}}-${{runner.arch}}.zip bin/* lib/* -x "bin/t*" -x "bin/verticalslicer"
elif [ "${RUNNER_OS}" == "macOS" -a "${RUNNER_ARCH}" == "X64" ]; then
zip -r ../../MuhRec-${{runner.os}}-${{runner.arch}}.zip lib/* *.app/* -x "lib/*.dylib"
elif [ "${RUNNER_OS}" == "macOS" -a "${RUNNER_ARCH}" == "ARM64" ]; then
zip -r ../../MuhRec-${{runner.os}}-${{runner.arch}}.zip lib/* *.app/* -x "lib/*.dylib" -x "lib/*.h"
fi
- name: Save build artifact Windows
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@master
with:
name: MuhRec-${{runner.os}}-${{runner.arch}}
path: |
${{ matrix.build_root }}/bin/Release/*
!${{ matrix.build_root }}/bin/Release/t*.exe
!${{ matrix.build_root }}/bin/Release/*.pyd
- name: Save build artifact
- name: Save build artifact Linux
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@master
with:
name: MuhRec-${{runner.os}}-${{runner.arch}}
path: |
${{ matrix.build_root }}/bin/*
!${{ matrix.build_root }}/bin/t*
${{ matrix.build_root }}/PlugIns/*
${{ matrix.build_root }}/lib/*
!${{ matrix.build_root }}/lib/*cpython*
${{ matrix.build_root }}/resources/*
- name: Save build artifact MacOS
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@master
with:
name: MuhRec-${{runner.os}}-${{runner.arch}}
path: "${{ github.workspace }}/MuhRec*.zip"
path: |
${{ matrix.build_root }}/*.app/*
27 changes: 14 additions & 13 deletions .github/workflows/Build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ jobs:
# 4. <MacOS 14 with arm64 arch, Release, Clang 15 compiler toolchain
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the list.
matrix: # Qt requires py7zr==0.20.x which requires python 3.7^
python-version: ["3.7","3.8","3.9", "3.10", "3.11", "3.12"]
os: [windows-2022, ubuntu-latest, macos-13, macos-14]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [windows-2022, ubuntu-22.04, macos-13, macos-14]
include:
- os: windows-2022
c_compiler: cl
cpp_compiler: cl
cl: 17
build_type: Release
build_root: build-imagingsuite
- os: ubuntu-latest
- os: ubuntu-22.04
c_compiler: gcc
cpp_compiler: g++
gcc: 11
Expand Down Expand Up @@ -165,29 +165,30 @@ jobs:
${QTPATH}/bin/macdeployqt imageviewer.app
fi
- name: Ammend shared libraries runpaths
if: ${{ runner.os == 'Linux' }}
working-directory: build-imagingsuite/Release/lib
shell: bash
run: patchelf --set-rpath '$ORIGIN' *.so*

- name: Copy bindings and shared libraries to package folder
shell: bash
working-directory: build-imagingsuite
run: |
if [ "${RUNNER_OS}" == "Windows" ]; then
cd bin/Release
cp *.dll ../../../imagingsuite/package/pymuhrec
cp *.dll PlugIns/BackProjectors/*.dll PlugIns/Preprocessors/*.dll ../../../imagingsuite/package/pymuhrec
cp *.pyd ../../../imagingsuite/package/pymuhrec
elif [ "${RUNNER_OS}" == "Linux" ]; then
cd Release/lib
cp * ../../../imagingsuite/package/pymuhrec
cd Release
cp lib/* PlugIns/BackProjectors/*.so PlugIns/Preprocessors/*.so ../../imagingsuite/package/pymuhrec
elif [ "${RUNNER_OS}" == "macOS" ]; then
cd Release/lib
cp *.dylib ../../../imagingsuite/package/pymuhrec
cp *.dylib BackProjectors/*.dylib Preprocessors/*.dylib ../../../imagingsuite/package/pymuhrec
cp *.so ../../../imagingsuite/package/pymuhrec
fi
- name: Ammend shared libraries runpaths
if: ${{ runner.os == 'Linux' }}
working-directory: imagingsuite/package/pymuhrec
shell: bash
run: |
patchelf --set-rpath '$ORIGIN' *.so*
- name: Build wheels
shell: bash
working-directory: imagingsuite/package
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cmake_install.cmake
*.synctex.gz
.vscode*
package/pymuhrec/*.dll
package/pymuhrec/*.so
package/pymuhrec/*.so*
package/pymuhrec/*.dylib
package/pymuhrec/*.pyd
package/pymuhrec.egg-info
Expand Down
146 changes: 18 additions & 128 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,22 @@ endif()

if (WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/Release)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/Release)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/Release)
set(PREPROCESSOR_MODULES_DIRECTORY ${CMAKE_BINARY_DIR}/bin/Release/PlugIns/Preprocessors)
set(PROJECTOR_MODULES_DIRECTORY ${CMAKE_BINARY_DIR}/bin/Release/PlugIns/BackProjectors)
elseif (LINUX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(PREPROCESSOR_MODULES_DIRECTORY ${CMAKE_BINARY_DIR}/PlugIns/Preprocessors)
set(PROJECTOR_MODULES_DIRECTORY ${CMAKE_BINARY_DIR}/PlugIns/BackProjectors)
elseif (APPLE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(PREPROCESSOR_MODULES_DIRECTORY ${CMAKE_BINARY_DIR}/lib/Preprocessors)
set(PROJECTOR_MODULES_DIRECTORY ${CMAKE_BINARY_DIR}/lib/BackProjectors)
include_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
endif()

Expand Down Expand Up @@ -234,130 +240,14 @@ add_subdirectory(frameworks/tomography/pyMuhRec)
add_subdirectory(core/algorithms/pyimgalg)
add_subdirectory(core/algorithms/pyadvancedfilters)

# if(DYNAMIC_LIB)
# install(
# EXPORT ${EXPORT_NAME}
# DESTINATION "lib/cmake/kipl"
# NAMESPACE kipl::
# )

# include(CMakePackageConfigHelpers)
# configure_package_config_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in
# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
# INSTALL_DESTINATION lib/cmake/kipl
# )
# write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
# VERSION "${CMAKE_PROJECT_VERSION}"
# COMPATIBILITY SameMinorVersion # switch to SameMajorVersion after 1.0
# # release
# )
# install(
# FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
# DESTINATION lib/cmake/kipl
# )
# if (LINUX)
# print('Linux')
# install(FILES
# ../lib/libkipl.so.1.0.0
# ../lib/libModuleConfig.so.1.0.0
# ../lib/libReconFramework.so.1.0.0
# ../lib/libStdBackProjectors.so.1.0.0
# ../lib/libFDKBackProjectors.so.1.0.0
# ../lib/libImagingAlgorithms.so.1.0.0
# ../lib/libReaderConfig.so.1.0.0
# ../lib/libNeXus.so.1.0.0
# ../lib/libhdf5_cpp.so.11
# ../lib/libNeXusCPP.so.1.0.0
# ../lib/libhdf5_hl.so.10
# ../lib/libhdf5.so.10
# ../lib/libsz.so.2

# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

# execute_process(
# COMMAND for f in `ls *.so.1.0.0`; do ln -s $f `basename $f .so.1.0.0`.so.1; done
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib"
# )
# endif()
# if (APPLE)
# install(FILES
# # ../ExternalDependencies/macos/${CMAKE_HOST_SYSTEM_PROCESSOR}/lib/libNeXus.1.0.0.dylib
# # ../ExternalDependencies/macos/${CMAKE_HOST_SYSTEM_PROCESSOR}/lib/libNeXusCPP.1.0.0.dylib
# # /opt/homebrew/lib/libhdf5.dylib
# # /opt/homebrew/lib/libhdf5_cpp.dylib

# # external/mac/lib/libNeXus.1.0.0.dylib
# # external/mac/lib//libhdf5_cpp.11.dylib
# # external/mac/lib//libNeXusCPP.1.0.0.dylib
# # external/mac/lib//libhdf5_hl.10.dylib
# # external/mac/lib//libhdf5.10.dylib
# # external/mac/lib//libsz.2.dylib

# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

# execute_process(
# COMMAND for f in `ls *.1.0.0.*`; do ln -s $f `basename $f .1.0.0.dylib`.1.dylib; done
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib"
# )
# endif()




# endif(DYNAMIC_LIB)
# if (WIN32)
# message("${OpenBLAS_LIBRARIES}")
# install(FILES
# external/lib64/nexus/NeXus.dll
# external/lib64/nexus/NeXusCPP.dll
# external/lib64/hdf5/hdf5_hl.dll
# external/lib64/hdf5/hdf5.dll
# external/lib64/hdf5/hdf5_cpp.dll
# external/lib64/hdf5/zlib.dll
# external/lib64/hdf5/szip.dll
# external/lib64/libtiff.dll
# external/lib64/libjpeg-62.dll
# external/lib64/zlib1.dll
# external/lib64/libfftw3-3.dll
# external/lib64/libfftw3f-3.dll


# # ${OpenBLAS_LIBRARIES}
# # external/lib64/libblas.dll
# # external/lib64/liblapack.dll
# # external/lib64/liblapacke.dll
# # external/lib64/libquadmath-0.dll
# # external/lib64/libgfortran_64-3.dll
# # external/lib64/libwinpthread-1.dll
# # external/lib64/libgcc_s_seh-1.dll
# # external/lib64/libgcc_s_seh_64-1.dll
# # ../ExternalDependencies/windows/bin/libopenblas.dll

# ../ExternalDependencies/windows/bin/libxml2.dll
# ../ExternalDependencies/windows/bin/cfitsio.dll
# ../ExternalDependencies/windows/bin/libopenblas.dll

# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# endif()
# message(${CMAKE_CURRENT_SOURCE_DIR})

## define test
#add_test(
# NAME
# testBindAverageImage
# COMMAND
# ${CMAKE_COMMAND} -E env IMAGALG_MODULE_PATH=$<TARGET_FILE_DIR:imagalg>
# ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/UnitTests/python/testBindAverageImage.py
# ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/UnitTests/python/testBindAverageImage.py
#)
#
#add_test(
# NAME
# testBindPolynomialCorrection
# COMMAND
# ${CMAKE_COMMAND} -E env IMAGALG_MODULE_PATH=$<TARGET_FILE_DIR:imagalg>
# ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/UnitTests/python/testBindPolynomialCorrection.py
#)
set_target_properties(InspectorModules StdPreprocModules
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PREPROCESSOR_MODULES_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${PREPROCESSOR_MODULES_DIRECTORY}
)

set_target_properties(FDKBackProjectors StdBackProjectors
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECTOR_MODULES_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${PROJECTOR_MODULES_DIRECTORY}
)
Loading

0 comments on commit 012491c

Please sign in to comment.