forked from khashayarmotarjemi/geonkick
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
280 lines (247 loc) · 9.63 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
cmake_minimum_required (VERSION 3.7)
project(geonkick VERSION 2.8.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
include(GNUInstallDirs)
option(GKICK_STANDALONE "Enable build for standalone" ON)
option(GKICK_PLUGIN "Enable build for plugin" ON)
if (GKICK_PLUGIN)
option(GKICK_PLUGIN_LV2 "Enable build LV2 plugin" ON)
endif (GKICK_PLUGIN)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "no build type selected, set default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type Release" FORCE)
endif()
if (NOT GKICK_ARCHITECTURE)
message(STATUS "GKICK_ARCHITECTURE variable was not set use default ${CMAKE_HOST_SYSTEM_PROCESSOR}")
set(GKICK_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif ()
if (GKICK_ARCHITECTURE MATCHES x86_64)
message(STATUS "set optimisation complier flags for ${GKICK_ARCHITECTURE}")
set(GKICK_OPTIMISATION_FLAGS "-O3 -msse -msse2 -mfpmath=sse -ffast-math -fomit-frame-pointer")
else ()
message(STATUS "set optimisation complier flags for ${GKICK_ARCHITECTURE}")
set(GKICK_OPTIMISATION_FLAGS "-O3 -ffast-math -fomit-frame-pointer")
endif ()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-Wall ${GKICK_OPTIMISATION_FLAGS} ${CMAKE_CXX_FLAGS} -fvisibility=hidden")
set(CMAKE_C_FLAGS "-Wall ${GKICK_OPTIMISATION_FLAGS} ${CMAKE_C_FLAGS} -fvisibility=hidden")
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "default install path" FORCE)
endif()
if (NOT CMAKE_INSTALL_FULL_DATADIR)
message(STATUS "CMAKE_INSTALL_FULL_DATADIR is not set, use default ${CMAKE_INSTALL_PREFIX}/share")
set(CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/share" CACHE PATH "default data dir path" FORCE)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGEONKICK_DATA_DIR=\\\"${CMAKE_INSTALL_FULL_DATADIR}\\\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGEONKICK_DATA_DIR=\\\"${CMAKE_INSTALL_FULL_DATADIR}\\\"")
set(GKICK_DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doc)
set(GKICK_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dsp)
set(GKICK_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(GKICK_RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/resources)
set(GKICK_STANDALONE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/standalone)
set(GKICK_UTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utils)
set(GKICK_REDKITE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/redkite)
if (GKICK_PLUGIN)
if (CMAKE_SYSTEM_NAME MATCHES Windows)
else()
if (GKICK_PLUGIN_LV2)
set(GKICK_LV2_DIR ${CMAKE_CURRENT_SOURCE_DIR}/plugin/lv2)
endif (GKICK_PLUGIN_LV2)
endif()
endif(GKICK_PLUGIN)
set(GKICK_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
set(GKICK_PRESETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/presets)
set(GKICK_COMMON_HEADERS
${GKICK_UTILS_DIR}/base64.h
${GKICK_COMMON_DIR}/GeonkickConfig.h
${GKICK_COMMON_DIR}/UiSettings.h
${GKICK_COMMON_DIR}/ViewState.h
${GKICK_COMMON_DIR}/geonkick_slider.h
${GKICK_COMMON_DIR}/geonkick_button.h
${GKICK_COMMON_DIR}/PathListModel.h
${GKICK_COMMON_DIR}/file_dialog.h
${GKICK_COMMON_DIR}/SampleBrowser.h
${GKICK_COMMON_DIR}/filter.h
${GKICK_COMMON_DIR}/geonkick_groupbox.h
${GKICK_COMMON_DIR}/top_bar.h
${GKICK_COMMON_DIR}/control_area.h
${GKICK_COMMON_DIR}/controls_widget.h
${GKICK_COMMON_DIR}/percussion_model.h
${GKICK_COMMON_DIR}/kit_model.h
${GKICK_COMMON_DIR}/percussion_view.h
${GKICK_COMMON_DIR}/kit_widget.h
${GKICK_COMMON_DIR}/envelope_draw_area.h
${GKICK_COMMON_DIR}/limiter.h
${GKICK_COMMON_DIR}/general_envelope.h
${GKICK_COMMON_DIR}/effects_group_box.h
${GKICK_COMMON_DIR}/compressor_group_box.h
${GKICK_COMMON_DIR}/distortion_group_box.h
${GKICK_COMMON_DIR}/layers_group_box.h
${GKICK_COMMON_DIR}/general_group_box.h
${GKICK_COMMON_DIR}/envelope.h
${GKICK_COMMON_DIR}/BufferView.h
${GKICK_COMMON_DIR}/kick_graph.h
${GKICK_COMMON_DIR}/envelope_widget.h
${GKICK_COMMON_DIR}/knob.h
${GKICK_COMMON_DIR}/oscillator.h
${GKICK_COMMON_DIR}/geonkick_api.h
${GKICK_COMMON_DIR}/percussion_state.h
${GKICK_COMMON_DIR}/kit_state.h
${GKICK_COMMON_DIR}/oscillator_envelope.h
${GKICK_COMMON_DIR}/oscillator_group_box.h
${GKICK_COMMON_DIR}/ExportAbstract.h
${GKICK_COMMON_DIR}/ExportSoundData.h
${GKICK_COMMON_DIR}/ExportToSfz.h
${GKICK_COMMON_DIR}/export_widget.h
${GKICK_COMMON_DIR}/preset.h
${GKICK_COMMON_DIR}/preset_folder.h
${GKICK_COMMON_DIR}/preset_browser_model.h
${GKICK_COMMON_DIR}/preset_browser_view.h
${GKICK_COMMON_DIR}/MidiKeyWidget.h
${GKICK_COMMON_DIR}/mainwindow.h)
set(GKICK_COMMON_SOURCES
${GKICK_UTILS_DIR}/base64.cpp
${GKICK_COMMON_DIR}/GeonkickConfig.cpp
${GKICK_COMMON_DIR}/UiSettings.cpp
${GKICK_COMMON_DIR}/ViewState.cpp
${GKICK_COMMON_DIR}/geonkick_widget.cpp
${GKICK_COMMON_DIR}/geonkick_slider.cpp
${GKICK_COMMON_DIR}/geonkick_button.cpp
${GKICK_COMMON_DIR}/PathListModel.cpp
${GKICK_COMMON_DIR}/file_dialog.cpp
${GKICK_COMMON_DIR}/SampleBrowser.cpp
${GKICK_COMMON_DIR}/filter.cpp
${GKICK_COMMON_DIR}/geonkick_groupbox.cpp
${GKICK_COMMON_DIR}/top_bar.cpp
${GKICK_COMMON_DIR}/control_area.cpp
${GKICK_COMMON_DIR}/controls_widget.cpp
${GKICK_COMMON_DIR}/percussion_model.cpp
${GKICK_COMMON_DIR}/kit_model.cpp
${GKICK_COMMON_DIR}/percussion_view.cpp
${GKICK_COMMON_DIR}/kit_widget.cpp
${GKICK_COMMON_DIR}/envelope_draw_area.cpp
${GKICK_COMMON_DIR}/limiter.cpp
${GKICK_COMMON_DIR}/general_envelope.cpp
${GKICK_COMMON_DIR}/effects_group_box.cpp
${GKICK_COMMON_DIR}/compressor_group_box.cpp
${GKICK_COMMON_DIR}/distortion_group_box.cpp
${GKICK_COMMON_DIR}/layers_group_box.cpp
${GKICK_COMMON_DIR}/general_group_box.cpp
${GKICK_COMMON_DIR}/envelope.cpp
${GKICK_COMMON_DIR}/BufferView.cpp
${GKICK_COMMON_DIR}/kick_graph.cpp
${GKICK_COMMON_DIR}/envelope_widget.cpp
${GKICK_COMMON_DIR}/knob.cpp
${GKICK_COMMON_DIR}/oscillator.cpp
${GKICK_COMMON_DIR}/geonkick_api.cpp
${GKICK_COMMON_DIR}/percussion_state.cpp
${GKICK_COMMON_DIR}/kit_state.cpp
${GKICK_COMMON_DIR}/oscillator_envelope.cpp
${GKICK_COMMON_DIR}/oscillator_group_box.cpp
${GKICK_COMMON_DIR}/export_widget.cpp
${GKICK_COMMON_DIR}/ExportAbstract.cpp
${GKICK_COMMON_DIR}/ExportSoundData.cpp
${GKICK_COMMON_DIR}/ExportToSfz.cpp
${GKICK_COMMON_DIR}/preset.cpp
${GKICK_COMMON_DIR}/preset_folder.cpp
${GKICK_COMMON_DIR}/preset_browser_model.cpp
${GKICK_COMMON_DIR}/preset_browser_view.cpp
${GKICK_COMMON_DIR}/MidiKeyWidget.cpp
${GKICK_COMMON_DIR}/mainwindow.cpp)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Enable application logging")
option(ENABLE_LOGGING "Enable logging for API and GUI" ON)
endif()
if (ENABLE_LOGGING)
message(STATUS "set debug level")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRK_LOG_DEBUG_LEVEL")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRK_LOG_DEBUG_LEVEL")
list(APPEND GKICK_API_FLAGS "-DGKICK_LIB_LOG_LEVEL_DEBUG")
list(APPEND GKICK_API_FLAGS "-DGKICK_LIB_LOG_FUNCTION")
list(APPEND GKICK_API_PLUGIN_FLAGS "-DGKICK_LIB_LOG_LEVEL_DEBUG")
list(APPEND GKICK_API_PLUGIN_FLAGS "-DGKICK_LIB_LOG_FUNCTION")
list(APPEND GKICK_API_PLUGIN_SINGLE_FLAGS "-DGKICK_LIB_LOG_LEVEL_DEBUG")
list(APPEND GKICK_API_PLUGIN_SINGLE_FLAGS "-DGKICK_LIB_LOG_FUNCTION")
endif()
find_package(PkgConfig REQUIRED)
find_package(RapidJSON REQUIRED)
pkg_check_modules(SNDFILE sndfile)
if (NOT SNDFILE_FOUND)
message(FATAL_ERROR "can't find sndfile library")
endif(NOT SNDFILE_FOUND)
if (GKICK_STANDALONE)
pkg_check_modules(JACK jack)
if (NOT JACK_FOUND)
message(FATAL_ERROR "can't find jack library")
endif(NOT JACK_FOUND)
list(APPEND GKICK_API_FLAGS "-DGEONKICK_AUDIO_JACK")
endif()
if (GKICK_PLUGIN)
list(APPEND GKICK_API_PLUGIN_SINGLE_FLAGS "-DGEONKICK_SINGLE")
if(CMAKE_SYSTEM_NAME MATCHES Windows)
message(STATUS "checking for VST SDK...")
else()
message(STATUS "checking for LV2 library...")
pkg_check_modules(LV2 lv2)
if (NOT LV2_FOUND)
message(FATAL_ERROR "can't find LV2 library")
endif(NOT LV2_FOUND)
endif()
endif(GKICK_PLUGIN)
if (CMAKE_SYSTEM_NAME MATCHES Windows)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRK_OS_WIN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRK_OS_WIN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRK_FOR_SHARED")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRK_OS_GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRK_OS_GNU")
endif ()
include_directories(${GKICK_API_DIR}/src)
include_directories(${GKICK_REDKITE_DIR}/include)
include_directories(${GKICK_UTILS_DIR})
link_directories(${CMAKE_BINARY_DIR}/redkite)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-fPIC)
add_subdirectory(dsp)
add_subdirectory(redkite)
include(${GKICK_RC_DIR}/resources.rc)
include_directories(${GKICK_COMMON_DIR})
link_directories(${REDKITE_LIBRARY_DIR})
add_library(geonkick_common STATIC
${GKICK_COMMON_HEADERS}
${GKICK_COMMON_SOURCES}
${GKICK_RESOURCES})
if (GKICK_PLUGIN)
add_library(geonkick_common_single STATIC
${GKICK_COMMON_HEADERS}
${GKICK_COMMON_SOURCES}
${GKICK_RESOURCES})
target_compile_options(geonkick_common_single PUBLIC ${GKICK_API_PLUGIN_SINGLE_FLAGS})
endif(GKICK_PLUGIN)
message(STATUS "------------ Summary ---------")
if (GKICK_STANDALONE)
message(STATUS "Standalone: yes" )
else(GKICK_STANDALONE)
message(STATUS "Standalone: no")
endif(GKICK_STANDALONE)
if (GKICK_PLUGIN_LV2)
message(STATUS "LV2 plugin: yes" )
else(GKICK_PLUGIN_LV2)
message(STATUS "LV2 plugin: no")
endif(GKICK_PLUGIN_LV2)
if (ENABLE_LOGGING)
message(STATUS "Debug enabled: yes" )
else(ENABLE_LOGGING)
message(STATUS "Debug enabled: no" )
endif(ENABLE_LOGGING)
message(STATUS "------------------------------")
if (GKICK_STANDALONE)
add_subdirectory(standalone)
endif (GKICK_STANDALONE)
if (GKICK_PLUGIN)
add_subdirectory(plugin)
endif (GKICK_PLUGIN)
add_subdirectory(data)
add_subdirectory(presets)