-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
55 lines (42 loc) · 1.37 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
cmake_minimum_required(VERSION 3.18)
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Os -flto")
set(CMAKE_CXX_FLAGS_DEBUG "-Os")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os -flto")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os -flto")
# Assembler complains when -DNDEBUG is here
set(CMAKE_ASM_FLAGS_RELEASE "-Os -flto")
set(CMAKE_ASM_FLAGS_DEBUG "-Os")
set(CMAKE_ASM_FLAGS_MINSIZEREL "-Os -flto")
set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "-Os -flto")
set(LLVM_MOS_PLATFORM nes-action53)
find_package(llvm-mos-sdk REQUIRED)
project(miroh-jr CXX ASM)
add_compile_options(
-g -gdwarf-4
-std=c++23
-Wall -Wextra -Wconversion -Wsign-conversion
)
add_link_options(
-g -gdwarf-4
-mreserve-zp=67
# donut: 18, ggsound: 40, zx02: 7
# make functions non-recursive by default
-fnonreentrant
# -Map generates a file with information about how the final binary's memory
# is laid out. This will eventually be used to show the remaining space in
# CHR-ROM, PRG-ROM, PRG-RAM, System RAM, and ZEROPAGE
# --lto-whole-program-visibility helps ensure clang does as many
# optimizations as possible
-Wl,-Map,${CMAKE_PROJECT_NAME}.map,--lto-whole-program-visibility
)
set(ROM ${CMAKE_PROJECT_NAME}.nes)
include(Assets)
add_executable(${ROM} "")
add_subdirectory(src)
target_link_libraries(${ROM} PRIVATE
# Second-party, included in llvm-mos
neslib
nesdoug
# subdirectory stuff
SourceObj
)