.
├── CMakeLists.txt
├── build/
├── include/
└── src/
└── CMakeLists.txt
A directory for *.cpp
files. By default it will contain CMakeLists.txt
with template code to build main.cpp
.
Default directory to put your headers into. It’s best to create a directory there with the name of your project because this would be the include you can use: #include <project/header.hpp>
. Your code will be more portable and you will omit various header name collissions.
Used for all sorts of temporary files. EBOOT.PBP
lives there under build/src/path/
, where path
is path to CMakeLists.txt
that has add_executable()
in it.
- Add an executable in one of sub-directories of
src/
.
add_executable(psp main.cpp)
- Link PSP libraries and any auxilary ones.
target_link_libraries(psp PRIVATE ${PSP_LIBRARIES})
- Create
EBOOT.PBP
.
create_pbp_file(TARGET psp TITLE "${CMAKE_PROJECT_NAME}"
# ICON_PATH
# BACKGROUND_PATH
# PREVIEW_PATH
)
Here we create an EBOOT.PBP
from target psp
with the same title as the project. You can replace "${CMAKE_PROJECT_NAME}"
with any other string that PSP will accept and display. If title is not specified it will be set to NULL
.
First we need to initialise CMake properly. If you have anything in build/
before first initialisation - remove it.
psp-cmake -S . -B build/
Same as any other cmake project with:
# in project root:
cmake --build build/
The output should be something like this:
[ 50%] Building CXX object src/CMakeFiles/psp.dir/main.cpp.obj
[100%] Linking CXX executable psp
Not stripping binary, build type is .
Creating psp_artifact directory.
Copying ELF to psp_arfitact directory.
Calling psp-fixup-imports
Calling mksfoex
Calling pack-pbp
[0] 316 bytes | PARAM.SFO
[1] 0 bytes | NULL
[2] 0 bytes | NULL
[3] 0 bytes | NULL
[4] 0 bytes | NULL
[5] 0 bytes | NULL
[6] 457844 bytes | /mnt/d/psp/cmake/build/src/psp_artifact/psp
[7] 0 bytes | NULL
EBOOT.PBP file created.
[100%] Built target psp
psp-cmake
passes a toolchain file at first build configuration and sets up a compiler, link and include paths. This step is important because without a propper compiler, linker, etc you would not be able to create a executable target for EBOOT.PBP
.
Upon build macro create_pbp_file()
parses arguments you give it looking for keywords such as TARGET
ICON_PATH
BACKGROUND_PATH
PREVIEW_PATH
. Following a keyword text is argument with such keyword name.