rpcs3/CMakeLists.txt

189 lines
8.5 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.28)
2025-06-08 16:33:45 +02:00
find_program(CCACHE_PATH ccache HINTS ENV PATH)
if(CCACHE_PATH)
message(STATUS "Using ccache: ${CCACHE_PATH}")
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PATH}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PATH}")
endif()
project(rpcs3 LANGUAGES C CXX)
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 12:07:33 +02:00
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2025-03-15 02:02:46 +01:00
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2021-05-26 21:21:01 +02:00
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
message(FATAL_ERROR "RPCS3 requires at least gcc-11.")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
message(FATAL_ERROR "RPCS3 requires at least clang-12.0.")
endif()
2019-06-23 07:54:42 +02:00
endif()
if(APPLE OR WIN32)
set(USE_SYSTEM_OPENAL_DEFAULT OFF)
else()
set(USE_SYSTEM_OPENAL_DEFAULT ON)
endif()
option(USE_NATIVE_INSTRUCTIONS "USE_NATIVE_INSTRUCTIONS makes rpcs3 compile with -march=native, which is useful for local builds, but not good for packages." ON)
option(WITH_LLVM "Enable usage of LLVM library" ON)
option(BUILD_LLVM "Build LLVM from git submodule" OFF)
2023-04-29 19:59:16 +02:00
option(STATIC_LINK_LLVM "Link against LLVM statically. This will get set to ON if you build LLVM from the submodule." OFF)
option(USE_FAUDIO "FAudio audio backend" ON)
option(USE_LIBEVDEV "libevdev-based joystick support" ON)
option(USE_DISCORD_RPC "Discord rich presence integration" OFF)
option(USE_VULKAN "Vulkan render backend" ON)
option(USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF)
2022-10-15 21:01:38 +02:00
option(USE_SDL "Enables SDL input handler" OFF)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_CUBEB "Prefer system cubeb instead of the builtin one" OFF)
option(USE_SYSTEM_CURL "Prefer system Curl instead of the prebuild one" ON)
option(USE_SYSTEM_FAUDIO "Prefer system FAudio instead of the builtin one" OFF)
2023-05-16 20:24:55 +02:00
option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_FLATBUFFERS "Prefer system flatbuffers instead of the builtin one" OFF)
option(USE_SYSTEM_GLSLANG "Prefer system glslang instead of the builtin one" OFF)
option(USE_SYSTEM_HIDAPI "Prefer system hidapi instead of the builtin one" OFF)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_LIBPNG "Prefer system libpng instead of the builtin one" OFF)
option(USE_SYSTEM_LIBUSB "Prefer system libusb instead of the builtin one" OFF)
option(USE_SYSTEM_MINIUPNPC "Prefer system MiniUPnPc instead of the builtin one" OFF)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_MVK "Prefer system MoltenVK instead of the builtin one" OFF)
option(USE_SYSTEM_OPENAL "Prefer system OpenAL instead of the prebuild one" ${USE_SYSTEM_OPENAL_DEFAULT})
2024-11-16 11:03:42 +01:00
option(USE_SYSTEM_OPENCV "Prefer system OpenCV instead of the builtin one" ON)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_PUGIXML "Prefer system pugixml instead of the builtin one" OFF)
option(USE_SYSTEM_RTMIDI "Prefer system RtMidi instead of the builtin one" OFF)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" ON)
option(USE_SYSTEM_VULKAN_MEMORY_ALLOCATOR "Prefer system Vulkan Memory Allocator instead of the builtin one" OFF)
option(USE_SYSTEM_WOLFSSL "Prefer system wolfSSL instead of the builtin one" OFF)
2025-06-16 08:21:26 +02:00
option(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the builtin one" ON)
option(USE_SYSTEM_ZSTD "Prefer system zstd instead of the builtin one" OFF)
option(HAS_MEMORY_BREAKPOINTS "Add support for memory breakpoints to the interpreter" OFF)
option(USE_LTO "Use LTO for building" ON)
2025-04-26 21:30:27 +02:00
option(BUILD_RPCS3_TESTS "Build RPCS3 unit tests." OFF)
option(RUN_RPCS3_TESTS "Run RPCS3 unit tests. Requires BUILD_RPCS3_TESTS" OFF)
option(USE_GAMEMODE "Choose whether to enable GameMode features or not." ON)
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 12:07:33 +02:00
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/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 12:07:33 +02:00
include(CheckCXXCompilerFlag)
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTI_CONFIG)
# TODO(cjj19970505@live.cn)
# Currently DicordRPC is included as a binary compiled with /MT flag.
# We need all 4 binaries(/MT /MTd /MD /MDd) or including the source instead of binary.
set(USE_DISCORD_RPC OFF CACHE BOOL "Discord RPC is only avaliable with single-config generator" FORCE)
else()
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT MSVC)
add_compile_definitions(_DEBUG)
endif()
if(MSVC)
option(USE_MSVC_STATIC_CRT "Use static MSVC C runtime" OFF)
# TODO(cjj19970505@live.cn)
# DiscordRPC binary in 3rdparty is compiled /MT
# So theoretically we should enable DiscordRPC in Release and static CRT build
# since we might encounter some rumtime issues when more than one CRT version are presented.
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160#what-problems-exist-if-an-application-uses-more-than-one-crt-version
# Add other DiscordRPC binaries(compiled with /MTd, /MD, /MDd) or compile it from source may address this issue.
if(NOT IS_MULTI_CONFIG)
if(NOT(CMAKE_BUILD_TYPE MATCHES "Release" AND USE_MSVC_STATIC_CRT))
set(USE_DISCORD_RPC OFF CACHE BOOL "Discord RPC is only available in Release and static CRT build." FORCE)
endif()
endif()
if(USE_MSVC_STATIC_CRT)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
# though doc ( https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html )
# says if that property is not set then CMake uses the default value MultiThreaded$<$<CONFIG:Debug>:Debug>DLL
# to select a MSVC runtime library.
# But yaml-cpp set /MT(d) if CMAKE_MSVC_RUNTIME_LIBRARY is undefined
# So we have to define it explicitly
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
# TODO(cjj19970505@live.cn)
# offical QT uses dynamic CRT.
# When building our lib with static CRT and debug build type
# and linking with Qt with dynamic CRT and debug build,
# error is encountered in runtime (which is expected).
# But building our lib with static CRT and release build type,
# and linking with Qt with dynamic CRT and release build seems to be working,
# which is the same config with VS solution.
# (though technically it might still have some hidden errors).
# So we allow static CRT in both relase and debug build, but prompt warning in debug build.
# For more info:
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160#what-problems-exist-if-an-application-uses-more-than-one-crt-version
# https://wiki.qt.io/Technical_FAQ#Why_does_a_statically_built_Qt_use_the_dynamic_Visual_Studio_runtime_libraries_.3F_Do_I_need_to_deploy_those_with_my_application_.3F
if(USE_MSVC_STATIC_CRT)
if(IS_MULTI_CONFIG OR CMAKE_BUILD_TYPE MATCHES "Debug")
message(AUTHOR_WARNING "Debug build currently can not work with static CRT.")
endif()
endif()
clang-cl ffmpeg Update rpcs3.yml Update rpcs3.yml Update rpcs3.yml folded scalar with neg newline x64-windows-release x64-windows-rel if: "!cancelled()" vcpkg_build_type Update rpcs3.yml no ccache ${{github.run_id}} zlib vcpkg qt vulkan ffmpeg llvm build with clang-cl Create build-windows-clang-cl.ps1 llvm --keep-going llvm[clang,core,tools,lld,target-x86]:x64-windows-release llvm:x64-windows-release@17.0.2 llvm with debug on Create vcpkg.json Update rpcs3.yml ffmpeg features vcpkg nuget minimal vcpkg.json Update rpcs3.yml fetch nuget more packages vcpkg.json libpng vcpkg classic cmake 3.29.0 Rename vcpkg.json to x_vcpkg.json Update rpcs3.yml Update rpcs3.yml llvm Update rpcs3.yml git llvm LLVM with cache Update rpcs3.yml Update rpcs3.yml build llvm LLVM_TARGETS_TO_BUILD="X86" llvm binary set path build rpcs3 DIA SDK Update rpcs3.yml Update rpcs3.yml Update rpcs3.yml fix conditionals fix conditionals set shell VCPKG env vars DIA SDK Update asm.hpp Update types.hpp Update aesni.cpp Update CMakeLists.txt Update ConfigureCompiler.cmake Update StrFmt.cpp Update CMakeLists.txt Update CMakeLists.txt Build with changes Update CMakeLists.txt D:\a\rpcs3\rpcs3\llvm D:\a\rpcs3\rpcs3\llvm llvm-* llvm-${{ matrix.llvmver }} clangpath llvm-* $llvmver $clangPath $clangPath include bin rm duplicate "add_compile_options" USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD zstd Update CMakeLists.txt PkgConfig zstd zstd::zstd ALIAS PkgConfig::libzstd clang-cl only cache hit Update CMakeLists.txt cache-hit cache vcpkg/vcpkg.exe NOT USE_SYSTEM_ZSTD vcpkg_root revert zstd Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt /defaultlib:zstd_static.lib Remove else /defaultlib:zstd.lib Zstd ahared Nodefaultlib Create Findzstd.cmake zstd CMakeLists.txt not use zstd system CMakeLists.txt dont add 3rdparty::libzstd add_library(PkgConfig::libzstd ALIAS 3rdparty::zstd) add_library(PkgConfig::libzstd ALIAS 3rdparty::zstd) add_library(3rdparty::libzstd ALIAS PkgConfig::zstd) add_library(3rdparty::zstd ALIAS PkgConfig::zstd) Update Findzstd.cmake zstd::zstd Update CMakeLists.txt zstd::zstd zstd::zstd CMakeLists.txt PkgConfig::libzstd CMakeLists.txt zstd::libzstd Update CMakeLists.txt Update CMakeLists.txt vcpkg zstd CMakeLists.txt MODULES CMakeLists.txt zstd::libzstd add_library(3rdparty::7zip ALIAS 3rdparty_7zip) LLVM Static-link on set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") Update CMakeLists.txt message(STATUS "MSVC Runtime Library: ${CMAKE_MSVC_RUNTIME_LIBRARY}") revert CMakeLists.txt DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" rpcs3_emu SHARED STATIC CMakeLists.txt cmake_policy(SET CMP0091 NEW) LLVM_AVAILABLE=ON add_compile_definitions(LLVM_AVAILABLE=true) add_compile_options(/MT) LLVM_AVAILABLE=1 add_compile_definitions(_DISABLE_STRING_ANNOTATION=1 _DISABLE_VECTOR_ANNOTATION=1) Update build-windows-clang-cl.ps1 clang msvc17-msvcrt rm compressed archve cachee name cache name again builtin clang-rt build all set $llvmPath extract into llvm copy with -verbose mv destination path build llvm cache $clangPath full build LLVM static LLVM -> LLVMCore STATIC_LINK_LLVM=OFF no lookup llvm bin dir revert revert revert LLVMCore -> LLVM LLVM -> LLVM-C llvm_map_components_to_libnames Update CMakeLists.txt LLVM CMakeLists.txt LLVM_DIR=$llvmPath MultiThreadedDLL CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON clang-cl version cmake -v --log-level=VERBOSE built-in LLVM llvm lib folder PF short name built-in LLVM/Clang 20.1.8 mt.exe path Use llvm-mt "$clangPath/llvm-mt.exe" fix terminator Add winqtdeploy to PATH Test windeployqt6.exe with version Missing ) No winqtdeploy Build no quotes prep artifacts no winqtdeploy $VcpkgWindeployqt --version $($VcpkgWindeployqt) --version --version Invoke-Expression Update build-windows-clang-cl.ps1 rpcs3_win_clang.7z rpcs3 artifacts dir cp artifacts build/bin dir clone recent asmjit Update build-windows-clang-cl.ps1 CMAKE_CXX_SCAN_FOR_MODULES=ON default-openal USE_NATIVE_INSTRUCTIONS=ON Update ConfigureCompiler.cmake USE_NATIVE_INSTRUCTIONS=OFF / rm 512 instuctions revert set(LLVM_LIBS LLVM) COMPILER_X86 only add_compile_options(-msse -msse2 -mcx16 -mavx512f -mavx -mavx2 -maes -mrtm -mpclmul -mmwaitx -mwaitpkg) avx512 flags add_compile_options(-march=native) check_cxx_compiler_flag("-march=native" add_compile_options(-maes -mrtm -mpclmul -mmwaitx -mwaitpkg) COMMAND Qt6::windeployqt --version COMMAND Qt6::windeployqt $<TARGET_FILE:rpcs3> add vcpkg bin to PATH check vcpkg is added to PATH update PATH cache [System.EnvironmentVariableTarget]::Machine display all paths cmd.exe /c "echo %PATH%" make windeployqt verbose verbose 2 Invoke-Expression "cmd.exe /c "set PATH=%PATH%;$VcpkgBin"" Update build-windows-clang-cl.ps1 no invoke cmd.exe /c "set PATH=$VcpkgBin;%PATH%" --ignore-library-errors -DQTPATH_EXE="$VcpkgQtpath" no --ignore-library-errors Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt change \ to / ${WINDEPLOYQT_EXECUTABLE} Qt6::windeployqt gci vcpkg tools bin --ignore-library-errors x64-windows/tools VCPKG_TRIPLET: x64-windows Save vcpkg cache revert revert remove MSVC runtime message revert rm dupes revert Delete buildfiles/cmake/Findzstd.cmake WINDEPLOYQT_EXECUTABLE Delete x_vcpkg.json add AVX512 compile options Wno-deprecated-anon-enum-enum-conversion clean-up silence warnings terminate properly set PRIVATE CFLAGS --no-vulkan rm vulkan lib at package step override cflags remove OpenGL_GL_PREFERENCE=LEGACY rm --no-vulkan switch Update CMakeLists.txt restore LLVM dir ASMJIT_CMAKE_FLAGS revert order check_cxx_compiler_flag Wno-unused-value revert revert Update CMakeLists.txt Update llvm_build_clang_cl.vcxproj Update llvm_build_clang_cl.vcxproj Update rpcs3.yml go to deploy if successful Create deploy-windows-clang-cl.sh build then deploy Update build-windows-clang-cl.ps1 deploy step test Update ProgramStateCache.cpp remove AVX512 Update JITLLVM.cpp FFMPEG 8.0 FFMPEG 8.0 LLVM 21 LLVM 21 set CMAKE_MSVC_RUNTIME_LIBRARY update OpenAL msys2 clang git openal-soft reset update yaml reset to master reset to master "Build succeeded" ALSOFT_ENABLE_MODULES OFF Build All Jobs Run Builds when not on Main branch Win Qt 6.9.3 Update build-mac-arm64.sh Update build-mac.sh Create TCDarwinX86_64.cmake
2025-07-20 06:02:56 +02:00
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(/MP)
endif()
endif()
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms.")
endif()
if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
include_directories(/opt/homebrew/include)
link_directories(/opt/homebrew/lib)
2018-11-10 15:43:38 +01:00
endif()
2019-06-28 06:15:49 +02:00
if(MSVC)
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()
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 12:07:33 +02:00
add_subdirectory(3rdparty)
2019-06-28 06:15:49 +02:00
if (DISABLE_LTO)
if (CMAKE_C_FLAGS)
string(REGEX REPLACE "-flto[^ ]*" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif()
if (CMAKE_CXX_FLAGS)
string(REGEX REPLACE "-flto[^ ]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
endif()
string(FIND "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}" "-flto" FOUND_LTO)
if (NOT FOUND_LTO EQUAL -1)
message(FATAL_ERROR "RPCS3 doesn't support building with LTO, use -DDISABLE_LTO=TRUE to force-disable it")
endif()
if(NOT WIN32)
add_compile_options(-pthread)
endif()
## Look for Gamemode if its installed on Linux
if(LINUX)
## User chooses whether to Enable GameMode features or not
if(USE_GAMEMODE)
add_compile_definitions(GAMEMODE_AVAILABLE)
endif()
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")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
2017-06-12 20:45:29 +02:00
2025-04-30 17:14:05 +02:00
if(BUILD_RPCS3_TESTS)
enable_testing()
endif()
add_subdirectory(rpcs3)
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT rpcs3)