-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
101 lines (81 loc) · 2.25 KB
/
CMakeLists.txt
File metadata and controls
101 lines (81 loc) · 2.25 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
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
cmake_minimum_required(VERSION 3.23)
project(nes)
include(FetchContent)
set(
CMAKE_CXX_STANDARD 20
CMAKE_CXX_STANDARD_REQUIRED ON
CMAKE_REQUIRED_FLAGS -std=c++20
)
find_package(SDL2 REQUIRED)
find_library(SDL2_LIBRARY NAME SDL2)
#set(SDL_LIBRARIES ${SDL_LIBRARIES} SDL2main SDL2-static SDL2_image)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g")
add_executable(nes
src/cartridge.cpp
src/cartridge.h
src/console.cpp
src/console.h
src/cpu.cpp
src/cpu.h
src/main.cpp
src/nes.h
src/ppu.cpp
src/ppu.h
src/rom.cpp
src/rom.h
src/controller.cpp src/controller.h src/apu.cpp src/apu.h src/dsp.cpp src/dsp.h src/game.cpp src/game.h)
include_directories(nes ${SDL2_INCLUDE_DIRS})
target_link_libraries(nes ${SDL2_LIBRARIES})
add_library(nes_dll MODULE
src/cartridge.cpp
src/cartridge.h
src/console.cpp
src/console.h
src/cpu.cpp
src/cpu.h
src/dll.cpp
src/nes.h
src/ppu.cpp
src/ppu.h
src/rom.cpp
src/rom.h
src/controller.cpp src/controller.h src/apu.cpp src/apu.h src/dsp.cpp src/dsp.h src/game.cpp src/game.h src/dll.h)
include_directories(nes_dll ${SDL2_INCLUDE_DIRS})
target_link_libraries(nes_dll ${SDL2_LIBRARIES})
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_executable(
nes_test
src/cartridge.cpp
src/cartridge.h
src/console.cpp
src/console.h
src/controller.cpp
src/controller.h
src/cpu.cpp
src/cpu.h
src/nes.h
src/ppu.cpp
src/ppu.h
src/rom.cpp
src/rom.h
tests/cpu.cpp tests/audio.cpp src/apu.cpp src/apu.h)
include_directories(nes_test ${SDL2_INCLUDE_DIRS})
target_link_libraries(nes_test ${SDL2_LIBRARIES})
target_link_libraries(
nes_test
GTest::gtest_main
${SDL_LIBRARIES}
)
include(GoogleTest)
gtest_discover_tests(nes_test)