-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathCMakeLists.txt
86 lines (73 loc) · 1.71 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
cmake_minimum_required(VERSION 3.13)
set(FAKEMOTE_MAJOR 0)
set(FAKEMOTE_MINOR 5)
set(FAKEMOTE_PATCH 1)
execute_process(COMMAND
git describe --dirty --always --exclude "*"
OUTPUT_VARIABLE FAKEMOTE_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_program(STRIPIOS stripios REQUIRED)
project(
fakemote
VERSION ${FAKEMOTE_MAJOR}.${FAKEMOTE_MINOR}.${FAKEMOTE_PATCH}
LANGUAGES ASM C
)
set(ARCH -mcpu=arm926ej-s -mthumb -mthumb-interwork -mbig-endian)
set(CMAKE_C_STANDARD 11)
add_compile_options(
${ARCH}
-O2
-g3
-ffreestanding
-fomit-frame-pointer
-fno-builtin
-ffunction-sections
-Wall
)
add_executable(fakemote
source/start.s
source/button_map.c
source/main.c
source/hci_state.c
source/injmessage.c
source/input_device.c
source/fake_wiimote.c
source/fake_wiimote_mgr.c
source/libc.c
source/wiimote_crypto.c
source/conf.c
source/usb_hid.c
source/usb_drivers/sony_ds3.c
source/usb_drivers/sony_ds4.c
)
target_include_directories(fakemote PRIVATE
include
)
target_compile_definitions(fakemote PRIVATE
FAKEMOTE_MAJOR=${FAKEMOTE_MAJOR}
FAKEMOTE_MINOR=${FAKEMOTE_MINOR}
FAKEMOTE_PATCH=${FAKEMOTE_PATCH}
FAKEMOTE_HASH=${FAKEMOTE_HASH}
)
add_subdirectory(cios-lib)
target_link_libraries(fakemote PRIVATE
cios-lib
gcc
)
target_link_options(fakemote PRIVATE
${ARCH}
-nostartfiles
-nostdlib
-Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/link.ld,-Map,${CMAKE_PROJECT_NAME}.map
-Wl,--gc-sections
-Wl,-static
)
add_custom_target(app ALL
DEPENDS FAKEMOTE.app
)
add_custom_command(
DEPENDS ${CMAKE_PROJECT_NAME}
OUTPUT FAKEMOTE.app
COMMAND ${STRIPIOS} ${CMAKE_PROJECT_NAME}.elf FAKEMOTE.app
)