Skip to content

Commit

Permalink
Prepare qt6 for linux
Browse files Browse the repository at this point in the history
To be able to use qt6 I need gcc version quite recent, ie. I need to use
manylinux_2_28.
But for people/cluster using older OS, I continue to compile the wheel
with manylinux2014 only for tagged version.
  • Loading branch information
tbaudier committed Sep 25, 2024
1 parent 79fd945 commit b917cbf
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/Dockerfile_opengate_core
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,35 @@
#build: docker build -t tbaudier/opengate_core -f Dockerfile_opengate_core .
#push: docker push tbaudier/opengate_core
#run: docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDERMANYLINUX}" -v $(Pipeline.Workspace)/software:/home tbaudier/opengate_core /home/opengate_core/azureCreateWheelLinux.sh
#interactive: docker run -ti --rm -v $(Pipeline.Workspace)/software:/home quay.io/pypa/manylinux2014_x86_64 /bin/bash
#interactive: docker run -ti --rm -v $PWD:/home quay.io/pypa/manylinux_2_28_x86_64 /bin/bash

FROM quay.io/pypa/manylinux2014_x86_64
FROM quay.io/pypa/manylinux_2_28_x86_64
MAINTAINER Thomas Baudier <thomas.baudier@creatis.insa-lyon.fr>
#Install packages
RUN yum install -y gcc wget git expat-devel fftw-devel qt5-qtbase-devel freeglut-devel libXmu-devel xerces-c-devel \
RUN yum install -y gcc wget git expat-devel fftw-devel freeglut-devel libXmu-devel libxkbcommon-x11-devel.x86_64 libxcb-devel.x86_64 xcb-util.x86_64 xcb-util-wm.x86_64 xcb-util-keysyms.x86_64 xcb-util-image.x86_64 xcb-util-renderutil.x86_64 libwayland-cursor.x86_64 libwayland-egl.x86_64 \

#Install xcb_cursor needed by qt6
&& wget https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/x/xcb-util-cursor-0.1.3-9.el8.x86_64.rpm \
&& yum install -y xcb-util-cursor-0.1.3-9.el8.x86_64.rpm \
&& rm -rf xcb-util-cursor-0.1.3-9.el8.x86_64.rpm \

#Install qt6 manually

#Create folder
&& mkdir -p /software/cmake /software/geant4/src /software/geant4/bin /software/geant4/data /software/itk/src /software/itk/bin /software/wheelhouse \
&& mkdir -p /software/cmake /software/geant4/src /software/geant4/bin /software/itk/src /software/itk/bin /software/wheelhouse \

#Install cmake
&& cd /software/cmake \
&& wget https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.tar.gz \
&& tar xzvf cmake-3.18.2-Linux-x86_64.tar.gz \
&& rm -rf cmake-3.18.2-Linux-x86_64.tar.gz \
&& export PATH=/software/cmake/cmake-3.18.2-Linux-x86_64/bin/:${PATH} \

#Compile Geant4
&& cd /software/geant4 \
&& git clone --branch v11.2.1 https://github.com/Geant4/geant4.git --depth 1 src \
&& cd bin \
&& cmake -DCMAKE_CXX_FLAGS=-std=c++17 -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=OFF -DGEANT4_INSTALL_DATADIR=/sofware/geant4/data -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON ../src \
&& cmake -DCMAKE_CXX_FLAGS=-std=c++17 -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_GDML=OFF -DGEANT4_INSTALL_DATA=OFF -DGEANT4_INSTALL_DATADIR=/sofware/geant4/data -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT_QT6=ON -DQT_DIR=/opt/Qt/6.7.2/gcc_64/lib/cmake/Qt6 -DQt6_DIR=/opt/Qt/6.7.2/gcc_64/lib/cmake/Qt6 -DQt6OpenGLWidgets_DIR=/opt/Qt/6.7.2/gcc_64/lib/cmake/Qt6OpenGLWidgets ../src \
&& make -j10 \
&& source /software/geant4/bin/geant4make.sh \

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/createWheelLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export PATH=/software/cmake/cmake-3.18.2-Linux-x86_64/bin/:${PATH}
source /software/geant4/bin/geant4make.sh
export CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/:${CMAKE_PREFIX_PATH}
mkdir opengate_core/plugins
cp -r /lib64/qt5/plugins/platforms opengate_core/plugins
cp -r /lib64/qt5/plugins/imageformats opengate_core/plugins
cp -r /opt/Qt/6.7.2/gcc_64/plugins/platforms opengate_core/plugins
cp -r /opt/Qt/6.7.2/gcc_64/plugins/imageformats opengate_core/plugins
/opt/python/${PYTHONFOLDER}/bin/pip install wget colored
/opt/python/${PYTHONFOLDER}/bin/python setup.py sdist bdist_wheel
auditwheel repair /home/core/dist/*.whl -w /software/wheelhouse/ --plat "manylinux2014_x86_64"
auditwheel repair /home/core/dist/*.whl -w /software/wheelhouse/ --plat "manylinux_2_28_x86_64"
cp -r /software/wheelhouse /home/
#/opt/python/${PYTHONFOLDER}/bin/pip install twine
#/opt/python/${PYTHONFOLDER}/bin/twine upload --repository-url https://test.pypi.org/legacy/ wheelhouse/*manylinux2014*.whl
20 changes: 19 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
export PYTHONFOLDER="cp312-cp312"
fi
mkdir -p $HOME/software
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${{ env.GEANT4_VERSION }} /home/.github/workflows/createWheelLinux.sh
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${{ env.GEANT4_VERSION }}_qt6 /home/.github/workflows/createWheelLinux.sh
ls wheelhouse
rm -rf dist
mv wheelhouse dist
Expand All @@ -102,6 +102,24 @@ jobs:
ls -lrt dist_opengate/
mv dist_opengate/* dist/
fi
- name: Create opengate_core Wheel Linux for old OS
if: matrix.os == 'ubuntu-latest' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
run: |
if [ ${{ matrix.python-version }} == "3.9" ]; then
export PYTHONFOLDER="cp39-cp39"
elif [ ${{ matrix.python-version }} == "3.10" ]; then
export PYTHONFOLDER="cp310-cp310"
elif [ ${{ matrix.python-version }} == "3.11" ]; then
export PYTHONFOLDER="cp311-cp311"
elif [ ${{ matrix.python-version }} == "3.12" ]; then
export PYTHONFOLDER="cp312-cp312"
fi
mkdir -p $HOME/software
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${{ env.GEANT4_VERSION }} /home/.github/workflows/createWheelLinux.sh
ls wheelhouse
rm -rf dist
mv wheelhouse dist
sudo chown -R runner:docker dist
- uses: conda-incubator/setup-miniconda@v3
if: (matrix.os == 'macos-12') || (matrix.os == 'windows-latest')
with:
Expand Down
7 changes: 4 additions & 3 deletions docs/source/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ The subpackage `opengate_core` depends on the ITK and Geant4 libraries. Therefor

Installing QT is optional. Currently, QT visualisation is not working on all architectures.

If you wish to use QT, you must install qt5 **before** installing Geant4 so that Geant4 can find the correct qt lib. It can be done for example with conda:
If you wish to use QT, you must install qt6 **before** installing Geant4 so that Geant4 can find the correct qt lib. It can be done for example with conda:

```bash
conda install qt=5
conda install conda-forge::qt6-main conda::forge::qt6-3d
```

For **Geant4**, you need to compile with the following options:
Expand All @@ -54,14 +54,15 @@ cmake -DCMAKE_CXX_FLAGS=-std=c++17 \
-DGEANT4_INSTALL_DATADIR=$HOME/software/geant4/data \
-DGEANT4_USE_QT=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_QT_QT6=ON \
-DGEANT4_BUILD_MULTITHREADED=ON \
../geant4
make -j 32
```

Change the QT flag (GEANT4_USE_QT) to OFF if you did not install QT.

WARNING : since June 2023, [Geant4 11.1.1](https://geant4.web.cern.ch/download/11.1.1.html) is needed.
WARNING : since June 2023, [Geant4 11.2.1](https://geant4.web.cern.ch/download/11.2.1.html) is needed.

#### STEP 2 - ITK

Expand Down

0 comments on commit b917cbf

Please sign in to comment.