Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
apk update
apk add cmake build-base git make

- name: Configure with CMake
- name: Configure with CMake (library + tests)
run: |
mkdir build
cd build
cmake ..
cmake -DBUILD_TESTS=ON ..

- name: Build project with CMake
run: |
Expand All @@ -46,3 +46,4 @@ jobs:
name: libps2stuff-${{ steps.slug.outputs.sha8 }}
path: |
build/*.a
build/tests/*.elf
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ objs_*
prebuilddone
*.o
*.a

# CMake
build/
CMakeCache.txt
Expand All @@ -12,3 +11,4 @@ cmake_install.cmake
install_manifest.txt
*.cmake
!CMakeLists.txt
*.elf
20 changes: 16 additions & 4 deletions CMAKE_BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ make

### Building with Tests

To build the test executables (when available):
To build the test executables:

```bash
cmake -DBUILD_TESTS=ON ..
make
```

If `ps2client` is installed and available in `PATH`, you can run:

```bash
make run_test_vu0
```

## Installing

To install the library and headers to `$PS2SDK/ports`:
Expand All @@ -57,16 +63,22 @@ The following CMake options are available:
|--------|---------|-------------|
| `DEBUG` | OFF | Enable debug build with `_DEBUG` definition |
| `BUILD_TESTS` | OFF | Build test executables |
| `ENABLE_VU0_VECTORS` | ON | Enable VU0 vector code paths |
| `ENABLE_ASM` | ON | Enable assembly optimizations |

## Build Flags

The CMake build automatically applies the following flags:
The CMake build automatically applies the following warning 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

To disable VU0 vectors or assembly paths, configure with:

```bash
cmake -DENABLE_VU0_VECTORS=OFF -DENABLE_ASM=OFF ..
```

## CMake Toolchain

The build uses the PS2DEV CMake toolchain file located at:
Expand Down
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ project(ps2stuff VERSION 1.0.0 LANGUAGES CXX C)
# Options
option(BUILD_TESTS "Build test projects" OFF)
option(DEBUG "Enable debug build" OFF)
option(ENABLE_VU0_VECTORS "Enable VU0 vector code paths" ON)
option(ENABLE_ASM "Enable assembly optimizations" ON)

# Check if PS2SDK is set (should be done by toolchain file)
if(NOT DEFINED PS2SDK)
Expand Down Expand Up @@ -45,11 +47,13 @@ set(WARNING_FLAGS
-Wno-conversion-null
)

# VU0 code is broken so disable for now
add_compile_definitions(
NO_VU0_VECTORS
NO_ASM
)
if(NOT ENABLE_VU0_VECTORS)
add_compile_definitions(NO_VU0_VECTORS)
endif()

if(NOT ENABLE_ASM)
add_compile_definitions(NO_ASM)
endif()

add_compile_options(${WARNING_FLAGS})

Expand Down Expand Up @@ -122,6 +126,6 @@ message(STATUS " Debug build: ${DEBUG}")
message(STATUS " Build tests: ${BUILD_TESTS}")
message(STATUS " Output library: ${EE_LIB}")
message(STATUS " Install prefix: ${PS2SDK}/ports")
message(STATUS " VU0 vectors: DISABLED")
message(STATUS " ASM optimizations: DISABLED")
message(STATUS " VU0 vectors: ${ENABLE_VU0_VECTORS}")
message(STATUS " ASM optimizations: ${ENABLE_ASM}")
message(STATUS "")
Loading
Loading