Browse Source

Refactor build and CI configurations

Reword vcpkg caching comment
Make comment about wxwidgets Linux/macOS workaround more clear
Give each step of `cmake_build.yml` workflow a unique ID
Change cache lookups to use step's id instead of step's name
Add glob protection to runner OS detection in CI
Set new default CI build type of MinSizeRel
Ensure consistent formatting across `CMakeLists.txt` files
Change mimetypes generated on Linux to use tenacity-project mimetype
Add more explanatory comments to both `CMakeLists.txt`
Replace improper build architecture debug messages

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
pull/545/head
Emily Mabrey 11 months ago
parent
commit
c3db577e93
No known key found for this signature in database GPG Key ID: 6F4EF47256A1B7DC
  1. 293
      .github/workflows/cmake_build.yml
  2. 1065
      CMakeLists.txt
  3. 2579
      src/CMakeLists.txt

293
.github/workflows/cmake_build.yml

@ -18,70 +18,94 @@ jobs:
strategy:
fail-fast: false
matrix:
# Matrix id format: {os}-{osname}-{osversion}-{arch}-{triplet}-{generator(_platform)}
# Replace - with _
# Remove .
config:
- name: Ubuntu_20.04
- name: Linux - Ubuntu 20.04 (x86_64) - Ninja
id: linux-ubuntu-2004-x86_64-x64_linux-ninja
os: ubuntu-20.04
arch: x86_64 # as reported by `arch` or `uname -m`
compiler_cache: ccache
compiler_cache_path: ~/.ccache
vcpkg_binary_cache: ~/.cache/vcpkg
arch: x86_64
vcpkg_triplet: x64-linux
wxwidgets_git_url: https://github.com/wxWidgets/wxWidgets.git
wxwidgets_git_ref: v3.1.5
WX_CONFIG: /home/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config
- name: macOS_Intel
os: macos-latest
arch: Intel # as reported by Apple menu > About This Mac
compiler_cache: ccache
compiler_cache_path: ~/Library/Caches/ccache
vcpkg_binary_cache: ~/.cache/vcpkg
CMAKE_GENERATOR: Ninja
- name: macOS - Big Sur 11 (Intel) - Ninja
id: macos-bigsur-1100-intel-x64_osx_1012min-ninja
os: macos-11
arch: Intel
vcpkg_triplet: x64-osx-10.12min
wxwidgets_git_url: https://github.com/wxWidgets/wxWidgets.git
wxwidgets_git_ref: v3.1.5
WX_CONFIG: /Users/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config
CMAKE_GENERATOR: Ninja
- name: Windows_32bit
os: windows-latest
- name: macOS - Catalina 10.15 (Intel) - Ninja
id: macos-catalina-1015-intel-x64_osx_1012min-ninja
os: macos-10.15
arch: Intel
vcpkg_triplet: x64-osx-10.12min
CMAKE_GENERATOR: Ninja
- name: Windows - Server 2019 (amd64) - Visual Studio 2019
id: windows-server-2019-amd64-x64_windows-vs2019_x64
os: windows-2019
arch: amd64
vcpkg_triplet: x64-windows
CMAKE_GENERATOR: Visual Studio 16 2019
CMAKE_GENERATOR_PLATFORM: x64
- name: Windows - Server 2019 (win32) - Visual Studio 2019
id: windows-server-2019-x86-x86_windows-vs2019_win32
os: windows-2019
arch: x86
# required so CMake uses MSVC rather than MinGW
cc: cl
cxx: cl
compiler_cache: sccache
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache
vcpkg_binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg
vcpkg_triplet: x86-windows
exe_suffix: .exe
CMAKE_GENERATOR: Visual Studio 16 2019
CMAKE_GENERATOR_PLATFORM: win32
- name: Windows_64bit
os: windows-latest
- name: Windows - Server 2019 (amd64) - Ninja
id: windows-server-2019-amd64-x64_windows-ninja
os: windows-2019
arch: amd64
# required so CMake uses MSVC rather than MinGW
cc: cl
cxx: cl
compiler_cache: sccache
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache
vcpkg_binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg
vcpkg_triplet: x64-windows
exe_suffix: .exe
CMAKE_GENERATOR: Ninja
- name: Windows - Server 2019 (win32) - Ninja
id: windows-server-2019-x86-x86_windows-ninja
os: windows-2019
arch: x86
vcpkg_triplet: x86-windows
CMAKE_GENERATOR: Ninja
env:
CMAKE_BUILD_TYPE: RelWithDebInfo
CMAKE_C_COMPILER_LAUNCHER: ${{ matrix.config.os.compiler_cache }}
CMAKE_CXX_COMPILER_LAUNCHER: ${{ matrix.config.os.compiler_cache }}
AUDACITY_ARCH_LABEL: ${{ matrix.config.arch }}
MACOSX_DEPLOYMENT_TARGET: 10.12
# CMake settings
CMAKE_BUILD_TYPE: MinSizeRel
CMAKE_GENERATOR: ${{matrix.config.CMAKE_GENERATOR}}
CMAKE_GENERATOR_PLATFORM: ${{matrix.config.CMAKE_GENERATOR_PLATFORM}}
# vcpkg settings
VCPKG_DISABLE_METRICS: true
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }}
VCPKG_BINARY_SOURCES: "clear;default,readwrite;nuget,https://tenacityteam.jfrog.io/artifactory/api/nuget/tenacity-nuget,readwrite"
# Artifactory cache settings
JFROG_ARTIFACTORY_NUGET_USER: ${{secrets.JFROG_ARTIFACTORY_NUGET_USER}}
JFROG_ARTIFACTORY_NUGET_PASS: ${{secrets.JFROG_ARTIFACTORY_NUGET_PASS}}
JFROG_ARTIFACTORY_NUGET_TOKEN: ${{secrets.JFROG_ARTIFACTORY_NUGET_TOKEN}}
# Apple codesigning
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_NOTARIZATION_USER_NAME: ${{ secrets.APPLE_NOTARIZATION_USER_NAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
# Windows codesigning
# This variables will be used by all the steps
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
AUDACITY_ARCH_LABEL: ${{ matrix.config.arch }}
# WxWidgets info for Linux and macOS builds
WX_GIT_URL: https://github.com/wxWidgets/wxWidgets.git
WX_GIT_REF: v3.1.5
steps:
@ -90,22 +114,63 @@ jobs:
with:
submodules: true
- name: Get Git commit of vcpkg submodule
run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> ${GITHUB_ENV}
- name: Setup platform specific environmental variables
run: |
if [[ "${{runner.os}}" == "Windows" ]]; then
echo "Using Windows specific env vars"
echo COMPILER_CACHE_PATH=C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache >> ${GITHUB_ENV}
echo COMPILER_CACHE=sccache >> ${GITHUB_ENV}
echo EXE_SUFFIX=.exe >> ${GITHUB_ENV}
echo VCPKG_CACHE_PATH=C:\Users\runneradmin\AppData\Local\vcpkg >> ${GITHUB_ENV}
echo CMAKE_C_COMPILER_LAUNCHER=sccache >> ${GITHUB_ENV}
echo CMAKE_CXX_COMPILER_LAUNCHER=sccache >> ${GITHUB_ENV}
if [[ "${{ env.CMAKE_GENERATOR }}" == "Ninja" ]]; then
echo CC=cl >> ${GITHUB_ENV}
echo CXX=cl >> ${GITHUB_ENV}
fi
else
echo "Using non-Windows env vars"
echo COMPILER_CACHE_PATH= ~/Library/Caches/ccache >> ${GITHUB_ENV}
echo COMPILER_CACHE=ccache >> ${GITHUB_ENV}
echo EXE_SUFFIX= >> ${GITHUB_ENV}
echo VCPKG_CACHE_PATH=~/.cache/vcpkg >> ${GITHUB_ENV}
echo CMAKE_C_COMPILER_LAUNCHER=ccache >> ${GITHUB_ENV}
echo CMAKE_CXX_COMPILER_LAUNCHER=ccache >> ${GITHUB_ENV}
if [[ "${{runner.os}}" == "Linux" ]]; then
echo WX_INSTALL_DIR=/home/runner/work/tenacity/tenacity/wxwidgets-install >> ${GITHUB_ENV}
echo WX_CONFIG=/home/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config >> ${GITHUB_ENV}
else
echo WX_INSTALL_DIR=/Users/runner/work/tenacity/tenacity/wxwidgets-install >> ${GITHUB_ENV}
echo WX_CONFIG=/Users/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config >> ${GITHUB_ENV}
fi
fi
- name: "[macOS] Install Apple codesigning certificates"
uses: apple-actions/import-codesign-certs@v1
if: startswith( matrix.config.os, 'macos' ) && github.repository_owner == 'tenacityteam' && github.event_name == 'create' && github.event.ref_type == 'tag'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v3
with:
arch: ${{ matrix.config.arch }}
- name: Install Nuget
uses: nuget/setup-nuget@v1
with:
# Nuget versions needs to be the same version that vcpkg expects
# So update them in parallel
nuget-version: 5.10.0
- name: Authenticate CI to Artifactory
- name: "[On Push] Authenticate CI to Artifactory"
if: github.event_name == 'push' && github.repository_owner == 'tenacityteam'
run: |
nuget sources Add -Name Artifactory -Source https://tenacityteam.jfrog.io/artifactory/api/nuget/tenacity-nuget -username ${JFROG_ARTIFACTORY_NUGET_USER} -password ${JFROG_ARTIFACTORY_NUGET_PASS} -ForceEnglishOutput -NonInteractive
nuget setapikey ${JFROG_ARTIFACTORY_NUGET_USER}:${JFROG_ARTIFACTORY_NUGET_TOKEN} -Source Artifactory -ForceEnglishOutput -NonInteractive
env:
JFROG_ARTIFACTORY_NUGET_USER: ${{secrets.JFROG_ARTIFACTORY_NUGET_USER}}
JFROG_ARTIFACTORY_NUGET_PASS: ${{secrets.JFROG_ARTIFACTORY_NUGET_PASS}}
JFROG_ARTIFACTORY_NUGET_TOKEN: ${{secrets.JFROG_ARTIFACTORY_NUGET_TOKEN}}
- name: "[Linux] Install dependencies"
if: runner.os == 'Linux'
@ -114,9 +179,9 @@ jobs:
sudo apt-get install -y --no-install-recommends
file
g++
ninja-build
nasm
git
ninja-build
nasm
git
wget
bash
scdoc
@ -127,7 +192,6 @@ jobs:
libgtk-3-dev
libsuil-dev
gettext
- name: "[MacOS] Install dependencies"
if: runner.os == 'macOS'
run: >-
@ -136,7 +200,6 @@ jobs:
ccache
ninja
nasm
- name: "[Windows] Install dependencies"
if: runner.os == 'Windows'
shell: pwsh
@ -148,126 +211,90 @@ jobs:
iwr -useb get.scoop.sh | iex
scoop install sccache
- name: Install Apple codesigning certificates
uses: apple-actions/import-codesign-certs@v1
if: startswith( matrix.config.os, 'macos' ) && github.repository_owner == 'tenacityteam' && github.event_name == 'create' && github.event.ref_type == 'tag'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# required for CMake to find Ninja
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v3
with:
arch: ${{ matrix.config.arch }}
- name: Get Git commit of vcpkg submodule
run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> ${GITHUB_ENV}
# Cache the vcpkg cache and the vcpkg executable to avoid bootstrapping each time
- name: Setup vcpkg cache
uses: actions/cache@v2
with:
# cache the vcpkg executable to avoid having to bootstrap vcpkg every time
path: |
${{ github.workspace }}/vcpkg/vcpkg${{ matrix.config.exe_suffix }}
${{ matrix.config.vcpkg_binary_cache }}
key: ${{ matrix.config.name }}-${{ hashFiles('**/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-${{ github.run_number }}
${{ github.workspace }}/vcpkg/vcpkg${{ env.EXE_SUFFIX }}
${{ env.VCPKG_CACHE_PATH }}
key: ${{ matrix.config.id }}-${{ hashFiles('**/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.name }}-${{ hashFiles(' **/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-
${{ matrix.config.name }}-${{ hashFiles(' **/vcpkg.json') }}-
${{ matrix.config.name }}-
# FIXME: hack around bad SSL certificate, needed to build ffmpeg
# https://github.com/microsoft/vcpkg/issues/19121
- name: "[Windows] Install yasm"
if: runner.os == 'Windows'
run: |
mkdir -p "vcpkg/downloads/tools/yasm/1.3.0.6"
curl -k -o "vcpkg/downloads/tools/yasm/1.3.0.6/yasm.exe" \
"http://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe"
${{ matrix.config.id }}-${{ hashFiles(' **/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-
${{ matrix.config.id }}-${{ hashFiles(' **/vcpkg.json') }}-
${{ matrix.config.id }}-
- name: "Set up wxwidgets cache"
- name: "[Linux/macOS] Set up wxWidgets cache"
uses: actions/cache@v2
id: wxwidgets-cache
if: runner.os != 'Windows'
with:
path: ${{ github.workspace }}/wxwidgets-install
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ matrix.config.wxwidgets_git_url }}-${{ matrix.config.wxwidgets_git_ref }}
path: ${{ env.WX_INSTALL_DIR }}
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ env.WX_GIT_URL }}-${{ env.WX_GIT_REF }}
# FIXME: use wxWidgets from vcpkg for all OSes when bugs are fixed for Linux and macOS
# https://github.com/microsoft/vcpkg/pull/17111
- name: Build and install wxWidgets
- name: "[Linux/macOS] Build and install wxWidgets"
if: steps.wxwidgets-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
run: |
# wxWidgets' build system does not find dependencies from vcpkg, so use its vendored Git submodules
git clone --recurse-submodules ${{ matrix.config.wxwidgets_git_url }}
git clone --recurse-submodules ${{ env.WX_GIT_URL }}
cd wxWidgets
git checkout ${{ matrix.config.wxwidgets_git_ref }}
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/wxwidgets-install \
-S . -B cmake_build
git checkout ${{ env.WX_GIT_REF }}
cmake -S . -B cmake_build -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -D CMAKE_INSTALL_PREFIX=${{ env.WX_INSTALL_DIR }}
cmake --build cmake_build
cmake --install cmake_build
- name: "Set up compiler cache"
- name: Set up compiler cache
uses: actions/cache@v2
with:
path: ${{ matrix.config.compiler_cache_path }}
path: ${{ env.COMPILER_CACHE_PATH }}
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.head_ref }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.head_ref }}-
${{ matrix.config.os }}-${{ matrix.config.arch }}-
- name: Configure
run: >-
cmake
-G Ninja
-D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
-D VCPKG=ON
-S .
-B build
# FIXME: hack around bad SSL certificate, needed to build ffmpeg
# https://github.com/microsoft/vcpkg/issues/19121
- name: "[Windows] Install yasm"
if: runner.os == 'Windows'
run: |
mkdir -p "${YASM_OUTPUT_DIR}"
curl -k -o "${YASM_OUTPUT_DIR}/yasm.exe" "http://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe"
env:
# Apple code signing
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_NOTARIZATION_USER_NAME: ${{ secrets.APPLE_NOTARIZATION_USER_NAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
# hack to get CMake to find wxWidgets until vcpkg wxWidgets port is fixed
# https://github.com/microsoft/vcpkg/pull/17111
WX_CONFIG: ${{ matrix.config.WX_CONFIG }}
YASM_OUTPUT_DIR: vcpkg/downloads/tools/yasm/1.3.0.6
- name: Configure
run: cmake -B build -D VCPKG=ON -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
- name: Build
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: "Print compiler cache stats"
run: ${{ matrix.config.compiler_cache }} -s
- name: Print compiler cache stats
run: ${{ env.COMPILER_CACHE}} -s
- name: Install
run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: "[Windows] Package"
if: runner.os == 'Windows'
run: cmake --build build --target innosetup --config ${{ env.CMAKE_BUILD_TYPE }}
- name: "[Ubuntu/macOS] Package"
if: runner.os != 'Windows'
working-directory: build
run: >-
cpack
-C ${{ env.CMAKE_BUILD_TYPE }}
-D CPACK_COMMAND_HDIUTIL=${{ github.workspace }}/scripts/ci/macos/repeat_hdiutil.sh
--verbose
&& rm -r package/_CPack_Packages
- name: Package
run: |
if [[ "${{runner.os}}" == "Windows" ]]; then
cmake --build build --target innosetup --config ${{ env.CMAKE_BUILD_TYPE }}
else
cd build
cpack -C ${{ env.CMAKE_BUILD_TYPE }} -D CPACK_COMMAND_HDIUTIL=${{ env.CPACK_COMMAND_HDIUTIL }} --verbose
rm -r package/_CPack_Packages
fi
env:
# Required for linuxdeploy to find wxWidgets libraries installed without a package manager
WXWIDGETS_LD_LIBRARY_PATH: ${{ github.workspace }}/wxwidgets-install/lib
# Workaround for CPack hdiutil/ finder service race condition bug
CPACK_COMMAND_HDIUTIL: ${{ github.workspace }}/scripts/ci/macos/repeat_hdiutil.sh
# Required on Linux to find wxWidgets libraries installed without a package manager
WXWIDGETS_LD_LIBRARY_PATH: ${{ env.WX_INSTALL_DIR }}/lib
- name: Upload package artifact
uses: actions/upload-artifact@v2
with:
name: Tenacity_${{ matrix.config.name }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }}
name: Tenacity_${{ matrix.config.id }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }}
path: build/package/*
if-no-files-found: error

1065
CMakeLists.txt
File diff suppressed because it is too large
View File

2579
src/CMakeLists.txt
File diff suppressed because it is too large
View File

Loading…
Cancel
Save