From 21c17258745e0178595d21b9dcd42ba6bc9de87a Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 11:45:19 +0000 Subject: [PATCH 01/14] fix(build): read runner temp path from environment Windows 11 Arm64 runners don't like x86_64 runners have two disk, they're only one disk C: Replace hardcoded path `/d/a/_temp/` to `${{ runner.temp }}` and use `MSYS2_ROOT` environment variables Signed-off-by: Coia Prant --- .github/workflows/ci.yml | 3 ++- CMakeLists.txt | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 716e641c2..8034c9477 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -288,7 +288,8 @@ jobs: - name: Debug msys2.CMD if: runner.os == 'Windows' run: | - cat /d/a/_temp/setup-msys2/msys2.CMD + echo "MSYS2_ROOT=${{ runner.temp }}/msys64" >> $GITHUB_ENV + cat "${{ runner.temp }}/setup-msys2/msys2.CMD" - name: Initialize Submodules # libx265 has issues when using the recursive method of the first checkout action diff --git a/CMakeLists.txt b/CMakeLists.txt index 1056f5d16..8936493e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,11 +51,17 @@ elseif(NOT N MATCHES "^[0-9]+$") set(N_PROC 1) endif() +set(MSYS2_ROOT "C:/msys64") +if(WIN32 AND DEFINED ENV{MSYS2_ROOT}) + set(MSYS2_ROOT "$ENV{MSYS2_ROOT}") + message(STATUS "Detected MSYS2_ROOT, get msys2 path from environment: ${MSYS2_ROOT}") +endif() + if(NOT DEFINED BASH_EXECUTABLE) find_program(BASH_EXECUTABLE NAMES zsh bash REQUIRED - HINTS D:/a/_temp/msys64/usr/bin C:/msys64/usr/bin /bin /usr/bin /usr/local/bin) + HINTS "${MSYS2_ROOT}/usr/bin" /bin /usr/bin /usr/local/bin) message(STATUS "Found bash: ${BASH_EXECUTABLE}") endif() @@ -71,7 +77,7 @@ if(WIN32) message(STATUS "Detected Windows, falling back to using make: ${MAKE_EXECUTABLE}") set(MSYSTEM "UCRT64") - find_file(MSYS2_EXECUTABLE NAMES msys2_shell.cmd REQUIRED HINTS D:/a/_temp/msys64 C:/msys64) + find_file(MSYS2_EXECUTABLE NAMES msys2_shell.cmd REQUIRED HINTS ${MSYS2_ROOT}) message(STATUS "Found MSYS2: ${MSYS2_EXECUTABLE}") if(NOT DEFINED MSYS2_OPTION OR MSYS2_OPTION STREQUAL "1" OR MSYS2_OPTION STREQUAL "") @@ -135,7 +141,7 @@ message(STATUS "Initial PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}") find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config REQUIRED - HINTS D:/a/_temp/msys64/usr/bin C:/msys64/usr/bin /bin /usr/bin /usr/local/bin) + HINTS "${MSYS2_ROOT}/usr/bin" /bin /usr/bin /usr/local/bin) UNIX_PATH(PKG_CONFIG_EXECUTABLE ${PKG_CONFIG_EXECUTABLE}) message(STATUS "Found pkg-config: ${PKG_CONFIG_EXECUTABLE}") From 0f3dfb61fc94845150ecaae75dc61ab0b9f2f29d Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 11:51:06 +0000 Subject: [PATCH 02/14] feat(build): add clangarm64 support Add initial clangarm64 support for Windows Arm64 builds Signed-off-by: Coia Prant --- CMakeLists.txt | 8 +++++++- msys2.cmd.in | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8936493e1..190b5cc65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,11 +77,17 @@ if(WIN32) message(STATUS "Detected Windows, falling back to using make: ${MAKE_EXECUTABLE}") set(MSYSTEM "UCRT64") + set(MSYS2_ARG "-ucrt64") + if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM64") + set(MSYSTEM "CLANGARM64") + set(MSYS2_ARG "-clangarm64") + endif() + find_file(MSYS2_EXECUTABLE NAMES msys2_shell.cmd REQUIRED HINTS ${MSYS2_ROOT}) message(STATUS "Found MSYS2: ${MSYS2_EXECUTABLE}") if(NOT DEFINED MSYS2_OPTION OR MSYS2_OPTION STREQUAL "1" OR MSYS2_OPTION STREQUAL "") - set(SHELL_CMD ${MSYS2_EXECUTABLE} -ucrt64 -defterm -here -no-start -shell bash -c) + set(SHELL_CMD ${MSYS2_EXECUTABLE} ${MSYS2_ARG} -defterm -here -no-start -shell bash -c) elseif(MSYS2_OPTION STREQUAL "2") # Theoretically, this is equivalent to the above configure_file(${CMAKE_CURRENT_SOURCE_DIR}/msys2.cmd.in ${CMAKE_CURRENT_BINARY_DIR}/msys2.cmd @ONLY) diff --git a/msys2.cmd.in b/msys2.cmd.in index f088754f1..e914d2bd2 100644 --- a/msys2.cmd.in +++ b/msys2.cmd.in @@ -3,4 +3,4 @@ setlocal IF NOT DEFINED MSYSTEM set MSYSTEM=@MSYSTEM@ IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=inherit set CHERE_INVOKING=1 -@MSYS2_EXECUTABLE@ -ucrt64 -defterm -here -no-start -shell bash -c %* +@MSYS2_EXECUTABLE@ @MSYS2_ARG@ -defterm -here -no-start -shell bash -c %* From 0b8daaebf10baa5f1a77ba8137172714e11a6754 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Mon, 12 May 2025 04:13:46 +0000 Subject: [PATCH 03/14] fix(build): add clangarm64 check MSYS2 CLANGARM64 is native arm64 binary, can not run on non-arm64 hosts. Signed-off-by: Coia Prant --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 190b5cc65..84e5ce9a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,12 @@ if(WIN32) set(MSYSTEM "UCRT64") set(MSYS2_ARG "-ucrt64") - if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM64") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") + # MSYS2 CLANGARM64 is native arm64 binary, can not run on non-arm64 hosts. + if (NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM64") + message(FATAL_ERROR "Compiling for Windows ARM64 targets on non Windows ARM64 hosts is not currently supported") + endif() + set(MSYSTEM "CLANGARM64") set(MSYS2_ARG "-clangarm64") endif() From 6ddab5882ac086a1902ccfc8acd262db817d3651 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 12:18:53 +0000 Subject: [PATCH 04/14] fix(build): x264 build Apple should be reported as darwin Win32 should be reported as mingw64 Signed-off-by: Coia Prant --- cmake/ffmpeg/x264.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/ffmpeg/x264.cmake b/cmake/ffmpeg/x264.cmake index 2115a3bd3..57f2ee770 100644 --- a/cmake/ffmpeg/x264.cmake +++ b/cmake/ffmpeg/x264.cmake @@ -19,9 +19,9 @@ else() endif() if(WIN32) - set(X264_HOST ${X264_ARCH}-windows) + set(X264_HOST ${X264_ARCH}-mingw64) elseif(APPLE) - set(X264_HOST ${X264_ARCH}-macos) + set(X264_HOST ${X264_ARCH}-darwin) elseif(UNIX) set(X264_HOST ${X264_ARCH}-linux) else() From 28b040500bf3316c36e1b4c502a8be15676cde2e Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 12:20:58 +0000 Subject: [PATCH 05/14] fix(build): x264 windows arm64 build This is a temporary solution to fix the issue with Windows Arm64 not being recognized correctly in x264 `uname -m` is currently reported as `x86_64` instead of `aarch64` in MSYS2 Link: https://github.com/msys2/msys2-runtime/issues/171 x264 `config.guess` uses `uname -m` to detect architecture Link: https://code.videolan.org/videolan/x264/-/tree/1ecc51ee971e0056a53bd6cf9c6f6af18b167e4b/config.guess#L809 Signed-off-by: Coia Prant --- cmake/ffmpeg/x264.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/ffmpeg/x264.cmake b/cmake/ffmpeg/x264.cmake index 57f2ee770..58c4732ee 100644 --- a/cmake/ffmpeg/x264.cmake +++ b/cmake/ffmpeg/x264.cmake @@ -37,6 +37,17 @@ if(CMAKE_CROSSCOMPILING) endif() endif() +# On Windows Arm64 +# We must specify the host parameter until one of the following issues is resolved +# +# https://github.com/msys2/msys2-runtime/issues/171 +# https://code.videolan.org/videolan/x264/-/tree/1ecc51ee971e0056a53bd6cf9c6f6af18b167e4b/config.guess#L809 +if(${X264_HOST} STREQUAL "aarch64-mingw64") + set(FFMPEG_X264_EXTRA_CONFIGURE + --host=${X264_HOST} + ) +endif() + # convert list to string # configure command will only take the first argument if not converted to string string(REPLACE ";" " " FFMPEG_X264_EXTRA_CONFIGURE "${FFMPEG_X264_EXTRA_CONFIGURE}") From 2f1ff8d7e7c6925dd365026871aec79a47ab1ba3 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 15:22:10 +0000 Subject: [PATCH 06/14] fix(build): FFmpeg windows arm64 build This is a temporary solution to fix the issue with Windows Arm64 not being recognized correctly in FFmpeg `uname -m` is currently reported as `x86_64` instead of `aarch64` in MSYS2 Link: https://github.com/msys2/msys2-runtime/issues/171 FFmpeg `configure` uses `uname -m` to detect architecture Link: https://github.com/FFmpeg/FFmpeg/blob/4e5523c98597a417eb43555933b1075d18ec5f8b/configure#L4161 Signed-off-by: Coia Prant --- cmake/ffmpeg/ffmpeg.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/ffmpeg/ffmpeg.cmake b/cmake/ffmpeg/ffmpeg.cmake index 4650691fc..6b12b6bfe 100644 --- a/cmake/ffmpeg/ffmpeg.cmake +++ b/cmake/ffmpeg/ffmpeg.cmake @@ -63,6 +63,17 @@ if(WIN32) --enable-nvenc --enable-mediafoundation ) + + # On Windows Arm64 + # We must specify the arch parameter until one of the following issues is resolved + # + # https://github.com/msys2/msys2-runtime/issues/171 + # https://github.com/FFmpeg/FFmpeg/blob/4e5523c98597a417eb43555933b1075d18ec5f8b/configure#L4161 + if(${arch} STREQUAL "aarch64" OR ${arch} STREQUAL "arm64") + list(APPEND FFMPEG_EXTRA_CONFIGURE + --arch=${arch} + ) + endif() elseif(APPLE) list(APPEND FFMPEG_EXTRA_CONFIGURE --enable-encoder=h264_videotoolbox,hevc_videotoolbox From 0d863cb51485de991fba341f94d8504d53c5471b Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 15:31:13 +0000 Subject: [PATCH 07/14] fix(build): disable ffnvcodec, cuda and nvenc on windows arm64 FFmpeg `configure` will disable ffnvcodec on Windows Arm64 Link: https://github.com/FFmpeg/FFmpeg/blob/4e5523c98597a417eb43555933b1075d18ec5f8b/configure#L7443 This problem may be solved in 2026 (NVIDIA and MediaTek release Windows Arm computers) Until FFmpeg fixes this, disable them first Signed-off-by: Coia Prant --- cmake/ffmpeg/ffmpeg.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/ffmpeg/ffmpeg.cmake b/cmake/ffmpeg/ffmpeg.cmake index 6b12b6bfe..7bcdc7745 100644 --- a/cmake/ffmpeg/ffmpeg.cmake +++ b/cmake/ffmpeg/ffmpeg.cmake @@ -52,15 +52,11 @@ list(APPEND FFMPEG_EXTRA_CONFIGURE if(WIN32) list(APPEND FFMPEG_EXTRA_CONFIGURE --enable-amf - --enable-cuda --enable-d3d11va --enable-encoder=h264_amf,hevc_amf,av1_amf --enable-encoder=h264_mf,hevc_mf - --enable-encoder=h264_nvenc,hevc_nvenc,av1_nvenc --enable-encoder=h264_qsv,hevc_qsv,av1_qsv - --enable-ffnvcodec --enable-libvpl - --enable-nvenc --enable-mediafoundation ) @@ -69,10 +65,21 @@ if(WIN32) # # https://github.com/msys2/msys2-runtime/issues/171 # https://github.com/FFmpeg/FFmpeg/blob/4e5523c98597a417eb43555933b1075d18ec5f8b/configure#L4161 + # + # We must disable CUDA and NVENC until following issues is resolved + # + # https://github.com/FFmpeg/FFmpeg/blob/4e5523c98597a417eb43555933b1075d18ec5f8b/configure#L7443 if(${arch} STREQUAL "aarch64" OR ${arch} STREQUAL "arm64") list(APPEND FFMPEG_EXTRA_CONFIGURE --arch=${arch} ) + elseif (${arch} STREQUAL "amd64" OR ${arch} STREQUAL "x86_64") + list(APPEND FFMPEG_EXTRA_CONFIGURE + --enable-cuda + --enable-encoder=h264_nvenc,hevc_nvenc,av1_nvenc + --enable-ffnvcodec + --enable-nvenc + ) endif() elseif(APPLE) list(APPEND FFMPEG_EXTRA_CONFIGURE From 0e4743038cb92bd3f6bdfa3d89d781ddaf6f6da9 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 15:36:00 +0000 Subject: [PATCH 08/14] ci(build): add windows arm64 build Add CI build for Windows ARM64 target Signed-off-by: Coia Prant --- .github/workflows/ci.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8034c9477..acece1649 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,15 @@ jobs: arch: x86_64 generator: "MSYS Makefiles" shell: msys2 {0} + msystem: ucrt64 + toolchain: ucrt-x86_64 + - name: Windows-ARM64 + os: windows-11-arm + arch: aarch64 + generator: "MSYS Makefiles" + shell: msys2 {0} + msystem: clangarm64 + toolchain: clang-aarch64 defaults: run: shell: ${{ matrix.shell }} @@ -270,20 +279,21 @@ jobs: if: runner.os == 'Windows' uses: msys2/setup-msys2@v2 with: - msystem: ucrt64 + msystem: ${{ matrix.msystem }} update: true install: >- diffutils git make pkg-config - mingw-w64-ucrt-x86_64-binutils - mingw-w64-ucrt-x86_64-cmake - mingw-w64-ucrt-x86_64-gcc - mingw-w64-ucrt-x86_64-make - mingw-w64-ucrt-x86_64-nasm - mingw-w64-ucrt-x86_64-ninja - mingw-w64-ucrt-x86_64-onevpl + mingw-w64-${{ matrix.toolchain }}-binutils + mingw-w64-${{ matrix.toolchain }}-cmake + mingw-w64-${{ matrix.toolchain }}-gcc + mingw-w64-${{ matrix.toolchain }}-make + mingw-w64-${{ matrix.toolchain }}-nasm + mingw-w64-${{ matrix.toolchain }}-ninja + mingw-w64-${{ matrix.toolchain }}-onevpl + mingw-w64-${{ matrix.toolchain }}-perl - name: Debug msys2.CMD if: runner.os == 'Windows' From d641ffb4f1a11e5d6178a3c15b886eb60887fee5 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 15:52:43 +0000 Subject: [PATCH 09/14] docs(readme): add windows arm64 build guide Add windows arm64 build guide with notes Signed-off-by: Coia Prant --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index c9fdc6815..f1ec88ccf 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,12 @@ brew install \ #### Windows +⚠ Currently only Windows Arm64 can be used to compile for Windows Arm64 targets! + +> The clangarm64 environment is an arm64 native binary toolchain and cannot be run on an x86 hosts + +##### x86_64 / amd64 + First, install [MSYS2](https://www.msys2.org/), then open the UCRT64 shell and run the following commands: ```bash @@ -139,6 +145,30 @@ pacman -S \ mingw-w64-ucrt-x86_64-onevpl ``` +##### aarch64 / arm64 + +First, install [MSYS2](https://www.msys2.org/), then open the CLANGARM64 shell and run the following commands: + +> For latest MSYS2, the Installer will be hangup on Windows On Arm, You can download [2024-12-08 version](https://github.com/msys2/msys2-installer/releases/tag/2024-12-08), See [issue #96](https://github.com/msys2/msys2-installer/issues/96) + +> Of course you can install the latest version using the command line, like [setup-msys2 does](https://github.com/msys2/setup-msys2/blob/main/main.js#L362), but this is beyond the scope of this repository. + +```bash +pacman -Syu +pacman -S \ + diffutils \ + git \ + make \ + pkg-config \ + mingw-w64-clang-aarch64-binutils \ + mingw-w64-clang-aarch64-cmake \ + mingw-w64-clang-aarch64-gcc \ + mingw-w64-clang-aarch64-make \ + mingw-w64-clang-aarch64-nasm \ + mingw-w64-clang-aarch64-ninja \ + mingw-w64-clang-aarch64-onevpl +``` + ### Configure Use the `Unix Makefiles` generator for Linux and macOS, and the `MSYS Makefiles` generator for Windows. From 36ee0c641caba46000d4ff05198a698cb29bbf8a Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sun, 11 May 2025 15:58:33 +0000 Subject: [PATCH 10/14] fix(ci): pin the MSYS2 version and disable update Some packages are not compatible with the latest MSYS2 version, because it bundles CMake 4.0 Pinned the MSYS2 version and disabled updates back to CMake 3.31.2 until the following issues are resolved Link: https://github.com/LizardByte/build-deps/issues/414 Signed-off-by: Coia Prant --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acece1649..66a083142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -277,10 +277,10 @@ jobs: - name: Setup Dependencies Windows # if a dependency needs to be pinned, see https://github.com/LizardByte/build-deps/pull/186 if: runner.os == 'Windows' - uses: msys2/setup-msys2@v2 + uses: msys2/setup-msys2@v2.26.0 with: msystem: ${{ matrix.msystem }} - update: true + # update: true install: >- diffutils git From 81729409d26960df18eacde09af9824f6c428114 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 23 May 2025 18:19:48 -0400 Subject: [PATCH 11/14] ci(windows): remove perl dependency --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc40d48e1..2b7c20a32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -305,7 +305,6 @@ jobs: "mingw-w64-${TOOLCHAIN}-nasm" "mingw-w64-${TOOLCHAIN}-ninja" "mingw-w64-${TOOLCHAIN}-onevpl" - "mingw-w64-${TOOLCHAIN}-perl" ) # do not modify below this line From b9002fc953fa14ac38bfeb93058a4d18973486b5 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 23 May 2025 18:20:00 -0400 Subject: [PATCH 12/14] docs(readme): simplify readme for Windows build --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f1ec88ccf..4cc40186c 100644 --- a/README.md +++ b/README.md @@ -121,13 +121,13 @@ brew install \ #### Windows -⚠ Currently only Windows Arm64 can be used to compile for Windows Arm64 targets! +ℹ️ Cross-compilation is not supported on Windows. You must build on the target architecture. -> The clangarm64 environment is an arm64 native binary toolchain and cannot be run on an x86 hosts +First, install [MSYS2](https://www.msys2.org/). ##### x86_64 / amd64 -First, install [MSYS2](https://www.msys2.org/), then open the UCRT64 shell and run the following commands: +Open the UCRT64 shell and run the following commands: ```bash pacman -Syu @@ -147,11 +147,7 @@ pacman -S \ ##### aarch64 / arm64 -First, install [MSYS2](https://www.msys2.org/), then open the CLANGARM64 shell and run the following commands: - -> For latest MSYS2, the Installer will be hangup on Windows On Arm, You can download [2024-12-08 version](https://github.com/msys2/msys2-installer/releases/tag/2024-12-08), See [issue #96](https://github.com/msys2/msys2-installer/issues/96) - -> Of course you can install the latest version using the command line, like [setup-msys2 does](https://github.com/msys2/setup-msys2/blob/main/main.js#L362), but this is beyond the scope of this repository. +Open the CLANGARM64 shell and run the following commands: ```bash pacman -Syu From 8b60aa200d110283f182019b63790ff290167c54 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 23 May 2025 18:52:46 -0400 Subject: [PATCH 13/14] ci(windows): fix pinned deps for arm64 --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b7c20a32..d32ccde18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -291,8 +291,10 @@ jobs: # variables declare -A pinned_deps pinned_deps["mingw-w64-${TOOLCHAIN}-cmake"]="3.31.6-1" - pinned_deps["mingw-w64-${TOOLCHAIN}-gcc"]="14.2.0-3" - pinned_deps["mingw-w64-${TOOLCHAIN}-gcc-libs"]="14.2.0-3" + if [[ ${MSYSTEM} == "ucrt64" ]]; then + pinned_deps["mingw-w64-${TOOLCHAIN}-gcc"]="14.2.0-3" + pinned_deps["mingw-w64-${TOOLCHAIN}-gcc-libs"]="14.2.0-3" + fi dependencies=( "diffutils" From e4138dab789416baa395866f7d2e0ab1cc7f31ab Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 23 May 2025 19:09:27 -0400 Subject: [PATCH 14/14] build(cmake/windows): refactor cross compiling check --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84e5ce9a4..b10cb61e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,14 +76,16 @@ if(WIN32) set(MAKE_EXECUTABLE "make") message(STATUS "Detected Windows, falling back to using make: ${MAKE_EXECUTABLE}") + # fatal error when cross compiling + if(CMAKE_CROSSCOMPILING) + message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}") + message(STATUS "Host system processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "Cross-compiling is not supported on Windows") + endif() + set(MSYSTEM "UCRT64") set(MSYS2_ARG "-ucrt64") if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") - # MSYS2 CLANGARM64 is native arm64 binary, can not run on non-arm64 hosts. - if (NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM64") - message(FATAL_ERROR "Compiling for Windows ARM64 targets on non Windows ARM64 hosts is not currently supported") - endif() - set(MSYSTEM "CLANGARM64") set(MSYS2_ARG "-clangarm64") endif()