From 1fb9c4fb57673df49ead7d0023cf4d708e4854e4 Mon Sep 17 00:00:00 2001 From: cqwrteur <100043421+trcrsired@users.noreply.github.com> Date: Thu, 20 Jun 2024 05:23:34 -0400 Subject: [PATCH 1/3] Fix llvm cross build for win on arm I try to use clang for cross-compiling for the win on the arm. The problem is that llvm-windres, by default, uses the false build architecture. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d9b58df8..46f426a3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,7 +141,7 @@ if(MINGW) endif() add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} + COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_RC_FLAGS} -D GCC_WINDRES -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_CURRENT_BINARY_DIR} From d54f7f8d96548e5b0f592d89204840de67f9b205 Mon Sep 17 00:00:00 2001 From: cqwrteur <100043421+trcrsired@users.noreply.github.com> Date: Thu, 20 Jun 2024 05:51:00 -0400 Subject: [PATCH 2/3] Split parameters for CMAKE_RC_COMPILER The problem is that i try to pass -DCMAKE_RC_COMPILER="llvm-windres --target=$TARGETTRIPLE -I$SYSROOTPATH/include" for cross compiling to arm. this is not possible. Fix it by split parameters --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46f426a3b..b9343e6e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,9 +139,10 @@ if(MINGW) if(NOT CMAKE_RC_COMPILER) set(CMAKE_RC_COMPILER windres.exe) endif() + string(REPLACE " " ";" ZLIB_RC_COMPILER_LIST ${CMAKE_RC_COMPILER}) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_RC_FLAGS} + COMMAND ${ZLIB_RC_COMPILER_LIST} -D GCC_WINDRES -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_CURRENT_BINARY_DIR} From 43b635f228ef9f1738f2c05be4d6a0d19a90dacc Mon Sep 17 00:00:00 2001 From: cqwrteur <100043421+trcrsired@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:12:27 -0400 Subject: [PATCH 3/3] Update CMakeLists.txt split CMAKE_RC_FLAGS instead of CMAKE_RC_COMPILER --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9343e6e5..d2ec22bad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,10 +139,10 @@ if(MINGW) if(NOT CMAKE_RC_COMPILER) set(CMAKE_RC_COMPILER windres.exe) endif() - string(REPLACE " " ";" ZLIB_RC_COMPILER_LIST ${CMAKE_RC_COMPILER}) + string(REPLACE " " ";" ZLIB_CMAKE_RC_FLAGS_LIST ${CMAKE_RC_FLAGS}) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${ZLIB_RC_COMPILER_LIST} + COMMAND ${CMAKE_RC_COMPILER} ${ZLIB_CMAKE_RC_FLAGS_LIST} -D GCC_WINDRES -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_CURRENT_BINARY_DIR}