forked from LMMS/lmms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
802 lines (701 loc) · 23.3 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
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
PROJECT(lmms)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
SET(LMMS_BINARY_DIR ${CMAKE_BINARY_DIR})
SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR})
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0005 NEW)
CMAKE_POLICY(SET CMP0003 NEW)
IF (CMAKE_MAJOR_VERSION GREATER 2)
CMAKE_POLICY(SET CMP0026 NEW)
CMAKE_POLICY(SET CMP0045 NEW)
CMAKE_POLICY(SET CMP0050 OLD)
ENDIF()
CMAKE_POLICY(SET CMP0020 NEW)
CMAKE_POLICY(SET CMP0057 NEW)
ENDIF(COMMAND CMAKE_POLICY)
# Import of windows.h breaks min()/max()
ADD_DEFINITIONS(-DNOMINMAX)
# CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is not set correctly for MinGW until
# CMake 3.14.1, so avoid specifying system include directories on affected
# versions. Normal include directories are safe, since GCC ignores them if they
# are already in the built-in search path.
if(MINGW AND CMAKE_VERSION VERSION_LESS "3.14.1")
set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE)
endif()
INCLUDE(PluginList)
INCLUDE(CheckSubmodules)
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFiles)
INCLUDE(FindPkgConfig)
INCLUDE(GenerateExportHeader)
STRING(TOUPPER "${CMAKE_PROJECT_NAME}" PROJECT_NAME_UCASE)
SET(PROJECT_YEAR 2020)
SET(PROJECT_AUTHOR "LMMS Developers")
SET(PROJECT_URL "https://lmms.io")
SET(PROJECT_EMAIL "[email protected]")
SET(PROJECT_DESCRIPTION "${PROJECT_NAME_UCASE} - Free music production software")
SET(PROJECT_COPYRIGHT "2008-${PROJECT_YEAR} ${PROJECT_AUTHOR}")
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "3")
SET(VERSION_RELEASE "0")
SET(VERSION_STAGE "alpha")
SET(VERSION_BUILD "")
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
IF(VERSION_STAGE)
SET(VERSION "${VERSION}-${VERSION_STAGE}")
ENDIF()
IF(VERSION_BUILD)
SET(VERSION "${VERSION}-${VERSION_BUILD}")
ENDIF()
# Override version information for non-base builds
INCLUDE(VersionInfo)
INCLUDE(DetectMachine)
OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON)
OPTION(WANT_CALF "Include CALF LADSPA plugins" ON)
OPTION(WANT_CAPS "Include C* Audio Plugin Suite (LADSPA plugins)" ON)
OPTION(WANT_CARLA "Include Carla plugin" ON)
OPTION(WANT_CMT "Include Computer Music Toolkit LADSPA plugins" ON)
OPTION(WANT_JACK "Include JACK (Jack Audio Connection Kit) support" ON)
OPTION(WANT_WEAKJACK "Loosely link JACK libraries" ON)
OPTION(WANT_LV2 "Include Lv2 plugins" ON)
OPTION(WANT_SUIL "Include SUIL for LV2 plugin UIs" ON)
OPTION(WANT_MP3LAME "Include MP3/Lame support" ON)
OPTION(WANT_OGGVORBIS "Include OGG/Vorbis support" ON)
OPTION(WANT_PULSEAUDIO "Include PulseAudio support" ON)
OPTION(WANT_PORTAUDIO "Include PortAudio support" ON)
OPTION(WANT_SNDIO "Include sndio support" ON)
OPTION(WANT_SOUNDIO "Include libsoundio support" ON)
OPTION(WANT_SDL "Include SDL (Simple DirectMedia Layer) support" ON)
OPTION(WANT_SF2 "Include SoundFont2 player plugin" ON)
OPTION(WANT_GIG "Include GIG player plugin" ON)
OPTION(WANT_STK "Include Stk (Synthesis Toolkit) support" ON)
OPTION(WANT_SWH "Include Steve Harris's LADSPA plugins" ON)
OPTION(WANT_TAP "Include Tom's Audio Processing LADSPA plugins" ON)
OPTION(WANT_VST "Include VST support" ON)
OPTION(WANT_VST_32 "Include 32-bit VST support" ON)
OPTION(WANT_VST_64 "Include 64-bit VST support" ON)
OPTION(WANT_WINMM "Include WinMM MIDI support" OFF)
OPTION(WANT_DEBUG_FPE "Debug floating point exceptions" OFF)
OPTION(BUNDLE_QT_TRANSLATIONS "Install Qt translation files for LMMS" OFF)
IF(LMMS_BUILD_APPLE)
# Fix linking on 10.14+. See issue #4762 on github
LINK_DIRECTORIES("${APPLE_PREFIX}/lib")
SET(WANT_SOUNDIO OFF)
SET(WANT_ALSA OFF)
SET(WANT_PULSEAUDIO OFF)
SET(WANT_VST OFF)
SET(STATUS_ALSA "<not supported on this platform>")
SET(STATUS_PULSEAUDIO "<not supported on this platform>")
SET(STATUS_APPLEMIDI "OK")
ELSE(LMMS_BUILD_APPLE)
SET(STATUS_APPLEMIDI "<not supported on this platform>")
ENDIF(LMMS_BUILD_APPLE)
IF(LMMS_BUILD_WIN32)
SET(WANT_ALSA OFF)
SET(WANT_PULSEAUDIO OFF)
SET(WANT_SNDIO OFF)
SET(WANT_SOUNDIO OFF)
SET(WANT_WINMM ON)
SET(BUNDLE_QT_TRANSLATIONS ON)
SET(LMMS_HAVE_WINMM TRUE)
SET(STATUS_ALSA "<not supported on this platform>")
SET(STATUS_PULSEAUDIO "<not supported on this platform>")
SET(STATUS_SOUNDIO "<disabled in this release>")
SET(STATUS_SNDIO "<not supported on this platform>")
SET(STATUS_WINMM "OK")
SET(STATUS_APPLEMIDI "<not supported on this platform>")
ELSE(LMMS_BUILD_WIN32)
SET(STATUS_WINMM "<not supported on this platform>")
ENDIF(LMMS_BUILD_WIN32)
# TODO: Fix linking issues with msys debug builds
IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(WANT_GIG OFF)
SET(WANT_STK OFF)
SET(WANT_SWH OFF)
SET(STATUS_GIG "not built as requested")
SET(STATUS_STK "not built as requested")
ENDIF()
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H)
CHECK_INCLUDE_FILES(semaphore.h LMMS_HAVE_SEMAPHORE_H)
CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
CHECK_INCLUDE_FILES(sys/time.h LMMS_HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(sys/times.h LMMS_HAVE_SYS_TIMES_H)
CHECK_INCLUDE_FILES(sched.h LMMS_HAVE_SCHED_H)
CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
CHECK_INCLUDE_FILES(fcntl.h LMMS_HAVE_FCNTL_H)
CHECK_INCLUDE_FILES(sys/ioctl.h LMMS_HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILES(ctype.h LMMS_HAVE_CTYPE_H)
CHECK_INCLUDE_FILES(string.h LMMS_HAVE_STRING_H)
CHECK_INCLUDE_FILES(process.h LMMS_HAVE_PROCESS_H)
CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)
include(CheckLibraryExists)
check_library_exists(rt shm_open "" LMMS_HAVE_LIBRT)
LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")
FIND_PACKAGE(Qt5 5.6.0 COMPONENTS Core Gui Widgets Xml REQUIRED)
FIND_PACKAGE(Qt5 COMPONENTS LinguistTools QUIET)
INCLUDE_DIRECTORIES(
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
)
SET(QT_LIBRARIES
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Xml
)
IF(LMMS_BUILD_LINUX AND WANT_VST)
FIND_PACKAGE(Qt5 COMPONENTS X11Extras REQUIRED)
LIST(APPEND QT_LIBRARIES Qt5::X11Extras)
ENDIF()
# Resolve Qt5::qmake to full path for use in packaging scripts
GET_TARGET_PROPERTY(QT_QMAKE_EXECUTABLE "${Qt5Core_QMAKE_EXECUTABLE}" IMPORTED_LOCATION)
# Find the location of Qt translation files
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS
OUTPUT_VARIABLE QT_TRANSLATIONS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
IF(EXISTS "${QT_TRANSLATIONS_DIR}")
MESSAGE("-- Found Qt translations in ${QT_TRANSLATIONS_DIR}")
ADD_DEFINITIONS("-DQT_TRANSLATIONS_DIR=\"${QT_TRANSLATIONS_DIR}\"")
ENDIF()
FIND_PACKAGE(Qt5Test)
SET(QT_QTTEST_LIBRARY Qt5::Test)
# check for libsndfile
FIND_PACKAGE(SndFile REQUIRED)
IF(NOT SNDFILE_FOUND)
MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!")
ENDIF()
# check if we can use SFC_SET_COMPRESSION_LEVEL
INCLUDE(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(
"#include <sndfile.h>
int main() {SFC_SET_COMPRESSION_LEVEL;}"
LMMS_HAVE_SF_COMPLEVEL
)
IF(WANT_LV2)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(LV2 lv2)
PKG_CHECK_MODULES(LILV lilv-0)
ENDIF()
IF(NOT LV2_FOUND AND NOT LILV_FOUND)
UNSET(LV2_FOUND CACHE)
UNSET(LILV_FOUND CACHE)
FIND_PACKAGE(LV2 CONFIG)
FIND_PACKAGE(LILV CONFIG)
IF(LILV_FOUND)
SET(LILV_LIBRARIES "lilv::lilv")
ENDIF()
ENDIF()
IF(LV2_FOUND AND LILV_FOUND)
SET(LMMS_HAVE_LV2 TRUE)
SET(STATUS_LV2 "OK")
ELSE()
SET(STATUS_LV2 "not found, install it or set PKG_CONFIG_PATH appropriately")
ENDIF()
ELSE(WANT_LV2)
SET(STATUS_LV2 "not built as requested")
ENDIF(WANT_LV2)
IF(WANT_SUIL)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(SUIL suil-0)
IF(SUIL_FOUND)
SET(LMMS_HAVE_SUIL TRUE)
SET(STATUS_SUIL "OK")
ELSE()
SET(STATUS_SUIL "not found, install it or set PKG_CONFIG_PATH appropriately")
ENDIF()
ELSE()
SET(STATUS_SUIL "not found, requires pkg-config")
ENDIF()
ELSE(WANT_SUIL)
SET(STATUS_SUIL "not built as requested")
ENDIF(WANT_SUIL)
IF(WANT_CALF)
SET(LMMS_HAVE_CALF TRUE)
SET(STATUS_CALF "OK")
ELSE(WANT_CALF)
SET(STATUS_CALF "not built as requested")
ENDIF(WANT_CALF)
IF(WANT_CAPS)
SET(LMMS_HAVE_CAPS TRUE)
SET(STATUS_CAPS "OK")
ELSE(WANT_CAPS)
SET(STATUS_CAPS "not built as requested")
ENDIF(WANT_CAPS)
IF(WANT_CMT)
SET(LMMS_HAVE_CMT TRUE)
SET(STATUS_CMT "OK")
ELSE(WANT_CMT)
SET(STATUS_CMT "not built as requested")
ENDIF(WANT_CMT)
IF(WANT_SWH)
SET(LMMS_HAVE_SWH TRUE)
SET(STATUS_SWH "OK")
ELSE(WANT_SWH)
SET(STATUS_SWH "not built as requested")
ENDIF(WANT_SWH)
IF(WANT_TAP)
SET(LMMS_HAVE_TAP TRUE)
SET(STATUS_TAP "OK")
ELSE(WANT_TAP)
SET(STATUS_TAP "not built as requested")
ENDIF(WANT_TAP)
# check for CARLA
IF(WANT_CARLA)
PKG_CHECK_MODULES(CARLA carla-native-plugin)
# look for carla under old name
IF(NOT CARLA_FOUND)
PKG_CHECK_MODULES(CARLA carla-standalone>=1.9.5)
ENDIF()
IF(CARLA_FOUND)
SET(LMMS_HAVE_CARLA TRUE)
SET(STATUS_CARLA "OK")
ELSE(CARLA_FOUND)
SET(LMMS_HAVE_WEAKCARLA TRUE)
SET(STATUS_CARLA "OK (weak linking enabled)")
ENDIF(CARLA_FOUND)
ENDIF(WANT_CARLA)
# check for SDL2
IF(WANT_SDL)
FIND_PACKAGE(SDL2)
IF(SDL2_FOUND)
SET(LMMS_HAVE_SDL TRUE)
SET(LMMS_HAVE_SDL2 TRUE)
SET(STATUS_SDL "OK, using SDL2")
SET(SDL2_LIBRARY "SDL2::SDL2")
SET(SDL_INCLUDE_DIR "")
SET(SDL_LIBRARY "")
ELSE()
SET(SDL2_LIBRARY "")
ENDIF()
ENDIF()
# fallback to SDL1
IF(WANT_SDL AND NOT LMMS_HAVE_SDL2)
# Fallback to SDL1.2
SET(SDL_BUILDING_LIBRARY TRUE)
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
SET(LMMS_HAVE_SDL TRUE)
SET(STATUS_SDL "OK, using SDL1.2")
# fix mingw since 53abd65
IF(NOT SDL_INCLUDE_DIR)
SET(SDL_INCLUDE_DIR "${CMAKE_FIND_ROOT_PATH}/include")
ENDIF()
ELSE()
SET(STATUS_SDL "not found, please install libsdl2-dev (or similar) "
"if you require SDL support")
SET(SDL_INCLUDE_DIR "")
SET(SDL_LIBRARY "")
ENDIF()
ENDIF()
# check for Stk
IF(WANT_STK)
FIND_PACKAGE(STK)
IF(STK_FOUND)
SET(LMMS_HAVE_STK TRUE)
SET(STATUS_STK "OK")
ELSE(STK_FOUND)
SET(STK_INCLUDE_DIR "")
SET(STATUS_STK "not found, please install libstk0-dev (or similar) "
"if you require the Mallets instrument")
ENDIF(STK_FOUND)
ENDIF(WANT_STK)
# check for PortAudio
IF(WANT_PORTAUDIO)
FIND_PACKAGE(Portaudio)
IF(Portaudio_FOUND)
SET(LMMS_HAVE_PORTAUDIO TRUE)
SET(STATUS_PORTAUDIO "OK")
ELSE()
SET(STATUS_PORTAUDIO "not found, please install portaudio19-dev (or similar, version >= 1.9) "
"if you require PortAudio support")
ENDIF()
ENDIF(WANT_PORTAUDIO)
# check for libsoundio
IF(WANT_SOUNDIO)
FIND_PACKAGE(SoundIo)
IF(SOUNDIO_FOUND)
SET(LMMS_HAVE_SOUNDIO TRUE)
SET(STATUS_SOUNDIO "OK")
INCLUDE_DIRECTORIES("${SOUNDIO_INCLUDE_DIR}")
ELSE(SOUNDIO_FOUND)
SET(SOUNDIO_INCLUDE_DIR "")
SET(STATUS_SOUNDIO "not found, please install libsoundio if you require libsoundio support")
SET(SOUNDIO_LIBRARY "")
ENDIF(SOUNDIO_FOUND)
ENDIF(WANT_SOUNDIO)
# check for PulseAudio
IF(WANT_PULSEAUDIO)
FIND_PACKAGE(PulseAudio)
IF(PULSEAUDIO_FOUND)
SET(LMMS_HAVE_PULSEAUDIO TRUE)
SET(STATUS_PULSEAUDIO "OK")
ELSE(PULSEAUDIO_FOUND)
SET(STATUS_PULSEAUDIO "not found, please install libpulse-dev (or similar) "
"if you require PulseAudio support")
ENDIF(PULSEAUDIO_FOUND)
ENDIF(WANT_PULSEAUDIO)
IF(NOT LMMS_HAVE_PULSEAUDIO)
SET(PULSEAUDIO_INCLUDE_DIR "")
SET(PULSEAUDIO_LIBRARIES "")
ENDIF(NOT LMMS_HAVE_PULSEAUDIO)
# check for MP3/Lame-libraries
IF(WANT_MP3LAME)
FIND_PACKAGE(Lame)
IF(LAME_FOUND)
SET(LMMS_HAVE_MP3LAME TRUE)
SET(STATUS_MP3LAME "OK")
ELSE(LAME_FOUND)
SET(STATUS_MP3LAME "not found, please install libmp3lame-dev (or similar)")
SET(LAME_LIBRARIES "")
SET(LAME_INCLUDE_DIRS "")
ENDIF(LAME_FOUND)
ELSE(WANT_MP3LAME)
SET(STATUS_MP3LAME "Disabled for build")
ENDIF(WANT_MP3LAME)
# check for OGG/Vorbis-libraries
IF(WANT_OGGVORBIS)
FIND_PACKAGE(OggVorbis)
IF(OGGVORBIS_FOUND)
SET(LMMS_HAVE_OGGVORBIS TRUE)
SET(STATUS_OGGVORBIS "OK")
ELSE(OGGVORBIS_FOUND)
SET(STATUS_OGGVORBIS "not found, libogg-dev and libvorbis-dev (or similar) "
"is highly recommended")
ENDIF(OGGVORBIS_FOUND)
ENDIF(WANT_OGGVORBIS)
# check whether to enable OSS-support
IF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
SET(LMMS_HAVE_OSS TRUE)
SET(STATUS_OSS "OK")
ELSE(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
SET(STATUS_OSS "<not found or not supported on this platform>")
ENDIF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
# check for ALSA
IF(WANT_ALSA)
FIND_PACKAGE(Alsa)
IF(ALSA_FOUND)
SET(LMMS_HAVE_ALSA TRUE)
SET(STATUS_ALSA "OK")
ELSE(ALSA_FOUND)
SET(STATUS_ALSA "not found, please install libasound2-dev (or similar) "
"if you require ALSA support")
ENDIF(ALSA_FOUND)
ENDIF(WANT_ALSA)
IF(NOT LMMS_HAVE_ALSA)
SET(ASOUND_LIBRARY "")
ENDIF(NOT LMMS_HAVE_ALSA)
# check for JACK
IF(WANT_JACK)
IF(WANT_WEAKJACK)
SET(LMMS_HAVE_WEAKJACK TRUE)
SET(WEAKJACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/weakjack/weakjack)
SET(JACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/jack2/common)
SET(STATUS_JACK "OK (weak linking enabled)")
# use dlsym instead
SET(JACK_LIBRARIES ${CMAKE_DL_LIBS})
SET(LMMS_HAVE_JACK TRUE)
SET(LMMS_HAVE_JACK_PRENAME TRUE)
SET(JACK_FOUND TRUE)
ELSE()
PKG_CHECK_MODULES(JACK jack>=0.77)
IF(JACK_FOUND)
SET(LMMS_HAVE_JACK TRUE)
SET(STATUS_JACK "OK")
SET(CMAKE_REQUIRED_LIBRARIES_BACKUP "${CMAKE_REQUIRED_LIBRARIES}")
SET(CMAKE_REQUIRED_LIBRARIES "${JACK_LIBRARIES}")
CHECK_LIBRARY_EXISTS(jack jack_port_rename "" LMMS_HAVE_JACK_PRENAME)
SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_BACKUP}")
UNSET(CMAKE_REQUIRED_LIBRARIES_BACKUP)
ENDIF()
ENDIF()
IF(NOT JACK_FOUND)
SET(JACK_INCLUDE_DIRS "")
SET(STATUS_JACK "not found")
ENDIF()
ENDIF(WANT_JACK)
# check for FFTW3F-library
FIND_PACKAGE(FFTW COMPONENTS fftw3f REQUIRED)
# check for FLTK
FIND_PACKAGE(FLTK)
IF(FLTK_FOUND)
SET(STATUS_ZYN "OK")
ELSE()
SET(STATUS_ZYN "not found, please install fltk")
ENDIF()
# check for Fluidsynth
IF(WANT_SF2)
find_package(FluidSynth 1.0.7)
if(FluidSynth_FOUND)
SET(LMMS_HAVE_FLUIDSYNTH TRUE)
SET(STATUS_FLUIDSYNTH "OK")
else()
SET(STATUS_FLUIDSYNTH "not found, libfluidsynth-dev (or similar)"
"is highly recommended")
endif()
ENDIF(WANT_SF2)
# check for libgig
If(WANT_GIG)
PKG_CHECK_MODULES(GIG gig)
IF(GIG_FOUND)
SET(LMMS_HAVE_GIG TRUE)
SET(STATUS_GIG "OK")
ELSE(GIG_FOUND)
SET(STATUS_GIG "not found, libgig needed for decoding .gig files")
ENDIF(GIG_FOUND)
ENDIF(WANT_GIG)
# check for pthreads
IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD OR LMMS_BUILD_FREEBSD OR LMMS_BUILD_HAIKU)
FIND_PACKAGE(Threads)
ENDIF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD OR LMMS_BUILD_FREEBSD OR LMMS_BUILD_HAIKU)
# check for sndio (roaraudio won't work yet)
IF(WANT_SNDIO)
FIND_PACKAGE(Sndio)
IF(SNDIO_FOUND)
SET(LMMS_HAVE_SNDIO TRUE)
SET(STATUS_SNDIO "OK")
ELSE()
SET(STATUS_SNDIO "<not found or not supported on this platform>")
ENDIF(SNDIO_FOUND)
ENDIF(WANT_SNDIO)
# check for WINE
IF(WANT_VST)
FIND_PACKAGE(Wine)
IF(WINE_FOUND)
SET(LMMS_SUPPORT_VST TRUE)
IF(WINE_LIBRARY_FIX)
SET(STATUS_VST "OK, with workaround linking ${WINE_LIBRARY_FIX}")
ELSE()
SET(STATUS_VST "OK")
ENDIF()
ELSEIF(WANT_VST_NOWINE)
SET(LMMS_SUPPORT_VST TRUE)
SET(STATUS_VST "OK")
ELSE(WINE_FOUND)
SET(STATUS_VST "not found, please install (lib)wine-dev (or similar) - 64 bit systems additionally need gcc-multilib and g++-multilib")
ENDIF(WINE_FOUND)
ENDIF(WANT_VST)
IF(LMMS_BUILD_WIN32)
SET(LMMS_SUPPORT_VST TRUE)
SET(STATUS_VST "OK")
ENDIF(LMMS_BUILD_WIN32)
IF(WANT_DEBUG_FPE)
IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
SET(LMMS_DEBUG_FPE TRUE)
SET (STATUS_DEBUG_FPE "Enabled")
ELSE()
SET (STATUS_DEBUG_FPE "Wanted but disabled due to unsupported platform")
ENDIF()
ELSE()
SET (STATUS_DEBUG_FPE "Disabled")
ENDIF(WANT_DEBUG_FPE)
# check for libsamplerate
FIND_PACKAGE(Samplerate 0.1.8 MODULE REQUIRED)
# set compiler flags
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow")
OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF)
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror")
ENDIF()
# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32))
SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds -Wno-attributes")
ENDIF()
ELSEIF(MSVC)
# Remove any existing /W flags
STRING(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
SET(WERROR_FLAGS "/W2")
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} /WX")
ENDIF()
ENDIF()
IF(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
ENDIF()
SET(CMAKE_C_FLAGS "${WERROR_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLMMS_DEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLMMS_DEBUG")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16")
set(NOOP_COMMAND "${CMAKE_COMMAND}" "-E" "true")
else()
set(NOOP_COMMAND "${CMAKE_COMMAND}" "-E" "echo")
endif()
if(STRIP)
set(STRIP_COMMAND "$<IF:$<TARGET:Debug,RelWithDebInfo>,${NOOP_COMMAND},${STRIP}>")
else()
set(STRIP_COMMAND "${NOOP_COMMAND}")
endif()
# people simply updating git will still have this and mess up build with it
FILE(REMOVE include/lmmsconfig.h)
FILE(GLOB LMMS_INCLUDES "${CMAKE_SOURCE_DIR}/include/*.h")
LIST(SORT LMMS_INCLUDES)
# Get list of all committers from git history, ordered by number of commits.
# The CONTRIBUTORS file is used by AboutDialog. This information can be provided
# with -DCONTRIBUTORS=/path/to/CONTRIBUTORS instead. For instance, to generate
# this file for version 1.1.3, the command is:
# git shortlog -sne v1.1.3 | cut -c8-
FIND_PACKAGE(Git)
IF(GIT_FOUND AND NOT CONTRIBUTORS)
SET(CONTRIBUTORS "${CMAKE_BINARY_DIR}/CONTRIBUTORS")
EXECUTE_PROCESS(
COMMAND "${GIT_EXECUTABLE}" shortlog -sne
COMMAND cut -c8-
OUTPUT_FILE "${CONTRIBUTORS}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
TIMEOUT 1)
ENDIF()
# we somehow have to make LMMS-binary depend on MOC-files
ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h")
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
ENDIF(WIN32)
ENDIF()
# use ccache
include(CompileCache)
# make sub-directories
ADD_SUBDIRECTORY(cmake)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(data)
ADD_SUBDIRECTORY(doc)
# install tasks
ADD_SUBDIRECTORY(cmake/install)
FIND_PACKAGE(UnixCommands)
IF(GZIP)
ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_BINARY_DIR}/lmms.1.gz"
COMMAND ${GZIP} -c ${CMAKE_SOURCE_DIR}/doc/lmms.1 > ${CMAKE_BINARY_DIR}/lmms.1.gz
DEPENDS "${CMAKE_SOURCE_DIR}/doc/lmms.1"
COMMENT "Generating lmms.1.gz"
VERBATIM)
ADD_CUSTOM_TARGET(manpage ALL
DEPENDS "${CMAKE_BINARY_DIR}/lmms.1.gz")
ELSEIF(UNIX)
MESSAGE(FATAL_ERROR "Can't find gzip required for generating lmms.1.gz")
ENDIF()
# install headers
IF(LMMS_BUILD_LINUX)
INSTALL(FILES ${LMMS_INCLUDES}
"${CMAKE_BINARY_DIR}/lmmsconfig.h"
"${CMAKE_BINARY_DIR}/lmmsversion.h"
"${CMAKE_SOURCE_DIR}/src/gui/embed.cpp"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/lmms/")
ENDIF(LMMS_BUILD_LINUX)
#
# add distclean-target
#
ADD_CUSTOM_TARGET(distclean
COMMAND make clean
COMMAND rm -rf `find -name cmake_install.cmake` `find -name Makefile` `find -type d -name CMakeFiles` CMakeCache.txt lmmsconfig.h lmms.1.gz)
#
# add tarball-target
#
SET(TMP "lmms-${VERSION}")
ADD_CUSTOM_TARGET(dist
COMMAND make clean
COMMAND rm -rf "${TMP}"
COMMAND mkdir -p "${TMP}"
COMMAND cp CMakeLists.txt LICENSE.txt INSTALL.txt README.md "${TMP}"
COMMAND cp -r buildtools cmake data doc include plugins src "${TMP}"
COMMAND rm -rf `find "${TMP}" -name cmake_install.cmake` `find "${TMP}" -name Makefile` `find "${TMP}" -type d -name CMakeFiles` "${TMP}/CMakeCache.txt"
COMMAND tar cjf lmms-${VERSION}-src.tar.bz2 "${TMP}"
COMMAND rm -rf "${TMP}")
#
# add uninstall-target
#
ADD_CUSTOM_TARGET(uninstall
COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake"
)
#
# display configuration information
#
MESSAGE("\n"
"Installation Summary\n"
"--------------------\n"
"* Install Directory : ${CMAKE_INSTALL_PREFIX}\n"
)
MESSAGE(
"Supported audio interfaces\n"
"--------------------------\n"
"* ALSA : ${STATUS_ALSA}\n"
"* JACK : ${STATUS_JACK}\n"
"* OSS : ${STATUS_OSS}\n"
"* Sndio : ${STATUS_SNDIO}\n"
"* PortAudio : ${STATUS_PORTAUDIO}\n"
"* libsoundio : ${STATUS_SOUNDIO}\n"
"* PulseAudio : ${STATUS_PULSEAUDIO}\n"
"* SDL : ${STATUS_SDL}\n"
)
MESSAGE(
"Supported MIDI interfaces\n"
"-------------------------\n"
"* ALSA : ${STATUS_ALSA}\n"
"* OSS : ${STATUS_OSS}\n"
"* Sndio : ${STATUS_SNDIO}\n"
"* JACK : ${STATUS_JACK}\n"
"* WinMM : ${STATUS_WINMM}\n"
"* AppleMidi : ${STATUS_APPLEMIDI}\n"
)
MESSAGE(
"Supported file formats for project export\n"
"-----------------------------------------\n"
"* WAVE : OK\n"
"* FLAC : OK\n"
"* OGG/VORBIS : ${STATUS_OGGVORBIS}\n"
"* MP3/Lame : ${STATUS_MP3LAME}\n"
)
MESSAGE(
"Optional plugins\n"
"----------------\n"
"* Lv2 plugins : ${STATUS_LV2}\n"
"* SUIL for plugin UIs : ${STATUS_SUIL}\n"
"* ZynAddSubFX instrument : ${STATUS_ZYN}\n"
"* Carla Patchbay & Rack : ${STATUS_CARLA}\n"
"* SoundFont2 player : ${STATUS_FLUIDSYNTH}\n"
"* Stk Mallets : ${STATUS_STK}\n"
"* VST-instrument hoster : ${STATUS_VST}\n"
"* VST-effect hoster : ${STATUS_VST}\n"
"* CALF LADSPA plugins : ${STATUS_CALF}\n"
"* CAPS LADSPA plugins : ${STATUS_CAPS}\n"
"* CMT LADSPA plugins : ${STATUS_CMT}\n"
"* TAP LADSPA plugins : ${STATUS_TAP}\n"
"* SWH LADSPA plugins : ${STATUS_SWH}\n"
"* GIG player : ${STATUS_GIG}\n"
)
MESSAGE(
"Developer options\n"
"-----------------------------------------\n"
"* Debug FP exceptions : ${STATUS_DEBUG_FPE}\n"
)
MESSAGE(
"\n"
"-----------------------------------------------------------------\n"
"IMPORTANT:\n"
"after installing missing packages, remove CMakeCache.txt before\n"
"running cmake again!\n"
"-----------------------------------------------------------------\n"
"\n\n")
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BIN_DIR}")
if(MSVC)
# We can't set this on the install time according to the configuration
SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
endif()
INCLUDE(InstallRequiredSystemLibraries)