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
|
|
|
#-------------------------------------------------------------------------------
|
2015-07-27 22:54:04 +00:00
|
|
|
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
2021-07-04 05:24:21 +00:00
|
|
|
find_package(Git)
|
2015-07-27 22:54:04 +00:00
|
|
|
endif()
|
2021-08-04 05:43:25 +00:00
|
|
|
if (WIN32)
|
|
|
|
# We bundle everything on Windows
|
|
|
|
add_subdirectory(3rdparty/zlib EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/libpng EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/libjpeg EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL)
|
2021-07-06 18:12:40 +00:00
|
|
|
add_subdirectory(3rdparty/wil EXCLUDE_FROM_ALL)
|
2021-08-04 05:43:25 +00:00
|
|
|
add_subdirectory(3rdparty/xz EXCLUDE_FROM_ALL)
|
2022-03-19 12:15:33 +00:00
|
|
|
add_subdirectory(3rdparty/D3D12MemAlloc EXCLUDE_FROM_ALL)
|
2022-12-18 13:05:00 +00:00
|
|
|
set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/3rdparty/ffmpeg/include")
|
2013-01-02 13:34:38 +00:00
|
|
|
else()
|
2021-08-04 05:43:25 +00:00
|
|
|
find_package(PCAP REQUIRED)
|
|
|
|
find_package(LibLZMA REQUIRED)
|
|
|
|
make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
|
|
|
|
|
|
|
|
# Using find_package OpenGL without either setting your opengl preference to GLVND or LEGACY
|
|
|
|
# is deprecated as of cmake 3.11.
|
2022-04-03 04:49:49 +00:00
|
|
|
if(USE_OPENGL)
|
|
|
|
set(OpenGL_GL_PREFERENCE GLVND)
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
endif()
|
2022-10-08 04:51:52 +00:00
|
|
|
# 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)
|
2021-08-04 05:43:25 +00:00
|
|
|
find_package(PNG REQUIRED)
|
2022-10-08 04:51:52 +00:00
|
|
|
set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP})
|
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
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
|
|
|
## Use pcsx2 package to find module
|
|
|
|
include(FindLibc)
|
|
|
|
|
|
|
|
## Use CheckLib package to find module
|
|
|
|
include(CheckLib)
|
|
|
|
|
2021-10-03 20:16:43 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2022-04-03 04:49:49 +00:00
|
|
|
if(USE_OPENGL)
|
|
|
|
check_lib(EGL EGL EGL/egl.h)
|
|
|
|
endif()
|
2021-10-16 00:14:34 +00:00
|
|
|
if(X11_API)
|
|
|
|
check_lib(X11_XCB X11-xcb X11/Xlib-xcb.h)
|
|
|
|
check_lib(XCB xcb xcb/xcb.h)
|
2022-02-10 18:46:39 +00:00
|
|
|
check_lib(XRANDR Xrandr X11/extensions/Xrandr.h)
|
2021-10-16 00:14:34 +00:00
|
|
|
endif()
|
2021-10-03 20:16:43 +00:00
|
|
|
|
|
|
|
if(Linux)
|
|
|
|
check_lib(AIO aio libaio.h)
|
|
|
|
# There are two udev pkg config files - udev.pc (wrong), libudev.pc (correct)
|
|
|
|
# When cross compiling, pkg-config will be skipped so we have to look for
|
|
|
|
# udev (it'll automatically be prefixed with lib). But when not cross
|
|
|
|
# compiling, we have to look for libudev.pc. Argh. Hence the silliness below.
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
check_lib(LIBUDEV udev libudev.h)
|
|
|
|
else()
|
|
|
|
check_lib(LIBUDEV libudev libudev.h)
|
|
|
|
endif()
|
2021-08-04 05:43:25 +00:00
|
|
|
endif()
|
2021-07-04 05:24:21 +00:00
|
|
|
endif()
|
2021-10-03 20:16:43 +00:00
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
check_lib(SOUNDTOUCH SoundTouch SoundTouch.h PATH_SUFFIXES soundtouch)
|
2010-08-02 07:33:11 +00:00
|
|
|
|
2022-01-31 14:12:26 +00:00
|
|
|
if(NOT QT_BUILD)
|
2022-05-22 03:28:06 +00:00
|
|
|
find_optional_system_library(SDL2 3rdparty/sdl2 2.0.12)
|
2022-01-31 14:12:26 +00:00
|
|
|
endif()
|
2010-06-04 17:17:55 +00:00
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
find_package(X11 REQUIRED)
|
|
|
|
make_imported_target_if_missing(X11::X11 X11)
|
2021-11-21 09:47:00 +00:00
|
|
|
|
2022-05-04 12:42:37 +00:00
|
|
|
if(WAYLAND_API)
|
|
|
|
find_package(Wayland REQUIRED)
|
|
|
|
endif()
|
2023-03-19 15:36:49 +00:00
|
|
|
|
|
|
|
find_package(Libbacktrace)
|
2021-10-16 00:14:34 +00:00
|
|
|
endif()
|
2021-08-04 05:43:25 +00:00
|
|
|
endif(WIN32)
|
2019-08-24 22:50:02 +00:00
|
|
|
|
2021-07-08 13:13:21 +00:00
|
|
|
# Require threads on all OSes.
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
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-04-27 02:24:17 +00:00
|
|
|
if(GCC_VERSION VERSION_GREATER_EQUAL "9.0" AND GCC_VERSION VERSION_LESS "9.2")
|
2021-07-04 05:24:21 +00:00
|
|
|
message(WARNING "
|
|
|
|
It looks like you are compiling with 9.0.x or 9.1.x. Using these versions is not recommended,
|
|
|
|
as there is a bug known to cause the compiler to segfault while compiling. See patch
|
|
|
|
https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=275ab714637a64672c6630cfd744af2c70957d5a
|
|
|
|
Even with that patch, compiling with LTO may still segfault. Use at your own risk!
|
|
|
|
This text being in a compile log in an open issue may cause it to be closed.")
|
2020-05-07 15:31:48 +00:00
|
|
|
endif()
|
2020-11-09 00:28:43 +00:00
|
|
|
|
2022-05-22 03:28:06 +00:00
|
|
|
find_optional_system_library(fmt 3rdparty/fmt/fmt 7.1.3)
|
|
|
|
find_optional_system_library(ryml 3rdparty/rapidyaml/rapidyaml 0.4.0)
|
|
|
|
find_optional_system_library(zstd 3rdparty/zstd 1.4.5)
|
|
|
|
if (${zstd_TYPE} STREQUAL System)
|
|
|
|
alias_library(Zstd::Zstd zstd::libzstd_shared)
|
|
|
|
alias_library(pcsx2-zstd zstd::libzstd_shared)
|
2020-11-27 18:59:31 +00:00
|
|
|
endif()
|
2022-05-22 03:28:06 +00:00
|
|
|
find_optional_system_library(libzip 3rdparty/libzip 1.8.0)
|
2022-04-12 08:07:19 +00:00
|
|
|
|
2021-12-13 12:12:54 +00:00
|
|
|
if(QT_BUILD)
|
2022-01-31 14:12:26 +00:00
|
|
|
# Default to bundled Qt6 for Windows.
|
|
|
|
if(WIN32 AND NOT DEFINED Qt6_DIR)
|
2023-04-25 10:02:11 +00:00
|
|
|
set(Qt6_DIR ${CMAKE_SOURCE_DIR}/3rdparty/qt/6.5.0/msvc2022_64/lib/cmake/Qt6)
|
2022-01-31 14:12:26 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Find the Qt components that we need.
|
|
|
|
find_package(Qt6 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets Network LinguistTools REQUIRED)
|
|
|
|
|
2022-05-23 10:01:51 +00:00
|
|
|
if (APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET AND "${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_LESS 10.15)
|
|
|
|
get_target_property(QT_FEATURES Qt6::Core QT_ENABLED_PUBLIC_FEATURES)
|
|
|
|
if (cxx17_filesystem IN_LIST QT_FEATURES)
|
|
|
|
message("Qt compiled with std::filesystem support, requires macOS 10.15")
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-01-31 14:12:26 +00:00
|
|
|
# We use the bundled (latest) SDL version for Qt.
|
2022-05-22 03:28:06 +00:00
|
|
|
find_optional_system_library(SDL2 3rdparty/sdl2 2.0.22)
|
2022-04-18 10:15:31 +00:00
|
|
|
|
|
|
|
# rcheevos backend for RetroAchievements.
|
|
|
|
if(USE_ACHIEVEMENTS)
|
|
|
|
add_subdirectory(3rdparty/rcheevos EXCLUDE_FROM_ALL)
|
2023-03-31 12:36:24 +00:00
|
|
|
if(WIN32)
|
|
|
|
add_subdirectory(3rdparty/rainterface EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
2022-04-18 10:15:31 +00:00
|
|
|
endif()
|
2022-10-01 12:28:48 +00:00
|
|
|
|
|
|
|
# Discord-RPC library for rich presence.
|
|
|
|
if(USE_DISCORD_PRESENCE)
|
|
|
|
add_subdirectory(3rdparty/rapidjson EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/discord-rpc EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
# Demangler for the debugger
|
|
|
|
add_subdirectory(3rdparty/demangler EXCLUDE_FROM_ALL)
|
2021-12-13 12:12:54 +00:00
|
|
|
endif()
|
|
|
|
|
2022-04-18 10:07:08 +00:00
|
|
|
if(NOT WIN32 AND QT_BUILD)
|
|
|
|
find_package(CURL REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2022-05-12 11:53:35 +00:00
|
|
|
add_subdirectory(3rdparty/lzma EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/libchdr 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)
|
|
|
|
|
2022-08-22 13:20:58 +00:00
|
|
|
add_subdirectory(3rdparty/jpgd EXCLUDE_FROM_ALL)
|
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)
|
2022-09-24 14:05:52 +00:00
|
|
|
add_subdirectory(3rdparty/zydis 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/glslang EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/vulkan-headers EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
2021-09-26 06:35:15 +00:00
|
|
|
if(CUBEB_API)
|
|
|
|
add_subdirectory(3rdparty/cubeb EXCLUDE_FROM_ALL)
|
2022-03-01 05:14:52 +00:00
|
|
|
target_compile_options(cubeb PRIVATE "-w")
|
|
|
|
target_compile_options(speex PRIVATE "-w")
|
2021-09-26 06:35:15 +00:00
|
|
|
endif()
|
2021-09-14 09:11:59 +00:00
|
|
|
|