-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (56 loc) · 1.75 KB
/
CMakeLists.txt
File metadata and controls
71 lines (56 loc) · 1.75 KB
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
cmake_minimum_required(VERSION 3.13)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(EGC_MAJOR 0)
set(EGC_MINOR 1)
set(EGC_PATCH 0)
execute_process(COMMAND
git describe --dirty --always --exclude "*"
OUTPUT_VARIABLE EGC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
project(
embedded-game-controller
VERSION ${EGC_MAJOR}.${EGC_MINOR}.${EGC_PATCH}
LANGUAGES ASM C
)
option(WITH_BLUETOOTH "Support bluetooth controllers" ON)
option(WITH_DEBUG "Print debug messages" OFF)
option(BUILD_EXAMPLE "Build example program" OFF)
option(WITH_DRIVER_DS3 "Enable DualShock 3 driver" ON)
option(WITH_DRIVER_DS4 "Enable DualShock 4 driver" ON)
option(WITH_DRIVER_NINTENDO_SWITCH "Enable Nintendo Switch driver" ON)
option(WITH_DRIVER_GENERIC "Enable generic driver" ON)
option(WITH_GENERIC_MAPPINGS "Enable hardcoded generic mappings" ON)
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# This is a hack just to provide a more readable name to our target platform.
# We could try to add a cmake toolchain file for Starlet in devkitPro.
if(CMAKE_SYSTEM_NAME MATCHES "Generic-dkP")
set(CMAKE_SYSTEM_NAME "Starlet")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Starlet")
set(ARCH -mcpu=arm926ej-s -mthumb -mthumb-interwork -mbig-endian)
set(EXTRA_CFLAGS -fno-builtin)
set(EXTRA_LDFLAGS -nostdlib)
set(EXTRA_LIBS cios-lib)
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS_DEBUG "-g3")
set(CMAKE_C_FLAGS_RELEASE "-O2")
add_compile_options(
${ARCH}
-ffreestanding
-fomit-frame-pointer
-ffunction-sections
-Wall
${EXTRA_CFLAGS}
)
add_subdirectory(embedded-game-controller)
if(CMAKE_SYSTEM_NAME MATCHES "Starlet")
add_subdirectory(cios-lib)
endif()
if(BUILD_EXAMPLE)
add_subdirectory(example)
endif()