Saturday, July 11, 2020

Basics on building the vpk

For this example, we are using the "hello_world". We explained this sample on our previous entry.

Before compiling, we have to edit the CmakeLists.txt with project data. Editing this file is the "hardest part" of building the vpk, and it will have updates every time we need to add a file to the project.

Some parts to keep in mind are:


## Define project parameters here
# Name of the project

 project(hello_world)

# This line adds Vita helper macros, must go after project definition in order
# to build Vita specific artifacts (self/vpk).

 include("${VITASDK}/share/vita.cmake" REQUIRED)

## Configuration options for this app
# Display name (under bubble in LiveArea)

 set(VITA_APP_NAME "Hello World")

# Unique ID must be exactly 9 characters. Recommended: XXXXYYYYY where X =
# unique string of developer and Y = a unique number for this app

 set(VITA_TITLEID  "VSDK00007")

# Optional version string to show in LiveArea's more info screen

 set(VITA_VERSION  "01.00")


# Add any additional include paths here
include_directories(
  ../common # This is for debugScreenPrintf(), you shouldn't need it in your projects
)

## Build and link
# Add all the files needed to compile here
add_executable(${PROJECT_NAME}
  src/main.c
  ../common/debugScreen.c
)


## Create Vita files
vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME})
# The FILE directive lets you add additional files to the VPK, the syntax is
# FILE src_path dst_path_in_vpk. In this case, we add the LiveArea paths.
vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} ${PROJECT_NAME}.self
  VERSION ${VITA_VERSION}
  NAME ${VITA_APP_NAME}
  FILE sce_sys/icon0.png sce_sys/icon0.png
  FILE sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png
  FILE sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
  FILE sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml
)

---


Now to the compiling, we are going to follow the instructions on the readme file, and type the commands in the terminal. [This part is fairly easy, to be honest]

"Use the following command to build every sample:"

mkdir build && cd build # create a building directory 
cmake .. # copy and create the files we'll need to compile in the build directory
make # actually build the archives and the vpk 
 
 
After this we will have our files in the "build" folder, every file is explained clearly in the CmakeLists.txt and because of that, there is no need to copy the same here.
 
----

Some screenshots of the process





No comments:

Post a Comment