blob: 7828adad0c2e19d7ab7abf29bbbeaf79162416bc (
plain)
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
|
cmake_minimum_required(VERSION 3.16)
project(demo64k LANGUAGES C CXX)
option(DEMO_SIZE_OPT "Enable size optimization flags" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(demo64k
src/main.cpp
src/platform.cpp
src/gpu/gpu.cpp
src/audio/audio.cpp
src/audio/fdct.cpp
src/audio/idct.cpp
src/audio/window.cpp
src/audio/synth.cpp
)
target_include_directories(demo64k PRIVATE
src
third_party
)
find_package(glfw3 REQUIRED)
target_link_libraries(demo64k PRIVATE glfw)
if (DEMO_SIZE_OPT)
if (MSVC)
target_compile_options(demo64k PRIVATE /Os /GS-)
target_link_options(demo64k PRIVATE /OPT:REF /OPT:ICF /INCREMENTAL:NO)
else()
target_compile_options(demo64k PRIVATE -Os -ffunction-sections -fdata-sections)
target_link_options(demo64k PRIVATE -Wl,--gc-sections -s)
endif()
endif()
option(DEMO_BUILD_TESTS "Build tests" OFF)
enable_testing()
if(DEMO_BUILD_TESTS)
add_executable(test_window
src/tests/test_window.cpp
src/audio/window.cpp
)
target_include_directories(test_window PRIVATE
src
)
add_test(NAME HammingWindowTest COMMAND test_window)
add_executable(test_synth
src/tests/test_synth.cpp
src/audio/synth.cpp
src/audio/idct.cpp
src/audio/window.cpp
)
target_include_directories(test_synth PRIVATE
src
)
add_test(NAME SynthEngineTest COMMAND test_synth)
endif()
option(DEMO_BUILD_TOOLS "Build tools" OFF)
if(DEMO_BUILD_TOOLS)
add_executable(spectool
tools/spectool.cpp
src/platform.cpp
src/audio/audio.cpp
src/audio/fdct.cpp
src/audio/idct.cpp
src/audio/window.cpp
src/audio/synth.cpp
)
target_include_directories(spectool PRIVATE
src
third_party
)
target_link_libraries(spectool PRIVATE glfw)
endif()
|