-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
179 lines (156 loc) · 5.15 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
cmake_minimum_required(VERSION 3.9)
project(lowl_audio)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(LOWL_LIB_MAIN lowl_audio_lib)
message([LOWL] Project: ${PROJECT_NAME})
message([LOWL] BuildType: ${CMAKE_BUILD_TYPE})
message([LOWL] CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID})
message([LOWL] CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME})
# config - start
set(LOWL_DEBUG TRUE)
set(LOWL_DRIVER_DUMMY TRUE)
set(LOWL_DRIVER_CORE_AUDIO TRUE)
set(LOWL_DRIVER_PORTAUDIO TRUE)
set(LOWL_DRIVER_WASAPI TRUE)
set(LOWL_PA_DEFAULT_DRIVER_PRIORITY "ALSA,OSS,JACK,COREAUDIO,WASAPI,WDMKS,DSOUND,WMME,ASIO,ASIHPI")
# config - end
set(LOWL_SOURCES
src/lowl.cpp
src/lowl_buffer.cpp
src/lowl_error.cpp
src/lowl_file.cpp
src/lowl_logger.cpp
src/audio/lowl_audio_data.cpp
src/audio/lowl_audio_device.cpp
src/audio/lowl_audio_driver.cpp
src/audio/lowl_audio_mixer.cpp
src/audio/lowl_audio_setting.cpp
src/audio/lowl_audio_source.cpp
src/audio/lowl_audio_space.cpp
src/audio/lowl_audio_stream.cpp
src/audio/lowl_audio_utilities.cpp
src/audio/convert/lowl_audio_channel_converter.cpp
src/audio/convert/lowl_audio_re_sampler.cpp
src/audio/convert/lowl_audio_sample_converter.cpp
src/audio/coreaudio/lowl_audio_core_audio_driver.cpp
src/audio/coreaudio/lowl_audio_core_audio_device.cpp
src/audio/coreaudio/lowl_audio_core_audio_utilities.cpp
src/audio/dummy/lowl_audio_dummy_driver.cpp
src/audio/portaudio/lowl_audio_pa_driver.cpp
src/audio/portaudio/lowl_audio_pa_device.cpp
src/audio/wasapi/lowl_audio_wasapi_driver.cpp
src/audio/wasapi/lowl_audio_wasapi_device.cpp
src/audio/wasapi/lowl_audio_wasapi_com.cpp
src/audio/reader/lowl_audio_reader.cpp
src/audio/reader/lowl_audio_reader_flac.cpp
src/audio/reader/lowl_audio_reader_mp3.cpp
src/audio/reader/lowl_audio_reader_ogg.cpp
src/audio/reader/lowl_audio_reader_opus.cpp
src/audio/reader/lowl_audio_reader_wav.cpp
)
add_library(${LOWL_LIB_MAIN} ${LOWL_SOURCES})
set_target_properties(${LOWL_LIB_MAIN} PROPERTIES PREFIX "")
target_include_directories(${LOWL_LIB_MAIN} PUBLIC src/)
IF (LOWL_DRIVER_DUMMY)
target_compile_definitions(${LOWL_LIB_MAIN} PRIVATE LOWL_DRIVER_DUMMY)
ENDIF ()
IF (LOWL_DRIVER_PORTAUDIO)
target_compile_definitions(${LOWL_LIB_MAIN} PRIVATE LOWL_DRIVER_PORTAUDIO)
target_compile_definitions(${LOWL_LIB_MAIN} PRIVATE "LOWL_PA_DEFAULT_DRIVER_PRIORITY=\"${LOWL_PA_DEFAULT_DRIVER_PRIORITY}\"")
ENDIF ()
if (WIN32)
message([LOWL] WIN32)
IF (LOWL_DRIVER_WASAPI)
target_compile_definitions(${LOWL_LIB_MAIN} PRIVATE LOWL_DRIVER_WASAPI)
target_link_libraries(${LOWL_LIB_MAIN} PUBLIC avrt)
ENDIF ()
endif ()
if (APPLE)
message([LOWL] APPLE)
IF (LOWL_DRIVER_CORE_AUDIO)
target_compile_definitions(${LOWL_LIB_MAIN} PRIVATE LOWL_DRIVER_CORE_AUDIO)
ENDIF ()
endif ()
if (UNIX)
message([LOWL] UNIX)
endif ()
if (MSVC)
message([LOWL] MSVC)
endif ()
if (MSYS)
message([LOWL] MSYS)
endif ()
if (MINGW)
message([LOWL] MINGW)
endif ()
IF (CMAKE_BUILD_TYPE MATCHES Debug)
set(LOWL_DEBUG TRUE)
ENDIF ()
IF (LOWL_DEBUG)
message([LOWL] Debug)
target_compile_definitions(${LOWL_LIB_MAIN} PUBLIC LOWL_DEBUG)
ELSE ()
message([LOWL] Release)
ENDIF ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message([LOWL] Clang)
IF (LOWL_DEBUG)
message([LOWL] Setting Debug Flags)
target_compile_options(${LOWL_LIB_MAIN} PRIVATE
-O0
-Werror
)
ELSE ()
message([LOWL] Setting Release Flags)
target_compile_options(${LOWL_LIB_MAIN} PRIVATE
-O2
-Werror
-D_FORTIFY_SOURCE=2
)
ENDIF ()
target_compile_options(${LOWL_LIB_MAIN} PRIVATE
-Walloca
-Wcast-qual
-Wconversion
-Wformat=2
-Wformat-security
-Wnull-dereference
-Wstack-protector
-Wvla
-Warray-bounds
-Warray-bounds-pointer-arithmetic
-Wassign-enum
-Wbad-function-cast
-Wconditional-uninitialized
-Wconversion
-Wfloat-equal
-Wformat-type-confusion
-Widiomatic-parentheses
-Wimplicit-fallthrough
-Wloop-analysis
-Wpointer-arith
-Wshift-sign-overflow
-Wshorten-64-to-32
-Wswitch-enum
-Wtautological-constant-in-range-compare
-Wunreachable-code-aggressive
-Wthread-safety
-Wthread-safety-beta
-Wcomma
)
target_link_options(${LOWL_LIB_MAIN} PRIVATE
LINKER:-z,relro
LINKER:-z,now
LINKER:-z,noexecstack
LINKER:-z,separate-code
)
endif ()
# Third Party
add_subdirectory(third_party)
target_link_libraries(${LOWL_LIB_MAIN} PUBLIC lowl_third_party)
# Unit Test
add_subdirectory(test)
# Example App
add_subdirectory(demo)