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/libsamplerate EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/baseclasses EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/pthreads4w 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/wxwidgets3.0 EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty/xz EXCLUDE_FROM_ALL)
|
2013-01-02 13:34:38 +00:00
|
|
|
else()
|
2021-08-04 05:43:25 +00:00
|
|
|
## Use cmake package to find module
|
|
|
|
if (Linux)
|
|
|
|
find_package(ALSA REQUIRED)
|
|
|
|
make_imported_target_if_missing(ALSA::ALSA ALSA)
|
|
|
|
endif()
|
|
|
|
find_package(PCAP REQUIRED)
|
|
|
|
find_package(LibXml2 REQUIRED)
|
|
|
|
make_imported_target_if_missing(LibXml2::LibXml2 LibXml2)
|
|
|
|
find_package(Gettext) # translation tool
|
|
|
|
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.
|
|
|
|
set(OpenGL_GL_PREFERENCE GLVND)
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
find_package(PNG REQUIRED)
|
|
|
|
find_package(Vtune)
|
|
|
|
|
|
|
|
# Does not require the module (allow to compile non-wx plugins)
|
|
|
|
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above)
|
|
|
|
# Warning do not put any double-quote for the argument...
|
|
|
|
# set(wxWidgets_CONFIG_OPTIONS --unicode=yes --debug=yes) # In case someone want to debug inside wx
|
|
|
|
#
|
|
|
|
# Fedora uses an extra non-standard option ... Arch must be the first option.
|
|
|
|
# They do uname -m if missing so only fix for cross compilations.
|
|
|
|
# http://pkgs.fedoraproject.org/cgit/wxGTK.git/plain/wx-config
|
|
|
|
if(Fedora AND CMAKE_CROSSCOMPILING)
|
|
|
|
set(wxWidgets_CONFIG_OPTIONS --arch ${PCSX2_TARGET_ARCHITECTURES} --unicode=yes)
|
|
|
|
else()
|
|
|
|
set(wxWidgets_CONFIG_OPTIONS --unicode=yes)
|
|
|
|
endif()
|
2015-01-04 00:56:50 +00:00
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
# I'm removing the version check, because it excludes newer versions and requires specifically 3.0.
|
|
|
|
#list(APPEND wxWidgets_CONFIG_OPTIONS --version=3.0)
|
2015-01-09 12:10:11 +00:00
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
# The wx version must be specified so a mix of gtk2 and gtk3 isn't used
|
|
|
|
# as that can cause compile errors.
|
|
|
|
if(GTK2_API AND NOT APPLE)
|
|
|
|
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk2)
|
|
|
|
elseif(NOT APPLE)
|
|
|
|
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3)
|
|
|
|
endif()
|
2015-01-09 12:10:11 +00:00
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
# wx2.8 => /usr/bin/wx-config-2.8
|
|
|
|
# lib32-wx2.8 => /usr/bin/wx-config32-2.8
|
|
|
|
# wx3.0 => /usr/bin/wx-config-3.0
|
|
|
|
# I'm going to take a wild guess and predict this:
|
|
|
|
# lib32-wx3.0 => /usr/bin/wx-config32-3.0
|
|
|
|
# FindwxWidgets only searches for wx-config.
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
# May need to fix the filenames for lib32-wx3.0.
|
|
|
|
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
|
|
|
|
if (Fedora AND EXISTS "/usr/bin/wx-config-3.0")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0")
|
|
|
|
endif()
|
|
|
|
if (EXISTS "/usr/bin/wx-config32")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32")
|
|
|
|
endif()
|
|
|
|
if (EXISTS "/usr/bin/wx-config32-3.0")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32-3.0")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.0-config")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "/usr/bin/wx-config-3.2")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.2")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "/usr/bin/wx-config-3.1")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.1")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "/usr/bin/wx-config-3.0")
|
2021-07-04 05:24:21 +00:00
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0")
|
|
|
|
endif()
|
2021-08-04 05:43:25 +00:00
|
|
|
if(EXISTS "/usr/bin/wx-config")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config")
|
2021-07-04 05:24:21 +00:00
|
|
|
endif()
|
2021-08-04 05:43:25 +00:00
|
|
|
if(NOT GTK2_API AND EXISTS "/usr/bin/wx-config-gtk3")
|
|
|
|
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-gtk3")
|
2021-07-04 05:24:21 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2021-08-04 05:43:25 +00:00
|
|
|
|
|
|
|
find_package(wxWidgets REQUIRED base core adv)
|
|
|
|
include(${wxWidgets_USE_FILE})
|
|
|
|
make_imported_target_if_missing(wxWidgets::all wxWidgets)
|
|
|
|
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
|
|
|
## Use pcsx2 package to find module
|
|
|
|
include(FindLibc)
|
|
|
|
|
|
|
|
## Use pcsx2 package to find module
|
|
|
|
include(FindPulseAudio)
|
|
|
|
|
|
|
|
## Use CheckLib package to find module
|
|
|
|
include(CheckLib)
|
|
|
|
|
2021-10-03 20:16:43 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2021-08-04 05:43:25 +00:00
|
|
|
check_lib(EGL EGL EGL/egl.h)
|
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)
|
|
|
|
check_lib(XRANDR xrandr)
|
|
|
|
endif()
|
|
|
|
if(WAYLAND_API)
|
|
|
|
find_package(Wayland REQUIRED)
|
|
|
|
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)
|
|
|
|
check_lib(SAMPLERATE samplerate samplerate.h)
|
2010-08-02 07:33:11 +00:00
|
|
|
|
2022-01-31 14:12:26 +00:00
|
|
|
if(NOT QT_BUILD)
|
|
|
|
check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2)
|
|
|
|
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
|
|
|
|
2021-08-04 05:43:25 +00:00
|
|
|
if (GTK2_API)
|
|
|
|
find_package(GTK2 REQUIRED gtk)
|
|
|
|
alias_library(GTK::gtk GTK2::gtk)
|
|
|
|
else()
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
find_package(GTK3 REQUIRED gtk)
|
|
|
|
alias_library(GTK::gtk GTK3::gtk)
|
|
|
|
else()
|
|
|
|
check_lib(GTK3 gtk+-3.0 gtk/gtk.h)
|
|
|
|
alias_library(GTK::gtk PkgConfig::GTK3)
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-07-04 05:24:21 +00:00
|
|
|
endif()
|
2021-10-16 00:14:34 +00:00
|
|
|
if(WAYLAND_API)
|
|
|
|
find_package(Wayland REQUIRED)
|
|
|
|
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()
|
|
|
|
|
2015-01-04 19:38:36 +00:00
|
|
|
#----------------------------------------
|
|
|
|
# Check correctness of the parameter
|
|
|
|
# Note: wxWidgets_INCLUDE_DIRS must be defined
|
|
|
|
#----------------------------------------
|
|
|
|
include(ApiValidation)
|
2017-05-21 17:23:05 +00:00
|
|
|
|
2015-01-04 19:38:36 +00:00
|
|
|
WX_vs_SDL()
|
2017-05-21 17:23:05 +00:00
|
|
|
|
|
|
|
# Blacklist bad GCC
|
|
|
|
if(GCC_VERSION VERSION_EQUAL "7.0" OR GCC_VERSION VERSION_EQUAL "7.1")
|
2021-07-04 05:24:21 +00:00
|
|
|
GCC7_BUG()
|
2017-05-21 17:23:05 +00:00
|
|
|
endif()
|
2019-06-19 04:24:23 +00:00
|
|
|
|
2019-09-22 01:00:52 +00:00
|
|
|
if((GCC_VERSION VERSION_EQUAL "9.0" OR GCC_VERSION VERSION_GREATER "9.0") AND GCC_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
|
|
|
|
2021-03-14 18:38:14 +00:00
|
|
|
find_package(fmt "7.1.3" QUIET)
|
2020-11-09 00:28:43 +00:00
|
|
|
if(NOT fmt_FOUND)
|
2021-07-04 05:24:21 +00:00
|
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/fmt/fmt/CMakeLists.txt")
|
|
|
|
message(STATUS "No system fmt was found. Using bundled")
|
|
|
|
add_subdirectory(3rdparty/fmt/fmt)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "No system or bundled fmt was found")
|
|
|
|
endif()
|
2020-11-09 00:28:43 +00:00
|
|
|
else()
|
2021-07-04 05:24:21 +00:00
|
|
|
message(STATUS "Found fmt: ${fmt_VERSION}")
|
2020-11-09 00:28:43 +00:00
|
|
|
endif()
|
2020-11-27 18:59:31 +00:00
|
|
|
|
2020-12-06 19:39:25 +00:00
|
|
|
if(USE_SYSTEM_YAML)
|
2021-12-24 02:55:32 +00:00
|
|
|
find_package(ryml REQUIRED)
|
|
|
|
if(NOT ryml_FOUND)
|
|
|
|
message(STATUS "No system rapidyaml was found, using the submodule in the 3rdparty directory")
|
2021-07-04 05:24:21 +00:00
|
|
|
set(USE_SYSTEM_YAML OFF)
|
|
|
|
else()
|
2021-12-24 02:55:32 +00:00
|
|
|
message(STATUS "Found rapidyaml: ${rapidyaml_VERSION}")
|
2021-07-04 05:24:21 +00:00
|
|
|
endif()
|
2020-12-06 19:39:25 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT USE_SYSTEM_YAML)
|
2021-12-24 02:55:32 +00:00
|
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/rapidyaml/rapidyaml/CMakeLists.txt")
|
|
|
|
message(STATUS "Using bundled rapidyaml")
|
|
|
|
add_subdirectory(3rdparty/rapidyaml/rapidyaml EXCLUDE_FROM_ALL)
|
2021-07-04 05:24:21 +00:00
|
|
|
else()
|
2021-12-24 02:55:32 +00:00
|
|
|
message(FATAL_ERROR "No bundled rapidyaml was found")
|
2021-07-04 05:24:21 +00:00
|
|
|
endif()
|
2020-11-27 18:59:31 +00:00
|
|
|
endif()
|
2020-12-25 10:25:55 +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)
|
|
|
|
set(Qt6_DIR ${CMAKE_SOURCE_DIR}/3rdparty/qt/6.2.2/msvc2019_64/lib/cmake/Qt6)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Find the Qt components that we need.
|
|
|
|
find_package(Qt6 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets Network LinguistTools REQUIRED)
|
|
|
|
|
|
|
|
# We use the bundled (latest) SDL version for Qt.
|
|
|
|
add_subdirectory(3rdparty/sdl2 EXCLUDE_FROM_ALL)
|
2021-12-13 12:12:54 +00:00
|
|
|
endif()
|
|
|
|
|
2020-12-25 10:25:55 +00:00
|
|
|
add_subdirectory(3rdparty/libchdr/libchdr EXCLUDE_FROM_ALL)
|
2021-08-02 06:55:11 +00:00
|
|
|
|
|
|
|
if(USE_NATIVE_TOOLS)
|
|
|
|
add_subdirectory(tools/bin2cpp EXCLUDE_FROM_ALL)
|
|
|
|
set(BIN2CPP bin2cpp)
|
2021-09-05 01:35:43 +00:00
|
|
|
set(BIN2CPPDEP bin2cpp)
|
2021-08-02 06:55:11 +00:00
|
|
|
else()
|
|
|
|
set(BIN2CPP perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl)
|
2021-09-05 01:35:43 +00:00
|
|
|
set(BIN2CPPDEP ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl)
|
2021-08-02 06:55:11 +00:00
|
|
|
endif()
|
2021-07-08 13:13:21 +00:00
|
|
|
|
|
|
|
add_subdirectory(3rdparty/glad 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-09-26 06:35:15 +00:00
|
|
|
|
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)
|
|
|
|
endif()
|
2021-09-14 09:11:59 +00:00
|
|
|
|