PCSX2 Documentation/PCSX2 Build Scripts: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 2: Line 2:


==build.sh==
==build.sh==
[https://github.com/PCSX2/pcsx2/blob/master/build.sh This is where the fun begins.] Running this shell script will begin the long build process for PCSX2. First, the script checks for arguments in the command line, setting the build and log directories. Then, the script runs CMake.
[https://github.com/PCSX2/pcsx2/blob/master/build.sh This is where the fun begins.] Running this shell script will begin the long build process for PCSX2. First, the script checks for arguments in the command line, setting the build and log directories. Then, the script runs CMake. You can view the available options with <code>build.sh -help</code>.


==CMake==
==CMake==
Line 9: Line 9:
The CMake build process is controlled by [https://github.com/PCSX2/pcsx2/blob/master/CMakeLists.txt This file here]. Cmake will check if directories exist for the different modules of pcsx2 (core, plugins, etc) and then search for CMakeLists.txt files within those directories, which in turn may check for further subdirectories. For example, the CMakeLists.txt file in the plugins folder will check if directories exist for the different pcsx2 plugins. There will in turn be a CMakeLists.txt file in each of the plugin folders. When you add a new source code file, you will need to add it to the CMakeLists.txt file for the module of pcsx2 you are working on.
The CMake build process is controlled by [https://github.com/PCSX2/pcsx2/blob/master/CMakeLists.txt This file here]. Cmake will check if directories exist for the different modules of pcsx2 (core, plugins, etc) and then search for CMakeLists.txt files within those directories, which in turn may check for further subdirectories. For example, the CMakeLists.txt file in the plugins folder will check if directories exist for the different pcsx2 plugins. There will in turn be a CMakeLists.txt file in each of the plugin folders. When you add a new source code file, you will need to add it to the CMakeLists.txt file for the module of pcsx2 you are working on.


 
==Expert mode: CMake build parameters==
### Using CMake
 
#### Basic mode: straightforward compilation
Run the `build.sh` script.
You can view the available options with `build.sh -help`
 
#### Expert mode: CMake build parameters
Basic parameters:
Basic parameters:
- Use Release/Devel/Debug : `-DCMAKE_BUILD_TYPE=Release|Devel|Debug`
*Use Release/Devel/Debug : `-DCMAKE_BUILD_TYPE=Release|Devel|Debug`
  - `Release`: Best in speed, but provides little or no debug/crash info.
**`Release`: Best in speed, but provides little or no debug/crash info.
  - `Devel`: Adds detailed trace logging abilities, but still lacks debug/crash info.
**`Devel`: Adds detailed trace logging abilities, but still lacks debug/crash info.
  - `Debug`: No compiler optimizations. Very good for debug/crash info but also very slooowww.  
**`Debug`: No compiler optimizations. Very good for debug/crash info but also very slooowww.  
- Follow XDG standard : `-DXDG_STD=TRUE`
*Follow XDG standard : `-DXDG_STD=TRUE`
- Build all plugins: `-DEXTRA_PLUGINS=TRUE`
*Build all plugins: `-DEXTRA_PLUGINS=TRUE`


Expert parameters (not supported, the best is to use the default options):
Expert parameters (not supported, the best is to use the default options):
- Tune C flags : `-DUSER_CMAKE_C_FLAGS:STRING="cflags"`
*Tune C flags : `-DUSER_CMAKE_C_FLAGS:STRING="cflags"`
- Tune C++ flags : `-DUSER_CMAKE_CXX_FLAGS:STRING="cxxflags"`
*Tune C++ flags : `-DUSER_CMAKE_CXX_FLAGS:STRING="cxxflags"`
- Tune linker flags : `-DUSER_CMAKE_LD_FLAGS:STRING="ldflags"`
*Tune linker flags : `-DUSER_CMAKE_LD_FLAGS:STRING="ldflags"`


Expert debugging parameters (typical developper only option):
Expert debugging parameters (typical developper only option):
- Build GS replayer: `-DBUILD_REPLAY_LOADERS=TRUE`
*Build GS replayer: `-DBUILD_REPLAY_LOADERS=TRUE`
- Use Address Sanitizer: `-DUSE_ASAN=TRUE`
*Use Address Sanitizer: `-DUSE_ASAN=TRUE`
- Force wxWidget 2.8 (to spot a regression) : `-DWX28_API=TRUE`
*Force wxWidget 2.8 (to spot a regression) : `-DWX28_API=TRUE`


Experimental parameters (not supported, the best is to use the default options):
Experimental parameters (not supported, the best is to use the default options):
- zzogl: Use GLSL for shading instead of nvidia cg : `-DGLSL_API=TRUE`
*zzogl: Use GLSL for shading instead of nvidia cg : `-DGLSL_API=TRUE`
- zzogl: Use EGL instead of GLX : `-DEGL_API=TRUE`
*zzogl: Use EGL instead of GLX : `-DEGL_API=TRUE`
- GSdx: Use openGL ES3.1 instead of pure openGL : `-DGLES_API=TRUE`  
*GSdx: Use openGL ES3.1 instead of pure openGL : `-DGLES_API=TRUE`  
- Use SDL2 (wxWidget must be linked with SDL1) : `-DSL2_API=TRUE`
*Use SDL2 (wxWidget must be linked with SDL1) : `-DSL2_API=TRUE`
- Use GTK3 (wxWidget must be built with GTK3 support) : `-DGTK3_API=TRUE`
*Use GTK3 (wxWidget must be built with GTK3 support) : `-DGTK3_API=TRUE`
- Use clang (nothing work) : `-DUSE_CLANG=TRUE`
*Use clang (nothing work) : `-DUSE_CLANG=TRUE`
- 64 bits support (nothing work): `-D64BIT_BUILD_DONT_WORK=TRUE`
*64 bits support (nothing work): `-D64BIT_BUILD_DONT_WORK=TRUE`


Expert options for package creation
Expert options for package creation
- Enable package mode : follow the FHS for distribution `-DPACKAGE_MODE=TRUE`
*Enable package mode : follow the FHS for distribution `-DPACKAGE_MODE=TRUE`
- Plugin install path in package mode : `-DPLUGIN_DIR="/usr/lib/pcsx2"`
*Plugin install path in package mode : `-DPLUGIN_DIR="/usr/lib/pcsx2"`
- GameDB install path in package mode : `-DGAMEINDEX_DIR="/usr/share/games/pcsx2"`
*GameDB install path in package mode : `-DGAMEINDEX_DIR="/usr/share/games/pcsx2"`
- GLSL shader install directory : `-DGLSL_SHADER_DIR="/usr/share/games/pcsx2"`
*GLSL shader install directory : `-DGLSL_SHADER_DIR="/usr/share/games/pcsx2"`
- Update po (translation file) : `-DCMAKE_BUILD_PO=TRUE`
*Update po (translation file) : `-DCMAKE_BUILD_PO=TRUE`
- Rebuild shader : `-DREBUILD_SHADER=TRUE`
*Rebuild shader : `-DREBUILD_SHADER=TRUE`
- Disable AVX: `-DDISABLE_ADVANCE_SIMD=TRUE`
*Disable AVX: `-DDISABLE_ADVANCE_SIMD=TRUE`
- Enable/disable the stipping : `-DCMAKE_BUILD_STRIP=TRUE|FALSE`
*Enable/disable the stipping : `-DCMAKE_BUILD_STRIP=TRUE|FALSE`
  - `TRUE`: Remove debugging information.
**`TRUE`: Remove debugging information.
  - `FALSE`: Keep symbols. Better for debug. (recommended since it should not have any impact on speed)  
**`FALSE`: Keep symbols. Better for debug. (recommended since it should not have any impact on speed)  


### Running CMake to generate the makefile:
==Running CMake to generate the makefile:==


It is advised to use a build method that places build files outside the PCSX2 sources directory, as it makes it easier to delete all CMake build files:
It is advised to use a build method that places build files outside the PCSX2 sources directory, as it makes it easier to delete all CMake build files:
```
 
mkdir build && cd build
mkdir build && cd build
cmake .. <other options>
cmake .. <other options>
```


#### Do the compilation:
====Do the compilation:====
```
 
make  
make  
```


#### Install files:
 
====Install files:====
```
```
make install  
make install  
```
```


### Reporting Cmake bugs
====Reporting Cmake bugs====


Not all distributions and configurations were tested. In case you encounter a CMake bug that is really a CMake issue, you can report it. Please provide the following information:
Not all distributions and configurations were tested. In case you encounter a CMake bug that is really a CMake issue, you can report it. Please provide the following information:


1. Linux distribution, the current kernel version, and architecture (32-bit or 64-bit)
#Linux distribution, the current kernel version, and architecture (32-bit or 64-bit)
2. The CMake commands. For example: `cmake CMakeLists.txt`
#The CMake commands. For example: `cmake CMakeLists.txt`
3. **All** of CMake's output. Something like this is good:
#''All'' of CMake's output. Something like this is good:


```
```
Line 128: Line 120:
```
```


## Ubuntu PPA
==Ubuntu PPA==


With multiarch functionality, you can install a 32-bit PPA on a 64-bit Ubuntu. You need at least Ubuntu 12.04 (Precise) to do this.
With multiarch functionality, you can install a 32-bit PPA on a 64-bit Ubuntu. You need at least Ubuntu 12.04 (Precise) to do this.


#### Add the x86 architecture to your package manager (x64 installs of 12.04 or newer only)
====Add the x86 architecture to your package manager (x64 installs of 12.04 or newer only)====
In a terminal, type:
In a terminal, type:
````
````
ninja
782

edits

Navigation menu