diff --git a/3rdparty/OpenAL/CMakeLists.txt b/3rdparty/OpenAL/CMakeLists.txt index ffeeee2bdc..2100de3b4f 100644 --- a/3rdparty/OpenAL/CMakeLists.txt +++ b/3rdparty/OpenAL/CMakeLists.txt @@ -5,8 +5,8 @@ if(USE_SYSTEM_OPENAL) target_include_directories(3rdparty_openal INTERFACE ${OPENAL_INCLUDE_DIR}) target_link_libraries(3rdparty_openal INTERFACE ${OPENAL_LIBRARY}) else() - option(ALSOFT_UTILS "Build utility programs" OFF) - option(ALSOFT_EXAMPLES "Build example programs" OFF) + option(ALSOFT_UTILS "Build utility programs" OFF) + option(ALSOFT_EXAMPLES "Build example programs" OFF) add_subdirectory(openal-soft EXCLUDE_FROM_ALL) add_library(3rdparty_openal INTERFACE) target_link_libraries(3rdparty_openal INTERFACE OpenAL::OpenAL) diff --git a/3rdparty/llvm/CMakeLists.txt b/3rdparty/llvm/CMakeLists.txt index 780d3412c4..310774f427 100644 --- a/3rdparty/llvm/CMakeLists.txt +++ b/3rdparty/llvm/CMakeLists.txt @@ -17,7 +17,8 @@ if(WITH_LLVM) option(LLVM_CCACHE_BUILD OFF) set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.") - if(WIN32 AND COMPILER_X86) + # For non arm64 windows + if(WIN32 AND (COMPILER_X86 OR (MSVC AND NOT COMPILER_ARM))) set(LLVM_USE_INTEL_JITEVENTS ON) endif() diff --git a/BUILDING.md b/BUILDING.md index 1067a3d501..5c9065e0ad 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -7,25 +7,41 @@ Other instructions may be found [here](https://wiki.rpcs3.net/index.php?title=Bu ### Windows 10 or later -* [CMake 3.28.0+](https://www.cmake.org/download/) (add to PATH) -* [Python 3.6+](https://www.python.org/downloads/) (add to PATH) -* [Qt 6.7.3](https://www.qt.io/download-qt-installer) -* [Visual Studio 2022](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community) (or at least Visual Studio 2019 16.11.xx+ as C++20 is not included in previous versions) -* [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 following tools are required to build RPCS3 on Windows 10 or later: +- [Visual Studio 2022](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community) (or at least Visual Studio 2019 16.11.xx+ as C++20 is not included in previous versions) +- **Optional** - [CMake 3.28.0+](https://www.cmake.org/download/) (add to PATH) -**Either add the** `QTDIR` **environment variable, e.g.** `\6.7.3\msvc2019_64\` **, or use the [Visual Studio Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2019)** + **NOTES:** + - **Visual Studio 2022** integrates **CMake 3.29+** and it also supports both the `sln` solution (`.sln`, `.vcxproj`) and `CMake` solution (`CMakeLists.txt`, `CMakePresets.json`). + See sections [Building with Visual Studio sln solution](#building-with-visual-studio-sln-solution) and [Building with Visual Studio CMake solution](#building-with-visual-studio-cmake-solution) + on how to build the project with **Visual Studio**. + - Install and use this standalone **CMake** tool just in case of your preference. See section [Building with standalone CMake tool](#building-with-standalone-cmake-tool) on how to build the project + with standalone **CMake** tool. -**NOTE: If you have issues with the Qt plugin, you may want to uninstall the Qt Plugin and install the [Legacy Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.LEGACYQtVisualStudioTools2019) instead.** +- [Python 3.6+](https://www.python.org/downloads/) (add to PATH) +- [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. + +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\` +- or use the [Visual Studio Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2019) + + **NOTE:** If you have issues with the **Visual Studio Qt Plugin**, you may want to uninstall it and install the [Legacy Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.LEGACYQtVisualStudioTools2019) instead. + +In order to build **RPCS3** with the `CMake` solution (with both **Visual Studio** and standalone **CMake** tool): +- add and set the `CMAKE_PREFIX_PATH` environment variable to the **Qt** libs path, e.g. `\6.7.3\msvc2019_64\` ### Linux -These are the essentials tools to build RPCS3 on Linux. Some of them can be installed through your favorite package manager. - -* Clang 17+ or GCC 13+ -* [CMake 3.28.0+](https://www.cmake.org/download/) -* [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/linux/getting_started.html)) for now future SDKs don't work. You need precisely 1.3.268.0. -* [SDL2](https://github.com/libsdl-org/SDL/releases) (for the FAudio backend) +These are the essentials tools to build RPCS3 on Linux. Some of them can be installed through your favorite package manager: +- Clang 17+ or GCC 13+ +- [CMake 3.28.0+](https://www.cmake.org/download/) +- [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/linux/getting_started.html)) for now future SDKs don't work. You need precisely 1.3.268.0. +- [SDL2](https://github.com/libsdl-org/SDL/releases) (for the FAudio backend) **If you have an NVIDIA GPU, you may need to install the libglvnd package.** @@ -38,6 +54,7 @@ These are the essentials tools to build RPCS3 on Linux. Some of them can be inst sudo apt-get install build-essential libasound2-dev libpulse-dev libopenal-dev libglew-dev zlib1g-dev libedit-dev libvulkan-dev libudev-dev git libevdev-dev libsdl2-2.0 libsdl2-dev libjack-dev libsndio-dev Ubuntu is usually horrendously out of date, and some packages need to be downloaded by hand. This part is for Qt, GCC, Vulkan, and CMake + ##### Qt PPA Ubuntu usually does not have a new enough Qt package to suit rpcs3's needs. There is currently no PPA available to work around this. @@ -65,6 +82,7 @@ sudo apt install vulkan-sdk ``` ##### CMake + ``` . /etc/os-release wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - @@ -95,34 +113,64 @@ git submodule update --init ### Windows -#### Configuring the Qt plugin (if used) +#### Building with Visual Studio sln solution -1) Go to `Extensions->Qt VS Tools->Qt Versions`. -2) Add the path to your Qt installation with compiler e.g. `\6.7.3\msvc2019_64`, version will fill in automatically. -3) Go to `Extensions->Qt VS Tools->Options->Legacy Project Format`. (Only available in the legacy Qt plugin) -4) Set `Build: Run pre-build setup` to `true`. (Only available in the legacy Qt plugin) +Start **Visual Studio**, click on `Open a project or solution` and select the `rpcs3.sln` file inside the RPCS3's root folder -#### Building the projects +##### Configuring the Qt Plugin (if used) -Open `rpcs3.sln`. The recommended build configuration is `Release`. (On older revisions: `Release - LLVM`) +1) go to `Extensions->Qt VS Tools->Qt Versions` +2) add the path to your Qt installation with compiler e.g. `\6.7.3\msvc2019_64`, version will fill in automatically +3) go to `Extensions->Qt VS Tools->Options->Legacy Project Format`. (Only available in the **Legacy Qt Plugin**) +4) set `Build: Run pre-build setup` to `true`. (Only available in the **Legacy Qt Plugin**) -You may want to download the precompiled [LLVM libs](https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-16.0.1/llvmlibs_mt.7z) and extract them to `3rdparty\llvm\`, 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). +##### Building the projects -If you're not using the precompiled libs, build the following projects in *__BUILD_BEFORE* folder by right-clicking on a project > *Build*.: -* glslang -* **Either** llvm_build **or** llvm_build_clang_cl +**NOTE:** The recommended build configuration is `Release`. (On older revisions: `Release - LLVM`) + +You may want to download the precompiled [LLVM libs](https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-16.0.1/llvmlibs_mt.7z) and extract them to `3rdparty\llvm\`, +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` Afterwards: `Build > Build Solution` +#### Building with Visual Studio CMake solution + +Start **Visual Studio**, click on `Open a local folder` and select the RPCS3's root folder + +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` +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` +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 + ``` +3) once the build is completed, the **RPCS3** application will be available under the `\build-msvc\bin` folder + ### Linux While still in the project root: 1) `cd .. && mkdir --parents rpcs3_build && cd rpcs3_build` 2) `cmake ../rpcs3/ && make` or `CXX=g++-13 CC=gcc-13 cmake ../rpcs3/ && make` to force these compilers -3) Run RPCS3 with `./bin/rpcs3` +3) run RPCS3 with `./bin/rpcs3` If compiling for ARM, pass the flag `-DUSE_NATIVE_INSTRUCTIONS=OFF` to the cmake command. This resolves some Neon errors when compiling our SIMD headers. diff --git a/CMakePresets.json b/CMakePresets.json index 82dc88e1a6..da5be489f2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -48,13 +48,16 @@ "strategy": "external" }, "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", "USE_FAUDIO": "OFF", "USE_PRECOMPILED_HEADERS": "ON", "USE_SYSTEM_ZLIB": "OFF", "USE_NATIVE_INSTRUCTIONS": "ON", "BUILD_LLVM": "ON", - "STATIC_LINK_LLVM": "ON" + "STATIC_LINK_LLVM": "ON", + "USE_SYSTEM_OPENAL": "OFF", + "USE_SYSTEM_CURL": "OFF" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index a32dbc41a4..c1358d25fa 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -153,7 +153,9 @@ elseif(UNIX) ${CMAKE_SOURCE_DIR}/bin/git $/git) elseif(WIN32) 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()