diff --git a/3rdparty/llvm/CMakeLists.txt b/3rdparty/llvm/CMakeLists.txt index 310774f427..7d3223a6d2 100644 --- a/3rdparty/llvm/CMakeLists.txt +++ b/3rdparty/llvm/CMakeLists.txt @@ -17,8 +17,10 @@ if(WITH_LLVM) option(LLVM_CCACHE_BUILD OFF) set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.") - # For non arm64 windows - if(WIN32 AND (COMPILER_X86 OR (MSVC AND NOT COMPILER_ARM))) + # For Windows x86 (not Windows AArch64). + # Check on MSVC is needed due to COMPILER_X86, COMPILER_ARM etc. are not set/supported by the MSVC compiler, if used. + # Furthermore, the MSVC compiler is not available/supported on Windows AArch64 + if(WIN32 AND (COMPILER_X86 OR MSVC)) set(LLVM_USE_INTEL_JITEVENTS ON) endif() @@ -71,10 +73,10 @@ if(WITH_LLVM) set(LLVM_TARGETS_TO_BUILD "X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") endif() endif() - if((WIN32 AND BUILD_LLVM) OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND COMPILER_X86)) + if(LLVM_USE_INTEL_JITEVENTS) list (APPEND LLVM_ADDITIONAL_LIBS IntelJITEvents) endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + if(LLVM_USE_PERF) list (APPEND LLVM_ADDITIONAL_LIBS PerfJITEvents) endif() llvm_map_components_to_libnames(LLVM_LIBS diff --git a/BUILDING.md b/BUILDING.md index 5c9065e0ad..b79075f5a1 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -22,8 +22,7 @@ The following tools are required to build RPCS3 on Windows 10 or later: - [Qt 6.7.3](https://www.qt.io/download-qt-installer) - [Vulkan SDK 1.3.268.0](https://vulkan.lunarg.com/sdk/home) (see "Install the SDK" [here](https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html)) for now future SDKs don't work. You need precisely 1.3.268.0. -The `sln` solution available only on **Visual Studio** is the preferred building solution. It allows to build the **RPCS3** application in `Release` and `Debug` mode -while the `CMake` solution is currently limited to `Debug` mode only. +The `sln` solution available only on **Visual Studio** is the preferred building solution. It easily allows to build the **RPCS3** application in `Release` and `Debug` mode. In order to build **RPCS3** with the `sln` solution (with **Visual Studio**), **Qt** libs need to be detected. To detect the libs: - add and set the `QTDIR` environment variable, e.g. `\6.7.3\msvc2019_64\` @@ -132,14 +131,21 @@ You may want to download the precompiled [LLVM libs](https://github.com/RPCS3/ll as well as download and extract the [additional libs](https://github.com/RPCS3/glslang/releases/latest/download/glslanglibs_mt.7z) to `lib\%CONFIGURATION%-x64\` to speed up compilation time (unoptimised/debug libs are currently not available precompiled). -If you're not using the precompiled libs, build the following projects in `__BUILD_BEFORE` folder by right-clicking on a project and then click on `Build`: -- `glslang` -- either `llvm_build` -- or `llvm_build_clang_cl` +If you're not using the precompiled libs, those dependency libs need to be compiled first. From the `Solution Explorer` panel: +1) expand `__BUILD_BEFORE` +2) from the `Solution Configurations` drop-down menu, select `Release` (select `Debug` if you want to build in `Debug` mode) +3) one after another, right-click on the following projects and then click on `Build` to build the selected lib: + - `glslang` + - either `llvm_build` + - or `llvm_build_clang_cl` (if you installed **clang** on VS) -Afterwards: +In order to build the **RPCS3** application: +1) from the `Solution Configurations` drop-down menu, select `Release` (select `Debug` if you want to build in `Debug` mode) -`Build > Build Solution` + **NOTE:** In case you previously compiled the dependency libs under `__BUILD_BEFORE`, you have also to select the same build configuration (e.g. `Release`, if you compiled the dependency libs in `Release` mode) + +2) click on `Build` menu and then on `Build Solution` +3) once the build is completed, the **RPCS3** application will be available under the `\bin` folder #### Building with Visual Studio CMake solution @@ -147,21 +153,22 @@ Start **Visual Studio**, click on `Open a local folder` and select the RPCS3's r Once the project is open on VS, from the `Solution Explorer` panel: 1) right-click on `rpcs3` and then click on `Switch to CMake Targets View` -2) from the `Configuration` drop-down menu select `Windows x64` +2) from the `Configuration` drop-down menu, select `msvc-release` (select `msvc-debug` if you want to build in `Debug` mode) 3) right-click on `CMakeLists.txt Project` and then click on `Configure Cache` 4) once the cache is created, the `rpcs3 project` will be available -5) right-click on `rpcs3 Project` and then click on `Build All` +5) right-click on `rpcs3 Project` and then click on `Build All` (or click on `Build` menu and then on `Build All`) 6) once the build is completed, the **RPCS3** application will be available under the `\build-msvc\bin` folder #### Building with standalone CMake tool In case you preferred to install and use the standalone **CMake** tool: 1) move on the RPCS3's root folder -2) execute the following commands to create the cache and to build the application, respectively: - ``` - cmake --preset msvc - cmake --build build-msvc - ``` +2) execute the following commands to create the cache and to build the application (for the build, use `--preset msvc-debug` if you want to build in `Debug` mode), respectively: + + ``` + cmake --preset msvc + cmake --build --preset msvc-release + ``` 3) once the build is completed, the **RPCS3** application will be available under the `\build-msvc\bin` folder ### Linux diff --git a/CMakePresets.json b/CMakePresets.json index da5be489f2..8fddc4d377 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -48,7 +48,7 @@ "strategy": "external" }, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CONFIGURATION_TYPES": "Debug;Release", "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", "USE_FAUDIO": "OFF", "USE_PRECOMPILED_HEADERS": "ON", @@ -67,5 +67,17 @@ } } } + ], + "buildPresets": [ + { + "name": "msvc-debug", + "configurePreset": "msvc", + "configuration": "Debug" + }, + { + "name": "msvc-release", + "configurePreset": "msvc", + "configuration": "Release" + } ] } diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index c1358d25fa..3d039e75f9 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -152,10 +152,13 @@ elseif(UNIX) COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/git $/git) elseif(WIN32) + if(MSVC) + add_custom_command(TARGET rpcs3 POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${PROJECT_BINARY_DIR}/3rdparty/OpenAL/openal-soft/$/OpenAL32.dll" "$" + COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_SOURCE_DIR}/bin/rpcs3.exe") + endif() add_custom_command(TARGET rpcs3 POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_SOURCE_DIR}/bin/rpcs3.exe" COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_SOURCE_DIR}/bin" "$" - COMMAND "${CMAKE_COMMAND}" -E copy "${PROJECT_BINARY_DIR}/3rdparty/OpenAL/openal-soft/Debug/OpenAL32.dll" "$" COMMAND "${WINDEPLOYQT_EXECUTABLE}" --no-compiler-runtime --no-opengl-sw --no-patchqt --no-translations --no-quick --no-system-d3d-compiler --no-quick-import --plugindir "$,$/plugins,$/share/qt6/plugins>" --verbose 0 "$") endif()