CMakeLists.txt 22.3 KB
Newer Older
1
2
project(Bonzomatic)

3
cmake_minimum_required(VERSION 3.0)
Gargaj's avatar
Gargaj committed
4
5

set(CMAKE_OSX_ARCHITECTURES x86_64)
6

7
8
9
10
11
if (APPLE OR WIN32)
	set(BZC_EXE_NAME "Bonzomatic")
else ()
	set(BZC_EXE_NAME "bonzomatic")
endif ()
12
13
14

set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
15
string(TIMESTAMP VERSION_PATCH "%Y%m%d")
16

Chris White's avatar
Chris White committed
17
if (WIN32)
mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
18
19
  option(BONZOMATIC_64BIT "Compile for 64 bit target?" ON)

Gargaj's avatar
Gargaj committed
20
21
22
23
24
25
26
  if (CMAKE_GENERATOR MATCHES "64")
    set(BONZOMATIC_64BIT ON CACHE BOOL "Compile for 64 bit target?")
  else ()
    set(BONZOMATIC_64BIT OFF CACHE BOOL "Compile for 64 bit target?")
  endif ()
endif ()

mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
27
28
29
30
if (APPLE)
  option(BONZOMATIC_TOUCHBAR "Compile with macOS TouchBar support (Xcode 9 or newer required)?" ON)
  option(BONZOMATIC_RETINA "Support HiDPI (warning: huge framebuffer, low fps in sight)?" OFF)
endif ()
31

mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
32
33
34
if (WIN32)
  option(BONZOMATIC_NDI "Enable NDI?" OFF)
endif ()
35

mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
36
37
38
39
if (WIN32)
  set(BONZOMATIC_WINDOWS_FLAVOR "GLFW" CACHE STRING "Windows renderer flavor selected at CMake configure time (DX11, DX9 or GLFW)")
  set_property(CACHE BONZOMATIC_WINDOWS_FLAVOR PROPERTY STRINGS DX11 DX9 GLFW) 
endif ()
40

41
42
43
44
if (NOT (UNIX AND (NOT APPLE))) #if not linux
  set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
endif ()

45
46
47
if (APPLE)
  set(CMAKE_FIND_FRAMEWORK LAST)
endif ()
48
49

add_definitions(-DSCI_LEXER -DSCI_NAMESPACE)
Gargaj's avatar
Gargaj committed
50
51
52
if (UNIX)
  add_definitions(-DGTK)
endif ()
53

Chris White's avatar
Chris White committed
54
if (WIN32)
Gargaj's avatar
Gargaj committed
55
56
57
58
  #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /VERBOSE")
  #set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /VERBOSE")
  #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /VERBOSE")
  if (BONZOMATIC_64BIT)
59
    set(BZC_LINK_DIRS ${BZC_LINK_DIRS} $ENV{DXSDK_DIR}/lib/x64)
Gargaj's avatar
Gargaj committed
60
  else ()
61
    set(BZC_LINK_DIRS ${BZC_LINK_DIRS} $ENV{DXSDK_DIR}/lib/x86)
Gargaj's avatar
Gargaj committed
62
  endif ()
63
64
endif ()

65
66
67
68
69
70
71
if (APPLE)
  set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
  set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  set(CMAKE_XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS "No")
  set(CMAKE_XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI "No")
endif ()

72
# Dont compile glfw and glew for windows dx targets
Chris White's avatar
Chris White committed
73
if (APPLE OR UNIX OR (WIN32 AND (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "GLFW")))
Gargaj's avatar
Gargaj committed
74
  ##############################################################################
75
76
  # GLFW
  # GLFW settings and project inclusion
mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
77
  set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
78
79
80
81
  set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
  set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
82
83
84
85
86
87
88
  set(GLFW_VULKAN_STATIC OFF CACHE BOOL "" FORCE)
  mark_as_advanced(BUILD_SHARED_LIBS GLFW_BUILD_EXAMPLES GLFW_BUILD_TESTS GLFW_BUILD_DOCS GLFW_INSTALL GLFW_VULKAN_STATIC)
  if (UNIX)
    set(GLFW_USE_OSMESA OFF CACHE BOOL "" FORCE)
    mark_as_advanced(GLFW_USE_OSMESA)
  endif()
  if (WIN32)
89
90
91
    set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "" FORCE)
    mark_as_advanced(USE_MSVC_RUNTIME_LIBRARY_DLL)
  endif()
92
93
94
95
  add_subdirectory(${CMAKE_SOURCE_DIR}/external/glfw/)
  set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/glfw/include)
  set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} glfw ${GLFW_LIBRARIES})

Gargaj's avatar
Gargaj committed
96
97
98
99
100
101
102
103
  ##############################################################################
  # GLEW
  set(GLEW_SRCS
  ${CMAKE_SOURCE_DIR}/external/glew/glew.c
  )
  add_library(bzc_glew STATIC ${GLEW_SRCS})
  target_include_directories(bzc_glew PUBLIC ${CMAKE_SOURCE_DIR}/external/glew)
  target_compile_definitions(bzc_glew PUBLIC -DGLEW_STATIC)
104
105
106
  if (MSVC)
    target_compile_options(bzc_glew PUBLIC "$<$<CONFIG:Release>:/MT>")
  endif ()
Gargaj's avatar
Gargaj committed
107
108
  set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/glew)
  set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_glew)
109
110
111
else ()
  # for windows, use DirectX
  set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} $ENV{DXSDK_DIR}/Include)
112
113
114
115
116
endif ()

##############################################################################
# STB
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES}
Gargaj's avatar
Gargaj committed
117
  ${CMAKE_SOURCE_DIR}/external/stb
118
119
120
)

##############################################################################
mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
121
122
# miniaudio
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/miniaudio)
123
124
125
126
127
128
129
130
131
132
133

##############################################################################
# kiss_fft
set(KISSFFT_SRCS
  ${CMAKE_SOURCE_DIR}/external/kiss_fft/kiss_fft.c
  ${CMAKE_SOURCE_DIR}/external/kiss_fft/tools/kiss_fftr.c
)
add_library(bzc_kissfft STATIC ${KISSFFT_SRCS})
target_include_directories(bzc_kissfft PUBLIC ${CMAKE_SOURCE_DIR}/external/kiss_fft ${CMAKE_SOURCE_DIR}/external/kiss_fft/tools)
if (MSVC)
  target_compile_options(bzc_kissfft PUBLIC "$<$<CONFIG:Release>:/MT>")
134
endif ()
135
136
137
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/kiss_fft)
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/kiss_fft/tools)
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_kissfft)
138
139
140
141

##############################################################################
# JSONXX
set(JSONXX_SRCS
Gargaj's avatar
Gargaj committed
142
  ${CMAKE_SOURCE_DIR}/external/jsonxx/jsonxx.cc
143
144
145
)
add_library(bzc_jsonxx STATIC ${JSONXX_SRCS})
target_include_directories(bzc_jsonxx PUBLIC ${CMAKE_SOURCE_DIR}/external/jsonxx)
146
147
148
if (MSVC)
  target_compile_options(bzc_jsonxx PUBLIC "$<$<CONFIG:Release>:/MT>")
endif ()
149
150
151
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/jsonxx)
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_jsonxx)

152
153
##############################################################################
# NDI
Chris White's avatar
Chris White committed
154
if (WIN32 AND BONZOMATIC_NDI)
155
156
157
158
159
160
161
  if(DEFINED ENV{NDI_SDK_DIR}) 
    set(NDI_SDK_DIR "$ENV{NDI_SDK_DIR}")
  else()
    message(FATAL_ERROR "Could not find NDI SDK. The NDI_SDK_DIR environment variable must be set to the SDK path.")
  endif()

  set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} "${NDI_SDK_DIR}/Include/")
162
  if (BONZOMATIC_64BIT)
163
    set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} "${NDI_SDK_DIR}/Lib/x64/Processing.NDI.Lib.x64.lib")
164
  else ()
165
    set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} "${NDI_SDK_DIR}/Lib/x86/Processing.NDI.Lib.x86.lib")
166
167
168
  endif ()
endif ()

169
170
171
##############################################################################
# SCINTILLA
set(SCINTILLA_SRCS
Gargaj's avatar
Gargaj committed
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexA68k.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAbaqus.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAda.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAPDL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAsm.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAsn1.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexASY.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAU3.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAVE.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexAVS.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexBaan.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexBash.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexBasic.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexBibTeX.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexBullant.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCaml.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCLW.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCmake.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCOBOL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCoffeeScript.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexConf.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCPP.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCrontab.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCsound.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexCSS.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexD.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexDMAP.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexDMIS.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexECL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexEiffel.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexErlang.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexEScript.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexFlagship.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexForth.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexFortran.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexGAP.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexGui4Cli.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexHaskell.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexHTML.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexInno.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexKix.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexKVIrc.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexLaTeX.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexLisp.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexLout.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexLua.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMagik.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMarkdown.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMatlab.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMetapost.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMMIXAL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexModula.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMPT.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMSSQL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexMySQL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexNimrod.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexNsis.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexOpal.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexOScript.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexOthers.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPascal.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPB.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPerl.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPLM.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPO.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPOV.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPowerPro.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPowerShell.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexProgress.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPS.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexPython.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexR.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexRebol.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexRegistry.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexRuby.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexRust.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexScriptol.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSmalltalk.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSML.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSorcus.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSpecman.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSpice.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSQL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexSTTXT.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTACL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTADS3.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTAL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTCL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTCMD.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTeX.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexTxt2tags.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexVB.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexVerilog.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexVHDL.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexVisualProlog.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexers/LexYAML.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/Accessor.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/CharacterCategory.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/CharacterSet.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/LexerBase.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/LexerModule.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/LexerNoExceptions.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/LexerSimple.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/PropSetSimple.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/StyleContext.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib/WordList.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/AutoComplete.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/CallTip.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/CaseConvert.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/CaseFolder.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Catalogue.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/CellBuffer.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/CharClassify.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/ContractionState.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Decoration.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Document.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/EditModel.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Editor.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/EditView.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/ExternalLexer.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Indicator.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/KeyMap.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/LineMarker.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/MarginView.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/PerLine.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/PositionCache.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/RESearch.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/RunStyles.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/ScintillaBase.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Selection.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/Style.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/UniConversion.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/ViewStyle.cxx
  ${CMAKE_SOURCE_DIR}/external/scintilla/src/XPM.cxx
306
307
308
)
add_library(bzc_scintilla STATIC ${SCINTILLA_SRCS})
target_include_directories(bzc_scintilla PUBLIC
Gargaj's avatar
Gargaj committed
309
310
311
  ${CMAKE_SOURCE_DIR}/external/scintilla/include
  ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib
  ${CMAKE_SOURCE_DIR}/external/scintilla/src
312
)
313
314
315
if (MSVC)
  target_compile_options(bzc_scintilla PUBLIC "$<$<CONFIG:Release>:/MT>")
endif ()
316
317
318
319
320
321
322
323
324
325
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES}
    ${CMAKE_SOURCE_DIR}/external/scintilla/include
    ${CMAKE_SOURCE_DIR}/external/scintilla/lexlib
    ${CMAKE_SOURCE_DIR}/external/scintilla/src
)
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_scintilla)

##############################################################################
# BONZOMATIC
file(GLOB BZC_PROJECT_SRCS
Gargaj's avatar
Gargaj committed
326
327
  ${CMAKE_SOURCE_DIR}/src/*.cpp
  ${CMAKE_SOURCE_DIR}/src/*.h
328
329
330
)
source_group("Bonzomatic" FILES ${BZC_PROJECT_SRCS})
if (APPLE)
Gargaj's avatar
Gargaj committed
331
  set(BZC_PLATFORM_SRCS
332
    ${CMAKE_SOURCE_DIR}/src/platform_glfw/Renderer.cpp
333
    ${CMAKE_SOURCE_DIR}/src/platform_common/FFT.cpp
Gargaj's avatar
Gargaj committed
334
    ${CMAKE_SOURCE_DIR}/src/platform_x11/MIDI.cpp
335
    ${CMAKE_SOURCE_DIR}/src/platform_osx/Misc.mm
Gargaj's avatar
Gargaj committed
336
    ${CMAKE_SOURCE_DIR}/src/platform_x11/Timer.cpp
337
    ${CMAKE_SOURCE_DIR}/src/platform_osx/SetupDialog.cpp
Gargaj's avatar
Gargaj committed
338
    ${CMAKE_SOURCE_DIR}/src/platform_osx/Clipboard.cpp
339
    ${CMAKE_SOURCE_DIR}/src/platform_osx/TouchBar.mm
Gargaj's avatar
Gargaj committed
340
341
342
343
344
345
  )
  source_group("Bonzomatic\\Platform" FILES ${BZC_PLATFORM_SRCS})
  set(BZC_RESOURCES_DATA
    ${CMAKE_SOURCE_DIR}/data/macosx/icon.icns
  )
  source_group("Data" FILES ${BZC_RESOURCES_DATA})
346
elseif (UNIX)
Gargaj's avatar
Gargaj committed
347
  set(BZC_PLATFORM_SRCS
348
    ${CMAKE_SOURCE_DIR}/src/platform_glfw/Renderer.cpp
349
    ${CMAKE_SOURCE_DIR}/src/platform_common/FFT.cpp
Gargaj's avatar
Gargaj committed
350
351
352
353
354
355
356
    ${CMAKE_SOURCE_DIR}/src/platform_x11/MIDI.cpp
    ${CMAKE_SOURCE_DIR}/src/platform_x11/Misc.cpp
    ${CMAKE_SOURCE_DIR}/src/platform_x11/SetupDialog.cpp
    ${CMAKE_SOURCE_DIR}/src/platform_x11/Timer.cpp
    ${CMAKE_SOURCE_DIR}/src/platform_x11/Clipboard.cpp
  )
  source_group("Bonzomatic\\Platform" FILES ${BZC_PLATFORM_SRCS})
Chris White's avatar
Chris White committed
357
elseif (WIN32)
Gargaj's avatar
Gargaj committed
358
359
360
  if (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX11")
    set(BZC_PLATFORM_SRCS
      ${CMAKE_SOURCE_DIR}/src/platform_w32_dx11/Renderer.cpp
361
      ${CMAKE_SOURCE_DIR}/src/platform_common/FFT.cpp
Gargaj's avatar
Gargaj committed
362
363
364
365
366
367
368
369
370
371
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/MIDI.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Misc.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/SetupDialog.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Timer.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Clipboard.cpp
      ${CMAKE_SOURCE_DIR}/data/windows/resource.h
    )
  elseif (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX9")
    set(BZC_PLATFORM_SRCS
      ${CMAKE_SOURCE_DIR}/src/platform_w32_dx9/Renderer.cpp
372
      ${CMAKE_SOURCE_DIR}/src/platform_common/FFT.cpp
Gargaj's avatar
Gargaj committed
373
374
375
376
377
378
379
380
381
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/MIDI.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Misc.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/SetupDialog.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Timer.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Clipboard.cpp
      ${CMAKE_SOURCE_DIR}/data/windows/resource.h
    )
  else ()
    set(BZC_PLATFORM_SRCS
382
      ${CMAKE_SOURCE_DIR}/src/platform_glfw/Renderer.cpp
383
      ${CMAKE_SOURCE_DIR}/src/platform_common/FFT.cpp
Gargaj's avatar
Gargaj committed
384
385
386
387
388
389
390
391
392
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/MIDI.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Misc.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/SetupDialog.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Timer.cpp
      ${CMAKE_SOURCE_DIR}/src/platform_w32_common/Clipboard.cpp
      ${CMAKE_SOURCE_DIR}/data/windows/resource.h
    )
  endif ()
  source_group("Bonzomatic\\Platform" FILES ${BZC_PLATFORM_SRCS})
393

Gargaj's avatar
Gargaj committed
394
395
396
397
398
399
  set(BZC_RESOURCES_DATA
    ${CMAKE_SOURCE_DIR}/data/windows/icon.ico
    ${CMAKE_SOURCE_DIR}/data/windows/SetupDialog.rc
  )
  source_group("Data" FILES ${BZC_RESOURCES_DATA})
  set(BZC_PROJECT_INCLUDES ${CMAKE_SOURCE_DIR}/data/windows ${BZC_PROJECT_INCLUDES})
400
401
endif ()

Chris White's avatar
Chris White committed
402
if (WIN32 AND BONZOMATIC_NDI)
403
404
405
406
407
408
409
410
411
412
413
  set(BZC_CAPTURE_SRCS
    ${CMAKE_SOURCE_DIR}/src/capturing/Capture_NDI.cpp
  )
else ()
  set(BZC_CAPTURE_SRCS
    ${CMAKE_SOURCE_DIR}/src/capturing/Capture_Dummy.cpp
  )
endif ()
source_group("Bonzomatic\\Capture" FILES ${BZC_CAPTURE_SRCS})

set(BZC_PROJECT_SRCS ${BZC_PROJECT_SRCS} ${BZC_PLATFORM_SRCS} ${BZC_RESOURCES_DATA} ${BZC_CAPTURE_SRCS})
414
415
416
417
418
419

set(BZC_PROJECT_INCLUDES ${CMAKE_SOURCE_DIR}/src ${BZC_PROJECT_INCLUDES})

##############################################################################
#### APPLE BUNDLE, RESSOURCES AND DYNAMIC LIBS
if (APPLE)
Gargaj's avatar
Gargaj committed
420
  set(GUI_TYPE MACOSX_BUNDLE)
421

Gargaj's avatar
Gargaj committed
422
423
424
425
  # Define some settings for the Bundle
  set(MACOSX_BUNDLE_BUNDLE_NAME ${BZC_EXE_NAME})
  set(MACOSX_BUNDLE_GUI_IDENTIFIER "${BZC_EXE_NAME}")
  set(MACOSX_BUNDLE_ICON_FILE icon.icns)
426
  set(MACOSX_BUNDLE_INFO_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},Copyright © 2019 The Bonzomatic Contributors")
427
  set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
Gargaj's avatar
Gargaj committed
428
429
  set(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
  set(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
430
  set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2014-2019 The Bonzomatic Contributors. All rights reserved.")
431

Gargaj's avatar
Gargaj committed
432
  set_source_files_properties(${BZC_RESOURCES_DATA} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
433

Gargaj's avatar
Gargaj committed
434
435
  set_source_files_properties(${OSX_LIB_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION MacOS)
  set(BZC_PROJECT_SRCS ${BZC_PROJECT_SRCS} ${OSX_LIB_FILES})
436

Gargaj's avatar
Gargaj committed
437
  set(BZC_PROJECT_SRCS ${GUI_TYPE} ${BZC_PROJECT_SRCS})
438
439
440
441

  find_library(COCOA_FRAMEWORK Cocoa)
  find_library(OPENGL_FRAMEWORK OpenGL)
  find_library(CARBON_FRAMEWORK Carbon)
mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
442
  find_library(COREAUDIO_FRAMEWORK CoreAudio)
443
444
445
  find_library(AVFOUNDATION_FRAMEWORK AVFoundation)
  mark_as_advanced(COCOA_FRAMEWORK OPENGL_FRAMEWORK CARBON_FRAMEWORK COREAUDIO_FRAMEWORK AVFOUNDATION_FRAMEWORK)
  set(PLATFORM_LIBS ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK} ${CARBON_FRAMEWORK} ${COREAUDIO_FRAMEWORK} ${AVFOUNDATION_FRAMEWORK})
446
elseif (UNIX)
Gargaj's avatar
Gargaj committed
447
  set(PLATFORM_LIBS GL)
Chris White's avatar
Chris White committed
448
elseif (WIN32)
449
450
451
452
453
454
455
456
457
458
459
460
    if (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX11")
        set(PLATFORM_LIBS d3d11 d3dcompiler dxguid DXGI winmm)
    elseif (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX9")
        set(PLATFORM_LIBS d3d9 d3dx9 winmm)
    else ()
        set(PLATFORM_LIBS opengl32 glu32 winmm)
    endif ()
endif ()
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} ${PLATFORM_LIBS})
##############################################################################

# create the executable
461
link_directories(${BZC_LINK_DIRS})
462
if (UNIX AND (NOT APPLE))
463
    set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
464
endif ()
465
add_executable(${BZC_EXE_NAME} ${BZC_PROJECT_SRCS})
mathieu _alkama_ m's avatar
mathieu _alkama_ m committed
466
if (APPLE AND BONZOMATIC_RETINA)
Gargaj's avatar
Gargaj committed
467
468
  # Add special plist to enable Retina display support
  set_target_properties(${BZC_EXE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/data/macosx/MacOSXBundleInfo.plist.in)
469
470
471
endif ()
# Set compiler specific flags
if (APPLE)
472
473
474
  if (BONZOMATIC_TOUCHBAR)
    target_compile_definitions(${BZC_EXE_NAME} PUBLIC -DBONZOMATIC_ENABLE_TOUCHBAR)
  endif ()
Chris White's avatar
Chris White committed
475
elseif (WIN32)
476
477
478
  if (BONZOMATIC_NDI)
    target_compile_definitions(${BZC_EXE_NAME} PUBLIC -DBONZOMATIC_ENABLE_NDI)
  endif ()
Chris White's avatar
Chris White committed
479
480
481
482
  if (MSVC)
    set_target_properties(${BZC_EXE_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
    target_compile_options(${BZC_EXE_NAME} PUBLIC "$<$<CONFIG:Release>:/MT>")
  endif ()
483
endif ()
Gargaj's avatar
Gargaj committed
484
target_include_directories(${BZC_EXE_NAME} PUBLIC ${BZC_PROJECT_INCLUDES})
485
486
target_link_libraries(${BZC_EXE_NAME} ${BZC_PROJECT_LIBS})

487
if (MSVC)
488
489
  if (BONZOMATIC_NDI)
    if (BONZOMATIC_64BIT)
490
      add_custom_command(TARGET ${BZC_EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NDI_SDK_DIR}/Bin/x64/Processing.NDI.Lib.x64.dll" $<TARGET_FILE_DIR:${BZC_EXE_NAME}>)
491
    else ()
492
      add_custom_command(TARGET ${BZC_EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NDI_SDK_DIR}/Bin/x86/Processing.NDI.Lib.x86.dll" $<TARGET_FILE_DIR:${BZC_EXE_NAME}>)
493
    endif ()
494
  endif ()
495
endif ()
496

497
498
499
## install
if (UNIX AND (NOT APPLE))
  install(TARGETS ${BZC_EXE_NAME} RUNTIME DESTINATION bin)
500
501
502
503
504
  install(FILES "${CMAKE_SOURCE_DIR}/data/unix/bonzomatic.desktop"
          DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
  install(FILES "${CMAKE_SOURCE_DIR}/data/unix/icon.png"
          RENAME "bonzomatic.png"
          DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps")
505
endif ()