From 71ce4224fba66b469c609955100996ed173ef0ff Mon Sep 17 00:00:00 2001 From: oltolm Date: Thu, 16 Jan 2025 18:17:13 +0100 Subject: [PATCH] cmake: fix build after 3rdparty updates --- 3rdparty/curl/CMakeLists.txt | 13 +++---------- 3rdparty/libpng/CMakeLists.txt | 5 ----- 3rdparty/llvm/CMakeLists.txt | 18 +++++++++--------- BUILDING.md | 2 +- buildfiles/cmake/FindWolfSSL.cmake | 4 ++++ buildfiles/cmake/FindZLIB.cmake | 11 +++++++++++ rpcs3/Emu/CMakeLists.txt | 5 +++++ rpcs3/Emu/NP/rpcn_client.h | 1 + 8 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 buildfiles/cmake/FindWolfSSL.cmake create mode 100644 buildfiles/cmake/FindZLIB.cmake diff --git a/3rdparty/curl/CMakeLists.txt b/3rdparty/curl/CMakeLists.txt index f7e904781d..d8fc5790fc 100644 --- a/3rdparty/curl/CMakeLists.txt +++ b/3rdparty/curl/CMakeLists.txt @@ -11,12 +11,13 @@ else() set(BUILD_STATIC_CURL OFF CACHE BOOL "Set to ON to build curl executable with static libcurl.") set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libcurl.") set(BUILD_SHARED_LIBS OFF CACHE BOOL "Set to ON to build shared libcurl.") - # If set to ON then CURL can not find our wolfssl - set(CURL_USE_WOLFSSL OFF CACHE BOOL "enable wolfSSL for SSL/TLS") + find_package(WolfSSL REQUIRED) + set(CURL_USE_WOLFSSL ON CACHE BOOL "enable wolfSSL for SSL/TLS") set(CURL_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental") set(HTTP_ONLY ON CACHE BOOL "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)") 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'.") + 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() @@ -26,18 +27,10 @@ else() set(CURL_USE_LIBSSH2 OFF CACHE BOOL "Use libSSH2") set(CURL_USE_LIBPSL OFF CACHE BOOL "Use libPSL") - set(SSL_ENABLED ON) - set(USE_WOLFSSL ON) - set(SHARE_LIB_OBJECT OFF) set(CURL_DISABLE_TESTS ON) add_subdirectory(curl EXCLUDE_FROM_ALL) - target_link_libraries(libcurl_static PRIVATE wolfssl) - if(MSVC) - target_compile_definitions(libcurl_static PRIVATE HAVE_SSIZE_T) - endif() - add_library(3rdparty_libcurl INTERFACE) target_link_libraries(3rdparty_libcurl INTERFACE libcurl_static) diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index c65f8b078f..f24c2c9709 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -4,11 +4,6 @@ if (NOT USE_SYSTEM_LIBPNG) # We use libpng's static library and don't need to build the shared library and run the tests set(PNG_SHARED OFF CACHE BOOL "Build shared lib") set(PNG_TESTS OFF CACHE BOOL "Build libpng tests") - if (NOT USE_SYSTEM_ZLIB) - set(PNG_BUILD_ZLIB ON CACHE BOOL "Custom zlib location, else find_package is used") - add_library(ZLIB::ZLIB INTERFACE IMPORTED) - target_link_libraries(ZLIB::ZLIB INTERFACE 3rdparty_zlib) - endif() set(SKIP_INSTALL_ALL ON) add_subdirectory(libpng EXCLUDE_FROM_ALL) target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}") diff --git a/3rdparty/llvm/CMakeLists.txt b/3rdparty/llvm/CMakeLists.txt index e2eb18f129..a643374c24 100644 --- a/3rdparty/llvm/CMakeLists.txt +++ b/3rdparty/llvm/CMakeLists.txt @@ -6,15 +6,15 @@ if(WITH_LLVM) message(STATUS "LLVM will be built from the submodule.") set(LLVM_TARGETS_TO_BUILD "AArch64;X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") - option(LLVM_BUILD_RUNTIME OFF) - option(LLVM_BUILD_TOOLS OFF) - option(LLVM_INCLUDE_BENCHMARKS OFF) - option(LLVM_INCLUDE_DOCS OFF) - option(LLVM_INCLUDE_EXAMPLES OFF) - option(LLVM_INCLUDE_TESTS OFF) - option(LLVM_INCLUDE_TOOLS OFF) - option(LLVM_INCLUDE_UTILS OFF) - option(LLVM_CCACHE_BUILD OFF) + option(LLVM_BUILD_RUNTIME "Build the LLVM runtime libraries." OFF) + option(LLVM_BUILD_TOOLS "Build the LLVM tools. If OFF, just generate build targets." OFF) + option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." OFF) + option(LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." OFF) + option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" OFF) + option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." OFF) + option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." OFF) + option(LLVM_INCLUDE_UTILS "Generate build targets for the LLVM utils." OFF) + option(LLVM_CCACHE_BUILD "Set to ON for a ccache enabled build" OFF) set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.") # For Windows x86 (not Windows AArch64). diff --git a/BUILDING.md b/BUILDING.md index cc868c1352..2dd3e4a524 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -31,7 +31,7 @@ In order to build **RPCS3** with the `sln` solution (with **Visual Studio**), ** **NOTE:** If you have issues with the **Visual Studio Qt Plugin**, you may want to uninstall it and install the [Legacy Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.LEGACYQtVisualStudioTools2022) instead. In order to build **RPCS3** with the `CMake` solution (with both **Visual Studio** and standalone **CMake** tool): -- add and set the `CMAKE_PREFIX_PATH` environment variable to the **Qt** libs path, e.g. `\6.8.1\msvc2022_64\` +- add and set the `Qt6_ROOT` environment variable to the **Qt** libs path, e.g. `\6.8.1\msvc2022_64\` ### Linux diff --git a/buildfiles/cmake/FindWolfSSL.cmake b/buildfiles/cmake/FindWolfSSL.cmake new file mode 100644 index 0000000000..d2e30be60b --- /dev/null +++ b/buildfiles/cmake/FindWolfSSL.cmake @@ -0,0 +1,4 @@ +set(WOLFSSL_LIBRARY ON) +set(WOLFSSL_INCLUDE_DIR ON) +set(WOLFSSL_LIBRARIES wolfssl) +set(WOLFSSL_FOUND TRUE) diff --git a/buildfiles/cmake/FindZLIB.cmake b/buildfiles/cmake/FindZLIB.cmake new file mode 100644 index 0000000000..0a29abafa9 --- /dev/null +++ b/buildfiles/cmake/FindZLIB.cmake @@ -0,0 +1,11 @@ +if(USE_SYSTEM_ZLIB) + list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + find_package(ZLIB) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) +else() + add_library(ZLIB::ZLIB INTERFACE IMPORTED) + set_target_properties(ZLIB::ZLIB PROPERTIES + INTERFACE_LINK_LIBRARIES zlibstatic + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/3rdparty/zlib/zlib;${CMAKE_BINARY_DIR}/3rdparty/zlib/zlib") + set(ZLIB_FOUND TRUE) +endif() diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index 97016dbb04..e52a66b33d 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -619,6 +619,11 @@ if(TARGET 3rdparty_vulkan) RSX/VK/VKVertexProgram.cpp RSX/VK/VKTextureCache.cpp ) + if(MSVC) + set_source_files_properties(RSX/VK/vkutils/shared.cpp PROPERTIES + COMPILE_FLAGS /EHs- + SKIP_PRECOMPILE_HEADERS ON) + endif() endif() target_link_libraries(rpcs3_emu diff --git a/rpcs3/Emu/NP/rpcn_client.h b/rpcs3/Emu/NP/rpcn_client.h index fb8921076a..feb085b057 100644 --- a/rpcs3/Emu/NP/rpcn_client.h +++ b/rpcs3/Emu/NP/rpcn_client.h @@ -33,6 +33,7 @@ #ifdef __clang__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wextern-c-compat" #endif #include #ifdef __clang__