1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

improve CMake files

Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
This commit is contained in:
oltolm 2024-05-02 13:53:18 +02:00 committed by Megamouse
parent 99b44cf33a
commit 065a64371e
11 changed files with 33 additions and 32 deletions

View File

@ -224,7 +224,7 @@ if(USE_FAUDIO)
if (USE_SYSTEM_FAUDIO) if (USE_SYSTEM_FAUDIO)
if (NOT SDL2_FOUND OR SDL2_VERSION VERSION_LESS 2.0.12) if (NOT SDL2_FOUND OR SDL2_VERSION VERSION_LESS 2.0.12)
message(WARNING message(WARNING
"RPCS3: FAudio requires SDL 2.0.9 or newer. Please note, this warning" "RPCS3: System FAudio requires SDL 2.0.9 or newer. Please note, this warning"
"can also be displayed with SDL2 versions between 2.0.9-2.0.12, as the" "can also be displayed with SDL2 versions between 2.0.9-2.0.12, as the"
"CMake config files are not correctly installed. Since a valid SDL2" "CMake config files are not correctly installed. Since a valid SDL2"
">=2.0.9 version cannot be found, building with FAudio will be skipped.") ">=2.0.9 version cannot be found, building with FAudio will be skipped.")
@ -329,8 +329,7 @@ if(USE_SDL)
message(STATUS "Using system SDL2") message(STATUS "Using system SDL2")
add_library(3rdparty_sdl2 INTERFACE) add_library(3rdparty_sdl2 INTERFACE)
target_compile_definitions(3rdparty_sdl2 INTERFACE -DHAVE_SDL2=1) target_compile_definitions(3rdparty_sdl2 INTERFACE -DHAVE_SDL2=1)
target_include_directories(3rdparty_sdl2 INTERFACE ${SDL2_INCLUDE_DIRS}) target_link_libraries(3rdparty_sdl2 INTERFACE SDL2::SDL2)
target_link_libraries(3rdparty_sdl2 INTERFACE ${SDL2_LIBRARIES})
set(SDL2_TARGET 3rdparty_sdl2) set(SDL2_TARGET 3rdparty_sdl2)
else() else()
message(FATAL_ERROR "SDL2 is not available on this system") message(FATAL_ERROR "SDL2 is not available on this system")

View File

@ -1,11 +1,13 @@
# OpenAL # OpenAL
if (WIN32) if(USE_SYSTEM_OPENAL)
find_path(OPENAL_INCLUDE_DIR al.h PATHS include/)
find_library(OPENAL_LIBRARY OpenAL32 PATHS libs/Win64/)
else()
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
add_library(3rdparty_openal INTERFACE)
target_include_directories(3rdparty_openal INTERFACE ${OPENAL_INCLUDE_DIR})
target_link_libraries(3rdparty_openal INTERFACE ${OPENAL_LIBRARY})
else()
option(ALSOFT_UTILS "Build utility programs" OFF)
option(ALSOFT_EXAMPLES "Build example programs" OFF)
add_subdirectory(openal-soft EXCLUDE_FROM_ALL)
add_library(3rdparty_openal INTERFACE)
target_link_libraries(3rdparty_openal INTERFACE OpenAL::OpenAL)
endif() endif()
add_library(3rdparty_openal INTERFACE)
target_include_directories(3rdparty_openal INTERFACE ${OPENAL_INCLUDE_DIR})
target_link_libraries(3rdparty_openal INTERFACE ${OPENAL_LIBRARY})

View File

@ -29,6 +29,7 @@ else()
set(SSL_ENABLED ON) set(SSL_ENABLED ON)
set(USE_WOLFSSL ON) set(USE_WOLFSSL ON)
set(SHARE_LIB_OBJECT OFF) set(SHARE_LIB_OBJECT OFF)
set(CURL_DISABLE_TESTS ON)
add_subdirectory(curl EXCLUDE_FROM_ALL) add_subdirectory(curl EXCLUDE_FROM_ALL)

View File

@ -14,7 +14,7 @@ if(WITH_LLVM)
option(LLVM_INCLUDE_TESTS OFF) option(LLVM_INCLUDE_TESTS OFF)
option(LLVM_INCLUDE_TOOLS OFF) option(LLVM_INCLUDE_TOOLS OFF)
option(LLVM_INCLUDE_UTILS OFF) option(LLVM_INCLUDE_UTILS OFF)
option(LLVM_CCACHE_BUILD ON) option(LLVM_CCACHE_BUILD OFF)
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.") set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.")
if(WIN32) if(WIN32)

View File

@ -1,3 +1,4 @@
option(RTMIDI_API_JACK "Compile with JACK support." OFF) option(RTMIDI_API_JACK "Compile with JACK support." OFF)
option(RTMIDI_BUILD_TESTING "Build test programs" OFF)
set(RTMIDI_TARGETNAME_UNINSTALL "uninstall-rpcs3-rtmidi") set(RTMIDI_TARGETNAME_UNINSTALL "uninstall-rpcs3-rtmidi")
add_subdirectory(rtmidi EXCLUDE_FROM_ALL) add_subdirectory(rtmidi EXCLUDE_FROM_ALL)

View File

@ -4,21 +4,21 @@ if(USE_SYSTEM_WOLFSSL)
add_library(wolfssl INTERFACE) add_library(wolfssl INTERFACE)
target_link_libraries(wolfssl INTERFACE PkgConfig::WolfSSL) target_link_libraries(wolfssl INTERFACE PkgConfig::WolfSSL)
else() else()
set(WOLFSSL_TLS13 OFF CACHE STRING "Enable wolfSSL TLS v1.3 (default: enabled)") option(WOLFSSL_TLS13 "Enable wolfSSL TLS v1.3 (default: enabled)" OFF)
set(WOLFSSL_SHA3 ON CACHE STRING "Enable wolfSSL SHA-3 support (default: enabled on x86_64/aarch64)") set(WOLFSSL_SHA3 ON CACHE STRING "Enable wolfSSL SHA-3 support (default: enabled on x86_64/aarch64)")
set(WOLFSSL_SHAKE256 ON CACHE STRING "Enable wolfSSL SHAKE256 support (default: enabled on x86_64/aarch64)") set(WOLFSSL_SHAKE256 ON CACHE STRING "Enable wolfSSL SHAKE256 support (default: enabled on x86_64/aarch64)")
set(WOLFSSL_BASE64_ENCODE OFF CACHE STRING "Enable Base64 encoding (default: enabled on x86_64)") option(WOLFSSL_BASE64_ENCODE "Enable Base64 encoding (default: enabled on x86_64)" OFF)
set(WOLFSSL_DES3 ON CACHE STRING "Enable DES3 (default: disabled)") option(WOLFSSL_DES3 "Enable DES3 (default: disabled)" ON)
set(WOLFSSL_PWDBASED ON CACHE STRING "Enable PWDBASED (default: disabled)") option(WOLFSSL_PWDBASED "Enable PWDBASED (default: disabled)" ON)
set(WOLFSSL_FAST_MATH ON CACHE STRING "Enable fast math ops (default: disabled)") option(WOLFSSL_FAST_MATH "Enable fast math ops (default: disabled)" ON)
set(WOLFSSL_EXAMPLES OFF CACHE STRING "Enable examples (default: enabled)") option(WOLFSSL_EXAMPLES "Enable examples (default: enabled)" OFF)
set(WOLFSSL_CRYPT_TESTS OFF CACHE STRING "Enable Crypt Bench/Test (default: enabled)") option(WOLFSSL_CRYPT_TESTS "Enable Crypt Bench/Test (default: enabled)" OFF)
set(WOLFSSL_ASYNC_THREADS OFF CACHE STRING "Enable Asynchronous Threading (default: enabled)") option(WOLFSSL_ASYNC_THREADS "Enable Asynchronous Threading (default: enabled)" OFF)
set(WOLFSSL_BUILD_OUT_OF_TREE ON CACHE STRING "Don't generate files in the source tree (default: no)") option(WOLFSSL_BUILD_OUT_OF_TREE "Don't generate files in the source tree (default: yes)" ON)
set(WOLFSSL_SNI ON CACHE STRING "Enable SNI (default: disabled)") option(WOLFSSL_SNI "Enable SNI (default: disabled)" ON)
set(WOLFSSL_OPENSSLEXTRA ON CACHE STRING "Enable extra OpenSSL API, size+ (default: disabled)") option(WOLFSSL_OPENSSLEXTRA "Enable extra OpenSSL API, size+ (default: disabled)" ON)
set(WOLFSSL_HARDEN OFF CACHE STRING "Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)") option(WOLFSSL_HARDEN "Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)" OFF)
set(WOLFSSL_ALT_CERT_CHAINS ON CACHE STRING "Enable support for Alternate certification chains (default: disabled)") option(WOLFSSL_ALT_CERT_CHAINS "Enable support for Alternate certification chains (default: disabled)" ON)
add_subdirectory(wolfssl EXCLUDE_FROM_ALL) add_subdirectory(wolfssl EXCLUDE_FROM_ALL)

View File

@ -6,6 +6,7 @@ if (USE_SYSTEM_ZLIB)
target_link_libraries(3rdparty_zlib INTERFACE ZLIB::ZLIB) target_link_libraries(3rdparty_zlib INTERFACE ZLIB::ZLIB)
target_compile_definitions(3rdparty_zlib INTERFACE -DZLIB_CONST=1) target_compile_definitions(3rdparty_zlib INTERFACE -DZLIB_CONST=1)
else() else()
option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" OFF)
message(STATUS "RPCS3: Using builtin ZLIB") message(STATUS "RPCS3: Using builtin ZLIB")
set(SKIP_INSTALL_ALL ON) set(SKIP_INSTALL_ALL ON)
add_subdirectory(zlib EXCLUDE_FROM_ALL) add_subdirectory(zlib EXCLUDE_FROM_ALL)
@ -14,8 +15,4 @@ else()
target_link_libraries(3rdparty_zlib INTERFACE zlibstatic) target_link_libraries(3rdparty_zlib INTERFACE zlibstatic)
target_include_directories(3rdparty_zlib INTERFACE zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib) target_include_directories(3rdparty_zlib INTERFACE zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
target_compile_definitions(3rdparty_zlib INTERFACE -DZLIB_CONST=1) target_compile_definitions(3rdparty_zlib INTERFACE -DZLIB_CONST=1)
if(NOT MSVC)
set(ZLIB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/zlib PARENT_SCOPE)
endif()
endif() endif()

View File

@ -1,6 +1,7 @@
option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF) option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF)
option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF) option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON) option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
option(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
add_subdirectory(zstd/build/cmake EXLUDE_FROM_ALL) add_subdirectory(zstd/build/cmake EXLUDE_FROM_ALL)
add_library(3rdparty_zstd INTERFACE) add_library(3rdparty_zstd INTERFACE)

View File

@ -27,6 +27,7 @@ option(USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF)
option(USE_SDL "Enables SDL input handler" OFF) option(USE_SDL "Enables SDL input handler" OFF)
option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" OFF) option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" OFF)
option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF) option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF)
option(USE_SYSTEM_OPENAL "Prefer system OpenAL instead of the prebuild one" ON)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake")

View File

@ -96,8 +96,7 @@ target_link_libraries(rpcs3 PRIVATE ${ADDITIONAL_LIBS})
# Unix display manager # Unix display manager
if(X11_FOUND) if(X11_FOUND)
target_include_directories(rpcs3 PUBLIC ${X11_INCLUDE_DIR}) target_link_libraries(rpcs3 PRIVATE X11::X11)
target_link_libraries(rpcs3 PRIVATE ${X11_LIBRARIES})
elseif(USE_VULKAN AND UNIX AND NOT WAYLAND_FOUND AND NOT APPLE) elseif(USE_VULKAN AND UNIX AND NOT WAYLAND_FOUND AND NOT APPLE)
# Wayland has been checked in 3rdparty/CMakeLists.txt already. # Wayland has been checked in 3rdparty/CMakeLists.txt already.
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.")

View File

@ -132,7 +132,7 @@ target_sources(rpcs3_emu PRIVATE
if(USE_FAUDIO) if(USE_FAUDIO)
find_package(SDL2) find_package(SDL2)
if(SDL2_FOUND AND NOT SDL2_VERSION VERSION_LESS 2.0.9) if(SDL2_FOUND AND SDL2_VERSION VERSION_GREATER_EQUAL 2.0.9)
target_sources(rpcs3_emu PRIVATE target_sources(rpcs3_emu PRIVATE
Audio/FAudio/FAudioBackend.cpp Audio/FAudio/FAudioBackend.cpp
Audio/FAudio/faudio_enumerator.cpp Audio/FAudio/faudio_enumerator.cpp