-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
26 lines (19 loc) · 1.04 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
cmake_minimum_required(VERSION 3.20)
set(CMAKE_TOOLCHAIN_FILE toolchain/toolchain.cmake)
project("ExceptionHandlerPayload" C CXX ASM)
# detect operating system and host processor
message(STATUS "We are on a ${CMAKE_SYSTEM_NAME} system")
message(STATUS "The host processor is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
add_link_options(
-T${CMAKE_SOURCE_DIR}/src/Linker.x
-nostartfiles -nostdlib -nodefaultlibs -Wl,--gc-sections,-static,--undefined=PayloadEntry
)
add_compile_options(
-Os -g -fno-exceptions -fno-builtin -ffunction-sections -ffreestanding -nostdinc -Wno-int-to-pointer-cast
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
add_executable("${PROJECT_NAME}.elf" "src/crt0.s" "src/HookAsm.s" "src/Libc.cpp" "src/Hooks.cpp" "src/Hex.cpp" "src/UserMemory.cpp" "src/SpinLock.s" "src/Main.cpp" "src/LV2/LV2.cpp" "src/HookOpCode.cpp" )
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
COMMENT Create ${PROJECT_NAME}.krnl
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.krnl
)