-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
120 lines (102 loc) · 2.41 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
cmake_minimum_required(VERSION 3.13)
project(maxmod
LANGUAGES C ASM
)
include(GNUInstallDirs)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(NINTENDO_DS)
set(CMAKE_INSTALL_PREFIX "${NDS_ROOT}" CACHE PATH "" FORCE)
elseif(NINTENDO_GBA)
set(CMAKE_INSTALL_PREFIX "${GBA_ROOT}" CACHE PATH "" FORCE)
endif()
endif()
if(NINTENDO_DS)
if(ARM7)
set(PLATFORM_SUFFIX "7")
elseif(ARM9)
set(PLATFORM_SUFFIX "9")
else()
message(FATAL_ERROR "Invalid processor, must be armv4t or armv5te")
endif()
endif()
# Define static library target
add_library(mm STATIC)
set_target_properties(mm PROPERTIES RELEASE_POSTFIX "${PLATFORM_SUFFIX}")
set_target_properties(mm PROPERTIES MINSIZEREL_POSTFIX "${PLATFORM_SUFFIX}")
# Add compiler flags
target_compile_options(mm PRIVATE
-Wall -Werror
)
# Add include directories
target_include_directories(mm PRIVATE asm_include include)
if(NINTENDO_GBA)
target_compile_definitions(mm PRIVATE SYS_GBA)
target_sources(mm PRIVATE
source_gba/mm_init_default.s
source_gba/mm_main_gba.s
source_gba/mm_mixer_gba.s
)
# Install the headers
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN maxmod.h
PATTERN mm_types.h
)
endif()
if(NINTENDO_DS)
target_compile_definitions(mm PRIVATE SYS_NDS)
endif()
if(NINTENDO_DS AND ARM7)
target_compile_definitions(mm PRIVATE SYS_NDS7)
target_sources(mm PRIVATE
source_ds7/mm_main7.s
source_ds7/mm_mixer_super.s
source_calico/mm_comms7.c
)
# Install the headers
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN maxmod7.h
PATTERN mm_types.h
)
endif()
if(NINTENDO_DS AND ARM9)
target_compile_definitions(mm PRIVATE SYS_NDS9)
target_sources(mm PRIVATE
source_calico/mm_comms9.c
source_calico/mm_loader.c
source_calico/mm_reverb.c
source_calico/mm_stream.c
source_calico/mm_deinterleave.32.s
)
# Install the headers
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN maxmod9.h
PATTERN mm_types.h
)
endif()
if(ARM7)
target_sources(mm PRIVATE
source/mm_main.s
source/mm_effect.s
source/mm_mas.s
source/mm_mas_arm.s
)
endif()
# Install the library
install(
TARGETS mm
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
# Install the license
install(
FILES maxmod_license.txt
DESTINATION ${CMAKE_INSTALL_PREFIX}
)