From: Martin Storsjö Date: Wed, 30 Jul 2025 09:05:22 +0000 (+0300) Subject: ci: Add a toolchain file for (cross) compilation for aarch64-w64-mingw32 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d608b2aedbf60a326f48cfc3162dd3ece232556a;p=thirdparty%2Fccache.git ci: Add a toolchain file for (cross) compilation for aarch64-w64-mingw32 Contrary to the existing toolchain files, this doesn't hardcode CMAKE_FIND_ROOT_PATH to a location in /usr, but locates the compiler from the path, and picks a sysroot adjacent to it - allowing using a compiler installed in any path. This uses a compiler named "${TOOLCHAIN_PREFIX}-gcc" - toolchains such as llvm-mingw do provide cross tools named "-gcc" for compatibility, even if they use Clang. --- diff --git a/toolchains/aarch64-w64-mingw32.cmake b/toolchains/aarch64-w64-mingw32.cmake new file mode 100644 index 00000000..558ac496 --- /dev/null +++ b/toolchains/aarch64-w64-mingw32.cmake @@ -0,0 +1,13 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(TOOLCHAIN_PREFIX aarch64-w64-mingw32) +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) +find_program(CC_LOCATION ${CMAKE_C_COMPILER} + NO_PACKAGE_ROOT_PATH + NO_CMAKE_FIND_ROOT_PATH) +get_filename_component(CC_DIR "${CC_LOCATION}" DIRECTORY) +get_filename_component(PREFIX "${CC_DIR}/../${TOOLCHAIN_PREFIX}" ABSOLUTE) +set(CMAKE_FIND_ROOT_PATH ${PREFIX}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)