Fixes for new build

This commit is contained in:
Luke Street 2021-04-18 11:19:09 -04:00
parent 7d7db261a2
commit 673ce0063b
2 changed files with 128 additions and 85 deletions

View File

@ -2,14 +2,15 @@ name: Build
on:
push:
branches-ignore:
- master
paths-ignore:
- '*.json'
- '*.md'
- '*LICENSE'
pull_request:
env:
BUILD_TYPE: RelWithDebInfo
jobs:
build-linux:
name: Build Linux (${{matrix.name}} x86_64)
@ -33,10 +34,18 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get -y install curl git cmake ninja-build clang lld qt5-default libcurl4-openssl-dev \
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 \
intel-oneapi-ipp-devel ccache
yarn global add @sentry/cli
echo "$(yarn global bin)" >> $GITHUB_PATH
# free up disk space
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
echo Before
@ -49,14 +58,23 @@ jobs:
echo After
df -h .
- name: Configure ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ubuntu-20.04-${{matrix.cc}}
max-size: 1G
- name: Configure CMake
run: |
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
-DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}}
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:PATH="$GITHUB_WORKSPACE/install" \
-DCMAKE_C_COMPILER:STRING=${{matrix.cc}} \
-DCMAKE_CXX_COMPILER:STRING=${{matrix.cxx}} \
-DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
run: cmake --build build --config $BUILD_TYPE --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
@ -67,6 +85,9 @@ jobs:
build-macos:
name: Build macOS (AppleClang universal)
runs-on: macos-10.15
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.192
steps:
- uses: actions/checkout@v2
with:
@ -76,36 +97,70 @@ jobs:
- name: Install dependencies
run: |
brew update
brew install ninja graphicsmagick imagemagick
brew install ninja graphicsmagick imagemagick ccache
yarn global add create-dmg
# universal qt5 from macports
curl -LSfs https://axiodl.com/files/qt5-5.15.2.mkpkg -o /tmp/qt5-5.15.2.mkpkg
sudo installer -pkg /tmp/qt5-5.15.2.mkpkg -target /
curl -LSfs https://axiodl.com/files/qt5-$Qt_VERSION.mkpkg -o /tmp/qt5-$Qt_VERSION.mkpkg
sudo installer -pkg /tmp/qt5-$Qt_VERSION.mkpkg -target /
- name: Install Intel IPP
run: |
NAME="m_ipp_oneapi_p_${IPP_VERSION}_offline"
curl -LSfs https://registrationcenter-download.intel.com/akdlm/irc_nas/17606/$NAME.dmg -o /tmp/$NAME.dmg
sudo hdiutil attach /tmp/$NAME.dmg -quiet
sudo /Volumes/$NAME/bootstrapper.app/Contents/MacOS/install.sh -c --action install --eula accept
sudo hdiutil detach /Volumes/$NAME -quiet
rm /tmp/$NAME.dmg
- name: Configure ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos-10.15-appleclang
max-size: 1G
- name: Configure CMake
run: |
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
-DQt5Widgets_DIR=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DPNG_DIR=/opt/local/lib
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
-DCMAKE_INSTALL_PREFIX:PATH="$GITHUB_WORKSPACE/install" \
-DQt5Widgets_DIR:PATH=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \
-DCMAKE_OSX_ARCHITECTURES:STRING="arm64;x86_64" \
-DPNG_DIR:PATH=/opt/local/lib
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
run: cmake --build build --config $BUILD_TYPE --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-x86_64
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-universal
path: install
build-windows-msvc:
name: Build Windows (MSVC x86_64)
if: 'false' # disabled due to memory constraints
build-windows:
name: Build Windows (${{matrix.name}} x86_64)
runs-on: windows-2019
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
BUILDCACHE_VERSION: v0.26.1
# C: has ~90GB available space at the moment
BUILDCACHE_DIR: C:\buildcache
BUILD_DIR: C:\build
INSTALL_DIR: C:\install
strategy:
fail-fast: false
matrix:
include:
# disabled due to memory constraints
# - name: MSVC
# oname: msvc
# cc: cl
# ld: link
- name: Clang
oname: clang
cc: clang-cl
ld: lld-link
steps:
- uses: actions/checkout@v2
with:
@ -120,77 +175,64 @@ jobs:
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename"
- name: Install dependencies
run: choco install ninja vulkan-sdk
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Create build directory
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
run: |
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE\install" `
-DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64
path: install
build-windows-clang:
name: Build Windows (Clang x86_64)
runs-on: windows-2019
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install vcpkg Qt
- name: Install Intel IPP
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "vcpkg-qt-$env:Qt_VERSION.7z"
$Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename"
(New-Object Net.WebClient).DownloadFile("https://registrationcenter-download.intel.com/akdlm/irc_nas/17739/$Filename", "$TempDir\$Filename")
Start-Process "$TempDir\$Filename" -ArgumentList "--x --s --f $TempDir\ipp" -Wait
Start-Process "$TempDir\ipp\bootstrapper.exe" -ArgumentList "--eula accept -c --action install" -Wait
- name: Install dependencies
run: choco install ninja vulkan-sdk
run: |
choco install ninja vulkan-sdk
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://github.com/mbitsnbites/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip")
Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir"
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "BUILDCACHE_ACCURACY=STRICT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "BUILDCACHE_MAX_CACHE_SIZE=1073741824" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# check available disk space
Get-PSDrive
- name: Restore buildcache
uses: actions/cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-windows-2019-${{matrix.oname}}
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: |
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE/install" `
-DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded `
-DCMAKE_C_COMPILER=clang-cl `
-DCMAKE_CXX_COMPILER=clang-cl `
-DCMAKE_LINKER=lld-link
buildcache -z
cmake -B "$env:BUILD_DIR" . -GNinja -DCMAKE_BUILD_TYPE:STRING=$env:BUILD_TYPE `
-DCMAKE_INSTALL_PREFIX:PATH="$env:INSTALL_DIR" `
-DCMAKE_TOOLCHAIN_FILE:PATH="$env:RUNNER_WORKSPACE\vcpkg-qt-$env:Qt_VERSION\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static `
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded `
-DCMAKE_C_COMPILER:STRING=${{matrix.cc}} `
-DCMAKE_CXX_COMPILER:STRING=${{matrix.cc}} `
-DCMAKE_LINKER:STRING=${{matrix.ld}} `
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache `
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache `
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MD /Z7 /O2 /Ob1 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="/MD /Z7 /O2 /Ob1 /DNDEBUG"
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
run: cmake --build "$env:BUILD_DIR" --config $env:BUILD_TYPE --target install
- name: Print buildcache stats
run: buildcache -s
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64
path: install
name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.oname}}-x86_64
path: ${{env.INSTALL_DIR}}

View File

@ -1,10 +1,16 @@
if (APPLE)
# only consider static libs
find_library(PNG_LIB NAMES libpng.a PATHS ${PNG_DIR} NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH)
if (PNG_LIB)
set(PNG_LIBRARIES ${PNG_LIB} ${ZLIB_LIBRARIES} CACHE PATH "PNG libraries" FORCE)
find_path(PNG_INCLUDE_DIR png.h PATHS "${PNG_LIB}/../../include" NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH)
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE)
message(STATUS "Using libpng at ${PNG_LIB}, include: ${PNG_INCLUDE_DIR}")
endif()
elseif (NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone
find_library(PNG_LIB NAMES png libpng PATHS ${PNG_DIR})
find_package(PNG REQUIRED)
endif ()
if (NOT PNG_LIB)
if (NOT PNG_LIBRARIES)
message(STATUS "Using HECL's built-in libpng")
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm(64)?" OR (APPLE AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES))
list(APPEND INTRINSICS
@ -50,9 +56,4 @@ if (NOT PNG_LIB)
target_include_directories(png PUBLIC ${ZLIB_INCLUDE_DIR})
set(PNG_LIBRARIES png CACHE PATH "PNG libraries" FORCE)
set(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "PNG include path" FORCE)
else ()
set(PNG_LIBRARIES ${PNG_LIB} ${ZLIB_LIBRARIES} CACHE PATH "PNG libraries" FORCE)
find_path(PNG_INCLUDE_DIR png.h PATHS "${PNG_LIB}/../../include" NO_DEFAULT_PATHS NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_SYSTEM_PATH)
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "PNG include path" FORCE)
message(STATUS "Using libpng at ${PNG_LIB}, include: ${PNG_INCLUDE_DIR}")
endif ()