2020-05-07 15:32:34 +00: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 11:18:03 +00:00
cmake_minimum_required ( VERSION 3.16...3.25 )
2021-11-28 01:07:13 +00:00
2023-12-29 11:18:03 +00:00
# Enabling this cmake policy gets rid of warnings regarding LTO.
2023-01-05 02:22:47 +00:00
cmake_policy ( SET CMP0069 NEW )
set ( CMAKE_POLICY_DEFAULT_CMP0069 NEW )
2022-01-23 04:36:24 +00: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-28 01:07:13 +00:00
# Project Name
2023-12-29 11:18:03 +00: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 14:28:59 +00:00
set ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /cmake )
2010-06-04 20:35:02 +00:00
2023-01-02 03:13:12 +00: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 14:25:11 +00:00
# include some generic functions to ensure correctness of the env
2010-06-04 20:35:02 +00:00
include ( Pcsx2Utils )
2014-03-30 14:25:11 +00:00
check_no_parenthesis_in_path ( )
2023-12-29 11:18:03 +00: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 06:19:47 +00: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 16:36:36 +00:00
add_subdirectory ( common )
2010-01-21 15:12:50 +00:00
# make pcsx2
2021-04-17 20:30:03 +00:00
add_subdirectory ( pcsx2 )
2023-08-26 04:37:56 +00:00
add_subdirectory ( pcsx2-qt )
2010-01-21 15:12:50 +00:00
2023-08-26 04:37:56 +00:00
# Updater is Windows only for now.
if ( WIN32 )
add_subdirectory ( updater )
2021-12-14 08:02:10 +00:00
endif ( )
2020-08-19 08:19:28 +00:00
# tests
2024-06-10 05:21:58 +00:00
if ( ENABLE_TESTS )
add_subdirectory ( 3rdparty/googletest )
2021-07-04 05:24:21 +00:00
add_subdirectory ( tests/ctest )
2020-08-19 08:19:28 +00:00
endif ( )
2023-12-30 07:33:37 +00:00
#-------------------------------------------------------------------------------
if ( NOT IS_SUPPORTED_COMPILER )
message ( WARNING "
* * * * * * * * * * * * * * * U N S U P P O R T E D C O N F I G U R A T I O N * * * * * * * * * * * * * * *
Y o u a r e n o t c o m p i l i n g P C S X 2 w i t h a s u p p o r t e d c o m p i l e r .
I t m a y n o t e v e n b u i l d s u c c e s s f u l l y .
P C S X 2 o n l y s u p p o r t s t h e C l a n g a n d MSVC c o m p i l e r s .
N o s u p p o r t w i l l b e p r o v i d e d , c o n t i n u e a t y o u r o w n r i s k .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * " )
endif ( )
2024-03-21 06:19:17 +00:00
if ( _M_ARM64 )
message ( WARNING "
* * * * * * * * * * * * * * * U N S U P P O R T E D C O N F I G U R A T I O N * * * * * * * * * * * * * * *
A p p l e S i l i c o n s u p p o r t i n P C S X 2 i s I N C O M P L E T E . T h e r e a r e
c u r r e n t l y n o E E / V U / I O P r e c o m p i l e r s , a n d g a m e s w i l l r u n
V E R Y s l o w . T h e r e i s n o d a t e f o r c o m p l e t i o n y e t , y o u
s h o u l d s e t - D C M A K E _ O S X _ A R C H I T E C T U R E S = x 8 6 _ 6 4 f o r n o w ,
u n l e s s y o u w a n t t o w o r k o n t h e r e c o m p i l e r s .
W e a l s o a s k t h a t y o u r e a d h t t p s : / / d o n t - s h i p . i t / .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * " )
endif ( )