[cmake] some extra clang-cl fixes
NOTE: still does not compile due to masm, see GH@boostorg/content#313 Signed-off-by: crueter <crueter@crueter.xyz>
This commit is contained in:
parent
d16f1712b4
commit
f18c354fb6
7 changed files with 37 additions and 26 deletions
|
@ -11,16 +11,3 @@ index d49f2ec..a9bdb80 100644
|
|||
};
|
||||
|
||||
|
||||
diff --git a/libs/context/CMakeLists.txt b/libs/context/CMakeLists.txt
|
||||
index 5870537..f8c3e61 100644
|
||||
--- a/libs/context/CMakeLists.txt
|
||||
+++ b/libs/context/CMakeLists.txt
|
||||
@@ -189,7 +189,7 @@ if(BOOST_CONTEXT_IMPLEMENTATION STREQUAL "fcontext")
|
||||
|
||||
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()
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|||
set(PLATFORM_LINUX ON)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(CXX_CLANG ON)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
|
||||
if (PLATFORM_SUN)
|
||||
|
@ -29,6 +33,19 @@ if (PLATFORM_SUN)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# clang-cl prints literally 10000+ warnings without this
|
||||
if (MSVC AND CXX_CLANG)
|
||||
add_compile_options(
|
||||
-Wno-unused-command-line-argument
|
||||
-Wno-unsafe-buffer-usage
|
||||
-Wno-unused-value
|
||||
-Wno-extra-semi-stmt
|
||||
-Wno-sign-conversion
|
||||
-Wno-reserved-identifier
|
||||
-Wno-deprecated-declarations
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cache/cpm)
|
||||
|
||||
include(DownloadExternals)
|
||||
|
@ -36,7 +53,7 @@ include(CMakeDependentOption)
|
|||
include(CTest)
|
||||
|
||||
# Disable Warnings as Errors for MSVC
|
||||
if (MSVC)
|
||||
if (MSVC AND NOT CXX_CLANG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX-")
|
||||
endif()
|
||||
|
||||
|
@ -274,7 +291,7 @@ if (YUZU_ROOM)
|
|||
endif()
|
||||
|
||||
# Build/optimization presets
|
||||
if (PLATFORM_LINUX)
|
||||
if (PLATFORM_LINUX OR CXX_CLANG)
|
||||
if (ARCHITECTURE_x86_64)
|
||||
set(YUZU_BUILD_PRESET "custom" CACHE STRING "Build preset to use. One of: custom, generic, v3, zen2, zen4, native")
|
||||
if (${YUZU_BUILD_PRESET} STREQUAL "generic")
|
||||
|
@ -749,7 +766,7 @@ if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja")
|
|||
endif()
|
||||
|
||||
# Adjustments for clang-cl
|
||||
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (MSVC AND CXX_CLANG)
|
||||
if (ARCHITECTURE_x86_64)
|
||||
set(FILE_ARCH x86_64)
|
||||
elseif (ARCHITECTURE_arm64)
|
||||
|
@ -763,7 +780,7 @@ if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|||
|
||||
add_library(llvm-mingw-runtime STATIC IMPORTED)
|
||||
set_target_properties(llvm-mingw-runtime PROPERTIES
|
||||
IMPORTED_LOCATION "${EXTRACTED_LIB}"
|
||||
IMPORTED_LOCATION "${LIB_PATH}"
|
||||
)
|
||||
|
||||
link_libraries(llvm-mingw-runtime)
|
||||
|
|
|
@ -108,8 +108,8 @@
|
|||
},
|
||||
"boost_headers": {
|
||||
"repo": "boostorg/headers",
|
||||
"sha": "0456900fad",
|
||||
"hash": "50cd75dcdfc5f082225cdace058f47b4fb114a47585f7aee1d22236a910a80b667186254c214fa2fcebac67ae6d37ba4b6e695e1faea8affd6fd42a03cf996e3",
|
||||
"sha": "95930ca8f5",
|
||||
"hash": "d1dece16f3b209109de02123c537bfe1adf07a62b16c166367e7e5d62e0f7c323bf804c89b3192dd6871bc58a9d879d25a1cc3f7b9da0e497cf266f165816e2a",
|
||||
"bundled": true
|
||||
},
|
||||
"discord-rpc": {
|
||||
|
|
5
externals/CMakeLists.txt
vendored
5
externals/CMakeLists.txt
vendored
|
@ -63,7 +63,8 @@ if (mbedtls_ADDED)
|
|||
if (NOT MSVC)
|
||||
target_compile_options(mbedcrypto PRIVATE
|
||||
-Wno-unused-but-set-variable
|
||||
-Wno-string-concatenation)
|
||||
-Wno-string-concatenation
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -84,6 +85,8 @@ if(MSVC AND USE_CCACHE AND sirit_ADDED)
|
|||
list(FILTER _opts EXCLUDE REGEX "/Zi")
|
||||
list(APPEND _opts "/Z7")
|
||||
set_target_properties(sirit PROPERTIES COMPILE_OPTIONS "${_opts}")
|
||||
elseif(MSVC AND CXX_CLANG)
|
||||
target_compile_options(sirit PRIVATE -Wno-error=unused-command-line-argument)
|
||||
endif()
|
||||
|
||||
# httplib
|
||||
|
|
|
@ -69,10 +69,6 @@ if (MSVC)
|
|||
/external:anglebrackets # Treats all headers included by #include <header>, where the header file is enclosed in angle brackets (< >), as external headers
|
||||
/external:W0 # Sets the default warning level to 0 for external headers, effectively disabling warnings for them.
|
||||
|
||||
# Warnings
|
||||
/W4
|
||||
/WX-
|
||||
|
||||
/we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled
|
||||
/we4189 # 'identifier': local variable is initialized but not referenced
|
||||
/we4265 # 'class': class has virtual functions, but destructor is not virtual
|
||||
|
@ -97,6 +93,14 @@ if (MSVC)
|
|||
/wd4702 # unreachable code (when used with LTO)
|
||||
)
|
||||
|
||||
if (NOT CXX_CLANG)
|
||||
add_compile_options(
|
||||
# Warnings
|
||||
/W4
|
||||
/WX-
|
||||
)
|
||||
endif()
|
||||
|
||||
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
|
||||
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
|
||||
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
|
||||
|
|
|
@ -245,7 +245,7 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if(CXX_CLANG)
|
||||
target_compile_options(common PRIVATE -fsized-deallocation
|
||||
-Werror=unreachable-code-aggressive)
|
||||
target_compile_definitions(
|
||||
|
|
|
@ -256,7 +256,7 @@ if (YUZU_CRASH_DUMPS)
|
|||
target_compile_definitions(yuzu PRIVATE YUZU_CRASH_DUMPS)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (CXX_CLANG)
|
||||
target_compile_definitions(yuzu PRIVATE
|
||||
$<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue