-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
CMakeLists.txt
124 lines (109 loc) · 3.54 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
cmake_minimum_required(VERSION 3.13)
set(VITA2HOS_MAJOR 0)
set(VITA2HOS_MINOR 3)
set(VITA2HOS_PATCH 0)
execute_process(COMMAND
git describe --dirty --always --exclude '*'
OUTPUT_VARIABLE VITA2HOS_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
project(
vita2hos
VERSION ${VITA2HOS_MAJOR}.${VITA2HOS_MINOR}.${VITA2HOS_PATCH}
LANGUAGES C CXX
)
# Overwrite libnx location
set(NX_ROOT ${DEVKITPRO}/libnx32)
include(Platform/NintendoSwitch)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(VITASDK_INCLUDE $ENV{VITASDK}/arm-vita-eabi/include)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NX_ARCH_SETTINGS} ${NX_COMMON_FLAGS} -idirafter ${VITASDK_INCLUDE}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NX_ARCH_SETTINGS} ${NX_COMMON_FLAGS} -idirafter ${VITASDK_INCLUDE}")
add_executable(vita2hos
source/load.c
source/log.c
source/main.c
source/module.c
source/uam_compiler_iface_c.cpp
source/util.c
source/vita3k_shader_recompiler_iface_c.cpp
source/modules/SceCtrl.c
source/modules/SceDisplay.c
source/modules/SceGxm.c
source/modules/SceKernelThreadMgr.c
source/modules/SceLibKernel.c
source/modules/SceSysmem.c
source/modules/SceTouch.c
Vita3K/vita3k/gxm/src/attributes.cpp
Vita3K/vita3k/gxm/src/color.cpp
Vita3K/vita3k/gxm/src/gxp.cpp
Vita3K/vita3k/gxm/src/stream.cpp
Vita3K/vita3k/gxm/src/textures.cpp
Vita3K/vita3k/gxm/src/transfer.cpp
Vita3K/vita3k/shader/src/gxp_parser.cpp
Vita3K/vita3k/shader/src/spirv_recompiler.cpp
Vita3K/vita3k/shader/src/translator/alu.cpp
Vita3K/vita3k/shader/src/translator/branch_cond.cpp
Vita3K/vita3k/shader/src/translator/data.cpp
Vita3K/vita3k/shader/src/translator/ialu.cpp
Vita3K/vita3k/shader/src/translator/illegal.cpp
Vita3K/vita3k/shader/src/translator/special.cpp
Vita3K/vita3k/shader/src/translator/texture.cpp
Vita3K/vita3k/shader/src/translator/utils.cpp
Vita3K/vita3k/shader/src/usse_decode_helpers.cpp
Vita3K/vita3k/shader/src/usse_disasm.cpp
Vita3K/vita3k/shader/src/usse_program_analyzer.cpp
Vita3K/vita3k/shader/src/usse_translator_entry.cpp
Vita3K/vita3k/shader/src/usse_utilities.cpp
)
target_include_directories(vita2hos PRIVATE
include
include/vita3k
Vita3K/vita3k/gxm/include
Vita3K/vita3k/shader/include
Vita3K/vita3k/features/include
Vita3K/vita3k/util/include
${NX_ROOT}/include/spirv_cross
${NX_ROOT}/include/glslang
${NX_ROOT}/include/uam/mesa-imported
)
target_compile_options(vita2hos PRIVATE
-Wall
)
target_compile_definitions(vita2hos PRIVATE
VITA2HOS_MAJOR="${VITA2HOS_MAJOR}"
VITA2HOS_MINOR="${VITA2HOS_MINOR}"
VITA2HOS_PATCH="${VITA2HOS_PATCH}"
VITA2HOS_HASH="${VITA2HOS_HASH}"
)
target_link_libraries(vita2hos PRIVATE
SPIRV
spirv-cross-c
spirv-cross-core
spirv-cross-cpp
spirv-cross-glsl
spirv-cross-reflect
spirv-cross-util
glslang
fmt
uam
miniz
deko3dd
)
target_link_directories(vita2hos PRIVATE
${NX_ROOT}/lib
)
target_link_options(vita2hos PRIVATE
-specs=${NX_ROOT}/switch32.specs
-Wl,-Map,${CMAKE_PROJECT_NAME}.map
# pthread_cancel gets removed otherwise, which makes __ghtread_active_p() fail
-Wl,-u,pthread_cancel
)
find_program(NX_ELF2NSO_EXE NAMES elf2nso HINTS "${DEVKITPRO}/tools/bin")
find_program(NX_NPDMTOOL_EXE NAMES npdmtool HINTS "${DEVKITPRO}/tools/bin")
find_program(NX_BUILD_PFS0_EXE NAMES build_pfs0 HINTS "${DEVKITPRO}/tools/bin")
nx_create_exefs(${CMAKE_PROJECT_NAME}
CONFIG ${CMAKE_PROJECT_NAME}.json
)