-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
146 lines (114 loc) · 3.77 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
# This file is part of Sharpscale
# Copyright © 2020 浅倉麗子
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake" CACHE PATH "DolceSDK toolchain file")
set(DOLCESDK_CMAKE_FILE "$ENV{DOLCESDK}/share/dolce.cmake" CACHE PATH "DolceSDK CMake functions file")
include("${DOLCESDK_CMAKE_FILE}" REQUIRED)
option(CMAKE_TLS_VERIFY "Verify TLS" ON)
include(ExternalProject REQUIRED)
project(sharpscale LANGUAGES C)
add_compile_options(
-Os -std=c99
-Wall -Wextra -Wdouble-promotion -Wshadow -Wundef
-fsingle-precision-constant -fno-common
-ftree-vectorize -funsafe-math-optimizations -flto
)
add_link_options(
-nostdlib
)
include_directories(
"${CMAKE_SOURCE_DIR}/include"
)
set(LOGGING "1" CACHE STRING "Enable logging")
set(FILE_LOGGING "0" CACHE STRING "Enable file logging")
set(LOG_LEVEL "INFO" CACHE STRING "Log verbosity level")
add_compile_definitions(
SCE_DBG_LOGGING_ENABLED=${LOGGING}
SCE_DBG_FILE_LOGGING_ENABLED=${FILE_LOGGING}
SCE_DBG_MINIMUM_LOG_LEVEL=SCE_DBG_LOG_LEVEL_${LOG_LEVEL}
)
if(FILE_LOGGING)
set(LOG_PREFIX "[Sharpscale] ")
else()
set(LOG_PREFIX "\\033[0;35m[Sharpscale]\\033[0m ")
endif()
# External dependencies
set(DEP_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dep")
include_directories("${DEP_INSTALL_PREFIX}/include")
link_directories("${DEP_INSTALL_PREFIX}/lib")
ExternalProject_Add(dep-psp2dbg
URL https://git.shotatoshounenwachigau.moe/vita/psp2dbg/snapshot/psp2dbg-master.tar.gz
PREFIX dep/psp2dbg
CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEP_INSTALL_PREFIX}
EXCLUDE_FROM_ALL ON
)
ExternalProject_Add(dep-fnblit
URL https://git.shotatoshounenwachigau.moe/vita/fnblit/snapshot/fnblit-master.tar.gz
PREFIX dep/fnblit
CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEP_INSTALL_PREFIX}
SOURCE_SUBDIR fnblit
EXCLUDE_FROM_ALL ON
)
ExternalProject_Add(dep-sfnconv
URL https://git.shotatoshounenwachigau.moe/vita/fnblit/snapshot/fnblit-master.tar.gz
PREFIX dep/sfnconv
CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEP_INSTALL_PREFIX}
SOURCE_SUBDIR sfnconv
EXCLUDE_FROM_ALL ON
)
ExternalProject_Add(dep-vita2d_sys
URL https://git.shotatoshounenwachigau.moe/vita/vita2d/snapshot/vita2d-lowmem.tar.gz
PREFIX dep/vita2d_sys
CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${DEP_INSTALL_PREFIX}
SOURCE_SUBDIR libvita2d_sys
EXCLUDE_FROM_ALL ON
)
add_custom_target(dep-all
DEPENDS dep-psp2dbg dep-fnblit dep-sfnconv dep-vita2d_sys
)
# Build self
set(ELF "sharpscale.elf")
set(SELF "sharpscale.skprx")
set(MODULE_INFO "sharpscale.yml")
set(MODULE_STUB "sharpscale-stub")
add_executable("${ELF}"
sharpscale.c
config.c
)
target_link_libraries("${ELF}"
psp2dbgForKernel
taihenForKernel_stub
taihenModuleUtils_stub
SceDebugForDriver_stub
SceIofilemgrForDriver_stub
SceSblACMgrForDriver_stub
SceSysclibForDriver_stub
SceSysmemForDriver_stub
SceThreadmgrForDriver_stub
m
)
target_compile_definitions("${ELF}" PRIVATE
SCE_DBG_LOG_PREFIX="${LOG_PREFIX}"
)
target_link_options("${ELF}" PRIVATE
--entry=module_start
)
dolce_create_self("${SELF}"
"${ELF}"
CONFIG "${MODULE_INFO}"
)
dolce_create_stubs("${MODULE_STUB}" "${SELF}" "${MODULE_INFO}"
KERNEL
LIB Sharpscale_stub
)
add_subdirectory(config-app)
add_subdirectory(scaling-test)