2020-02-26 22:31:46 +01:00
|
|
|
cmake_minimum_required(VERSION 3.14.1)
|
2014-04-25 18:57:00 +02:00
|
|
|
|
2018-09-18 12:07:33 +02:00
|
|
|
project(rpcs3)
|
|
|
|
|
2021-04-17 15:40:24 +02:00
|
|
|
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
2020-02-10 12:08:18 +01:00
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
|
|
|
|
message(FATAL_ERROR "RPCS3 requires at least gcc-9.")
|
2019-06-23 07:54:42 +02:00
|
|
|
endif()
|
|
|
|
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
2020-12-22 04:38:34 +01:00
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
|
|
|
|
message(FATAL_ERROR "RPCS3 requires at least clang-11.0.")
|
2019-06-23 07:54:42 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-04-03 23:02:23 +02:00
|
|
|
# include build options
|
|
|
|
include(options.cmake)
|
2018-09-18 12:07:33 +02:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/rpcs3/cmake_modules")
|
|
|
|
|
2020-02-09 12:17:36 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2018-09-18 12:07:33 +02:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
2021-04-18 16:36:00 +02:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2014-07-10 18:46:10 +02:00
|
|
|
message(STATUS "No build type selected, default to Release")
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
|
2018-09-21 23:54:16 +02:00
|
|
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
add_definitions(-DNDEBUG)
|
2021-01-18 11:49:16 +01:00
|
|
|
elseif(NOT MSVC)
|
|
|
|
add_definitions(-D_DEBUG)
|
2018-09-21 23:54:16 +02:00
|
|
|
endif()
|
|
|
|
|
2014-07-10 18:46:10 +02:00
|
|
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms." )
|
|
|
|
endif()
|
|
|
|
|
2017-03-02 22:49:42 +01:00
|
|
|
find_program(CCACHE_FOUND ccache)
|
2021-04-18 16:36:00 +02:00
|
|
|
if(CCACHE_FOUND)
|
2017-03-02 22:49:42 +01:00
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
endif()
|
|
|
|
|
2018-09-18 12:07:33 +02:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DUNICODE)
|
|
|
|
add_definitions(-D_WIN32_WINNT=0x0602)
|
2018-06-14 21:39:48 +02:00
|
|
|
endif()
|
|
|
|
|
2018-11-10 15:43:38 +01:00
|
|
|
if(APPLE)
|
|
|
|
include_directories(/opt/local/include)
|
|
|
|
link_directories(/opt/local/lib)
|
|
|
|
endif()
|
|
|
|
|
2019-06-23 07:54:42 +02:00
|
|
|
# Warnings are silenced for 3rdparty code
|
|
|
|
set(CMAKE_CXX_FLAGS -w)
|
|
|
|
set(CMAKE_C_FLAGS -w)
|
2019-06-28 06:15:49 +02:00
|
|
|
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "")
|
|
|
|
|
|
|
|
if(MSVC)
|
2020-12-05 12:55:00 +01:00
|
|
|
add_compile_options(/wd4530 /utf-8) # C++ exception handler used, but unwind semantics are not enabled
|
2019-06-28 06:15:49 +02:00
|
|
|
endif()
|
|
|
|
|
2018-09-18 12:07:33 +02:00
|
|
|
add_subdirectory(Vulkan EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(asmjitsrc EXCLUDE_FROM_ALL)
|
|
|
|
add_subdirectory(3rdparty)
|
2019-06-28 06:15:49 +02:00
|
|
|
|
2019-06-23 07:54:42 +02:00
|
|
|
unset(CMAKE_CXX_FLAGS)
|
|
|
|
unset(CMAKE_C_FLAGS)
|
2018-06-07 18:38:19 +02:00
|
|
|
|
2021-04-18 16:36:00 +02:00
|
|
|
if(NOT WIN32)
|
2019-07-07 15:15:06 +02:00
|
|
|
add_compile_options(-pthread)
|
|
|
|
endif()
|
|
|
|
|
2015-08-07 23:53:39 +02:00
|
|
|
# TODO: do real installation, including copying directory structure
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
2017-06-22 22:05:32 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
|
2017-06-12 20:45:29 +02:00
|
|
|
|
2019-10-12 21:12:03 +02:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2018-05-02 01:10:19 +02:00
|
|
|
add_subdirectory(rpcs3)
|