Skip to content

Commit

Permalink
Merge pull request #98 from d3m3vilurr/use-vitasdk-cmake
Browse files Browse the repository at this point in the history
Use vitasdk cmake rules
  • Loading branch information
d3m3vilurr authored Apr 15, 2020
2 parents 3df974e + 51cf01c commit 63cfa4b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
64 changes: 29 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
cmake_minimum_required(VERSION 2.8)

set(CMAKE_SYSTEM_NAME "Generic")
set(CMAKE_C_COMPILER "arm-vita-eabi-gcc")
# VitaSDK defines
if( NOT DEFINED CMAKE_TOOLCHAIN_FILE )
if( DEFINED ENV{VITASDK} )
set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file")
else()
message(FATAL_ERROR "Please define VITASDK to point to your SDK path!")
endif()
endif()

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

project(savemgr)
set(TITLE_ID "SAVEMGR00")
set(TITLE "Save Manager")
set(VERSION "2.0.0")

add_subdirectory(extern/vitashell/modules/kernel)
add_subdirectory(extern/vitashell/modules/user)

execute_process(COMMAND
python -c "print ('%02d.%02d' % tuple(map(lambda x: int(x), '${VERSION}'.split('.')[:2])))"
OUTPUT_VARIABLE APP_VER
Expand All @@ -33,22 +45,6 @@ add_definitions(-DVERSION=\"${VERSION}\")

set(CMAKE_C_FLAGS "-Wl,-q -Wall -O3 -std=c99")

add_custom_target(vitashell_kernel_module
COMMAND ${CMAKE_COMMAND} .
COMMAND make
COMMAND cp kernel.skprx ${CMAKE_SOURCE_DIR}/sce_sys/kernel.skprx
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/extern/vitashell/modules/kernel)

add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/extern/vitashell/modules/user/vitashell_user_stubs/libVitaShellUser_stub_weak.a
DEPENDS vitashell_kernel_module
COMMAND ${CMAKE_COMMAND} .
COMMAND make
COMMAND cp user.suprx ${CMAKE_SOURCE_DIR}/sce_sys/user.suprx
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/extern/vitashell/modules/user)

add_custom_target(vitashell_user_lib ALL DEPENDS ${CMAKE_SOURCE_DIR}/extern/vitashell/modules/user/vitashell_user_stubs/libVitaShellUser_stub_weak.a)
add_custom_target(vitashell_user_module ALL DEPENDS vitashell_user_lib)

include_directories(
extern/sqlite3
extern/inih
Expand Down Expand Up @@ -92,27 +88,25 @@ target_link_libraries(${PROJECT_NAME}.elf
-lSceShellSvc_stub
-lSceRegistryMgr_stub
-ltaihen_stub
${CMAKE_SOURCE_DIR}/extern/vitashell/modules/user/vitashell_user_stubs/libVitaShellUser_stub_weak.a
${CMAKE_CURRENT_BINARY_DIR}/extern/vitashell/modules/user/libVitaShellUser_stub_weak.a

-ldebugnet
-lSceNetCtl_stub
-lSceNet_stub
)

add_dependencies(${PROJECT_NAME}.elf vitashell_kernel_module vitashell_user_module)

add_custom_target(${PROJECT_NAME}.vpk ALL
COMMAND vita-elf-create ${PROJECT_NAME}.elf ${PROJECT_NAME}.velf
COMMAND vita-make-fself -c ${PROJECT_NAME}.velf eboot.bin
COMMAND vita-mksfoex -s TITLE_ID=${TITLE_ID} -s APP_VER=${APP_VER} "${TITLE}" param.sfo
COMMAND vita-pack-vpk -s param.sfo -b eboot.bin
--add ../sce_sys/icon0.png=sce_sys/icon0.png
--add ../sce_sys/kernel.skprx=sce_sys/kernel.skprx
--add ../sce_sys/user.suprx=sce_sys/user.suprx
--add ../sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png
--add ../sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png
--add ../sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml
${PROJECT_NAME}.vpk
add_dependencies(${PROJECT_NAME}.elf libVitaShellUser_stub_weak.a)
add_dependencies(${PROJECT_NAME}.elf kernel.skprx)
add_dependencies(${PROJECT_NAME}.elf user.suprx)

vita_create_self(eboot.bin ${PROJECT_NAME}.elf UNSAFE)
vita_create_vpk(${PROJECT_NAME}.vpk ${TITLE_ID} eboot.bin
VERSION ${APP_VER}
NAME ${TITLE}
FILE ${CMAKE_SOURCE_DIR}/sce_sys/icon0.png sce_sys/icon0.png
${CMAKE_CURRENT_BINARY_DIR}/extern/vitashell/modules/kernel/kernel.skprx sce_sys/kernel.skprx
${CMAKE_CURRENT_BINARY_DIR}/extern/vitashell/modules/user/user.suprx sce_sys/user.suprx
${CMAKE_SOURCE_DIR}/sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png
${CMAKE_SOURCE_DIR}/sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
${CMAKE_SOURCE_DIR}/sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml
)

add_dependencies(${PROJECT_NAME}.vpk ${PROJECT_NAME}.elf)

0 comments on commit 63cfa4b

Please sign in to comment.