Skip to content

Commit

Permalink
CI: Enable Qt5 + lightpreview (#406)
Browse files Browse the repository at this point in the history
* chore(CI): refine current 'cmake.yml' file content

* chore(CI): enable Qt5 on Linux and macOS

* Appveyor.yml: remove deploy step

we are deploying from GitHub Actions now

* build-linux-64.sh: adjust .zip wildcard

to hopefully not break on PR builds

* build-linux-64.sh: remove fragile unzip/readelf lines

* lightpreview\CMakeLists.txt: only install Qt on Win/Mac

* lightpreview: attempt to fix mac Qt packaging

* lightpreview: apple fixes

* Install qtdbus on macOS

* try alternate dbus module name

* try cmake find_package for dbus

* also find Qt5PrintSupport

* build-osx.sh: remove coreutils install

we don't use sha256sum anymore

* lightpreview/CMakeLists.txt: create .app bundle on macOS

* Update CMakeLists.txt

* build-*: run cpack as part of the build command

on my macOS test system, running cpack separately
is doubling the build time

* cmake: factor out add_loader_path_to_rpath function, apply to all targets

* chore(CI): add steps to re-pack the 'doc' and 'bin' directories

* chore(CI): remove GitHub release-related step (to be re-introduced)

* chore(CI): adjust inflating destination directories

---------

Co-authored-by: Eric Wasylishen <ewasylishen@gmail.com>
  • Loading branch information
jonathanlinat and ericwa authored Jan 9, 2024
1 parent 126931a commit 39074b8
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 142 deletions.
86 changes: 0 additions & 86 deletions .github/workflows/cmake.yml

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/continuous-building.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Continuous Building

on:
- push
- pull_request

jobs:
build-and-upload:
name: Build & upload the artifact
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
use-asan:
- YES
- NO
exclude:
- os: windows-2022
use-asan: YES
env:
USE_ASAN: ${{ matrix.use-asan }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: 'Linux: Install Qt5'
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install qtbase5-dev libqt5svg5-dev
- name: 'Linux: Build the artifact'
if: startsWith(matrix.os, 'ubuntu-')
run: ./build-linux-64.sh
- name: 'Linux: Prepare the artifact'
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: |
unzip build-linux/*-Linux.zip
mv ericw-tools-*/*-Linux/ ericw-tools-linux
- name: 'Linux: Upload the artifact'
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.use-asan == 'NO' }}
uses: actions/upload-artifact@v4
with:
path: ericw-tools-linux/
name: ericw-tools-${{ github.sha }}-linux
if-no-files-found: error

- name: 'macOS: Install Qt5'
if: ${{ startsWith(matrix.os, 'macos-') }}
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2
- name: 'macOS: Build the artifact'
if: startsWith(matrix.os, 'macos-')
run: ./build-osx.sh
- name: 'macOS: Prepare the artifact'
if: ${{ startsWith(matrix.os, 'macos-') }}
run: |
unzip build-osx/*-Darwin.zip
mv ericw-tools-*/*-Darwin/ ericw-tools-macos
- name: 'macOS: Upload the artifact'
if: ${{ startsWith(matrix.os, 'macos-') && matrix.use-asan == 'NO' }}
uses: actions/upload-artifact@v4
with:
path: ericw-tools-macos/
name: ericw-tools-${{ github.sha }}-macos
if-no-files-found: error

- name: 'Windows: Setup MSVC environment'
if: startsWith(matrix.os, 'windows-')
uses: ilammy/msvc-dev-cmd@v1
- name: 'Windows: Install Qt5'
if: ${{ startsWith(matrix.os, 'windows-') }}
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2
arch: win64_msvc2019_64
- name: 'Windows: Build the artifact'
if: startsWith(matrix.os, 'windows-')
run: .\build-windows.ps1
- name: 'Windows: Prepare the artifact'
if: ${{ startsWith(matrix.os, 'windows-') }}
run: |
7z x build-windows\*-win64.zip -o"ericw-tools-windows-temp\" -y
New-Item -ItemType Directory -Path ericw-tools-windows
Get-ChildItem -Path ericw-tools-windows-temp\ericw-tools-*\*-win64 -Recurse |
Move-Item -Destination ericw-tools-windows
shell: pwsh
- name: 'Windows: Upload the artifact'
if: ${{ startsWith(matrix.os, 'windows-') && matrix.use-asan == 'NO' }}
uses: actions/upload-artifact@v4
with:
path: ericw-tools-windows/
name: ericw-tools-${{ github.sha }}-windows
if-no-files-found: error
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ function(copy_mingw_dlls TARGETNAME)
endif()
endfunction()

# so the executable will search for dylib's in the same directory as the executable
function(add_loader_path_to_rpath TARGETNAME)
if(APPLE)
add_custom_command(TARGET ${TARGETNAME} POST_BUILD
COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $<TARGET_FILE:${TARGETNAME}> || true\")
endif()
endfunction()

if (WIN32)
set("NO_ITERATOR_DEBUG" FALSE CACHE BOOL "Whether to use MSVC iterator debugging or not")

Expand Down
9 changes: 0 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,3 @@ build_script:
- cmd: powershell .\build-appveyor.ps1
artifacts:
- path: cmakebuild\*.zip
deploy:
description: 'release description'
provider: GitHub
auth_token:
secure: +KEW/TPBKmDCgwmkYgXMuhDJPY1iGeWz7Qf4Vw42Rnk+6OixNCfbvS+zP9IvYgtD
draft: true
prerelease: false
on:
appveyor_repo_tag: true
1 change: 1 addition & 0 deletions bspinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ add_custom_command(TARGET bspinfo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:bspinfo>"
)
copy_mingw_dlls(bspinfo)
add_loader_path_to_rpath(bspinfo)

install(TARGETS bspinfo RUNTIME DESTINATION bin)
1 change: 1 addition & 0 deletions bsputil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ add_custom_command(TARGET bsputil POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:bsputil>"
)
copy_mingw_dlls(bsputil)
add_loader_path_to_rpath(bsputil)

install(TARGETS bsputil RUNTIME DESTINATION bin)
7 changes: 2 additions & 5 deletions build-linux-64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ TBB_CMAKE_DIR="$(pwd)/oneapi-tbb-2021.3.0/lib/cmake"

# check USE_ASAN environment variable (see cmake.yml)
if [ "$USE_ASAN" == "YES" ]; then
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" -DERICWTOOLS_ASAN=YES
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" -DENABLE_LIGHTPREVIEW=YES -DERICWTOOLS_ASAN=YES
else
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR"
fi

# not yet free of memory leaks, so don't abort on leak detection
export ASAN_OPTIONS=detect_leaks=false

make -j8 VERBOSE=1 || exit 1
cpack || exit 1
make -j8 VERBOSE=1 package || exit 1

# run tests
if [ "$USE_ASAN" != "YES" ]; then
Expand All @@ -45,5 +44,3 @@ fi

# check rpath
readelf -d ./light/light
unzip -X ericw-tools-*.zip
readelf -d ./ericw-tools-*/bin/light
17 changes: 7 additions & 10 deletions build-osx.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
#!/bin/bash

# for sha256sum, used by the tests
brew install coreutils

python3 -m pip install -r docs/requirements.txt --force-reinstall

BUILD_DIR=build-osx
EMBREE_ZIP="https://github.com/embree/embree/releases/download/v3.13.0/embree-3.13.0.x86_64.macosx.zip"
EMBREE_ZIP="https://github.com/embree/embree/releases/download/v3.13.1/embree-3.13.1.x86_64.macosx.zip"

# embree-3.13.1.x86_64.macosx.zip
EMBREE_ZIP_NAME=$(basename "$EMBREE_ZIP")

# embree-3.13.1.x86_64.macosx
EMBREE_DIR_NAME=$(basename "$EMBREE_ZIP_NAME" ".zip")

TBB_TGZ="https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-mac.tgz"
TBB_TGZ="https://github.com/oneapi-src/oneTBB/releases/download/v2021.3.0/oneapi-tbb-2021.3.0-mac.tgz"
TBB_TGZ_NAME=$(basename "$TBB_TGZ")
TBB_DIR_NAME="oneapi-tbb-2021.2.0"
TBB_DIR_NAME="oneapi-tbb-2021.3.0"

if [ -d "$BUILD_DIR" ]; then
echo "$BUILD_DIR already exists, remove it first"
Expand All @@ -32,16 +29,16 @@ unzip -q "$EMBREE_ZIP_NAME"
wget -q "$TBB_TGZ"
tar xf "$TBB_TGZ_NAME"

EMBREE_CMAKE_DIR="$(pwd)/$EMBREE_DIR_NAME/lib/cmake/embree-3.13.0"
EMBREE_CMAKE_DIR="$(pwd)/$EMBREE_DIR_NAME/lib/cmake/embree-3.13.1"
TBB_CMAKE_DIR="$(pwd)/${TBB_DIR_NAME}/lib/cmake"

# check USE_ASAN environment variable (see cmake.yml)
if [ "$USE_ASAN" == "YES" ]; then
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" -DERICWTOOLS_ASAN=YES
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" -DENABLE_LIGHTPREVIEW=YES -DERICWTOOLS_ASAN=YES
else
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR"
fi
make -j8 || exit 1
cpack || exit 1
make -j8 package || exit 1

# print shared libraries used
otool -L ./light/light
Expand Down
9 changes: 2 additions & 7 deletions build-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,13 @@ choco install ninja
mkdir build-windows
cd build-windows

cmake .. -GNinja -Dembree_DIR="C:\embree-3.12.1.x64.vc14.windows" -DTBB_DIR="C:\tbb\cmake" -DCMAKE_BUILD_TYPE=Release
cmake .. -GNinja -Dembree_DIR="C:\embree-3.12.1.x64.vc14.windows" -DTBB_DIR="C:\tbb\cmake" -DCMAKE_BUILD_TYPE=Release -DENABLE_LIGHTPREVIEW=YES -DQt5Widgets_DIR="C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5Widgets"

ninja
ninja package
if ( $? -eq $false ) {
throw "build failed"
}

cpack
if ( $? -eq $false ) {
throw "package failed"
}

.\tests\tests.exe --no-skip

if ( $? -eq $false ) {
Expand Down
7 changes: 1 addition & 6 deletions light/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ if (embree_FOUND)
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EMBREE_TBB_DLL}" "$<TARGET_FILE_DIR:light>")
endif()

# so the executable will search for dylib's in the same directory as the executable
if(APPLE)
add_custom_command(TARGET light POST_BUILD
COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $<TARGET_FILE:light> || true\")
endif()

if(NOT SKIP_EMBREE_INSTALL)
install(FILES $<TARGET_FILE:embree> DESTINATION bin)
endif()
Expand Down Expand Up @@ -144,6 +138,7 @@ if (embree_FOUND)
endif(embree_FOUND)

copy_mingw_dlls(light)
add_loader_path_to_rpath(light)

install(TARGETS light RUNTIME DESTINATION bin)
install(FILES ../gpl_v3.txt DESTINATION bin)
Loading

0 comments on commit 39074b8

Please sign in to comment.