-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
154 lines (137 loc) · 5.12 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
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
146
147
148
149
150
151
152
153
154
cmake_minimum_required(VERSION 3.12)
set(CMAKE_TOOLCHAIN_FILE "$ENV{SCE_PSP2_SDK_DIR}/host_tools/build/cmake/psp2-snc-toolchain.cmake")
project(SelfLauncher)
include(VitaDevelopmentSuite)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
add_subdirectory(SLKernel)
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
message("Debug build!")
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
add_compile_options(
-D_SCE_TARGET_OS_PSP2=1 -Xdiag=0 -Xquit=2 -Od -g -noex -DSCE_PAF_TOOL_PRX=1 -D_DEBUG=1
)
else()
add_compile_options(
-D_SCE_TARGET_OS_PSP2=1 -Xdiag=0 -Xquit=2 -O3 -noex
)
endif()
add_link_options(
--no-standard-libraries -Map=${CMAKE_BINARY_DIR}/mapfile -sn-full-map
)
# Generate the headers for the PAF plugin
add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/include/sl_plugin.h
COMMAND py ${CMAKE_SOURCE_DIR}/genhashheaders.py ${CMAKE_SOURCE_DIR}/resource/sl_plugin.xml ${CMAKE_SOURCE_DIR}/include/sl_plugin.h
)
# Generate the headers for the plugin locale
add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/include/sl_locale.h
COMMAND py ${CMAKE_SOURCE_DIR}/genhashheaders.py ${CMAKE_SOURCE_DIR}/resource/locale/en.xml ${CMAKE_SOURCE_DIR}/include/sl_locale.h
)
# Generate the headers for the plugin settings
add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/include/sl_settings.h
COMMAND py ${CMAKE_SOURCE_DIR}/genhashheaders.py ${CMAKE_SOURCE_DIR}/resource/file/sl_settings.xml ${CMAKE_SOURCE_DIR}/include/sl_settings.h
)
add_executable(${PROJECT_NAME}
src/main.cpp
src/utils.cpp
src/settings.cpp
src/paf_runtime.cpp
src/pages/page.cpp
src/pages/file_browser.cpp
common/SLKernel.h
include/common.h
include/print.h
include/utils.h
include/pages/page.h
include/pages/file_browser.h
include/sl_plugin.h
include/sl_locale.h
include/sl_settings.h
)
target_link_directories(${PROJECT_NAME} PRIVATE
${VDSUITE_LIBRARY_DIRECTORIES}
stubs
)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/common
${VDSUITE_USER_INCLUDE_DIRECTORIES}
${VDSUITE_STANDARD_INCLUDE_DIRECTORIES}
$ENV{SCE_PSP2_SDK_DIR}/target/include
$ENV{SCE_PSP2_SDK_DIR}/target/include_common
)
target_link_libraries(${PROJECT_NAME}
SceLibKernel_stub
SceThreadMgr_stub
SceVshBridge_stub
ScePafStdc_stub
ScePafThread_stub
ScePafTopLevel_stub
ScePafWidget_stub
ScePafCommon_stub
ScePafGraphics_stub
ScePafResource_stub
ScePafMisc_stub
LoaderCompanionKernel_stub_weak
SceAppUtil_stub
SceAppSettings_stub
taihenUnsafe_stub
SceSysmodule_stub
)
# Create our list for all locale .xml files
file(GLOB localeXml "${CMAKE_SOURCE_DIR}/resource/locale/*.xml")
# Create our list for generated rcs files
set(rcsFiles)
# Loop through the xml files and generate an rcs file and add to the deps list
foreach(_xml ${localeXml})
get_filename_component(localeName ${_xml} NAME_WE)
set(rcsOutPath ${CMAKE_SOURCE_DIR}/resource/locale/${localeName}.rcs)
message("Locale added - ${localeName}.rcs")
add_custom_command(
OUTPUT ${rcsOutPath}
COMMAND python $ENV{SCE_PSP2_SDK_DIR}/host_tools/build/cxml/appinfo/rcs_compiler.py -o ${rcsOutPath} ${_xml}
)
list(APPEND rcsFiles ${rcsOutPath})
endforeach()
# Generate RCO file
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/sl_plugin.rco
DEPENDS ${CMAKE_SOURCE_DIR}/resource/sl_plugin.xml ${rcsFiles}
COMMAND python $ENV{SCE_PSP2_SDK_DIR}/host_tools/build/cxml/appinfo/appinfo_compiler.py -o ${CMAKE_BINARY_DIR}/sl_plugin.rco ${CMAKE_SOURCE_DIR}/resource/sl_plugin.xml
)
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
# Generate the RCD file
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/sl_plugin.rcd
DEPENDS ${CMAKE_SOURCE_DIR}/resource/sl_plugin.xml
COMMAND $ENV{SCE_PSP2_SDK_DIR}/host_tools/build/bin/psp2rcd.exe -i ${CMAKE_SOURCE_DIR}/resource/sl_plugin.xml -o ${CMAKE_BINARY_DIR}/sl_plugin.rcd
)
endif()
VDSuiteCreateSfo(${PROJECT_NAME}.sfo param.sfx)
VDSuiteSignElf(${PROJECT_NAME}.self $<TARGET_FILE:${PROJECT_NAME}> BOOT_PARAM bootparam.yml PROGRAM_AUTHORITY_ID 2200000000000001)
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.elf
DEPENDS ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.self
COMMAND "$ENV{SCE_ROOT_DIR}/PSP2/Tools/Publishing Tools/bin/ext/unfself.exe" ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.self ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.elf
)
VDSuitePackage(${PROJECT_NAME}.vpk
FILES
${PROJECT_NAME}.self eboot.bin
${CMAKE_BINARY_DIR}/${PROJECT_NAME}.sfo sce_sys/param.sfo
${CMAKE_BINARY_DIR}/sl_plugin.rco resource/sl_plugin.rco
${CMAKE_BINARY_DIR}/sl_plugin.rcd resource/sl_plugin.rcd
${CMAKE_BINARY_DIR}/SLKernel/SLKernel.skprx module/SLKernel.skprx
)
else()
VDSuitePackage(${PROJECT_NAME}.vpk
FILES
${PROJECT_NAME}.self eboot.bin
${CMAKE_BINARY_DIR}/${PROJECT_NAME}.sfo sce_sys/param.sfo
${CMAKE_BINARY_DIR}/sl_plugin.rco resource/sl_plugin.rco
${CMAKE_BINARY_DIR}/SLKernel/SLKernel.skprx module/SLKernel.skprx
)
endif()