-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
96 lines (80 loc) · 2.14 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
cmake_minimum_required(VERSION 3.19)
project(Canvas)
set(CMAKE_CXX_STANDARD 14)
set(
CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules
${CMAKE_MODULE_PATH}
)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
find_package(SndFile REQUIRED)
find_package(FFTW REQUIRED)
# Aliases for NanoGUI-SDL's sake.
set(SDL2TTF_LIBRARY ${SDL2_TTF_LIBRARY})
set(SDL2TTF_INCLUDE_DIR ${SDL2_TTF_INCLUDE_DIR})
add_subdirectory(third_party/portaudio)
include_directories(
third_party/portaudio/include/
third_party/portaudio/src/common/
)
if(APPLE)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif()
set(NANOGUI_BUILD_EXAMPLE OFF)
add_subdirectory(third_party/nanogui-sdl)
include_directories(
third_party/nanogui-sdl
)
file(GLOB nanogui_sdl_files
third_party/nanogui-sdl/sdlgui/*.cpp
third_party/nanogui-sdl/sdlgui/*.c
)
if(APPLE)
set(
nanogui_sdl_files
${nanogui_sdl_files}
third_party/nanogui-sdl/sdlgui/darwin.mm
)
endif()
include_directories(third_party/stb)
include_directories(third_party/tclap/include)
file(GLOB canvas_files src/*.cpp)
add_executable(canvas ${canvas_files} ${nanogui_sdl_files})
if(APPLE)
find_library(cocoa_library Cocoa)
target_link_libraries(canvas PRIVATE ${cocoa_library})
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(
canvas
SDL2
SDL2_image
SDL2_ttf
portaudio_static
sndfile
fftw3f
)
else()
target_include_directories(
canvas
PRIVATE
${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR}
${SDL2_TTF_INCLUDE_DIR}
)
target_link_libraries(
canvas
PRIVATE
${SDL2_LIBRARY}
${SDL2_IMAGE_LIBRARY}
${SDL2_TTF_LIBRARY}
)
target_include_directories(canvas PRIVATE ${SNDFILE_INCLUDE_DIR})
target_link_libraries(canvas PRIVATE ${SNDFILE_LIBRARY})
target_include_directories(canvas PRIVATE ${FFTW_INCLUDE_DIRS})
target_link_libraries(canvas PRIVATE ${FFTW_LIBRARIES})
target_link_libraries(canvas PRIVATE portaudio_static)
endif()