2010-01-21 15:12:50 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2021-07-04 05:24:21 +00:00
|
|
|
# Search all libraries on the system
|
2010-01-21 15:12:50 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2024-03-28 06:33:55 +00:00
|
|
|
find_package(Git)
|
|
|
|
|
|
|
|
# Require threads on all OSes.
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
# Dependency libraries.
|
|
|
|
# On macOS, Mono.framework contains an ancient version of libpng. We don't want that.
|
|
|
|
# Avoid it by telling cmake to avoid finding frameworks while we search for libpng.
|
|
|
|
set(FIND_FRAMEWORK_BACKUP ${CMAKE_FIND_FRAMEWORK})
|
|
|
|
set(CMAKE_FIND_FRAMEWORK NEVER)
|
|
|
|
find_package(PNG 1.6.40 REQUIRED)
|
2024-03-28 07:00:46 +00:00
|
|
|
find_package(JPEG REQUIRED) # No version because flatpak uses libjpeg-turbo.
|
2024-03-28 06:33:55 +00:00
|
|
|
find_package(ZLIB REQUIRED) # v1.3, but Mac uses the SDK version.
|
|
|
|
find_package(Zstd 1.5.5 REQUIRED)
|
|
|
|
find_package(LZ4 REQUIRED)
|
|
|
|
find_package(WebP REQUIRED) # v1.3.2, spews an error on Linux because no pkg-config.
|
|
|
|
find_package(SDL2 2.30.2 REQUIRED)
|
2024-04-06 08:18:22 +00:00
|
|
|
find_package(Freetype 2.13.1 REQUIRED)
|
2024-03-28 06:33:55 +00:00
|
|
|
|
2024-04-06 07:06:10 +00:00
|
|
|
if(USE_VULKAN)
|
|
|
|
find_package(Shaderc REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2024-03-28 06:33:55 +00:00
|
|
|
# Platform-specific dependencies.
|
2021-08-04 05:43:25 +00:00
|
|
|
if (WIN32)
|
2022-03-19 12:15:33 +00:00
|
|
|
add_subdirectory(3rdparty/D3D12MemAlloc EXCLUDE_FROM_ALL)
|
2023-08-24 02:38:51 +00:00
|
|
|
add_subdirectory(3rdparty/winpixeventruntime EXCLUDE_FROM_ALL)
|
2022-12-18 13:05:00 +00:00
|
|
|
set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/3rdparty/ffmpeg/include")
|
2021-10-12 02:48:44 +00:00
|
|
|
find_package(Vtune)
|
2023-07-19 14:03:40 +00:00
|
|
|
|
|
|
|
# Don't try to build tests for WIL, it needs NuGet.
|
|
|
|
set(WIL_BUILD_TESTS OFF CACHE BOOL "")
|
|
|
|
set(WIL_BUILD_PACKAGING OFF CACHE BOOL "")
|
|
|
|
add_subdirectory(3rdparty/wil EXCLUDE_FROM_ALL)
|
2013-01-02 13:34:38 +00:00
|
|
|
else()
|
2023-08-26 04:37:56 +00:00
|
|
|
find_package(CURL REQUIRED)
|
2024-03-28 06:33:55 +00:00
|
|
|
find_package(PCAP REQUIRED)
|
2021-08-04 05:43:25 +00:00
|
|
|
find_package(Vtune)
|
|
|
|
|
2022-12-18 13:05:00 +00:00
|
|
|
# Use bundled ffmpeg v4.x.x headers if we can't locate it in the system.
|
|
|
|
# We'll try to load it dynamically at runtime.
|
2023-01-01 15:49:02 +00:00
|
|
|
find_package(FFMPEG COMPONENTS avcodec avformat avutil swresample swscale)
|
|
|
|
if(NOT FFMPEG_FOUND)
|
2022-12-18 13:05:00 +00:00
|
|
|
message(WARNING "FFmpeg not found, using bundled headers.")
|
|
|
|
set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/3rdparty/ffmpeg/include")
|
|
|
|
endif()
|
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
## Use CheckLib package to find module
|
|
|
|
include(CheckLib)
|
|
|
|
|
2021-10-03 20:16:43 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2023-12-29 11:18:03 +00:00
|
|
|
if(LINUX)
|
2021-10-03 20:16:43 +00:00
|
|
|
check_lib(AIO aio libaio.h)
|
2023-12-30 04:24:09 +00:00
|
|
|
check_lib(LIBUDEV libudev libudev.h)
|
2021-08-04 05:43:25 +00:00
|
|
|
endif()
|
2021-10-03 20:16:43 +00:00
|
|
|
|
2023-09-16 05:01:13 +00:00
|
|
|
if(X11_API)
|
|
|
|
find_package(X11 REQUIRED)
|
|
|
|
if (NOT X11_Xrandr_FOUND)
|
|
|
|
message(FATAL_ERROR "XRandR extension is required")
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-11-21 09:47:00 +00:00
|
|
|
|
2022-05-04 12:42:37 +00:00
|
|
|
if(WAYLAND_API)
|
2023-07-05 09:33:44 +00:00
|
|
|
find_package(ECM REQUIRED NO_MODULE)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
|
|
|
|
find_package(Wayland REQUIRED Egl)
|
2022-05-04 12:42:37 +00:00
|
|
|
endif()
|
2023-03-19 15:36:49 +00:00
|
|
|
|
|
|
|
find_package(Libbacktrace)
|
2023-09-16 05:01:13 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(DBUS REQUIRED dbus-1)
|
2021-10-16 00:14:34 +00:00
|
|
|
endif()
|
2024-03-28 06:33:55 +00:00
|
|
|
endif()
|
2021-07-08 13:13:21 +00:00
|
|
|
|
2024-03-28 06:33:55 +00:00
|
|
|
set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP})
|
2023-07-19 13:09:04 +00:00
|
|
|
|
2020-08-19 08:19:28 +00:00
|
|
|
set(ACTUALLY_ENABLE_TESTS ${ENABLE_TESTS})
|
|
|
|
if(ENABLE_TESTS)
|
|
|
|
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/gtest/CMakeLists.txt")
|
|
|
|
message(WARNING "ENABLE_TESTS was on but gtest was not found, unit tests will not be enabled")
|
|
|
|
set(ACTUALLY_ENABLE_TESTS Off)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2023-08-26 04:37:56 +00:00
|
|
|
add_subdirectory(3rdparty/rapidyaml/rapidyaml EXCLUDE_FROM_ALL)
|
2022-05-12 11:53:35 +00:00
|
|
|
add_subdirectory(3rdparty/lzma EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/libchdr EXCLUDE_FROM_ALL)
|
2023-09-25 12:56:40 +00:00
|
|
|
disable_compiler_warnings_for_target(libchdr)
|
2023-06-28 14:58:02 +00:00
|
|
|
add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL)
|
2021-08-02 06:55:11 +00:00
|
|
|
|
2022-09-25 06:23:14 +00:00
|
|
|
# rapidyaml includes fast_float as a submodule, saves us pulling it in directly.
|
|
|
|
# Normally, we'd just pull in the cmake project, and link to it, but... it seems to enable
|
|
|
|
# permissive mode, which breaks other parts of PCSX2. So, we'll just create a target here
|
|
|
|
# for now.
|
|
|
|
#add_subdirectory(3rdparty/rapidyaml/rapidyaml/ext/c4core/src/c4/ext/fast_float EXCLUDE_FROM_ALL)
|
|
|
|
add_library(fast_float INTERFACE)
|
|
|
|
target_include_directories(fast_float INTERFACE 3rdparty/rapidyaml/rapidyaml/ext/c4core/src/c4/ext/fast_float/include)
|
|
|
|
|
2021-09-22 07:48:03 +00:00
|
|
|
add_subdirectory(3rdparty/simpleini EXCLUDE_FROM_ALL)
|
2021-09-14 09:11:59 +00:00
|
|
|
add_subdirectory(3rdparty/imgui EXCLUDE_FROM_ALL)
|
2021-10-31 09:21:35 +00:00
|
|
|
add_subdirectory(3rdparty/cpuinfo EXCLUDE_FROM_ALL)
|
2023-08-26 03:25:24 +00:00
|
|
|
disable_compiler_warnings_for_target(cpuinfo)
|
2022-09-24 14:05:52 +00:00
|
|
|
add_subdirectory(3rdparty/zydis EXCLUDE_FROM_ALL)
|
2023-08-24 02:30:24 +00:00
|
|
|
add_subdirectory(3rdparty/libzip EXCLUDE_FROM_ALL)
|
2023-09-16 05:19:51 +00:00
|
|
|
add_subdirectory(3rdparty/rcheevos EXCLUDE_FROM_ALL)
|
2023-09-16 05:24:34 +00:00
|
|
|
add_subdirectory(3rdparty/rapidjson EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/discord-rpc EXCLUDE_FROM_ALL)
|
2021-09-26 06:35:15 +00:00
|
|
|
|
2022-04-03 04:49:49 +00:00
|
|
|
if(USE_OPENGL)
|
|
|
|
add_subdirectory(3rdparty/glad EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
2021-11-06 06:53:01 +00:00
|
|
|
if(USE_VULKAN)
|
|
|
|
add_subdirectory(3rdparty/vulkan-headers EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
2023-08-26 04:37:56 +00:00
|
|
|
add_subdirectory(3rdparty/cubeb EXCLUDE_FROM_ALL)
|
|
|
|
disable_compiler_warnings_for_target(cubeb)
|
|
|
|
disable_compiler_warnings_for_target(speex)
|
|
|
|
|
|
|
|
# Find the Qt components that we need.
|
2024-03-08 13:46:30 +00:00
|
|
|
find_package(Qt6 6.6.2 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets LinguistTools REQUIRED)
|
2023-08-26 04:37:56 +00:00
|
|
|
|
2023-09-16 05:19:51 +00:00
|
|
|
if(WIN32)
|
|
|
|
add_subdirectory(3rdparty/rainterface EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
2023-08-26 04:37:56 +00:00
|
|
|
# Demangler for the debugger
|
|
|
|
add_subdirectory(3rdparty/demangler EXCLUDE_FROM_ALL)
|
|
|
|
|
2023-12-29 11:18:03 +00:00
|
|
|
# Prevent fmt from being built with exceptions, or being thrown at call sites.
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFMT_EXCEPTIONS=0")
|
|
|
|
add_subdirectory(3rdparty/fmt/fmt EXCLUDE_FROM_ALL)
|
|
|
|
|
2023-08-26 03:25:24 +00:00
|
|
|
# Deliberately at the end. We don't want to set the flag on third-party projects.
|
|
|
|
if(MSVC)
|
|
|
|
# Don't warn about "deprecated" POSIX functions.
|
2023-12-22 11:17:46 +00:00
|
|
|
add_definitions("-D_CRT_NONSTDC_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS" "-DCRT_SECURE_NO_DEPRECATE")
|
2023-08-26 03:25:24 +00:00
|
|
|
endif()
|