This document describes how to build ps2stuff using CMake instead of the traditional Makefile.
- PS2DEV environment installed and configured
PS2DEVenvironment variable set- CMake 3.13 or later
mkdir build
cd build
cmake ..
makeTo enable debug symbols and _DEBUG definition:
cmake -DDEBUG=ON ..
makeTo build the test executables (when available):
cmake -DBUILD_TESTS=ON ..
makeTo install the library and headers to $PS2SDK/ports:
make installThis will:
- Install
libps2stuff.ato$PS2SDK/ports/lib/ - Install all headers from
include/ps2s/to$PS2SDK/ports/include/ps2s/
The following CMake options are available:
| Option | Default | Description |
|---|---|---|
DEBUG |
OFF | Enable debug build with _DEBUG definition |
BUILD_TESTS |
OFF | Build test executables |
The CMake build automatically applies the following flags:
-DNO_VU0_VECTORS- Disables VU0 vector code (currently broken)-DNO_ASM- Disables assembly optimizations-Wno-strict-aliasing- Suppresses strict aliasing warnings-Wno-conversion-null- Suppresses conversion null warnings
The build uses the PS2DEV CMake toolchain file located at:
$PS2DEV/share/ps2dev.cmake
This toolchain file is automatically detected when PS2DEV is set.
To perform a clean build:
rm -rf build
mkdir build
cd build
cmake ..
makeThe CMake build produces the same output as the traditional Makefile:
- Same compiler flags
- Same source files
- Same install locations
- Compatible library format
The CMake build system was designed to be compatible with the existing Makefile build. Both build systems can coexist in the repository.
- Out-of-source builds: CMake uses a separate
build/directory - Dependency tracking: CMake automatically handles dependencies
- Cross-platform: CMake can generate build files for different build systems
If you get an error about PS2DEV not being set:
export PS2DEV=/path/to/ps2dev
export PS2SDK=$PS2DEV/ps2sdkMake sure the toolchain file exists at $PS2DEV/share/ps2dev.cmake.
Try a clean build:
rm -rf build
mkdir build
cd build
cmake ..
make