[cmake] port torzu cmake build stuff for clang-cl
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
428f136a75
commit
3f625fffcb
2 changed files with 67 additions and 0 deletions
24
.patch/Boost/0001-clang-cl.patch
Normal file
24
.patch/Boost/0001-clang-cl.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
diff -ruN a/libs/cobalt/include/boost/cobalt/concepts.hpp b/libs/cobalt/include/boost/cobalt/concepts.hpp
|
||||||
|
--- a/libs/cobalt/include/boost/cobalt/concepts.hpp 2025-04-12 18:25:53.791233755 +0200
|
||||||
|
+++ b/libs/cobalt/include/boost/cobalt/concepts.hpp 2025-04-12 18:29:50.304496166 +0200
|
||||||
|
@@ -62,7 +62,7 @@
|
||||||
|
template <typename T>
|
||||||
|
concept with_get_executor = requires (T& t)
|
||||||
|
{
|
||||||
|
- {t.get_executor()} -> asio::execution::executor;
|
||||||
|
+ t.get_executor();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
diff -ruN a/libs/context/CMakeLists.txt b/libs/context/CMakeLists.txt
|
||||||
|
--- a/libs/context/CMakeLists.txt 2025-04-12 18:25:53.847233801 +0200
|
||||||
|
+++ b/libs/context/CMakeLists.txt 2025-04-12 18:29:33.436479899 +0200
|
||||||
|
@@ -189,7 +189,7 @@
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set_property(SOURCE ${ASM_SOURCES} APPEND PROPERTY COMPILE_OPTIONS "-x" "assembler-with-cpp")
|
||||||
|
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MSVC)
|
||||||
|
set_property(SOURCE ${ASM_SOURCES} APPEND PROPERTY COMPILE_OPTIONS "-Wno-unused-command-line-argument")
|
||||||
|
endif()
|
||||||
|
|
|
@ -748,6 +748,49 @@ if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja")
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Adjustments for Clang-cl
|
||||||
|
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND ARCHITECTURE STREQUAL "x86_64")
|
||||||
|
set(LLVM_MINGW_VERSION 20250402)
|
||||||
|
# Set download URL and library path within the ZIP
|
||||||
|
set(ZIP_URL "https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64.zip")
|
||||||
|
set(LIB_PATH "llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64/lib/clang/20/lib/windows/libclang_rt.builtins-x86_64.a")
|
||||||
|
# Set paths for download and extraction
|
||||||
|
set(DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/llvm-mingw-download")
|
||||||
|
set(ZIP_FILE "${DOWNLOAD_DIR}/llvm-mingw.zip")
|
||||||
|
set(EXTRACTED_LIB "${DOWNLOAD_DIR}/${LIB_PATH}")
|
||||||
|
# Create download directory if it doesn't exist
|
||||||
|
file(MAKE_DIRECTORY "${DOWNLOAD_DIR}")
|
||||||
|
# Download and extract if the library doesn't exist
|
||||||
|
if(NOT EXISTS "${EXTRACTED_LIB}")
|
||||||
|
message(STATUS "Downloading llvm-mingw runtime libraries...")
|
||||||
|
# Download the ZIP file
|
||||||
|
file(DOWNLOAD
|
||||||
|
${ZIP_URL}
|
||||||
|
${ZIP_FILE}
|
||||||
|
SHOW_PROGRESS
|
||||||
|
# Uncomment and add EXPECTED_HASH if you know the SHA256 checksum
|
||||||
|
EXPECTED_HASH SHA256=4edc13d878b4ec49c2f1a6e9161abb093bbaefc8b7d129f3b3f57a22a4a41d38
|
||||||
|
)
|
||||||
|
message(STATUS "Extracting compiler-rt builtins library...")
|
||||||
|
# Extract the specific file from the ZIP
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E tar xvf "${ZIP_FILE}" "${LIB_PATH}"
|
||||||
|
WORKING_DIRECTORY "${DOWNLOAD_DIR}"
|
||||||
|
RESULT_VARIABLE extraction_result
|
||||||
|
)
|
||||||
|
if(NOT extraction_result EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed to extract library: ${extraction_result}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
# Create imported target for the library
|
||||||
|
add_library(llvm-mingw-runtime STATIC IMPORTED)
|
||||||
|
set_target_properties(llvm-mingw-runtime PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${EXTRACTED_LIB}"
|
||||||
|
)
|
||||||
|
# Link the library to all executables in the project
|
||||||
|
link_libraries(llvm-mingw-runtime)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (YUZU_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (YUZU_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# We will assume that if the compiler is GCC, it will attempt to use ld.bfd by default.
|
# We will assume that if the compiler is GCC, it will attempt to use ld.bfd by default.
|
||||||
# Try to pick a faster linker.
|
# Try to pick a faster linker.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue