From e4a0432383331e013808a97b7c24707e4ddc4726 Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 26 Sep 2025 12:23:19 +0200 Subject: Initial Commit --- cmake/toolchains/mingw-w64-x86_64.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmake/toolchains/mingw-w64-x86_64.cmake (limited to 'cmake/toolchains') diff --git a/cmake/toolchains/mingw-w64-x86_64.cmake b/cmake/toolchains/mingw-w64-x86_64.cmake new file mode 100644 index 0000000..7935b7e --- /dev/null +++ b/cmake/toolchains/mingw-w64-x86_64.cmake @@ -0,0 +1,27 @@ +# MinGW-w64 x86_64 toolchain file for cross-compiling Windows binaries from Linux +# Usage: +# cmake -S . -B build-win-mingw \ +# -G Ninja \ +# -DCMAKE_BUILD_TYPE=Release \ +# -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64-x86_64.cmake + +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_VERSION 10) + +# Adjust these prefixes if your distro uses different triplets +set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) + +find_program(CMAKE_C_COMPILER NAMES ${TOOLCHAIN_PREFIX}-gcc) +find_program(CMAKE_CXX_COMPILER NAMES ${TOOLCHAIN_PREFIX}-g++) +find_program(CMAKE_RC_COMPILER NAMES ${TOOLCHAIN_PREFIX}-windres) + +# For pkg-config in cross environment (optional) +# set(ENV{PKG_CONFIG_LIBDIR} "") +# set(ENV{PKG_CONFIG_PATH} "") + +set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} /usr/${TOOLCHAIN_PREFIX}/${TOOLCHAIN_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) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -- cgit v1.2.3