Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
324 changes: 137 additions & 187 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,202 +6,152 @@ on:
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
branch:
description: 'PenRed branch to compile'
required: true
default: 'master'

env:
BUILD_TYPE: Release
QT_VERSION: 6.2.4
jobs:

buildLinux:
name: Build on Linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
build_viewer:
runs-on: ${{ matrix.os.runner }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
include:
- os: ubuntu-22.04
release_suffix: ubuntu-22.04
- os: ubuntu-20.04
release_suffix: ubuntu-20.04

steps:
- uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: linux
target: desktop
dir: ${{ runner.temp }}
setup-python: 'true'
install-deps: 'true'
cache: 'false'
set-env: 'true'

- name: Create building folder
run: |
mkdir ${{ github.workspace }}/src/build
os:
- { runner: ubuntu-latest, container: 'quay.io/pypa/manylinux_2_28_x86_64', name: linux }
- { runner: windows-latest, container: '', name: windows }
- { runner: macos-latest, container: '', name: mac }
container: ${{ matrix.os.container }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install pip
if: matrix.os.name == 'linux'
run: |
python3 -m ensurepip --upgrade
yum install -y libxkbcommon-devel

- name: Build the geometry viewer
run: |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIEW_SHARED_LIB="OFF" -Wno-dev ../
cmake --build . --config Release
working-directory: ${{ github.workspace }}/src/build

- name: Bundle dependencies
run: |
cp ${{ github.workspace }}/bundle.sh bundle.sh
bash bundle.sh ${{ env.Qt6_DIR }}
working-directory: ${{ github.workspace }}/src/build

- name: Build the PenRed shared lib
run: |
git clone https://github.com/PenRed/PenRed
mkdir ${{ github.workspace }}/src/build/PenRed/src/build
cd ${{ github.workspace }}/src/build/PenRed/src/build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_C_BINDS=ON -DWITH_NATIVE=OFF -DWITH_DICOM=OFF -DWITH_MULTI_THREADING=ON -DWITH_MPI=OFF -DWITH_LB=OFF -DDEVELOPMENT_WARNINGS=OFF -DWITH_EMBEDDED_DB=OFF ../
cmake --build . --target install --config Release
working-directory: ${{ github.workspace }}/src/build

- name: Move the library
working-directory: ${{ github.workspace }}/src/build
run: |
mv ${{ github.workspace }}/GeometryViewer.sh GeometryViewer.sh
mv PenRed/src/bindings/C/viewers/geometry/libgeoView* .
chmod +x GeometryViewer

- name: Save build artifact
uses: actions/upload-artifact@master
with:
name: geometryViewer-${{ matrix.os }}
path: |
${{ github.workspace }}/src/build/GeometryViewer
${{ github.workspace }}/src/build/GeometryViewer.sh
${{ github.workspace }}/src/build/libgeoView*
${{ github.workspace }}/src/build/lib
${{ github.workspace }}/src/build/platforms
${{ github.workspace }}/src/build/plugins

buildMacOS:
name: Build on MacOS
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-11]
include:
- os: macos-12
release_suffix: macOS Monterey 12
- os: macos-11
release_suffix: macOS Big Sur 11

steps:
- uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: mac
target: desktop
dir: ${{ runner.temp }}
setup-python: 'true'
install-deps: 'true'
cache: 'false'
set-env: 'true'

- name: Create building folder
run: |
mkdir ${{ github.workspace }}/src/build
- name: Install Qt manylinux
if: matrix.os.name == 'linux'
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: ${{ matrix.os.name }}
target: desktop
dir: ${{ runner.temp }}
setup-python: 'false'
install-deps: 'false'
cache: 'false'
set-env: 'true'

- name: Install Qt
if: matrix.os.name != 'linux'
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: ${{ matrix.os.name }}
target: desktop
dir: ${{ runner.temp }}
setup-python: 'true'
install-deps: 'true'
cache: 'false'
set-env: 'true'

- name: Create building folder
run: |
mkdir src/build

- name: Build the geometry viewer
run: |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIEW_SHARED_LIB="OFF" -Wno-dev ../
cmake --build . --config Release
mkdir Release
cp -r GeometryViewer.app Release/
cd Release
macdeployqt GeometryViewer.app -dmg
rm -r GeometryViewer.app
working-directory: ${{ github.workspace }}/src/build
- name: Build the geometry viewer and bundle dependencies
shell: bash
run: |
if [[ "${{ matrix.os.name }}" == "windows" ]]; then
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIEW_SHARED_LIB="OFF" -Wno-dev ../
cmake --build . --config Release
cd Release
windeployqt GeometryViewer.exe --pdb --release
elif [[ "${{ matrix.os.name }}" == "mac" ]]; then
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIEW_SHARED_LIB="OFF" -Wno-dev ../
cmake --build . --config Release
mkdir Release
mv GeometryViewer.app Release/
cd Release
macdeployqt GeometryViewer.app -dmg
else
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIEW_SHARED_LIB="OFF" -Wno-dev ../
cmake --build . --config Release
cp ../../bundle.sh bundle.sh
bash bundle.sh ${{ env.Qt6_DIR }}
cp ../../GeometryViewer.sh GeometryViewer.sh
chmod +x GeometryViewer
fi
working-directory: ${{ github.workspace }}/src/build

- name: Clone PenRed
run: |
git clone https://github.com/PenRed/PenRed --single-branch --branch "${{ github.event.inputs.branch || 'master' }}"
working-directory: ${{ github.workspace }}/src/build

- name: Build the PenRed shared lib
run: |
git clone https://github.com/PenRed/PenRed
mkdir ${{ github.workspace }}/src/build/PenRed/src/build
cd ${{ github.workspace }}/src/build/PenRed/src/build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_C_BINDS=ON -DWITH_NATIVE=OFF -DWITH_DICOM=OFF -DWITH_MULTI_THREADING=ON -DWITH_MPI=OFF -DWITH_LB=OFF -DDEVELOPMENT_WARNINGS=OFF -DWITH_EMBEDDED_DB=OFF ../
cmake --build . --target install --config Release
working-directory: ${{ github.workspace }}/src/build

- name: Move the library
working-directory: ${{ github.workspace }}/src/build
run: |
mv PenRed/src/bindings/C/viewers/geometry/libgeoView_C.dylib Release/libgeoView_C.dylib

- name: Save build artifact
uses: actions/upload-artifact@master
with:
name: geometryViewer-${{ matrix.os }}
path: |
${{ github.workspace }}/src/build/Release

buildWindows:

name: Build on Windows
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]

steps:
- uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: windows
target: desktop
dir: ${{ runner.temp }}
setup-python: 'true'
install-deps: 'true'
cache: 'false'
set-env: 'true'
- name: Build the PenRed shared lib
shell: bash
run: |
# Set architecture-specific flags for macOS
if [[ "${{ matrix.os.name }}" == "mac" ]]; then
ARCH_FLAGS="-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
else
ARCH_FLAGS=""
fi

mkdir build
cd build
cmake $ARCH_FLAGS -DCMAKE_BUILD_TYPE=Release -DBUILD_C_BINDS=ON -DWITH_NATIVE=OFF -DWITH_DICOM=OFF -DWITH_MULTI_THREADING=ON -DWITH_EMBEDDED_DB=OFF ..
cmake --build . --target install --config Release -j 4
working-directory: ${{ github.workspace }}/src/build/PenRed/src

- name: Move the library
working-directory: ${{ github.workspace }}/src/build
shell: bash
run: |
if [[ "${{ matrix.os.name }}" == "linux" ]]; then
mv PenRed/src/bindings/C/viewers/geometry/libgeoView* .
elif [[ "${{ matrix.os.name }}" == "windows" ]]; then
mv PenRed\\src\\bindings\\C\\viewers\\geometry\\geoView_C.dll Release\\libgeoView_C.dll
else
mv PenRed/src/bindings/C/viewers/geometry/libgeoView_C.dylib Release/libgeoView_C.dylib
fi

- name: Create application bundle
shell: bash
run: |
mkdir geometryViewer-${{ matrix.os.name }}
if [[ "${{ matrix.os.name }}" == "linux" ]]; then
mv src/build/GeometryViewer \
src/build/GeometryViewer.sh \
src/build/libgeoView* \
src/build/lib \
src/build/platforms \
src/build/plugins \
geometryViewer-${{ matrix.os.name }}/

- name: Create building folder
run: |
mkdir ${{ github.workspace }}/src/build
- name: Build the geometry viewer
run: |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIEW_SHARED_LIB="OFF" -Wno-dev ../
cmake --build . --config Release
cd Release
windeployqt GeometryViewer.exe --pdb --release
working-directory: ${{ github.workspace }}/src/build

- name: Build the PenRed shared lib
run: |
git clone https://github.com/PenRed/PenRed
mkdir ${{ github.workspace }}/src/build/PenRed/src/build
cd ${{ github.workspace }}/src/build/PenRed/src/build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_C_BINDS=ON -DWITH_NATIVE=OFF -DWITH_DICOM=OFF -DWITH_MULTI_THREADING=ON -DWITH_MPI=OFF -DWITH_LB=OFF -DDEVELOPMENT_WARNINGS=OFF -DWITH_EMBEDDED_DB=OFF ../
cmake --build . --target install --config Release
working-directory: ${{ github.workspace }}/src/build
tar -czvf geometryViewer-${{ matrix.os.name }}.tar.gz geometryViewer-${{ matrix.os.name }}/

elif [[ "${{ matrix.os.name }}" == "windows" ]]; then
mv src/build/Release/* geometryViewer-${{ matrix.os.name }}/
choco install 7zip -y
7z a -r geometryViewer-${{ matrix.os.name }}.zip geometryViewer-${{ matrix.os.name }}/
else
mv src/build/Release/* geometryViewer-${{ matrix.os.name }}/
tar -czvf geometryViewer-${{ matrix.os.name }}.tar.gz geometryViewer-${{ matrix.os.name }}/
fi

- name: Move the library
working-directory: ${{ github.workspace }}/src/build
run: |
move PenRed/src/bindings/C/viewers/geometry/geoView_C.dll Release/libgeoView_C.dll

- name: Save build artifact
uses: actions/upload-artifact@master
with:
name: geometryViewer-${{ matrix.os }}
path: |
${{ github.workspace }}\src\build\Release


- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: geometryViewer-${{ matrix.os.name }}-artifact
path: |
geometryViewer-${{ matrix.os.name }}.zip
geometryViewer-${{ matrix.os.name }}.tar.gz
16 changes: 1 addition & 15 deletions GeometryViewer.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
#!/bin/sh
appname=`basename $0 | sed s,\.sh$,,`

dirname=`dirname $0`
tmp="${dirname#?}"

if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=${dirname}/lib
export LD_LIBRARY_PATH

echo "Path lib: ${LD_LIBRARY_PATH}"

chmod +x $appname
$dirname/$appname "$@"
LD_LIBRARY_PATH="./lib" QT_QPA_PLATFORM_PLUGIN_PATH="./platforms" ./GeometryViewer
7 changes: 5 additions & 2 deletions bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ mkdir lib
mkdir platforms
mkdir plugins

#ldd GeometryViewer | grep "Qt" | cut -d'>' -f2 | cut -d' ' -f2 | xargs -I % cp % lib/
ldd GeometryViewer | cut -d'>' -f2 | cut -d' ' -f2 | grep "/" | xargs -I % cp % lib/
# Copy ONLY Qt libraries that are actually used (via ldd), avoiding system libs
ldd GeometryViewer | awk '/=>/ {print $3}' | grep -i qt | while read -r lib; do
cp "$lib" lib/
done

find ${QTDIR}/lib -name libQt*XcbQ* | xargs -I % cp % lib/
find ${QTDIR}/lib -name "*Wayland*" | grep ".so" | xargs -I % cp % lib/
find ${QTDIR}/lib -name "*OpenGL*" | grep ".so" | xargs -I % cp % lib/
Expand Down
5 changes: 4 additions & 1 deletion src/pen_geoViewInterface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#ifndef __PEN_GEO_VIEWER__

#include <cstdio>
#include <array>
#include <vector>

struct geoError{
Expand All @@ -52,6 +51,10 @@ class pen_geoViewInterface{
private:

public:

virtual unsigned getBodies() const = 0;

virtual std::string getBodyName(const unsigned ibody) const = 0;

virtual double z2dir(const double u,
const double v,
Expand Down
Loading
Loading