forked from mmozeiko/pkgi
-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathcross.cmake
145 lines (131 loc) · 3.52 KB
/
cross.cmake
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
find_package(vitasqlite REQUIRED)
find_package(imgui REQUIRED)
enable_language(ASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1")
function(add_assets target)
set(result)
foreach(in_f ${ARGN})
set(asm_f "${CMAKE_CURRENT_BINARY_DIR}/${in_f}.S")
set(out_f "${CMAKE_CURRENT_BINARY_DIR}/${in_f}.o")
string(REPLACE "/" "_" symbol ${in_f})
string(REPLACE "." "_" symbol ${symbol})
get_filename_component(out_dir ${out_f} DIRECTORY)
# we use this embedding method to enforce alignment on resources
# which is needed for shaders
file(WRITE ${asm_f}
".section .rodata
.global _binary_${symbol}_start
.global _binary_${symbol}_end
.align 4
_binary_${symbol}_start:
.incbin \"${CMAKE_CURRENT_SOURCE_DIR}/${in_f}\"
_binary_${symbol}_end:"
)
add_custom_command(OUTPUT ${out_f}
COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
COMMAND ${CMAKE_ASM_COMPILER} -c -o ${out_f} ${asm_f}
DEPENDS ${in_f} ${asm_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
assets/imgui_v_cg.gxp
assets/imgui_f_cg.gxp
)
add_executable(pkgj
${assets}
src/aes128.cpp
src/bgdl.cpp
src/comppackdb.cpp
src/config.cpp
src/db.cpp
src/dialog.cpp
src/download.cpp
src/downloader.cpp
src/extractzip.cpp
src/filedownload.cpp
src/gameview.cpp
src/patchinfo.cpp
src/patchinfofetcher.cpp
src/psx.cpp
src/imagefetcher.cpp
src/imgui.cpp
src/install.cpp
src/menu.cpp
src/pkgi.cpp
src/puff.c
src/sfo.cpp
src/sha256.cpp
src/update.cpp
src/vita.cpp
src/vitafile.cpp
src/vitahttp.cpp
src/zrif.cpp
)
target_link_libraries(pkgj
vita2d
fmt::fmt
Boost::headers
cereal::cereal
libzip::zip
vitasqlite::vitasqlite
imgui::imgui
png
jpeg
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
SceVshBridge_stub
taihen_stub
)
set_target_properties(pkgj PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
)
vita_create_self(eboot.bin pkgj UNSAFE)
configure_file(
assets/sce_sys/livearea/contents/template.xml.in
assets/sce_sys/livearea/contents/template.xml
)
vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} eboot.bin
VERSION 0${VITA_VERSION}
NAME ${VITA_APP_NAME}
FILE assets/sce_sys/icon0.png sce_sys/icon0.png
assets/sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png
assets/sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
${CMAKE_CURRENT_BINARY_DIR}/assets/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
)