Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare qt6 for linux #460

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
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 <[email protected]>
#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
19 changes: 16 additions & 3 deletions .github/workflows/createWheelLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@ 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
ls /opt/Qt/6.7.2/gcc_64/plugins/
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/designer/ opengate_core/plugins/ #pareil
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/egldeviceintegrations/ opengate_core/plugins/ #pareil
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/generic/ opengate_core/plugins/ #pareil
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/iconengines/ opengate_core/plugins/ #pareil
cp -r /opt/Qt/6.7.2/gcc_64/plugins/imageformats opengate_core/plugins/ #initial
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/networkinformation/ opengate_core/plugins/ #pareil
##cp -r /opt/Qt/6.7.2/gcc_64/plugins/platforminputcontexts/ opengate_core/plugins/ #libpango-1.0.so.0
cp -r /opt/Qt/6.7.2/gcc_64/plugins/platforms opengate_core/plugins/ #initial
##cp -r /opt/Qt/6.7.2/gcc_64/plugins/platformthemes opengate_core/plugins/ #libgtk-3.so.0
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/qmllint opengate_core/plugins/ #pareil
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/qmltooling opengate_core/plugins/ #pareil
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/sqldrivers opengate_core/plugins/ #Cannot repair wheel, because required library "libmimerapi.so" could not be located
#cp -r /opt/Qt/6.7.2/gcc_64/plugins/tls opengate_core/plugins/ #pareil
cp -r /opt/Qt/6.7.2/gcc_64/plugins/xcbglintegrations opengate_core/plugins/ #initial
/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
23 changes: 20 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
python-version: [3.9, '3.10', '3.11', '3.12']
os: [ubuntu-latest]
python-version: [3.9, '3.12']

env:
GEANT4_VERSION: 'v11.2.1'
Expand Down 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_withoutOpenGL /home/.github/workflows/createWheelLinux.sh
ls wheelhouse
rm -rf dist
mv wheelhouse dist
Expand All @@ -102,6 +102,23 @@ 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
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
4 changes: 2 additions & 2 deletions core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def build_extension(self, ext):
"-DPYTHON_EXECUTABLE=" + sys.executable,
]

# cfg = 'Debug' if self.debug else 'Release'
cfg = "Release"
cfg = "Debug" # if self.debug else 'Release'
# cfg = "Release"
build_args = ["--config", cfg]

# Pile all .so in one place and use $ORIGIN as RPATH
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
Loading