[PATCH] D141738: Add initial support for cross compile Windows runtimes under Linux when building Fuchsia clang toolchain

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 15:27:52 PST 2023


phosek added inline comments.


================
Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:79
+  if (LLVM_WINSYSROOT)
+    set(CLANG_WINDOWS_CROSS_FLAGS
+      -Xclang
----------------
I think we'll want to use these flags even when not cross-compiling so I'd change the name to reflect that.


================
Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:90
+    string(REPLACE ";" " " CLANG_WINDOWS_CROSS_FLAGS "${CLANG_WINDOWS_CROSS_FLAGS}")
+    set(LINK_WINDOWS_CROSS_FLAGS
+        /vfsoverlay:${LLVM_VFSOVERLAY}
----------------
I think we'll want to use these flags even when not cross-compiling so I'd change the name to reflect that.


================
Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:105-112
 
+  if(LLVM_WINSYSROOT)
+    set(BUILTINS_${target}_CMAKE_C_FLAGS ${CLANG_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_CXX_FLAGS ${CLANG_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAGS ${LINK_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS ${LINK_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS ${LINK_WINDOWS_CROSS_FLAGS} CACHE STRING "")
----------------
You can set these unconditionally (unset variables in CMake evaluate to empty string).


================
Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:122-131
+
+  if(LLVM_WINSYSROOT)
+    set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS ${CLANG_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_C_FLAGS ${CLANG_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_CXX_FLAGS ${CLANG_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS ${LINK_WINDOWS_CROSS_FLAGS} CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS ${LINK_WINDOWS_CROSS_FLAGS} CACHE STRING "")
----------------
You can set these unconditionally.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141738/new/

https://reviews.llvm.org/D141738



More information about the cfe-commits mailing list