1
0
mirror of https://github.com/RPCS3/rpcs3 synced 2024-07-08 19:56:08 +00:00
rpcs3/CMakeLists.txt

82 lines
2.1 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.14.1)
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 10:07:33 +00:00
project(rpcs3)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
message(FATAL_ERROR "RPCS3 requires at least gcc-9.")
2019-06-23 05:54:42 +00:00
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
2020-12-22 03:38:34 +00:00
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
message(FATAL_ERROR "RPCS3 requires at least clang-11.0.")
2019-06-23 05:54:42 +00:00
endif()
endif()
2021-04-03 21:02:23 +00:00
# include build options
include(options.cmake)
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 10:07:33 +00:00
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/rpcs3/cmake_modules")
set(CMAKE_CXX_STANDARD 20)
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 10:07:33 +00:00
include(CheckCXXCompilerFlag)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DNDEBUG)
elseif(NOT MSVC)
add_definitions(-D_DEBUG)
endif()
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms." )
endif()
2017-03-02 21:49:42 +00:00
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
2017-03-02 21:49:42 +00:00
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 10:07:33 +00:00
if(WIN32)
add_definitions(-DUNICODE)
add_definitions(-D_WIN32_WINNT=0x0602)
endif()
2018-11-10 14:43:38 +00:00
if(APPLE)
include_directories(/opt/local/include)
link_directories(/opt/local/lib)
endif()
2019-06-23 05:54:42 +00:00
# Warnings are silenced for 3rdparty code
set(CMAKE_CXX_FLAGS -w)
set(CMAKE_C_FLAGS -w)
2019-06-28 04:15:49 +00:00
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "")
if(MSVC)
2020-12-05 11:55:00 +00:00
add_compile_options(/wd4530 /utf-8) # C++ exception handler used, but unwind semantics are not enabled
2019-06-28 04:15:49 +00:00
endif()
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 10:07:33 +00:00
add_subdirectory(Vulkan EXCLUDE_FROM_ALL)
add_subdirectory(asmjitsrc EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty)
2019-06-28 04:15:49 +00:00
2019-06-23 05:54:42 +00:00
unset(CMAKE_CXX_FLAGS)
unset(CMAKE_C_FLAGS)
if(NOT WIN32)
add_compile_options(-pthread)
endif()
2015-08-07 21:53:39 +00: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")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
2017-06-12 18:45:29 +00:00
2019-10-12 19:12:03 +00:00
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(rpcs3)