diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 648fd333..77ad3b99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,14 +72,14 @@ jobs: build-macos: name: Build macOS - runs-on: macos-13 + runs-on: macos-14 strategy: fail-fast: false matrix: config: - release arch: - - x64 + - amd64 - arm64 steps: - name: Check out files @@ -93,7 +93,7 @@ jobs: uses: Homebrew/actions/setup-homebrew@master - name: Install LLVM - run: brew install llvm + run: brew install llvm lld - name: Add LLVM to PATH run: | @@ -122,17 +122,50 @@ jobs: path: | build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool + prebuild-linux: + name: Prebuild Linux + runs-on: ubuntu-24.04 + steps: + - name: Check out files + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + lfs: false + + - name: Add premake5 to PATH + uses: abel0b/setup-premake@v2.4 + with: + version: ${{ env.PREMAKE_VERSION }} + + - name: Generate project files + run: premake5 gmake2 + + - name: Upload project files + uses: actions/upload-artifact@v4.3.3 + with: + name: linux-project-files + path: | + build/ + include/xsk/version.hpp + build-linux: name: Build Linux - runs-on: ubuntu-24.04 + runs-on: ${{ matrix.os }} + needs: prebuild-linux strategy: fail-fast: false matrix: config: - release arch: - - x64 - # - arm64 + - amd64 + - arm64 + include: + - arch: amd64 + os: ubuntu-24.04 + - arch: arm64 + os: ubuntu-24.04-arm steps: - name: Check out files uses: actions/checkout@v4 @@ -141,26 +174,28 @@ jobs: fetch-depth: 0 lfs: false + - name: Download project files + uses: actions/download-artifact@v4.1.7 + with: + name: linux-project-files + path: ./ + - name: Install LLVM run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 18 - # - name: Install dependencies (arm64) - # if: matrix.arch == 'arm64' - # run: sudo apt-get install crossbuild-essential-arm64 -y - - - name: Add premake5 to PATH - uses: abel0b/setup-premake@v2.4 - with: - version: ${{ env.PREMAKE_VERSION }} + # - name: Add premake5 to PATH + # uses: abel0b/setup-premake@v2.4 + # with: + # version: ${{ env.PREMAKE_VERSION }} - - name: Generate project files - run: premake5 gmake2 + # - name: Generate project files + # run: premake5 gmake2 - - name: Set up problem matching - uses: ammaraskar/gcc-problem-matcher@master + # - name: Set up problem matching + # uses: ammaraskar/gcc-problem-matcher@master - name: Build ${{matrix.arch}} ${{matrix.config}} binaries run: | @@ -196,6 +231,8 @@ jobs: - name: Compress Binaries run: | + rm -rf linux-project-files/ + for dir in */; do if [[ $dir == *"windows"* ]]; then cd "$dir" && zip -r "../${dir%/}.zip" . && cd .. @@ -221,10 +258,8 @@ jobs: # with: # cosign-release: 'v2.1.1' - # - name: Setup QEMU - # uses: docker/setup-qemu-action@v3.0.0 - # with: - # platforms: linux/amd64,linux/arm64 + - name: Setup QEMU + uses: docker/setup-qemu-action@v3.0.0 - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3.0.0 @@ -257,7 +292,7 @@ jobs: uses: docker/build-push-action@v5.1.0 with: context: . - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 2e7b0041..1b443275 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM ubuntu:24.04 +ARG TARGETARCH -COPY --chmod=755 ./linux-x64-release/gsc-tool /usr/local/bin/ +COPY --chmod=755 ./linux-${TARGETARCH}-release/gsc-tool /usr/local/bin/ RUN groupadd gsc-tool && useradd -r -g gsc-tool gsc-tool USER gsc-tool diff --git a/premake5.lua b/premake5.lua index 8041c08a..f7efc77f 100644 --- a/premake5.lua +++ b/premake5.lua @@ -81,11 +81,29 @@ workspace "gsc-tool" objdir "%{wks.location}/obj/%{cfg.buildcfg}/%{prj.name}" targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}" targetname "%{prj.name}" + cppdialect "C++20" + staticruntime "On" + warnings "Extra" + -- configurations configurations { "debug", "release" } + filter "configurations:debug" + optimize "Debug" + symbols "On" + defines { "DEBUG", "_DEBUG" } + filter {} + + filter "configurations:release" + optimize "Full" + symbols "Off" + defines "NDEBUG" + flags "FatalCompileWarnings" + filter {} + + -- platforms if os.istarget("linux") or os.istarget("macosx") then - platforms { "x64", "arm64" } + platforms { "arm64", "amd64" } else platforms { "x86", "x64", "arm64" } end @@ -98,15 +116,15 @@ workspace "gsc-tool" architecture "x86_64" filter {} - filter "platforms:arm64" - architecture "ARM64" + filter "platforms:amd64" + architecture "x86_64" filter {} - filter { "language:C++", "toolset:not msc*" } - buildoptions "-std=c++20" + filter "platforms:arm64" + architecture "ARM64" filter {} - filter "toolset:msc*" + filter { "toolset:msc*" } buildoptions "/bigobj" buildoptions "/Zc:__cplusplus" buildoptions "/std:c++20" @@ -116,16 +134,14 @@ workspace "gsc-tool" systemversion "latest" filter {} - staticruntime "On" - warnings "Extra" - - filter "system:linux" + filter { "system:linux" } + toolset "clang" linkoptions "-fuse-ld=lld" filter {} - filter { "system:linux", "platforms:arm64" } - buildoptions "--target=arm64-linux-gnu" - linkoptions "--target=arm64-linux-gnu" + filter { "system:macosx", "platforms:amd64" } + buildoptions "-arch x86_64" + linkoptions "-arch x86_64" filter {} filter { "system:macosx", "platforms:arm64" } @@ -133,19 +149,6 @@ workspace "gsc-tool" linkoptions "-arch arm64" filter {} - filter "configurations:release" - optimize "Full" - symbols "Off" - defines "NDEBUG" - flags "FatalCompileWarnings" - filter {} - - filter "configurations:debug" - optimize "Debug" - symbols "On" - defines { "DEBUG", "_DEBUG" } - filter {} - project "xsk-tool" kind "ConsoleApp" language "C++"