CMake: remove option USE_MSVC_STATIC_CRT and clean up
This commit is contained in:
Vendored
-3
@@ -18,9 +18,6 @@ else()
|
|||||||
set(USE_LIBIDN2 OFF CACHE BOOL "Use libidn2 for IDN support") # Disabled because MacOS CI doesn't work otherwise
|
set(USE_LIBIDN2 OFF CACHE BOOL "Use libidn2 for IDN support") # Disabled because MacOS CI doesn't work otherwise
|
||||||
set(CURL_CA_PATH "none" CACHE STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
set(CURL_CA_PATH "none" CACHE STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||||
option(CURL_DISABLE_INSTALL "Disable installation targets" ON)
|
option(CURL_DISABLE_INSTALL "Disable installation targets" ON)
|
||||||
if(USE_MSVC_STATIC_CRT)
|
|
||||||
set(CURL_STATIC_CRT ON CACHE BOOL "Use static crt to build curl")
|
|
||||||
endif()
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(ENABLE_UNICODE ON CACHE BOOL "enable Unicode")
|
set(ENABLE_UNICODE ON CACHE BOOL "enable Unicode")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Vendored
+2
@@ -20,6 +20,8 @@ else()
|
|||||||
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
|
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
|
||||||
option(protobuf_FORCE_FETCH_DEPENDENCIES "Force all dependencies to be downloaded from GitHub. Local installations will be ignored." OFF)
|
option(protobuf_FORCE_FETCH_DEPENDENCIES "Force all dependencies to be downloaded from GitHub. Local installations will be ignored." OFF)
|
||||||
option(protobuf_LOCAL_DEPENDENCIES_ONLY "Prevent downloading any dependencies from GitHub. If this option is set, the dependency must be available locally as an installed package." OFF)
|
option(protobuf_LOCAL_DEPENDENCIES_ONLY "Prevent downloading any dependencies from GitHub. If this option is set, the dependency must be available locally as an installed package." OFF)
|
||||||
|
option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
||||||
|
option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" OFF)
|
||||||
|
|
||||||
add_subdirectory(protobuf EXCLUDE_FROM_ALL)
|
add_subdirectory(protobuf EXCLUDE_FROM_ALL)
|
||||||
target_include_directories(3rdparty_protobuf SYSTEM INTERFACE protobuf/src)
|
target_include_directories(3rdparty_protobuf SYSTEM INTERFACE protobuf/src)
|
||||||
|
|||||||
+2
-49
@@ -86,50 +86,7 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT MSVC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
option(USE_MSVC_STATIC_CRT "Use static MSVC C runtime" OFF)
|
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/MP>")
|
||||||
|
|
||||||
# TODO(cjj19970505@live.cn)
|
|
||||||
# DiscordRPC binary in 3rdparty is compiled /MT
|
|
||||||
# So theoretically we should enable DiscordRPC in Release and static CRT build
|
|
||||||
# since we might encounter some rumtime issues when more than one CRT version are presented.
|
|
||||||
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160#what-problems-exist-if-an-application-uses-more-than-one-crt-version
|
|
||||||
# Add other DiscordRPC binaries(compiled with /MTd, /MD, /MDd) or compile it from source may address this issue.
|
|
||||||
if(NOT IS_MULTI_CONFIG)
|
|
||||||
if(NOT(CMAKE_BUILD_TYPE MATCHES "Release" AND USE_MSVC_STATIC_CRT))
|
|
||||||
set(USE_DISCORD_RPC OFF CACHE BOOL "Discord RPC is only available in Release and static CRT build." FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(USE_MSVC_STATIC_CRT)
|
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
||||||
else()
|
|
||||||
# though doc ( https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html )
|
|
||||||
# says if that property is not set then CMake uses the default value MultiThreaded$<$<CONFIG:Debug>:Debug>DLL
|
|
||||||
# to select a MSVC runtime library.
|
|
||||||
# But yaml-cpp set /MT(d) if CMAKE_MSVC_RUNTIME_LIBRARY is undefined
|
|
||||||
# So we have to define it explicitly
|
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# TODO(cjj19970505@live.cn)
|
|
||||||
# offical QT uses dynamic CRT.
|
|
||||||
# When building our lib with static CRT and debug build type
|
|
||||||
# and linking with Qt with dynamic CRT and debug build,
|
|
||||||
# error is encountered in runtime (which is expected).
|
|
||||||
# But building our lib with static CRT and release build type,
|
|
||||||
# and linking with Qt with dynamic CRT and release build seems to be working,
|
|
||||||
# which is the same config with VS solution.
|
|
||||||
# (though technically it might still have some hidden errors).
|
|
||||||
# So we allow static CRT in both relase and debug build, but prompt warning in debug build.
|
|
||||||
# For more info:
|
|
||||||
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160#what-problems-exist-if-an-application-uses-more-than-one-crt-version
|
|
||||||
# https://wiki.qt.io/Technical_FAQ#Why_does_a_statically_built_Qt_use_the_dynamic_Visual_Studio_runtime_libraries_.3F_Do_I_need_to_deploy_those_with_my_application_.3F
|
|
||||||
if(USE_MSVC_STATIC_CRT)
|
|
||||||
if(IS_MULTI_CONFIG OR CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
||||||
message(AUTHOR_WARNING "Debug build currently can not work with static CRT.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
add_compile_options(/MP)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
@@ -142,7 +99,7 @@ if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_options(/wd4530 /utf-8) # C++ exception handler used, but unwind semantics are not enabled
|
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/wd4530;/utf-8>") # C++ exception handler used, but unwind semantics are not enabled
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(3rdparty)
|
add_subdirectory(3rdparty)
|
||||||
@@ -161,10 +118,6 @@ if (NOT FOUND_LTO EQUAL -1)
|
|||||||
message(FATAL_ERROR "RPCS3 doesn't support building with LTO, use -DDISABLE_LTO=TRUE to force-disable it")
|
message(FATAL_ERROR "RPCS3 doesn't support building with LTO, use -DDISABLE_LTO=TRUE to force-disable it")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
add_compile_options(-pthread)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
## Look for Gamemode if its installed on Linux
|
## Look for Gamemode if its installed on Linux
|
||||||
if(LINUX)
|
if(LINUX)
|
||||||
## User chooses whether to Enable GameMode features or not
|
## User chooses whether to Enable GameMode features or not
|
||||||
|
|||||||
@@ -96,11 +96,6 @@ else()
|
|||||||
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
|
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
|
||||||
add_link_options(-Wl,--exclude-libs,ALL)
|
add_link_options(-Wl,--exclude-libs,ALL)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
add_compile_definitions(__STDC_FORMAT_MACROS=1)
|
|
||||||
|
|
||||||
# Workaround for mingw64 (MSYS2)
|
|
||||||
add_link_options(-Wl,--allow-multiple-definition)
|
|
||||||
|
|
||||||
# Increase stack limit to 8 MB
|
# Increase stack limit to 8 MB
|
||||||
add_link_options(-Wl,--stack -Wl,8388608)
|
add_link_options(-Wl,--stack -Wl,8388608)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -87,12 +87,6 @@ if (NOT ANDROID)
|
|||||||
message(FATAL_ERROR "RPCS3 requires either X11 or Wayland (or both) for Vulkan.")
|
message(FATAL_ERROR "RPCS3 requires either X11 or Wayland (or both) for Vulkan.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
||||||
find_package(Threads REQUIRED)
|
|
||||||
target_link_libraries(rpcs3_lib PRIVATE Threads::Threads)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(rpcs3_lib PRIVATE ws2_32 Iphlpapi Winmm Psapi gdi32 setupapi)
|
target_link_libraries(rpcs3_lib PRIVATE ws2_32 Iphlpapi Winmm Psapi gdi32 setupapi)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -645,6 +645,9 @@ if(TARGET 3rdparty_vulkan)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
endif()
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
target_link_libraries(rpcs3_emu
|
target_link_libraries(rpcs3_emu
|
||||||
|
|||||||
Reference in New Issue
Block a user