From 5d651319662a5feefe150f3c0ab23d0d7b3e9c8a Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 12 Jun 2021 00:13:57 -0400 Subject: [PATCH] Improvements to install target --- .github/workflows/build.yml | 11 +++++++---- .github/workflows/release.yml | 37 +++++++++-------------------------- CMakeLists.txt | 24 ++++++++++++++++++++--- Runtime/rstl.hpp | 12 ++++++------ ci/build-appimage.sh | 17 +++++++++++----- ci/build-dmg.sh | 9 +++++---- ci/split-debug-linux.sh | 7 ------- ci/upload-debug-macos.sh | 8 +------- 8 files changed, 61 insertions(+), 64 deletions(-) delete mode 100755 ci/split-debug-linux.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75c045b06..377a9514e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: Build on: push: + branches-ignore: + - main paths-ignore: - '*.json' - '*.md' @@ -85,7 +87,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.cc}}-x86_64 + name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.preset}}-x86_64 path: build/install build-macos: @@ -167,8 +169,9 @@ jobs: fail-fast: false matrix: include: - - name: MSVC - preset: msvc + # Disabled due to memory constraints +# - name: MSVC +# preset: msvc - name: Clang preset: clang @@ -233,5 +236,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.oname}}-x86_64 + name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.preset}}-x86_64 path: ${{env.BUILD_DIR}}/install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fcf70f87..a233b10d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,9 +84,6 @@ jobs: - name: Print buildcache stats run: buildcache -s - - name: Split debug information - run: ci/split-debug-linux.sh - - name: Upload debug information if: ${{matrix.name == 'Clang'}} env: @@ -100,10 +97,10 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.cc}}-x86_64 + name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.preset}}-x86_64 path: | - Metaforce-*.AppImage - debug.tar.* + build/install/Metaforce-*.AppImage + build/install/debug.tar.* build-macos: name: Build macOS (AppleClang universal) @@ -187,10 +184,10 @@ jobs: - 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: | - Metaforce *.dmg - debug.tar.* + build/install/Metaforce *.dmg + build/install/debug.tar.* build-windows-msvc: name: Build Windows (MSVC x86_64) @@ -251,22 +248,14 @@ jobs: SENTRY_URL: ${{secrets.SENTRY_URL}} run: | & "$env:RUNNER_WORKSPACE\temp\sentry-cli.exe" upload-dif --org axiodl --project metaforce --include-sources ` - metaforce.exe metaforce.pdb hecl.exe hecl.pdb metaforce-gui.exe metaforce-gui.pdb visigen.exe visigen.pdb - - - name: Compress PDBs - working-directory: ${{github.workspace}}/build/install - run: 7z a -t7z debug.7z metaforce.pdb hecl.pdb metaforce-gui.pdb visigen.pdb + *.exe *.pdb - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64 path: | - build/install/metaforce.exe - build/install/metaforce-gui.exe - build/install/hecl.exe - build/install/visigen.exe - build/install/crashpad_handler.exe + build/install/*.exe build/install/debug.7z build-windows-clang: @@ -338,18 +327,10 @@ jobs: - name: Print buildcache stats run: buildcache -s - - name: Compress PDBs - working-directory: ${{github.workspace}}/build/install - run: 7z a -t7z debug.7z metaforce.pdb hecl.pdb metaforce-gui.pdb visigen.pdb - - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64 path: | - build/install/metaforce.exe - build/install/metaforce-gui.exe - build/install/hecl.exe - build/install/visigen.exe - build/install/crashpad_handler.exe + build/install/*.exe build/install/debug.7z diff --git a/CMakeLists.txt b/CMakeLists.txt index 28cc87270..beb0324be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -560,8 +560,8 @@ if (TARGET metaforce-gui) install(TARGETS metaforce-gui DESTINATION ${BIN_PREFIX}) list(APPEND DSYM_ONLY_TARGETS metaforce-gui) # we have to rename here, cmake is inflexible about bundle naming - install(CODE "execute_process(COMMAND rm -fr ${BIN_PREFIX}/Metaforce.app)") - install(CODE "execute_process(COMMAND mv ${BIN_PREFIX}/metaforce-gui.app ${BIN_PREFIX}/Metaforce.app)") + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND rm -fr Metaforce.app)") + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND mv metaforce-gui.app Metaforce.app)") set(BIN_PREFIX "${BIN_PREFIX}/Metaforce.app/Contents/MacOS") else() list(APPEND BINARY_TARGETS metaforce-gui) @@ -573,7 +573,25 @@ if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) if (WIN32) install(FILES $ DESTINATION ${BIN_PREFIX} OPTIONAL) elseif (APPLE) - install(CODE "execute_process(COMMAND dsymutil ${BIN_PREFIX}/${target})") + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND dsymutil ${target})") + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND strip -S ${target})") + elseif (UNIX) + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND objcopy --only-keep-debug ${target} ${target}.dbg)") + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND objcopy --strip-debug --add-gnu-debuglink=${target}.dbg ${target})") endif () endforeach () + set(DEBUG_FILES_LIST ${BINARY_TARGETS} ${DSYM_ONLY_TARGETS}) + if (WIN32) + list(TRANSFORM DEBUG_FILES_LIST APPEND ".pdb") + list(JOIN DEBUG_FILES_LIST " " DEBUG_FILES) + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND 7z a -t7z \"${CMAKE_INSTALL_PREFIX}/debug.7z\" ${DEBUG_FILES})") + elseif (APPLE) + list(TRANSFORM DEBUG_FILES_LIST APPEND ".dSYM") + list(JOIN DEBUG_FILES_LIST " " DEBUG_FILES) + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND tar acfv \"${CMAKE_INSTALL_PREFIX}/debug.tar.xz\" ${DEBUG_FILES})") + elseif (UNIX) + list(TRANSFORM DEBUG_FILES_LIST APPEND ".dbg") + list(JOIN DEBUG_FILES_LIST " " DEBUG_FILES) + install(CODE "execute_process(WORKING_DIRECTORY \"${BIN_PREFIX}\" COMMAND tar -I \"xz -9 -T0\" -cvf \"${CMAKE_INSTALL_PREFIX}/debug.tar.xz\" ${DEBUG_FILES})") + endif () endif () diff --git a/Runtime/rstl.hpp b/Runtime/rstl.hpp index 4235c0a6c..2c2af590a 100644 --- a/Runtime/rstl.hpp +++ b/Runtime/rstl.hpp @@ -447,12 +447,12 @@ public: [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] const_iterator cend() const noexcept { return end(); } - [[nodiscard]] auto rbegin() const noexcept { return std::make_reverse_iterator(end()); } - [[nodiscard]] auto rend() const noexcept { return std::make_reverse_iterator(begin()); } - [[nodiscard]] auto rbegin() noexcept { return std::make_reverse_iterator(end()); } - [[nodiscard]] auto rend() noexcept { return std::make_reverse_iterator(begin()); } - [[nodiscard]] auto crbegin() const noexcept { return rbegin(); } - [[nodiscard]] auto crend() const noexcept { return rend(); } + [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return std::make_reverse_iterator(end()); } + [[nodiscard]] const_reverse_iterator rend() const noexcept { return std::make_reverse_iterator(begin()); } + [[nodiscard]] reverse_iterator rbegin() noexcept { return std::make_reverse_iterator(end()); } + [[nodiscard]] reverse_iterator rend() noexcept { return std::make_reverse_iterator(begin()); } + [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); } + [[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); } [[nodiscard]] T& operator[](size_t idx) { #ifndef NDEBUG diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index bfad864f5..05d3a7066 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -1,13 +1,20 @@ #!/bin/bash -ex +shopt -s extglob # Get linuxdeploy +cd "$RUNNER_WORKSPACE" curl -OL https://github.com/encounter/linuxdeploy/releases/download/continuous/linuxdeploy-$(uname -m).AppImage curl -OL https://github.com/encounter/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-$(uname -m).AppImage chmod +x linuxdeploy-$(uname -m).AppImage linuxdeploy-plugin-qt-$(uname -m).AppImage # Build AppImage -mkdir -p appdir/usr/{bin,share/{applications,icons/hicolor}} -cp build/install/{hecl,metaforce-gui,metaforce,visigen} appdir/usr/bin -cp -r metaforce-gui/platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} appdir/usr/share/icons/hicolor -cp metaforce-gui/platforms/freedesktop/metaforce.desktop appdir/usr/share/applications -VERSION="$METAFORCE_VERSION" NO_STRIP=1 ./linuxdeploy-$(uname -m).AppImage --appdir appdir --plugin qt --output appimage +cd "$GITHUB_WORKSPACE" +mkdir -p build/appdir/usr/{bin,share/{applications,icons/hicolor}} +cp build/install/!(*.*) build/appdir/usr/bin +cp -r metaforce-gui/platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} build/appdir/usr/share/icons/hicolor +cp metaforce-gui/platforms/freedesktop/metaforce.desktop build/appdir/usr/share/applications + +cd build/install +VERSION="$METAFORCE_VERSION" NO_STRIP=1 "$RUNNER_WORKSPACE"/linuxdeploy-$(uname -m).AppImage \ + --appdir "$GITHUB_WORKSPACE"/build/appdir \ + --plugin qt --output appimage diff --git a/ci/build-dmg.sh b/ci/build-dmg.sh index 8090e2c77..b74175f1d 100755 --- a/ci/build-dmg.sh +++ b/ci/build-dmg.sh @@ -1,11 +1,12 @@ #!/bin/bash -ex cd build/install -mv metaforce-gui.app Metaforce.app +# remove debug files before package +rm -r Metaforce.app/Contents/MacOS/*.dSYM # order is important for i in visigen hecl metaforce crashpad_handler; do codesign --timestamp --options runtime -s "$CODESIGN_IDENT" Metaforce.app/Contents/MacOS/$i done macdeployqt Metaforce.app -sign-for-notarization="$CODESIGN_IDENT" -no-strip -create-dmg Metaforce.app --identity="$CODESIGN_IDENT" "$GITHUB_WORKSPACE" -xcrun altool -t osx -f "$GITHUB_WORKSPACE"/*.dmg --primary-bundle-id com.axiodl.Metaforce --notarize-app \ - -u "$ASC_USERNAME" -p "$ASC_PASSWORD" --team-id "$ASC_TEAM_ID" +create-dmg Metaforce.app --identity="$CODESIGN_IDENT" . +xcrun altool -t osx -f --primary-bundle-id com.axiodl.Metaforce --notarize-app \ + -u "$ASC_USERNAME" -p "$ASC_PASSWORD" --team-id "$ASC_TEAM_ID" -- *.dmg diff --git a/ci/split-debug-linux.sh b/ci/split-debug-linux.sh deleted file mode 100755 index 96faa8099..000000000 --- a/ci/split-debug-linux.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -ex -cd build/install -for f in hecl metaforce-gui metaforce visigen; do - objcopy --only-keep-debug $f $f.dbg - objcopy --strip-debug --add-gnu-debuglink=$f.dbg $f -done -tar acfv "$GITHUB_WORKSPACE"/debug.tar.xz -- *.dbg diff --git a/ci/upload-debug-macos.sh b/ci/upload-debug-macos.sh index 28d952256..507ba610a 100755 --- a/ci/upload-debug-macos.sh +++ b/ci/upload-debug-macos.sh @@ -1,9 +1,3 @@ #!/bin/bash -ex -cd build/install/metaforce-gui.app/Contents/MacOS -for f in hecl metaforce-gui metaforce visigen; do - dsymutil $f - strip -S $f -done +cd build/install/Metaforce.app/Contents/MacOS sentry-cli upload-dif --org axiodl --project metaforce {hecl,metaforce-gui,metaforce,visigen}{,.dSYM} --include-sources -tar acfv "$GITHUB_WORKSPACE"/debug.tar.xz -- *.dSYM -rm -r -- *.dSYM