-
Notifications
You must be signed in to change notification settings - Fork 162
/
CMakeLists.txt
110 lines (93 loc) · 2.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
cmake_minimum_required(VERSION 2.8)
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()
project(pkgi)
include("${VITASDK}/share/vita.cmake" REQUIRED)
set(VITA_APP_NAME "PKGi")
set(VITA_TITLEID "PKGI00000")
set(VITA_VERSION "00.05")
option(PKGI_ENABLE_LOGGING "enables debug logging over udp multicast" OFF)
if(PKGI_ENABLE_LOGGING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPKGI_ENABLE_LOGGING")
endif()
if(NOT $ENV{PKGI_REFRESH_URL} STREQUAL "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPKGI_REFRESH_URL=\\\"$ENV{PKGI_REFRESH_URL}\\\"")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPKGI_VERSION=\\\"${VITA_VERSION}\\\" -D_GNU_SOURCE -g -Wall -Wextra -Werror -fvisibility=hidden")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1")
function(add_assets target)
set(result)
foreach(in_f ${ARGN})
set(out_f "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${in_f}.o")
get_filename_component(out_dir ${out_f} DIRECTORY)
add_custom_command(OUTPUT ${out_f}
COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
COMMAND ${CMAKE_LINKER} -r -b binary -o ${out_f} ${in_f}
DEPENDS ${in_f}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Using ${in_f}"
VERBATIM
)
list(APPEND result ${out_f})
endforeach()
set(${target} "${result}" PARENT_SCOPE)
endfunction()
add_assets(assets assets/background.png)
add_executable(pkgi
${assets}
pkgi.c
pkgi_aes128.c
pkgi_config.c
pkgi_db.c
pkgi_dialog.c
pkgi_download.c
pkgi_menu.c
pkgi_sha256.c
pkgi_vita.c
pkgi_zrif.c
puff.c
)
target_link_libraries(pkgi
vita2d
png
z
m
SceAppMgr_stub
SceAppUtil_stub
SceCommonDialog_stub
SceCtrl_stub
SceDisplay_stub
SceGxm_stub
SceHttp_stub
SceNet_stub
SceNetCtl_stub
ScePgf_stub
ScePower_stub
ScePromoterUtil_stub
SceShellSvc_stub
SceSsl_stub
SceSysmodule_stub
)
vita_create_self(eboot.bin pkgi UNSAFE)
vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} eboot.bin
VERSION ${VITA_VERSION}
NAME ${VITA_APP_NAME}
FILE sce_sys/icon0.png sce_sys/icon0.png
sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png
sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml
)
add_custom_target(send
COMMAND curl -T eboot.bin ftp://"$ENV{PSVITAIP}":1337/ux0:/app/${VITA_TITLEID}/
DEPENDS eboot.bin
)
add_custom_target(copy
COMMAND cp eboot.bin ${PSVITADRIVE}/app/${VITA_TITLEID}/eboot.bin
DEPENDS eboot.bin
)