From f29ede25c1232ceb3c3fe80bc0a1c0c8f760acc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 14 Jul 2026 19:46:20 +0200 Subject: [PATCH 1/3] Build on Windows. --- .github/workflows/build-natives.yml | 58 ++++++++++++++++++++--------- mingw-x64.cmake | 24 ------------ 2 files changed, 41 insertions(+), 41 deletions(-) delete mode 100644 mingw-x64.cmake diff --git a/.github/workflows/build-natives.yml b/.github/workflows/build-natives.yml index af209e2..bef8ecd 100644 --- a/.github/workflows/build-natives.yml +++ b/.github/workflows/build-natives.yml @@ -15,32 +15,56 @@ permissions: jobs: windows: name: Windows (x86 + x64) - runs-on: ubuntu-22.04 + 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/x86 | Out-Null + 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 + + # x86 build + cmake -S $src -B "$src\build-x86" ` + -A Win32 ` + -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-x86" --config Release + Copy-Item "$src\build-x86\Release\freetype.dll" "artifacts\x86\freetype6.dll" -Force + + # x64 build + 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 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 From b38e37a0ef7d93d3970040359aac1dc51d72521a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 14 Jul 2026 19:53:30 +0200 Subject: [PATCH 2/3] Build for ARM on Windows. --- .github/workflows/build-natives.yml | 43 +++++++++++++++++++++++++++++ .github/workflows/build-nuget.yml | 6 ++++ OpenRA-FreeType6.nuspec | 1 + OpenRA-FreeType6.targets | 5 ++++ 4 files changed, 55 insertions(+) diff --git a/.github/workflows/build-natives.yml b/.github/workflows/build-natives.yml index bef8ecd..ddbbdf4 100644 --- a/.github/workflows/build-natives.yml +++ b/.github/workflows/build-natives.yml @@ -72,6 +72,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..91d307d 100644 --- a/OpenRA-FreeType6.nuspec +++ b/OpenRA-FreeType6.nuspec @@ -24,6 +24,7 @@ + diff --git a/OpenRA-FreeType6.targets b/OpenRA-FreeType6.targets index d86c77b..b61afbc 100644 --- a/OpenRA-FreeType6.targets +++ b/OpenRA-FreeType6.targets @@ -11,6 +11,11 @@ freetype6.dll false + + PreserveNewest + freetype6.dll + false + PreserveNewest freetype6.so From 65b42cbf18beefbaa7aa983ad297df17ff085d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 15 Jul 2026 21:20:47 +0200 Subject: [PATCH 3/3] Drop Windows x86. --- .github/workflows/build-natives.yml | 18 +----------------- OpenRA-FreeType6.nuspec | 1 - OpenRA-FreeType6.targets | 5 ----- mingw-x86.cmake | 24 ------------------------ 4 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 mingw-x86.cmake diff --git a/.github/workflows/build-natives.yml b/.github/workflows/build-natives.yml index ddbbdf4..9e017e8 100644 --- a/.github/workflows/build-natives.yml +++ b/.github/workflows/build-natives.yml @@ -14,7 +14,7 @@ permissions: jobs: windows: - name: Windows (x86 + x64) + name: Windows (x64) runs-on: windows-2022 steps: - name: Clone repository @@ -23,7 +23,6 @@ jobs: - name: Setup Dependencies shell: pwsh run: | - New-Item -ItemType Directory -Force -Path artifacts/x86 | Out-Null New-Item -ItemType Directory -Force -Path artifacts/x64 | Out-Null - name: Compile natives @@ -38,21 +37,6 @@ jobs: patch -p0 -i ..\win64.patch Pop-Location - # x86 build - cmake -S $src -B "$src\build-x86" ` - -A Win32 ` - -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-x86" --config Release - Copy-Item "$src\build-x86\Release\freetype.dll" "artifacts\x86\freetype6.dll" -Force - - # x64 build cmake -S $src -B "$src\build-x64" ` -A x64 ` -DBUILD_SHARED_LIBS=TRUE ` diff --git a/OpenRA-FreeType6.nuspec b/OpenRA-FreeType6.nuspec index 91d307d..325ce02 100644 --- a/OpenRA-FreeType6.nuspec +++ b/OpenRA-FreeType6.nuspec @@ -22,7 +22,6 @@ - diff --git a/OpenRA-FreeType6.targets b/OpenRA-FreeType6.targets index b61afbc..c084d4e 100644 --- a/OpenRA-FreeType6.targets +++ b/OpenRA-FreeType6.targets @@ -1,11 +1,6 @@ - - PreserveNewest - freetype6.dll - false - PreserveNewest freetype6.dll 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