-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
126 lines (103 loc) · 3.84 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
121
122
123
124
125
126
cmake_minimum_required(VERSION 3.13...3.23)
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards )
set(PICO_BOARD "murmulator" CACHE STRING "Board type")
include(pico_sdk_import.cmake)
project(gameboy-color C CXX ASM)
SET(BUILD_NAME "${PROJECT_NAME}")
option(I2S "Enable I2S sound" OFF)
option(I2S_CS4334 "Enable I2S CS4334 sound" OFF)
option(VGA "Enable VGA" OFF)
option(TFT "Enable TFT display" OFF)
option(ILI9341 "Enable TFT ILI9341 display" OFF)
option(HDMI "Enable HDMI display" OFF)
option(TV "Enable TV composite output" OFF)
option(SOFTTV "Enable TV soft composite output" OFF)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -funroll-loops -ffast-math -feliminate-unused-debug-types -ffunction-sections -fdata-sections -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funroll-loops -ffast-math -feliminate-unused-debug-types -ffunction-sections -fdata-sections -O2")
pico_sdk_init()
set(OUTPUT_DIR "${CMAKE_SOURCE_DIR}/bin/${PICO_PLATFORM}/${CMAKE_BUILD_TYPE}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_DIR}")
add_subdirectory(drivers/fatfs)
add_subdirectory(drivers/sdcard)
add_subdirectory(drivers/ps2kbd)
add_subdirectory(drivers/nespad)
add_subdirectory(drivers/audio)
add_subdirectory(drivers/vga-nextgen)
add_subdirectory(drivers/hdmi)
add_subdirectory(drivers/st7789)
add_subdirectory(drivers/tv)
add_subdirectory(drivers/tv-software)
add_subdirectory(drivers/graphics)
add_executable(${PROJECT_NAME}
ext/minigb_apu/minigb_apu.c
src/main.cpp
)
pico_define_boot_stage2(slower_boot2 ${PICO_DEFAULT_BOOT_STAGE2_FILE})
target_compile_definitions(slower_boot2 PRIVATE PICO_FLASH_SPI_CLKDIV=4)
pico_set_boot_stage2(${PROJECT_NAME} slower_boot2)
pico_set_program_name(gameboy-color "Gameboy Emulator by xrip")
pico_set_program_version(gameboy-color "test")
target_include_directories(${PROJECT_NAME} PRIVATE
src
inc
ext/minigb_apu
)
IF(TFT)
target_link_libraries(${PROJECT_NAME} PRIVATE st7789)
target_compile_definitions(${PROJECT_NAME} PRIVATE TFT)
SET(BUILD_NAME "${BUILD_NAME}-TFT")
IF(ILI9341)
SET(BUILD_NAME "${BUILD_NAME}-ILI9341")
target_compile_definitions(${PROJECT_NAME} PRIVATE ILI9341)
ELSE()
SET(BUILD_NAME "${BUILD_NAME}-ST7789")
ENDIF()
ELSEIF(HDMI)
target_link_libraries(${PROJECT_NAME} PRIVATE hdmi)
target_compile_definitions(${PROJECT_NAME} PRIVATE HDMI)
SET(BUILD_NAME "${BUILD_NAME}-HDMI")
ELSEIF(TV)
target_compile_definitions(${PROJECT_NAME} PRIVATE TV)
target_link_libraries(${PROJECT_NAME} PRIVATE tv)
SET(BUILD_NAME "${BUILD_NAME}-TV")
ELSEIF(SOFTTV)
target_compile_definitions(${PROJECT_NAME} PRIVATE SOFTTV)
target_link_libraries(${PROJECT_NAME} PRIVATE tv-software)
SET(BUILD_NAME "${BUILD_NAME}-TV-SOFT")
ELSE()
target_compile_definitions(${PROJECT_NAME} PRIVATE VGA)
target_link_libraries(${PROJECT_NAME} PRIVATE vga-nextgen)
SET(BUILD_NAME "${BUILD_NAME}-VGA")
ENDIF()
IF(NOT I2S)
target_compile_definitions(${PROJECT_NAME} PRIVATE AUDIO_PWM)
ELSEIF(I2S_CS4334)
target_compile_definitions(${PROJECT_NAME} PRIVATE I2S_CS4334)
SET(BUILD_NAME "${BUILD_NAME}-I2S-CS4334")
ELSE()
SET(BUILD_NAME "${BUILD_NAME}-I2S-TDA1387")
ENDIF()
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${BUILD_NAME}")
target_link_libraries(${PROJECT_NAME} PRIVATE
audio
graphics
ps2kbd
sdcard
fatfs
nespad
pico_runtime
pico_stdlib
pico_stdio
pico_bootrom
pico_multicore
pico_stdio
pico_multicore
tinyusb_board
tinyusb_device
)
target_link_options(${PROJECT_NAME} PRIVATE -Xlinker --print-memory-usage --data-sections)
pico_add_extra_outputs(${PROJECT_NAME})