From 5815fa6577477d2b35520a65abe358dc9ec68598 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 11 Jun 2021 21:19:33 -0400 Subject: [PATCH] Updates based on universal branch --- .github/workflows/build.yml | 105 ++++++++--------- .github/workflows/release.yml | 30 ++--- .gitignore | 17 +-- CMakeLists.txt | 7 +- CMakePresets.json | 211 +++++++++++++++++++++++++--------- CMakeSettings.json | 207 --------------------------------- README.md | 6 +- ci/build-appimage.sh | 2 +- ci/build-dmg.sh | 4 +- ci/split-debug-linux.sh | 4 +- ci/upload-debug-linux.sh | 2 +- ci/upload-debug-macos.sh | 2 +- extern/athena | 2 +- hecl/ApplicationTools.cmake | 7 ++ hecl/CMakeLists.txt | 7 -- 15 files changed, 254 insertions(+), 359 deletions(-) delete mode 100644 CMakeSettings.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73ed81057..d2d3b4dcd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,10 +8,19 @@ on: - '*LICENSE' pull_request: +env: + BUILDCACHE_VERSION: v0.27.0 + BUILDCACHE_ACCURACY: STRICT + BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB + jobs: build-linux: name: Build Linux (${{matrix.name}} x86_64) runs-on: ubuntu-20.04 + + env: + BUILDCACHE_DIR: ${{github.workspace}}/.buildcache + strategy: fail-fast: false matrix: @@ -33,14 +42,17 @@ jobs: 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 llvm-dev libclang-dev clang lld libcurl4-openssl-dev \ + sudo apt-get -y install curl git cmake ninja-build clang lld libcurl4-openssl-dev intel-oneapi-ipp-devel \ 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 qt5-default \ - intel-oneapi-ipp-devel ccache + libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 qt5-default yarn global add @sentry/cli echo "$(yarn global bin)" >> $GITHUB_PATH + # setup buildcache + curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE" + echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH + # free up disk space # https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173 echo Before @@ -53,26 +65,20 @@ jobs: echo After df -h . - - name: Configure ccache - uses: hendrikmuhs/ccache-action@v1 + - name: Restore buildcache + uses: actions/cache@v2 with: - key: ubuntu-20.04-${{matrix.cc}} - max-size: 1G - -# - name: Configure CMake -# run: | -# 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 + path: ${{env.BUILDCACHE_DIR}} + key: buildcache-ubuntu-20.04-${{matrix.preset}} - name: Configure CMake - run: cmake --preset linux-ci-${{matrix.preset}} + run: cmake --preset x-linux-ci-${{matrix.preset}} - name: Build - run: cmake --build --preset linux-ci-${{matrix.preset}} + run: cmake --build --preset x-linux-ci-${{matrix.preset}} + + - name: Print buildcache stats + run: buildcache -s - name: Upload artifacts uses: actions/upload-artifact@v2 @@ -83,9 +89,12 @@ 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 + BUILDCACHE_DIR: ${{env.RUNNER_WORKSPACE}}/.buildcache + steps: - uses: actions/checkout@v2 with: @@ -96,12 +105,18 @@ jobs: run: | brew update brew upgrade --formula - brew install ninja graphicsmagick imagemagick ccache + brew install ninja graphicsmagick imagemagick yarn global add create-dmg + # universal qt5 from macports curl -LSfs https://axiodl.com/files/qt-$Qt_VERSION.mpkg -o /tmp/qt-$Qt_VERSION.mpkg sudo installer -pkg /tmp/qt-$Qt_VERSION.mpkg -target / + # setup buildcache + curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip + unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE" + echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH + - name: Install Intel IPP if: 'false' # not supported for universal build run: | @@ -112,24 +127,20 @@ jobs: sudo hdiutil detach /Volumes/$NAME -quiet rm /tmp/$NAME.dmg - - name: Configure ccache - uses: hendrikmuhs/ccache-action@v1 + - name: Restore buildcache + uses: actions/cache@v2 with: - key: macos-10.15-appleclang - max-size: 1G + path: ${{env.BUILDCACHE_DIR}} + key: buildcache-macos-10.15-universal - name: Configure CMake - run: | - 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 + run: cmake --preset x-macos-ci - name: Build - run: cmake --build build --config $BUILD_TYPE --target install + run: cmake --build --preset x-macos-ci + + - name: Print buildcache stats + run: buildcache -s - name: Upload artifacts uses: actions/upload-artifact@v2 @@ -144,11 +155,9 @@ jobs: 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 @@ -168,7 +177,7 @@ jobs: - name: Install vcpkg Qt run: | $TempDir = "$env:RUNNER_WORKSPACE\temp" - $Filename = "vcpkg-qt-$env:Qt_VERSION.7z" + $Filename = "vcpkg-qt-$env:Qt_VERSION-full.7z" 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" @@ -192,8 +201,6 @@ jobs: (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 @@ -202,32 +209,16 @@ jobs: uses: actions/cache@v2 with: path: ${{env.BUILDCACHE_DIR}} - key: buildcache-windows-2019-${{matrix.oname}} + key: buildcache-windows-2019-${{matrix.preset}} - name: Enable Visual Studio environment uses: ilammy/msvc-dev-cmd@v1 -# - name: Configure CMake -# run: | -# 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: Configure CMake - run: cmake --preset windows-ci-${{matrix.preset}} + run: cmake --preset x-windows-ci-${{matrix.preset}} - name: Build - run: cmake --build --preset windows-ci-${{matrix.preset}} + run: cmake --build --preset x-windows-ci-${{matrix.preset}} - name: Print buildcache stats run: buildcache -s @@ -236,4 +227,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.oname}}-x86_64 - path: ${{env.INSTALL_DIR}} + path: ${{env.BUILD_DIR}}/install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12958b708..a1ec67634 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -232,7 +232,7 @@ jobs: run: cmake --build . --target metaforce metaforce-gui hecl visigen crashpad_handler - name: Upload debug information - working-directory: ${{github.workspace}}/build/Binaries + working-directory: ${{github.workspace}}/build/install env: SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}} SENTRY_URL: ${{secrets.SENTRY_URL}} @@ -241,7 +241,7 @@ jobs: 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/Binaries + working-directory: ${{github.workspace}}/build/install run: 7z a -t7z debug.7z metaforce.pdb hecl.pdb metaforce-gui.pdb visigen.pdb - name: Upload artifacts @@ -249,12 +249,12 @@ jobs: with: name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64 path: | - build/Binaries/metaforce.exe - build/Binaries/metaforce-gui.exe - build/Binaries/hecl.exe - build/Binaries/visigen.exe - build/Binaries/crashpad_handler.exe - build/Binaries/debug.7z + build/install/metaforce.exe + build/install/metaforce-gui.exe + build/install/hecl.exe + build/install/visigen.exe + build/install/crashpad_handler.exe + build/install/debug.7z build-windows-clang: name: Build Windows (Clang x86_64) @@ -323,7 +323,7 @@ jobs: run: cmake --build . --target metaforce metaforce-gui hecl visigen crashpad_handler - name: Compress PDBs - working-directory: ${{github.workspace}}/build/Binaries + working-directory: ${{github.workspace}}/build/install run: 7z a -t7z debug.7z metaforce.pdb hecl.pdb metaforce-gui.pdb visigen.pdb - name: Upload artifacts @@ -331,9 +331,9 @@ jobs: with: name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64 path: | - build/Binaries/metaforce.exe - build/Binaries/metaforce-gui.exe - build/Binaries/hecl.exe - build/Binaries/visigen.exe - build/Binaries/crashpad_handler.exe - build/Binaries/debug.7z + build/install/metaforce.exe + build/install/metaforce-gui.exe + build/install/hecl.exe + build/install/visigen.exe + build/install/crashpad_handler.exe + build/install/debug.7z diff --git a/.gitignore b/.gitignore index 1079b646c..2a5a91d23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,14 @@ -.directory -version.h -*.user -.DS_Store *.autosave -docs/* +*.user +.buildcache/ +.directory +.DS_Store .idea/ -Runtime/platforms/win/metaforce.rc .vs/ -out/ -cmake-build-*/ build/ +cmake-build-*/ CMakeUserPresets.json +docs/* +out/ +Runtime/platforms/win/metaforce.rc +version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 52b2dda06..28cc87270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -368,7 +368,12 @@ if (NOT WIN32) endif() option(BUILD_ATHENA "Build Athena libraries from source" ON) -option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" OFF) +if (WIN32 OR APPLE) + # Default to binary atdna on Windows & macOS + option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" OFF) +else () + option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" ON) +endif () if (NOT BUILD_ATDNA) set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest") diff --git a/CMakePresets.json b/CMakePresets.json index b4d111e61..d7ddb561b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,14 +10,16 @@ "name": "debug", "hidden": true, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDebug" } }, { "name": "relwithdebinfo", "hidden": true, "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo" + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded" } }, { @@ -25,6 +27,9 @@ "displayName": "Linux (default)", "generator": "Ninja", "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install" + }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ @@ -40,16 +45,16 @@ "name": "linux-default-debug", "displayName": "Linux (default) Debug", "inherits": [ - "linux-default", - "debug" + "debug", + "linux-default" ] }, { "name": "linux-default-relwithdebinfo", "displayName": "Linux (default) RelWithDebInfo", "inherits": [ - "linux-default", - "relwithdebinfo" + "relwithdebinfo", + "linux-default" ] }, { @@ -67,16 +72,16 @@ "name": "linux-clang-debug", "displayName": "Linux (Clang) Debug", "inherits": [ - "linux-clang", - "debug" + "debug", + "linux-clang" ] }, { "name": "linux-clang-relwithdebinfo", "displayName": "Linux (Clang) RelWithDebInfo", "inherits": [ - "linux-clang", - "relwithdebinfo" + "relwithdebinfo", + "linux-clang" ] }, { @@ -91,12 +96,11 @@ "cacheVariables": { "CMAKE_C_COMPILER": "cl", "CMAKE_CXX_COMPILER": "cl", - "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install", "CMAKE_TOOLCHAIN_FILE": { "type": "FILEPATH", "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" }, - "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded", "VCPKG_TARGET_TRIPLET": "x64-windows-static" }, "vendor": { @@ -111,16 +115,16 @@ "name": "windows-msvc-debug", "displayName": "Windows (MSVC) Debug", "inherits": [ - "windows-msvc", - "debug" + "debug", + "windows-msvc" ] }, { "name": "windows-msvc-relwithdebinfo", "displayName": "Windows (MSVC) RelWithDebInfo", "inherits": [ - "windows-msvc", - "relwithdebinfo" + "relwithdebinfo", + "windows-msvc" ] }, { @@ -144,70 +148,132 @@ "name": "windows-clang-debug", "displayName": "Windows (Clang) Debug", "inherits": [ - "windows-clang", - "debug" + "debug", + "windows-clang" ] }, { "name": "windows-clang-relwithdebinfo", "displayName": "Windows (Clang) RelWithDebInfo", "inherits": [ - "windows-clang", - "relwithdebinfo" + "relwithdebinfo", + "windows-clang" ] }, { - "name": "linux-ci", - "hidden": true, - "inherits": [ - "relwithdebinfo" - ], + "name": "macos-default", + "displayName": "macOS (default)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { - "Clang_DIR": { - "type": "FILEPATH", - "value": "/usr/lib/cmake/clang-11" + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "macOS" + ] } } }, { - "name": "linux-ci-gcc", + "name": "macos-default-debug", + "displayName": "macOS (default) Debug", "inherits": [ - "linux-default", - "linux-ci" + "debug", + "macos-default" ] }, { - "name": "linux-ci-clang", + "name": "macos-default-relwithdebinfo", + "displayName": "macOS (default) RelWithDebInfo", "inherits": [ - "linux-clang", - "linux-ci" + "relwithdebinfo", + "macos-default" ] }, { - "name": "windows-ci", + "name": "x-linux-ci", "hidden": true, "inherits": [ "relwithdebinfo" ], "cacheVariables": { - "LLVM_ROOT_DIR": "$env{RUNNER_WORKSPACE}/LLVM" + "CMAKE_C_COMPILER_LAUNCHER": "buildcache", + "CMAKE_CXX_COMPILER_LAUNCHER": "buildcache", + "Clang_DIR": { + "type": "FILEPATH", + "value": "/usr/lib/cmake/clang-11" + }, + "BUILD_ATDNA": { + "type": "BOOL", + "value": false + } + } + }, + { + "name": "x-linux-ci-gcc", + "inherits": [ + "x-linux-ci", + "linux-default" + ] + }, + { + "name": "x-linux-ci-clang", + "inherits": [ + "x-linux-ci", + "linux-clang" + ] + }, + { + "name": "x-macos-ci", + "inherits": [ + "macos-default-relwithdebinfo" + ], + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "buildcache", + "CMAKE_CXX_COMPILER_LAUNCHER": "buildcache", + "CMAKE_OSX_ARCHITECTURES": "arm64;x86_64", + "Qt5Widgets_DIR": { + "type": "FILEPATH", + "value": "/opt/local/libexec/qt5/lib/cmake/Qt5Widgets" + }, + "PNG_DIR": { + "type": "FILEPATH", + "value": "/opt/local/lib" + } + } + }, + { + "name": "x-windows-ci", + "hidden": true, + "inherits": [ + "relwithdebinfo" + ], + "binaryDir": "$env{BUILD_DIR}", + "cacheVariables": { + "CMAKE_C_COMPILER_LAUNCHER": "buildcache", + "CMAKE_CXX_COMPILER_LAUNCHER": "buildcache", + "CMAKE_C_FLAGS_RELWITHDEBINFO": "/MD /Z7 /O2 /Ob1 /DNDEBUG", + "CMAKE_CXX_FLAGS_RELWITHDEBINFO": "/MD /Z7 /O2 /Ob1 /DNDEBUG", + "CMAKE_INSTALL_PREFIX": "$env{BUILD_DIR}/install" }, "environment": { "VCPKG_ROOT": "$env{RUNNER_WORKSPACE}/vcpkg-qt-$env{Qt_VERSION}" } }, { - "name": "windows-ci-msvc", + "name": "x-windows-ci-msvc", "inherits": [ - "windows-msvc", - "windows-ci" + "x-windows-ci", + "windows-msvc" ] }, { - "name": "windows-ci-clang", + "name": "x-windows-ci-clang", "inherits": [ - "windows-clang", - "windows-ci" + "x-windows-ci", + "windows-clang" ] } ], @@ -236,6 +302,18 @@ "description": "Linux (Clang) release build with debug info", "displayName": "Linux (Clang) RelWithDebInfo" }, + { + "name": "macos-default-debug", + "configurePreset": "macos-default-debug", + "description": "macOS debug build", + "displayName": "macOS Debug" + }, + { + "name": "macos-default-relwithdebinfo", + "configurePreset": "macos-default-relwithdebinfo", + "description": "macOS release build with debug info", + "displayName": "macOS RelWithDebInfo" + }, { "name": "windows-msvc-debug", "configurePreset": "windows-msvc-debug", @@ -261,24 +339,49 @@ "displayName": "Windows (Clang) RelWithDebInfo" }, { - "name": "linux-ci-gcc", - "configurePreset": "linux-ci-gcc", - "targets": ["metaforce", "metaforce-gui", "hecl", "visigen"] + "name": "x-linux-ci-gcc", + "configurePreset": "x-linux-ci-gcc", + "description": "(Internal) Linux CI GCC", + "displayName": "(Internal) Linux CI GCC", + "targets": [ + "install" + ] }, { - "name": "linux-ci-clang", - "configurePreset": "linux-ci-clang", - "targets": ["metaforce", "metaforce-gui", "hecl", "visigen"] + "name": "x-linux-ci-clang", + "configurePreset": "x-linux-ci-clang", + "description": "(Internal) Linux CI Clang", + "displayName": "(Internal) Linux CI Clang", + "targets": [ + "install" + ] }, { - "name": "windows-ci-msvc", - "configurePreset": "windows-ci-msvc", - "targets": ["metaforce", "metaforce-gui", "hecl", "visigen"] + "name": "x-macos-ci", + "configurePreset": "x-macos-ci", + "description": "(Internal) macOS CI", + "displayName": "(Internal) macOS CI", + "targets": [ + "install" + ] }, { - "name": "windows-ci-clang", - "configurePreset": "windows-ci-clang", - "targets": ["metaforce", "metaforce-gui", "hecl", "visigen"] + "name": "x-windows-ci-msvc", + "configurePreset": "x-windows-ci-msvc", + "description": "(Internal) Windows CI MSVC", + "displayName": "(Internal) Windows CI MSVC", + "targets": [ + "install" + ] + }, + { + "name": "x-windows-ci-clang", + "configurePreset": "x-windows-ci-clang", + "description": "(Internal) Windows CI Clang", + "displayName": "(Internal) Windows CI Clang", + "targets": [ + "install" + ] } ] } diff --git a/CMakeSettings.json b/CMakeSettings.json deleted file mode 100644 index 9934b0489..000000000 --- a/CMakeSettings.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "configurations": [ - { - "name": "x64-Clang-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "inheritEnvironments": [ "clang_cl_x64" ], - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "-v", - "ctestCommandArgs": "", - "variables": [ - { - "name": "CMAKE_MSVC_RUNTIME_LIBRARY", - "value": "MultiThreadedDebugDLL", - "type": "STRING" - }, - { - "name": "CMAKE_C_COMPILER", - "value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", - "type": "FILEPATH" - }, - { - "name": "CMAKE_CXX_COMPILER", - "value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", - "type": "FILEPATH" - }, - { - "name": "CMAKE_LINKER", - "value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe", - "type": "FILEPATH" - } - ] - }, - { - "name": "x64-Clang-Release", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "inheritEnvironments": [ "clang_cl_x64" ], - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "-v", - "ctestCommandArgs": "", - "variables": [ - { - "name": "CMAKE_MSVC_RUNTIME_LIBRARY", - "value": "MultiThreadedDLL", - "type": "STRING" - }, - { - "name": "CMAKE_C_COMPILER", - "value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", - "type": "FILEPATH" - }, - { - "name": "CMAKE_CXX_COMPILER", - "value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", - "type": "FILEPATH" - }, - { - "name": "CMAKE_LINKER", - "value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe", - "type": "FILEPATH" - } - ] - }, - { - "name": "x64-Clang-Release-vcpkg", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "inheritEnvironments": [ "clang_cl_x64" ], - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "-v", - "ctestCommandArgs": "", - "variables": [ - { - "name": "CMAKE_TOOLCHAIN_FILE", - "value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake", - "type": "FILEPATH" - }, - { - "name": "VCPKG_TARGET_TRIPLET", - "value": "x64-windows-static", - "type": "STRING" - }, - { - "name": "CMAKE_MSVC_RUNTIME_LIBRARY", - "value": "MultiThreaded", - "type": "STRING" - }, - { - "name": "CMAKE_C_COMPILER", - "value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", - "type": "FILEPATH" - }, - { - "name": "CMAKE_CXX_COMPILER", - "value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", - "type": "FILEPATH" - }, - { - "name": "CMAKE_LINKER", - "value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe", - "type": "FILEPATH" - } - ] - }, - { - "name": "x64-MSVC-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "-v", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x64_x64" ], - "variables": [ - { - "name": "CMAKE_MSVC_RUNTIME_LIBRARY", - "value": "MultiThreadedDebugDLL", - "type": "STRING" - }, - { - "name": "CMAKE_CXX_FLAGS", - "value": "", - "type": "STRING" - }, - { - "name": "CMAKE_C_FLAGS", - "value": "", - "type": "STRING" - } - ] - }, - { - "name": "x64-MSVC-Release", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "-v", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x64_x64" ], - "variables": [ - { - "name": "CMAKE_MSVC_RUNTIME_LIBRARY", - "value": "MultiThreadedDLL", - "type": "STRING" - }, - { - "name": "CMAKE_CXX_FLAGS", - "value": "", - "type": "STRING" - }, - { - "name": "CMAKE_C_FLAGS", - "value": "", - "type": "STRING" - } - ] - }, - { - "name": "x64-MSVC-Release-vcpkg", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "-v", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x64_x64" ], - "variables": [ - { - "name": "CMAKE_TOOLCHAIN_FILE", - "value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake", - "type": "FILEPATH" - }, - { - "name": "VCPKG_TARGET_TRIPLET", - "value": "x64-windows-static", - "type": "STRING" - }, - { - "name": "CMAKE_MSVC_RUNTIME_LIBRARY", - "value": "MultiThreaded", - "type": "STRING" - }, - { - "name": "CMAKE_CXX_FLAGS", - "value": "", - "type": "STRING" - }, - { - "name": "CMAKE_C_FLAGS", - "value": "", - "type": "STRING" - } - ] - } - ] -} \ No newline at end of file diff --git a/README.md b/README.md index 6c6b2471c..983768654 100644 --- a/README.md +++ b/README.md @@ -92,14 +92,16 @@ For Windows, it's recommended to use Visual Studio. See below. #### ninja (Windows/macOS/Linux) +Builds using `RelWithDebInfo` by default. + ```sh cd metaforce-build -cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja ../metaforce +cmake -G Ninja ../metaforce ninja ``` #### CMake options -- Build release optimized (better runtime performance): `-DCMAKE_BUILD_TYPE=Release` +- Build in debug mode (slower runtime speed, better backtraces): `-DCMAKE_BUILD_TYPE=Debug` - Use clang+lld (faster linking): `-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++` - Optimize for current CPU (resulting binaries are not portable): `-DMETAFORCE_VECTOR_ISA=native` diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index 8614dde33..bfad864f5 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -7,7 +7,7 @@ chmod +x linuxdeploy-$(uname -m).AppImage linuxdeploy-plugin-qt-$(uname -m).AppI # Build AppImage mkdir -p appdir/usr/{bin,share/{applications,icons/hicolor}} -cp build/Binaries/{hecl,metaforce-gui,metaforce,visigen} appdir/usr/bin +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 diff --git a/ci/build-dmg.sh b/ci/build-dmg.sh index 1da19d33c..8090e2c77 100755 --- a/ci/build-dmg.sh +++ b/ci/build-dmg.sh @@ -1,5 +1,5 @@ #!/bin/bash -ex -cd build/Binaries +cd build/install mv metaforce-gui.app Metaforce.app # order is important for i in visigen hecl metaforce crashpad_handler; do @@ -8,4 +8,4 @@ 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" \ No newline at end of file + -u "$ASC_USERNAME" -p "$ASC_PASSWORD" --team-id "$ASC_TEAM_ID" diff --git a/ci/split-debug-linux.sh b/ci/split-debug-linux.sh index 91f551bea..96faa8099 100755 --- a/ci/split-debug-linux.sh +++ b/ci/split-debug-linux.sh @@ -1,7 +1,7 @@ #!/bin/bash -ex -cd build/Binaries +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 \ No newline at end of file +tar acfv "$GITHUB_WORKSPACE"/debug.tar.xz -- *.dbg diff --git a/ci/upload-debug-linux.sh b/ci/upload-debug-linux.sh index 81ecff8f9..760b5d125 100755 --- a/ci/upload-debug-linux.sh +++ b/ci/upload-debug-linux.sh @@ -1,3 +1,3 @@ #!/bin/bash -ex -cd build/Binaries +cd build/install sentry-cli upload-dif --org axiodl --project metaforce {hecl,metaforce-gui,metaforce,visigen}{,.dbg} --include-sources diff --git a/ci/upload-debug-macos.sh b/ci/upload-debug-macos.sh index 528d8bbc8..28d952256 100755 --- a/ci/upload-debug-macos.sh +++ b/ci/upload-debug-macos.sh @@ -1,5 +1,5 @@ #!/bin/bash -ex -cd build/Binaries/metaforce-gui.app/Contents/MacOS +cd build/install/metaforce-gui.app/Contents/MacOS for f in hecl metaforce-gui metaforce visigen; do dsymutil $f strip -S $f diff --git a/extern/athena b/extern/athena index 37c56eec0..37206e530 160000 --- a/extern/athena +++ b/extern/athena @@ -1 +1 @@ -Subproject commit 37c56eec076d74cc7708ff14c66ee960d7f53e2a +Subproject commit 37206e5301a28486aa836c77041f67263d5cb012 diff --git a/hecl/ApplicationTools.cmake b/hecl/ApplicationTools.cmake index ca81e7d09..478c3a714 100644 --- a/hecl/ApplicationTools.cmake +++ b/hecl/ApplicationTools.cmake @@ -61,3 +61,10 @@ function(add_special_shader name) add_library(${name} ${name}.hpp ${ARGN}) add_shader_target(${name}) endfunction() + +include(ExternalProject) +ExternalProject_Add(bintoc + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/bintoc" + CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install) +include(${CMAKE_CURRENT_LIST_DIR}/bintoc/bintocHelpers.cmake) diff --git a/hecl/CMakeLists.txt b/hecl/CMakeLists.txt index d9688f7e9..bcd542638 100644 --- a/hecl/CMakeLists.txt +++ b/hecl/CMakeLists.txt @@ -52,13 +52,6 @@ endforeach() configure_file(include/hecl/ApplicationReps.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/ApplicationReps.hpp @ONLY) -include(ExternalProject) -ExternalProject_Add(bintoc - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bintoc" - CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH= - INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install) -include(bintoc/bintocHelpers.cmake) - if(NOT TARGET atdna) # Import native atdna if cross-compiling find_package(atdna REQUIRED)