diff --git a/.github/workflows/build-natives.yml b/.github/workflows/build-natives.yml index af209e2..9e017e8 100644 --- a/.github/workflows/build-natives.yml +++ b/.github/workflows/build-natives.yml @@ -14,33 +14,41 @@ permissions: jobs: windows: - name: Windows (x86 + x64) - runs-on: ubuntu-22.04 + name: Windows (x64) + runs-on: windows-2022 steps: - name: Clone repository uses: actions/checkout@v7 - name: Setup Dependencies + shell: pwsh run: | - mkdir -p artifacts/x86 - mkdir artifacts/x64 - sudo apt-get install mingw-w64 + New-Item -ItemType Directory -Force -Path artifacts/x64 | Out-Null - name: Compile natives + shell: pwsh run: | - curl -s -L -O https://github.com/freetype/freetype/archive/refs/tags/${FREETYPE_VERSION}.zip - unzip ${FREETYPE_VERSION}.zip - mkdir freetype-${FREETYPE_VERSION}/build - cd freetype-${FREETYPE_VERSION} - patch -p0 < ../win64.patch - cd build - cmake .. -DCMAKE_TOOLCHAIN_FILE=../../mingw-x86.cmake -DBUILD_SHARED_LIBS=true -DCMAKE_BUILD_TYPE=Release -DFT_DISABLE_ZLIB=TRUE -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_PNG=TRUE -DFT_DISABLE_HARFBUZZ=TRUE -DFT_DISABLE_BROTLI=TRUE -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc" - cmake --build . - cp libfreetype.dll ../../artifacts/x86/freetype6.dll - rm -rf * - cmake .. -DCMAKE_TOOLCHAIN_FILE=../../mingw-x64.cmake -DBUILD_SHARED_LIBS=true -DCMAKE_BUILD_TYPE=Release -DFT_DISABLE_ZLIB=TRUE -DFT_DISABLE_BZIP2=TRUE -DFT_DISABLE_PNG=TRUE -DFT_DISABLE_HARFBUZZ=TRUE -DFT_DISABLE_BROTLI=TRUE - cmake --build . - cp libfreetype.dll ../../artifacts/x64/freetype6.dll + $zip = "${env:FREETYPE_VERSION}.zip" + Invoke-WebRequest -Uri "https://github.com/freetype/freetype/archive/refs/tags/$zip" -OutFile $zip + Expand-Archive -Path $zip -DestinationPath . + + $src = "freetype-${env:FREETYPE_VERSION}" + Push-Location $src + patch -p0 -i ..\win64.patch + Pop-Location + + cmake -S $src -B "$src\build-x64" ` + -A x64 ` + -DBUILD_SHARED_LIBS=TRUE ` + -DCMAKE_BUILD_TYPE=Release ` + -DFT_DISABLE_ZLIB=TRUE ` + -DFT_DISABLE_BZIP2=TRUE ` + -DFT_DISABLE_PNG=TRUE ` + -DFT_DISABLE_HARFBUZZ=TRUE ` + -DFT_DISABLE_BROTLI=TRUE + + cmake --build "$src\build-x64" --config Release + Copy-Item "$src\build-x64\Release\freetype.dll" "artifacts\x64\freetype6.dll" -Force - name: Upload Artifacts uses: actions/upload-artifact@v7 @@ -48,6 +56,49 @@ jobs: name: Natives-Windows path: ./artifacts + windows-arm64: + name: Windows (arm64) + runs-on: windows-11-arm + steps: + - name: Clone repository + uses: actions/checkout@v7 + + - name: Setup Dependencies + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path artifacts/arm64 | Out-Null + + - name: Compile natives + shell: pwsh + run: | + $zip = "${env:FREETYPE_VERSION}.zip" + Invoke-WebRequest -Uri "https://github.com/freetype/freetype/archive/refs/tags/$zip" -OutFile $zip + Expand-Archive -Path $zip -DestinationPath . + + $src = "freetype-${env:FREETYPE_VERSION}" + Push-Location $src + patch -p0 -i ..\win64.patch + Pop-Location + + cmake -S $src -B "$src\build-arm64" ` + -A ARM64 ` + -DBUILD_SHARED_LIBS=TRUE ` + -DCMAKE_BUILD_TYPE=Release ` + -DFT_DISABLE_ZLIB=TRUE ` + -DFT_DISABLE_BZIP2=TRUE ` + -DFT_DISABLE_PNG=TRUE ` + -DFT_DISABLE_HARFBUZZ=TRUE ` + -DFT_DISABLE_BROTLI=TRUE + + cmake --build "$src\build-arm64" --config Release + Copy-Item "$src\build-arm64\Release\freetype.dll" "artifacts\arm64\freetype6.dll" -Force + + - name: Upload Artifacts + uses: actions/upload-artifact@v7 + with: + name: Natives-Windows(arm64) + path: ./artifacts + macos: name: macOS (x64 + arm64) runs-on: macos-14 diff --git a/.github/workflows/build-nuget.yml b/.github/workflows/build-nuget.yml index d0ca523..9e40e1a 100644 --- a/.github/workflows/build-nuget.yml +++ b/.github/workflows/build-nuget.yml @@ -47,6 +47,12 @@ jobs: name: Natives-Windows path: ./native/win + - name: Download artifacts - native - Windows (arm64) + uses: actions/download-artifact@v8 + with: + name: Natives-Windows(arm64) + path: ./native/win + - name: Download artifacts - native - MacOS uses: actions/download-artifact@v8 with: diff --git a/OpenRA-FreeType6.nuspec b/OpenRA-FreeType6.nuspec index f2ccb61..325ce02 100644 --- a/OpenRA-FreeType6.nuspec +++ b/OpenRA-FreeType6.nuspec @@ -22,8 +22,8 @@ - + diff --git a/OpenRA-FreeType6.targets b/OpenRA-FreeType6.targets index d86c77b..c084d4e 100644 --- a/OpenRA-FreeType6.targets +++ b/OpenRA-FreeType6.targets @@ -1,12 +1,12 @@ - + PreserveNewest freetype6.dll false - + PreserveNewest freetype6.dll false diff --git a/mingw-x64.cmake b/mingw-x64.cmake deleted file mode 100644 index 998ccdf..0000000 --- a/mingw-x64.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Sample toolchain file for building for Windows from an Ubuntu Linux system. -# -# Typical usage: -# *) install cross compiler: `sudo apt-get install mingw-w64` -# *) cd build -# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake .. -# This is free and unencumbered software released into the public domain. - -set(CMAKE_SYSTEM_NAME Windows) -set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) - -# cross compilers to use for C, C++ and Fortran -set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) -set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) -set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) - -# target environment on the build host system -set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) - -# modify default behavior of FIND_XXX() commands -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/mingw-x86.cmake b/mingw-x86.cmake deleted file mode 100644 index e3bdb53..0000000 --- a/mingw-x86.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Sample toolchain file for building for Windows from an Ubuntu Linux system. -# -# Typical usage: -# *) install cross compiler: `sudo apt-get install mingw-w64` -# *) cd build -# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake .. -# This is free and unencumbered software released into the public domain. - -set(CMAKE_SYSTEM_NAME Windows) -set(TOOLCHAIN_PREFIX i686-w64-mingw32) - -# cross compilers to use for C, C++ and Fortran -set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) -set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) -set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) - -# target environment on the build host system -set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) - -# modify default behavior of FIND_XXX() commands -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file