Updated 10 Building on Linux (markdown)

Connor McLaughlin 2024-04-06 17:41:00 +10:00
parent 06b9492495
commit ff2ed13b23
1 changed files with 31 additions and 23 deletions

@ -10,40 +10,41 @@ Note that the procedure defined herein closely mirrors the scripts used by the P
Note that dependencies tend to change over time, along with their required versions. In particular, PCSX2 no longer supports the gcc compiler, as it has transitioned to clang/llvm due to the many benefits the latter compiler offers, including superior efficiency and speed.
### Build system
### Ubuntu Package List
- `clang` >= 17.0.6
- `cmake`
- `git`
- `lld` >= 17.0.6
- `llvm` >= 17.0.6
- `ninja`
Someone needs to fill this out.
### Libraries
### Fedora Package List
- `libaio`
- `libpng`
- `libx11`
- `qt` >= 6.6.1
- `sdl2` >= 2.28.5
- `soundtouch`
- `xz`
The following package list is sufficient for building PCSX2 as of 2024/04/06 with Fedora 39. You must build the third-party dependencies using the script from the CI, as instructed below.
```
alsa-lib-devel brotli-devel clang cmake dbus-devel egl-wayland-devel extra-cmake-modules fontconfig-devel gcc-c++ libaio-devel libcurl-devel libdecor-devel libevdev-devel libICE-devel libinput-devel libpcap-devel libSM-devel libX11-devel libXau-devel libxcb-devel libXcomposite-devel libXcursor-devel libXext-devel libXfixes-devel libXft-devel libXi-devel libxkbcommon-devel libxkbcommon-x11-devel libXpresent-devel libXrandr-devel libXrender-devel lld llvm make mesa-libEGL-devel mesa-libGL-devel ninja-build openssl-devel patch pcre2-devel perl-Digest-SHA pipewire-devel pulseaudio-libs-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-devel xcb-util-errors-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xcb-util-xrm-devel zlib-devel
```
## Build procedure
### Clone repository
```
git clone --recursive https://github.com/PCSX2/pcsx2.git
cd pcsx2
$ git clone --recursive https://github.com/PCSX2/pcsx2.git
$ cd pcsx2
```
### Build Dependencies
PCSX2 depends on multiple third-party libraries, which should be built for your development environment. We provide a convenience script for building these dependencies, which is also used by our CI runners for release builds.
This will build the dependencies to your PCSX2 Git tree, in the `deps` directory. You can also specify an alternative location, but be sure to adjust `CMAKE_PREFIX_PATH` in the next step.
```
$ .github/workflows/scripts/linux/build-dependencies-qt.sh deps
```
### Prepare build with CMake
```
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=<path_to_clang> -DCMAKE_CXX_COMPILER=<path_to_clang++> -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld" -GNinja ..
cmake -B build -DCMAKE_C_COMPILER=<path_to_clang> -DCMAKE_CXX_COMPILER=<path_to_clang++> -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld" -DCMAKE_PREFIX_PATH="$PWD/deps" -GNinja
```
Note the following optional CMake flags that are commonly used:
@ -56,11 +57,18 @@ Note the following optional CMake flags that are commonly used:
- `-DCMAKE_CXX_COMPILER_LAUNCHER=ccache`
- Uses ccache to speed up the build process
- `-DCMAKE_PREFIX_PATH=<path>`
- Defines paths to system libraries that are not globally recognized within the build environment. For example, if SDL2 is manually installed from a source outside its official repository, then its path can be defined here.
- `-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON`
- Turns on link time optimization, which provides a noticeable performance improvement.
### Execute build
```
ninja
$ ninja -C build
```
### Running PCSX2
PCSX2 can be launched from the build directory:
```
$ build/bin/pcsx2-qt
```