2020-05-07 08:32:34 -07:00
# Setting it to a range tells it that it supports the features on the newer
# versions as well, avoiding setting policies.
2023-12-29 21:18:03 +10:00
cmake_minimum_required ( VERSION 3.16...3.25 )
2021-11-27 18:07:13 -07:00
2023-12-29 21:18:03 +10:00
# Enabling this cmake policy gets rid of warnings regarding LTO.
2023-01-04 18:22:47 -08:00
cmake_policy ( SET CMP0069 NEW )
set ( CMAKE_POLICY_DEFAULT_CMP0069 NEW )
2022-01-22 22:36:24 -06:00
if ( ${ CMAKE_SOURCE_DIR } STREQUAL ${ CMAKE_BINARY_DIR } )
message ( FATAL_ERROR "PCSX2 does not support in-tree builds. Please make a build directory that is not the PCSX2 source directory and generate your CMake project there using either `cmake -B build_directory` or by running cmake from the build directory." )
endif ()
2021-11-27 18:07:13 -07:00
# Project Name
2023-12-29 21:18:03 +10:00
project ( Pcsx2 C CXX )
2012-10-21 18:10:13 +00:00
2010-06-22 13:30:36 +00:00
# Variable to check that people use the good file
set ( TOP_CMAKE_WAS_SOURCED TRUE )
2010-06-04 20:35:02 +00:00
# set module path
2014-03-30 16:28:59 +02:00
set ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /cmake )
2010-06-04 20:35:02 +00:00
2023-01-02 13:13:12 +10:00
# Write binaries to the bin directory under the build directory.
# This makes it simple to run development builds directly out of the build directory.
if ( UNIX AND NOT APPLE )
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" )
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" )
endif ()
2014-03-30 16:25:11 +02:00
# include some generic functions to ensure correctness of the env
2010-06-04 20:35:02 +00:00
include ( Pcsx2Utils )
2014-03-30 16:25:11 +02:00
check_no_parenthesis_in_path ()
2023-12-29 21:18:03 +10:00
detect_operating_system ()
detect_compiler ()
2013-07-06 09:42:46 +00:00
2010-05-23 07:51:43 +00:00
#-------------------------------------------------------------------------------
2010-06-04 20:35:02 +00:00
# Include specific module
2010-06-03 17:28:20 +00:00
include ( BuildParameters )
2010-05-23 07:51:43 +00:00
include ( SearchForStuff )
2013-06-28 10:43:50 +00:00
# Must be done after SearchForStuff
2020-05-24 01:19:47 -05:00
get_git_version_info ()
2013-06-28 10:43:50 +00:00
write_svnrev_h ()
2010-01-21 15:12:50 +00:00
# make common
2021-09-02 12:36:36 -04:00
add_subdirectory ( common )
2010-01-21 15:12:50 +00:00
# make pcsx2
2021-04-17 15:30:03 -05:00
add_subdirectory ( pcsx2 )
2023-08-26 14:37:56 +10:00
add_subdirectory ( pcsx2-qt )
2010-01-21 15:12:50 +00:00
2023-08-26 14:37:56 +10:00
# Updater is Windows only for now.
if ( WIN32 )
add_subdirectory ( updater )
2021-12-14 18:02:10 +10:00
endif ()
2020-08-19 03:19:28 -05:00
# tests
2024-06-10 15:21:58 +10:00
if ( ENABLE_TESTS )
add_subdirectory ( 3rdparty/googletest )
2021-07-04 00:24:21 -05:00
add_subdirectory ( tests/ctest )
2020-08-19 03:19:28 -05:00
endif ()
2023-12-30 17:33:37 +10:00
#-------------------------------------------------------------------------------
if ( NOT IS_SUPPORTED_COMPILER )
message ( WARNING "
*************** UNSUPPORTED CONFIGURATION ***************
You are not compiling PCSX2 with a supported compiler.
It may not even build successfully.
PCSX2 only supports the Clang and MSVC compilers.
No support will be provided, continue at your own risk.
*********************************************************" )
endif ()
2024-03-21 16:19:17 +10:00
if ( _M_ARM64 )
message ( WARNING "
*************** UNSUPPORTED CONFIGURATION ***************
Apple Silicon support in PCSX2 is INCOMPLETE. There are
currently no EE/VU/IOP recompilers, and games will run
VERY slow. There is no date for completion yet, you
should set -DCMAKE_OSX_ARCHITECTURES=x86_64 for now,
unless you want to work on the recompilers.
We also ask that you read https://dont-ship.it/.
*********************************************************" )
endif ()