Made 0.4.12 release
[lmms/mlankhorst.git] / CMakeLists.txt
blobca386211a755598d2630b520bb35d791407e67c0
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)
3 PROJECT(lmms)
5 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
7 IF(COMMAND CMAKE_POLICY)
8         CMAKE_POLICY(SET CMP0005 NEW)
9         CMAKE_POLICY(SET CMP0003 NEW)
10 ENDIF(COMMAND CMAKE_POLICY)
12 INCLUDE(AddFileDependencies)
13 INCLUDE(CheckIncludeFiles)
14 INCLUDE(FindPkgConfig)
16 SET(VERSION_MAJOR "0")
17 SET(VERSION_MINOR "4")
18 SET(VERSION_PATCH "12")
19 #SET(VERSION_SUFFIX "")
20 SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
21 IF(VERSION_SUFFIX)
22         SET(VERSION "${VERSION}-${VERSION_SUFFIX}")
23 ENDIF(VERSION_SUFFIX)
26 INCLUDE(DetectMachine)
29 OPTION(WANT_ALSA        "Include ALSA (Advanced Linux Sound Architecture) support" ON)
30 OPTION(WANT_CALF        "Include CALF LADSPA plugins" ON)
31 OPTION(WANT_CAPS        "Include C* Audio Plugin Suite (LADSPA plugins)" ON)
32 OPTION(WANT_CMT         "Include Computer Music Toolkit LADSPA plugins" ON)
33 OPTION(WANT_FFTW3F      "Include SpectrumAnalyzer and ZynAddSubFX plugin" ON)
34 OPTION(WANT_JACK        "Include JACK (Jack Audio Connection Kit) support" ON)
35 OPTION(WANT_OGGVORBIS   "Include OGG/Vorbis support" ON)
36 OPTION(WANT_PULSEAUDIO  "Include PulseAudio support" ON)
37 OPTION(WANT_PORTAUDIO   "Include PortAudio support" ON)
38 OPTION(WANT_SDL         "Include SDL (Simple DirectMedia Layer) support" ON)
39 OPTION(WANT_SF2         "Include SoundFont2 player plugin" ON)
40 OPTION(WANT_STK         "Include Stk (Synthesis Toolkit) support" ON)
41 OPTION(WANT_SYSTEM_SR   "Use system's libsamplerate" ON)
42 OPTION(WANT_SWH         "Include Steve Harris's LADSPA plugins" ON)
43 OPTION(WANT_TAP         "Include Tom's Audio Processing LADSPA plugins" ON)
44 OPTION(WANT_VST         "Include VST support" ON)
45 OPTION(WANT_VST_NOWINE  "Include partial VST support (without wine)" OFF)
46 OPTION(WANT_WINMM       "Include WinMM MIDI support" OFF)
48 IF(LMMS_BUILD_WIN32)
49         SET(WANT_ALSA OFF)
50         SET(WANT_JACK OFF)
51         SET(WANT_PULSEAUDIO OFF)
52         SET(WANT_SYSTEM_SR OFF)
53         SET(WANT_WINMM ON)
54         SET(LMMS_HAVE_WINMM TRUE)
55         SET(STATUS_ALSA "<not supported on this platform>")
56         SET(STATUS_JACK "<not supported on this platform>")
57         SET(STATUS_PULSEAUDIO "<not supported on this platform>")
58         SET(STATUS_WINMM "OK")
59 ELSE(LMMS_BUILD_WIN32)
60         SET(STATUS_WINMM "<not supported on this platform>")
61 ENDIF(LMMS_BUILD_WIN32)
65 CHECK_INCLUDE_FILES(stdint.h LMMS_HAVE_STDINT_H)
66 CHECK_INCLUDE_FILES(stdlib.h LMMS_HAVE_STDLIB_H)
67 CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H)
68 CHECK_INCLUDE_FILES(semaphore.h LMMS_HAVE_SEMAPHORE_H)
69 CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H)
70 CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H)
71 CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
72 CHECK_INCLUDE_FILES(sys/shm.h LMMS_HAVE_SYS_SHM_H)
73 CHECK_INCLUDE_FILES(sys/time.h LMMS_HAVE_SYS_TIME_H)
74 CHECK_INCLUDE_FILES(sys/wait.h LMMS_HAVE_SYS_WAIT_H)
75 CHECK_INCLUDE_FILES(sys/select.h LMMS_HAVE_SYS_SELECT_H)
76 CHECK_INCLUDE_FILES(stdarg.h LMMS_HAVE_STDARG_H)
77 CHECK_INCLUDE_FILES(signal.h LMMS_HAVE_SIGNAL_H)
78 CHECK_INCLUDE_FILES(sched.h LMMS_HAVE_SCHED_H)
79 CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
80 CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
81 CHECK_INCLUDE_FILES(fcntl.h LMMS_HAVE_FCNTL_H)
82 CHECK_INCLUDE_FILES(sys/ioctl.h LMMS_HAVE_SYS_IOCTL_H)
83 CHECK_INCLUDE_FILES(ctype.h LMMS_HAVE_CTYPE_H)
84 CHECK_INCLUDE_FILES(string.h LMMS_HAVE_STRING_H)
85 CHECK_INCLUDE_FILES(process.h LMMS_HAVE_PROCESS_H)
86 CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)
88 # check for Qt4
89 SET(QT_MIN_VERSION "4.3.0" COMPONENTS QtCore QtGui QtXml)
90 FIND_PACKAGE(Qt4 REQUIRED)
91 SET(QT_USE_QTXML 1)
92 EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_TRANSLATIONS" OUTPUT_VARIABLE QT_TRANSLATIONS_DIR)
93 IF(WIN32)
94         SET(QT_TRANSLATIONS_DIR "${MINGW_PREFIX}/share/qt4/translations/")
95 ENDIF(WIN32)
96 IF(EXISTS "${QT_TRANSLATIONS_DIR}")
97         MESSAGE("-- Found Qt translations in ${QT_TRANSLATIONS_DIR}")
98         ADD_DEFINITIONS(-D'QT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}"')
99 ENDIF(EXISTS "${QT_TRANSLATIONS_DIR}")
100 IF(NOT WIN32)
101         STRING(REPLACE "-DQT_DLL" "" QT_DEFINITIONS "${QT_DEFINITIONS}")
102 ENDIF(NOT WIN32)
103 INCLUDE(${QT_USE_FILE})
105 # check for libsndfile
106 PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.11)
107 IF(NOT SNDFILE_FOUND)
108         MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.11 - please install, remove CMakeCache.txt and try again!")
109 ENDIF(NOT SNDFILE_FOUND)
111 IF(WANT_CALF)
112 SET(LMMS_HAVE_CALF TRUE)
113 SET(STATUS_CALF "OK")
114 ELSE(WANT_CALF)
115 SET(STATUS_CALF "not built as requested")
116 ENDIF(WANT_CALF)
118 IF(WANT_CAPS)
119 SET(LMMS_HAVE_CAPS TRUE)
120 SET(STATUS_CAPS "OK")
121 ELSE(WANT_CAPS)
122 SET(STATUS_CAPS "not built as requested")
123 ENDIF(WANT_CAPS)
125 IF(WANT_CMT)
126 SET(LMMS_HAVE_CMT TRUE)
127 SET(STATUS_CMT "OK")
128 ELSE(WANT_CMT)
129 SET(STATUS_CMT "not built as requested")
130 ENDIF(WANT_CMT)
132 IF(WANT_SWH)
133 SET(LMMS_HAVE_SWH TRUE)
134 SET(STATUS_SWH "OK")
135 ELSE(WANT_SWH)
136 SET(STATUS_SWH "not built as requested")
137 ENDIF(WANT_SWH)
139 IF(WANT_TAP)
140 SET(LMMS_HAVE_TAP TRUE)
141 SET(STATUS_TAP "OK")
142 ELSE(WANT_TAP)
143 SET(STATUS_TAP "not built as requested")
144 ENDIF(WANT_TAP)
147 # check for SDL
148 IF(WANT_SDL)
149         SET(SDL_BUILDING_LIBRARY TRUE)
150         FIND_PACKAGE(SDL)
151         IF(SDL_FOUND)
152                 SET(LMMS_HAVE_SDL TRUE)
153                 SET(STATUS_SDL "OK")
154         ELSE(SDL_FOUND)
155                 SET(STATUS_SDL "not found, please install libsdl1.2-dev (or similiar) "
156                         "if you require SDL support")
157         ENDIF(SDL_FOUND)
158 ENDIF(WANT_SDL)
159 IF(NOT LMMS_HAVE_SDL)
160         SET(SDL_INCLUDE_DIR "")
161 ELSE(NOT LMMS_HAVE_SDL)
162         IF(NOT SDL_INCLUDE_DIR)
163                 SET(SDL_INCLUDE_DIR ${CMAKE_FIND_ROOT_PATH}/include)
164         ENDIF(NOT SDL_INCLUDE_DIR)
165 ENDIF(NOT LMMS_HAVE_SDL)
168 # check for Stk
169 IF(WANT_STK)
170         FIND_PACKAGE(STK)
171         IF(STK_FOUND)
172                 SET(LMMS_HAVE_STK TRUE)
173                 SET(STATUS_STK "OK")
174         ELSE(STK_FOUND)
175                 SET(STK_INCLUDE_DIR "")
176                 SET(STATUS_STK "not found, please install libstk0-dev (or similiar) "
177                         "if you require the Mallets instrument")
178         ENDIF(STK_FOUND)
179 ENDIF(WANT_STK)
182 # check for PortAudio
183 IF(WANT_PORTAUDIO)
184         FIND_PACKAGE(Portaudio)
185         IF(PORTAUDIO_FOUND)
186                 SET(LMMS_HAVE_PORTAUDIO TRUE)
187                 SET(STATUS_PORTAUDIO "OK")
188         ELSE(PORTAUDIO_FOUND)
189                 SET(STATUS_PORTAUDIO "not found, please install portaudio19-dev (or similiar, version >= 1.9) "
190                         "if you require PortAudio support")
191         ENDIF(PORTAUDIO_FOUND)
192 ENDIF(WANT_PORTAUDIO)
195 # check for PulseAudio
196 IF(WANT_PULSEAUDIO)
197         FIND_PACKAGE(PulseAudio)
198         IF(PULSEAUDIO_FOUND)
199                 SET(LMMS_HAVE_PULSEAUDIO TRUE)
200                 SET(STATUS_PULSEAUDIO "OK")
201         ELSE(PULSEAUDIO_FOUND)
202                 SET(STATUS_PULSEAUDIO "not found, please install libpulse-dev (or similiar) "
203                         "if you require PulseAudio support")
204         ENDIF(PULSEAUDIO_FOUND)
205 ENDIF(WANT_PULSEAUDIO)
206 IF(NOT LMMS_HAVE_PULSEAUDIO)
207         SET(PULSEAUDIO_INCLUDE_DIR "")
208         SET(PULSEAUDIO_LIBRARIES "")
209 ENDIF(NOT LMMS_HAVE_PULSEAUDIO)
212 # check for OGG/Vorbis-libraries
213 IF(WANT_OGGVORBIS)
214         FIND_PACKAGE(OggVorbis)
215         IF(OGGVORBIS_FOUND)
216                 SET(LMMS_HAVE_OGGVORBIS TRUE)
217                 SET(STATUS_OGGVORBIS "OK")
218         ELSE(OGGVORBIS_FOUND)
219                 SET(STATUS_OGGVORBIS "not found, libogg-dev and libvorbis-dev (or similiar) "
220                         "is highly recommended")
221         ENDIF(OGGVORBIS_FOUND)
222 ENDIF(WANT_OGGVORBIS)
225 # check whether to enable OSS-support
226 IF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
227         SET(LMMS_HAVE_OSS TRUE)
228         SET(STATUS_OSS "OK")
229 ELSE(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
230         SET(STATUS_OSS "<not found or not supported on this platform>")
231 ENDIF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
234 # check for ALSA
235 IF(WANT_ALSA)
236         FIND_PACKAGE(Alsa)
237         IF(ALSA_FOUND)
238                 SET(LMMS_HAVE_ALSA TRUE)
239                 SET(STATUS_ALSA "OK")
240         ELSE(ALSA_FOUND)
241                 SET(STATUS_ALSA "not found, please install libasound2-dev (or similiar) "
242                         "if you require ALSA support")
243         ENDIF(ALSA_FOUND)
244 ENDIF(WANT_ALSA)
245 IF(NOT LMMS_HAVE_ALSA)
246         SET(ASOUND_LIBRARY "")
247 ENDIF(NOT LMMS_HAVE_ALSA)
250 # check for JACK
251 IF(WANT_JACK)
252         PKG_CHECK_MODULES(JACK jack>=0.77)
253         IF(JACK_FOUND)
254                 SET(LMMS_HAVE_JACK TRUE)
255                 SET(STATUS_JACK "OK")
256         ELSE(JACK_FOUND)
257                 SET(STATUS_JACK "not found, please install libjack0.100.0-dev (or similiar) "
258                         "if you require JACK support")
259         ENDIF(JACK_FOUND)
260 ENDIF(WANT_JACK)
263 # check for FFTW3F-library
264 IF(WANT_FFTW3F)
265         PKG_CHECK_MODULES(FFTW3F fftw3f>=3.0.0)
266         IF(FFTW3F_FOUND)
267                 SET(LMMS_HAVE_FFTW3F TRUE)
268                 SET(STATUS_FFTW3F "OK")
269         ELSE(FFTW3F_FOUND)
270                 SET(STATUS_FFTW3F "not found, libfftw3-dev (or similiar) "
271                         "is highly recommended")
272         ENDIF(FFTW3F_FOUND)
273 ENDIF(WANT_FFTW3F)
276 # check for Fluidsynth
277 IF(WANT_SF2)
278         PKG_CHECK_MODULES(FLUIDSYNTH fluidsynth>=1.0.7)
279         IF(FLUIDSYNTH_FOUND)
280                 SET(LMMS_HAVE_FLUIDSYNTH TRUE)
281                 SET(STATUS_FLUIDSYNTH "OK")
282         ELSE(FLUIDSYNTH_FOUND)
283                 SET(STATUS_FLUIDSYNTH "not found, libfluidsynth-dev (or similiar)"
284                         "is highly recommended")
285         ENDIF(FLUIDSYNTH_FOUND)
286 ENDIF(WANT_SF2)
288 # check for pthreads
289 IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
290         FIND_PACKAGE(Threads)
291 ENDIF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
293 # check for WINE
294 IF(WANT_VST)
295         INCLUDE(CheckLibraryExists)
296         INCLUDE(CheckIncludeFileCXX)
297         SET(CMAKE_REQUIRED_FLAGS_ORIG ${CMAKE_REQUIRED_FLAGS})
298         SET(CMAKE_REQUIRED_INCLUDES_ORIG ${CMAKE_REQUIRED_INCLUDES})
299         SET(CMAKE_CXX_COMPILER_ORIG ${CMAKE_CXX_COMPILER})
300         IF(LMMS_HOST_X86_64)
301                 SET(CMAKE_REQUIRED_FLAGS -m32 ${CMAKE_REQUIRED_FLAGS})
302         ENDIF(LMMS_HOST_X86_64)
303         CHECK_LIBRARY_EXISTS(wine wine_init "" HAVE_LIBWINE)
304         SET(CMAKE_CXX_COMPILER /usr/bin/wineg++)
305         SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include/wine/windows /usr/include/wine/windows)
306         CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
307         SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_ORIG})
308         SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_ORIG})
309         SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_ORIG})
310         IF(HAVE_LIBWINE AND HAVE_WINDOWS_H)
311                 SET(LMMS_SUPPORT_VST TRUE)
312                 SET(STATUS_VST "OK")
313         ELSE(HAVE_LIBWINE AND HAVE_WINDOWS_H)
314                 SET(STATUS_VST "not found, please install (lib)wine-dev (or similiar) - 64 bit systems additionally need gcc-multilib and g++-multilib")
315         ENDIF(HAVE_LIBWINE AND HAVE_WINDOWS_H)
316 ENDIF(WANT_VST)
317 IF(LMMS_BUILD_WIN32)
318         SET(LMMS_SUPPORT_VST TRUE)
319         SET(STATUS_VST "OK")
320 ENDIF(LMMS_BUILD_WIN32)
323 # check for libsamplerate
324 IF(WANT_SYSTEM_SR)
325         PKG_CHECK_MODULES(SAMPLERATE samplerate>=0.1.7)
326         IF(SAMPLERATE_FOUND)
327                 SET(LMMS_HAVE_SAMPLERATE TRUE)
328         ENDIF(SAMPLERATE_FOUND)
329 ENDIF(WANT_SYSTEM_SR)
330 IF(NOT LMMS_HAVE_SAMPLERATE)
331         INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate)
332         SET(CMAKE_CROSSCOMPILING_ORIG "${CMAKE_CROSSCOMPILING}")
333         SET(CMAKE_CROSSCOMPILING "")
334         INCLUDE(ChecksForLibSamplerate)
335         SET(LIBSAMPLERATE_SOURCES 
336                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/samplerate.c
337                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/samplerate.h
338                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_sinc.c
339                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/high_qual_coeffs.h
340                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/mid_qual_coeffs.h
341                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/fastest_coeffs.h
342                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/common.h
343                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_config.h
344                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/float_cast.h
345                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_zoh.c
346                 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_linear.c)
347         SET(CMAKE_CROSSCOMPILING "${CMAKE_CROSSCOMPILING_ORIG}")
348 ENDIF(NOT LMMS_HAVE_SAMPLERATE)
351 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmmsconfig.h.in ${CMAKE_BINARY_DIR}/lmmsconfig.h)
352 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmmsversion.h.in ${CMAKE_BINARY_DIR}/lmmsversion.h)
353 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmms.rc.in ${CMAKE_BINARY_DIR}/lmms.rc)
354 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc.in ${CMAKE_BINARY_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc)
356 # set compiler flags
357 #SET(CMAKE_BUILD_TYPE relwithdebug)
358 SET(CMAKE_C_FLAGS "-O2 -g -Wall ${CMAKE_C_FLAGS}")
359 SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions -Wall ${CMAKE_CXX_FLAGS}")
360 #SET(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS}")
361 #SET(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CXX_FLAGS}")
364 # people simply updating SVN will still have this and mess up build with it
365 FILE(REMOVE include/lmmsconfig.h)
367 FILE(GLOB lmms_INCLUDES ${CMAKE_SOURCE_DIR}/include/*.h)
368 FILE(GLOB lmms_UI ${CMAKE_SOURCE_DIR}/src/gui/dialogs/*.ui ${CMAKE_SOURCE_DIR}/src/gui/Forms/*.ui)
369 FILE(GLOB_RECURSE lmms_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp)
371 SET(lmms_MOC ${lmms_INCLUDES})
373 SET(lmms_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/COPYING)
375 QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw)
376 QT4_WRAP_UI(lmms_UI_out ${lmms_UI})
379 # embedded resources stuff
380 IF(WIN32 OR WIN64)
381         # compile buildtools native
382         SET(BIN2RES_CPP ${CMAKE_SOURCE_DIR}/buildtools/bin2res.cpp)
383         SET(BIN2RES ${CMAKE_BINARY_DIR}/bin2res)
384         ADD_CUSTOM_COMMAND(OUTPUT ${BIN2RES} COMMAND g++ ARGS ${BIN2RES_CPP} -o ${BIN2RES} DEPENDS ${BIN2RES_CPP})
385 ELSE(WIN32 OR WIN64)
386         ADD_EXECUTABLE(bin2res buildtools/bin2res.cpp)
387         GET_TARGET_PROPERTY(BIN2RES bin2res LOCATION)
388 ENDIF(WIN32 OR WIN64)
390 SET(LMMS_ER_H ${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h)
392 # we somehow have to make LMMS-binary depend on MOC-files
393 ADD_FILE_DEPENDENCIES(${CMAKE_BINARY_DIR}/lmmsconfig.h ${lmms_MOC_out})
395 ADD_CUSTOM_COMMAND(OUTPUT ${LMMS_ER_H} COMMAND ${BIN2RES} ARGS ${lmms_EMBEDDED_RESOURCES} > ${LMMS_ER_H} DEPENDS ${BIN2RES})
397 IF(WIN32)
398         SET(WINRC "${CMAKE_BINARY_DIR}/lmmsrc.obj")
399         ADD_CUSTOM_COMMAND(OUTPUT ${WINRC}
400                                 COMMAND ${WINDRES}
401                                         -I${CMAKE_SOURCE_DIR}
402                                         -o${CMAKE_BINARY_DIR}/lmmsrc.obj
403                                         -i${CMAKE_BINARY_DIR}/lmms.rc
404                                 DEPENDS ${CMAKE_BINARY_DIR}/lmms.rc)
405         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
406 ELSE(WIN32)
407         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
408 ENDIF(WIN32)
412 # make sub-directories
413 ADD_SUBDIRECTORY(plugins)
414 ADD_SUBDIRECTORY(data)
418 # build LMMS-binary
420 IF(LMMS_BUILD_WIN32)
421         SET(EXTRA_LIBRARIES "-lwinmm")
422 ENDIF()
424 ADD_DEFINITIONS(-D'LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/"' -D'PLUGIN_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/lmms/"' ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS})
426 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${SDL_INCLUDE_DIR} ${PORTAUDIO_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR} ${JACK_INCLUDE_DIRS} ${OGGVORBIS_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS})
427 LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${ASOUND_LIBRARY_DIR} ${JACK_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS})
428 LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${EXTRA_LIBRARIES})
430 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/lmms.1.gz COMMAND gzip -c ${CMAKE_SOURCE_DIR}/lmms.1 > ${CMAKE_BINARY_DIR}/lmms.1.gz DEPENDS ${CMAKE_SOURCE_DIR}/lmms.1 COMMENT "Generating lmms.1.gz")
432 ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${lmms_INCLUDES} ${LIBSAMPLERATE_SOURCES} ${LMMS_ER_H} ${lmms_UI_out} lmmsconfig.h lmmsversion.h ${WINRC} ${CMAKE_BINARY_DIR}/lmms.1.gz)
434 IF(LMMS_BUILD_WIN32)
436         SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows")
437         ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND ${STRIP} ${CMAKE_BINARY_DIR}/lmms.exe)
439         INSTALL(TARGETS lmms RUNTIME DESTINATION .)
440         INSTALL(FILES
441                                         ${MINGW_PREFIX}/bin/QtCore4.dll
442                                         ${MINGW_PREFIX}/bin/QtGui4.dll
443                                         ${MINGW_PREFIX}/bin/QtXml4.dll
444                                         ${MINGW_PREFIX}/bin/libsndfile-1.dll
445                                         ${MINGW_PREFIX}/bin/libvorbis-0.dll
446                                         ${MINGW_PREFIX}/bin/libvorbisenc-2.dll
447                                         ${MINGW_PREFIX}/bin/libvorbisfile-3.dll
448                                         ${MINGW_PREFIX}/bin/libogg-0.dll
449                                         ${MINGW_PREFIX}/bin/libfluidsynth.dll
450                                         ${MINGW_PREFIX}/bin/libfftw3f-3.dll
451                                         ${MINGW_PREFIX}/bin/libFLAC-8.dll
452                                         ${MINGW_PREFIX}/bin/libportaudio-2.dll
453                                         ${MINGW_PREFIX}/bin/SDL.dll
454                                         ${MINGW_PREFIX}/bin/libglib-2.0-0.dll
455                                         ${MINGW_PREFIX}/bin/libgthread-2.0-0.dll
456                                         ${MINGW_PREFIX}/bin/zlib1.dll
457                                 DESTINATION .)
459 ELSE(LMMS_BUILD_WIN32)
460         IF(NOT LMMS_BUILD_APPLE)
461                 SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E")
462         ENDIF(NOT LMMS_BUILD_APPLE)
464         INSTALL(TARGETS lmms RUNTIME DESTINATION bin)
465         INSTALL(FILES ${CMAKE_BINARY_DIR}/lmms.1.gz DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
467 ENDIF(LMMS_BUILD_WIN32)
470 # rules for building localizations
472 FILE(GLOB lmms_LOCALES data/locale/*.ts)
473 SET(ts_targets "")
474 SET(qm_targets "")
475 FOREACH(_ts_file ${lmms_LOCALES})
476         STRING(REPLACE "${CMAKE_SOURCE_DIR}/data/locale/" "" _ts_target "${_ts_file}")
477         STRING(REPLACE ".ts" ".qm" _qm_file "${_ts_file}")
478         STRING(REPLACE ".ts" ".qm" _qm_target "${_ts_target}")
479         ADD_CUSTOM_TARGET(${_ts_target} COMMAND ${QT_LUPDATE_EXECUTABLE} -locations none -no-obsolete ${lmms_SOURCES} ${lmms_UI} `find ${CMAKE_SOURCE_DIR}/plugins/ -type f -name '*.cpp'` -ts ${_ts_file})
480         ADD_CUSTOM_TARGET(${_qm_target} COMMAND ${QT_LRELEASE_EXECUTABLE} ${_ts_file} -qm ${_qm_file})
481         LIST(APPEND ts_targets "${_ts_target}")
482         LIST(APPEND qm_targets "${_qm_target}")
483 ENDFOREACH(_ts_file ${lmms_LOCALES})
485 ADD_CUSTOM_TARGET(update-locales)
486 FOREACH(_item ${ts_targets})
487         ADD_DEPENDENCIES(update-locales ${_item})
488 ENDFOREACH(_item ${ts_targets})
490 ADD_CUSTOM_TARGET(finalize-locales)
491 FOREACH(_item ${qm_targets})
492         ADD_DEPENDENCIES(finalize-locales ${_item})
493 ENDFOREACH(_item ${qm_targets})
496 # install headers
498 IF(LMMS_BUILD_LINUX)
499 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/)
500 IF(NOT LMMS_HAVE_SAMPLERATE)
501 INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/samplerate.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lmms/)
502 ENDIF(NOT LMMS_HAVE_SAMPLERATE)
503 ENDIF(LMMS_BUILD_LINUX)
505 # package ZynAddSubFX into win32 build
506 IF(LMMS_BUILD_WIN32)
507 IF(EXISTS ${CMAKE_SOURCE_DIR}/extras)
508 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extras/data/presets)
509 FILE(GLOB ZASF_BINARIES ${CMAKE_SOURCE_DIR}/extras/plugins/zynaddsubfx/zynaddsubfx.dll ${CMAKE_SOURCE_DIR}/extras/plugins/zynaddsubfx/remote_zynaddsubfx.exe)
510 INSTALL(FILES ${ZASF_BINARIES} DESTINATION ${PLUGIN_DIR})
511 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/extras)
512 ENDIF(LMMS_BUILD_WIN32)
515 # add distclean-target
517 ADD_CUSTOM_TARGET(distclean
518                         COMMAND make clean
519                         COMMAND rm -rf `find -name cmake_install.cmake` `find -name Makefile` `find -type d -name CMakeFiles` CMakeCache.txt lmmsconfig.h lmms.1.gz)
522 # add tarball-target
524 SET(TMP "lmms-${VERSION}")
525 ADD_CUSTOM_TARGET(dist
526                         COMMAND make clean
527                         COMMAND rm -rf ${TMP}
528                         COMMAND mkdir -p ${TMP}
529                         COMMAND cp AUTHORS build_mingw32 build_mingw64 CMakeLists.txt configure COPYING INSTALL lmms.1 lmms.rc.in lmms.spec.in lmmsconfig.h.in lmmsversion.h.in README TODO ${TMP}
530                         COMMAND cp -r buildtools cmake data include plugins src ${TMP}
531                         COMMAND rm -rf `find ${TMP} -type d -name ".svn"`  `find ${TMP} -name cmake_install.cmake` `find ${TMP} -name Makefile` `find ${TMP} -type d -name CMakeFiles` ${TMP}/CMakeCache.txt
532                         COMMAND tar cjf lmms-${VERSION}.tar.bz2 ${TMP}
533                         COMMAND rm -rf ${TMP})
536 # add win32-pkg-target (deprecated - use "package" target instead)
538 ADD_CUSTOM_TARGET(win32-pkg
539                         COMMAND mkdir -p tmp/lmms/data
540                         COMMAND mkdir -p tmp/lmms/plugins/ladspa/
541                         COMMAND cp lmms.exe tmp/lmms
542                         COMMAND find plugins/ -maxdepth 2 -name '*.dll'  -exec cp '{}' tmp/lmms/plugins/ "';'"
543                         COMMAND rm tmp/lmms/plugins/caps.dll
544                         COMMAND rm tmp/lmms/plugins/tap*.dll
545                         COMMAND cp plugins/ladspa_effect/caps/caps.dll tmp/lmms/plugins/ladspa/
546                         COMMAND cp plugins/ladspa_effect/tap/tap*.dll tmp/lmms/plugins/ladspa/
547                         COMMAND cd data && make DESTDIR=${CMAKE_BINARY_DIR}/tmp/lmms/ install
548                         COMMAND mv tmp/lmms/opt/mingw32/share/lmms/* tmp/lmms/data/ && rm -rf tmp/lmms/opt
549                         COMMAND cp /opt/mingw32/bin/QtCore4.dll tmp/lmms
550                         COMMAND cp /opt/mingw32/bin/QtGui4.dll tmp/lmms
551                         COMMAND cp /opt/mingw32/bin/QtXml4.dll tmp/lmms
552                         COMMAND cp /opt/mingw32/bin/libz.dll tmp/lmms
553                         COMMAND cp /opt/mingw32/bin/libsndfile-1.dll tmp/lmms
554                         COMMAND cp /opt/mingw32/bin/libvorbis*.dll tmp/lmms
555                         COMMAND cp /opt/mingw32/bin/libogg-0.dll tmp/lmms
556                         COMMAND cp /opt/mingw32/bin/libfluidsynth-1.dll tmp/lmms
557                         COMMAND cp /opt/mingw32/bin/libfftw3f-3.dll tmp/lmms
558                         COMMAND cp /opt/mingw32/bin/SDL.dll tmp/lmms
559                         COMMAND cp /opt/mingw32/i586-mingw32/bin/mingwm10.dll tmp/lmms
560                         COMMAND cp -L ${CMAKE_SOURCE_DIR}/COPYING tmp/lmms/LICENSE.TXT
561                         COMMAND cp -L ${CMAKE_SOURCE_DIR}/README tmp/lmms/README.TXT
562                         COMMAND ${STRIP} tmp/lmms/lmms.exe tmp/lmms/plugins/*.dll tmp/lmms/plugins/ladspa/*.dll
563                         COMMAND mv tmp/lmms tmp/lmms-${VERSION}
564                         COMMAND cd tmp && zip -r -9 ../lmms-${VERSION}-bin-win32.zip lmms-${VERSION}/*
565                         COMMAND rm -rf tmp
569 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LMMS_ER_H} ${lmms_MOC_out} ${lmms_UI_out} lmmsconfig.h lmms.1.gz")
573 # display configuration information
576 MESSAGE("\n"
577 "Installation Summary\n"
578 "--------------------\n"
579 "* Install Directory           : ${CMAKE_INSTALL_PREFIX}\n"
580 #"* Build type                  : ${CMAKE_BUILD_TYPE}\n"
581 "* Use system's libsamplerate  : ${LMMS_HAVE_SAMPLERATE}\n"
584 MESSAGE(
585 "Supported audio interfaces\n"
586 "--------------------------\n"
587 "* ALSA                        : ${STATUS_ALSA}\n"
588 "* JACK                        : ${STATUS_JACK}\n"
589 "* OSS                         : ${STATUS_OSS}\n"
590 "* PortAudio                   : ${STATUS_PORTAUDIO}\n"
591 "* PulseAudio                  : ${STATUS_PULSEAUDIO}\n"
592 "* SDL                         : ${STATUS_SDL}\n"
595 MESSAGE(
596 "Supported MIDI interfaces\n"
597 "-------------------------\n"
598 "* ALSA                        : ${STATUS_ALSA}\n"
599 "* OSS                         : ${STATUS_OSS}\n"
600 "* WinMM                       : ${STATUS_WINMM}\n"
603 MESSAGE(
604 "Supported file formats for project export\n"
605 "-----------------------------------------\n"
606 "* WAVE                        : OK\n"
607 "* OGG/VORBIS                  : ${STATUS_OGGVORBIS}\n"
610 MESSAGE(
611 "Optional plugins\n"
612 "----------------\n"
613 "* SoundFont2 player           : ${STATUS_FLUIDSYNTH}\n"
614 "* Stk Mallets                 : ${STATUS_STK}\n"
615 "* VST-instrument hoster       : ${STATUS_VST}\n"
616 "* VST-effect hoster           : ${STATUS_VST}\n"
617 "* SpectrumAnalyzer            : ${STATUS_FFTW3F}\n"
618 "* CALF LADSPA plugins         : ${STATUS_CALF}\n"
619 "* CAPS LADSPA plugins         : ${STATUS_CAPS}\n"
620 "* CMT LADSPA plugins          : ${STATUS_CMT}\n"
621 "* TAP LADSPA plugins          : ${STATUS_TAP}\n"
622 "* SWH LADSPA plugins          : ${STATUS_SWH}\n"
623 "* ZynAddSubFX                 : ${STATUS_FFTW3F}\n"
626 MESSAGE(
627 "\n"
628 "-----------------------------------------------------------------\n"
629 "IMPORTANT:\n"
630 "after installing missing packages, remove CMakeCache.txt before\n"
631 "running cmake again!\n"
632 "-----------------------------------------------------------------\n"
633 "\n\n")
635 INCLUDE(InstallRequiredSystemLibraries)
636 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Linux MultiMedia Studio - easy music production for everyone!")
637 SET(CPACK_PACKAGE_VENDOR "LMMS Developers")
638 IF(LMMS_BUILD_APPLE)
639 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/README ${CMAKE_BINARY_DIR}/README.txt COPYONLY)
640 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/COPYING ${CMAKE_BINARY_DIR}/COPYING.txt COPYONLY)
641 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_BINARY_DIR}/README.txt")
642 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.txt")
643 ELSE(LMMS_BUILD_APPLE)
644 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
645 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
646 ENDIF(LMMS_BUILD_APPLE)
648 SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
649 SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
650 SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
651 IF(VERSION_SUFFIX)
652         SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}-${VERSION_SUFFIX}")
653 ENDIF(VERSION_SUFFIX)
654 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LMMS")
655 IF(WIN32)
656 SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/data/nsis_branding.bmp")
657 SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data/lmms.ico")
658 SET(CPACK_NSIS_INSTALLED_ICON_NAME "lmms.exe")
659 SET(CPACK_NSIS_DISPLAY_NAME "LMMS ${VERSION}")
660 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lmms.sourceforge.net")
661 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lmms.sourceforge.net")
662 SET(CPACK_NSIS_CONTACT "lmms-devel@lists.sourceforge.net")
663 SET(CPACK_PACKAGE_EXECUTABLES "lmms.exe;Linux MultiMedia Studio")
664 SET(CPACK_NSIS_MENU_LINKS "lmms.exe;Linux MultiMedia Studio")
665 SET(CPACK_NSIS_DEFINES "!include ${CMAKE_SOURCE_DIR}/cmake/nsis/FileAssociation.nsh")
666 SET(CPACK_PACKAGE_FILE_NAME "lmms-${VERSION}-win32")
667 SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
668   \\\${registerExtension} \\\"$INSTDIR\\\\lmms.exe\\\" \\\".mmp\\\" \\\"LMMS Project\\\"
669   \\\${registerExtension} \\\"$INSTDIR\\\\lmms.exe\\\" \\\".mmpz\\\" \\\"LMMS Project (compressed)\\\"
670   ")
671 SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
672   \\\${unregisterExtension} \\\".mmp\\\" \\\"LMMS Project\\\"
673   \\\${unregisterExtension} \\\".mmpz\\\" \\\"LMMS Project (compressed)\\\"
674   ")
675 ELSE(WIN32)
676 SET(CPACK_STRIP_FILES "bin/lmms;${PLUGIN_DIR}/*.so")
677 SET(CPACK_PACKAGE_EXECUTABLES "lmms" "LMMS binary")
678 ENDIF(WIN32)
680 IF(WIN64)
681         SET(CPACK_PACKAGE_FILE_NAME "lmms-${VERSION}-win64")
682         SET(CPACK_NSIS_DEFINES "${CPACK_NSIS_DEFINES}
683                 InstallDir \\\"\\\$PROGRAMFILES64\\\\${CPACK_PACKAGE_INSTALL_DIRECTORY}\\\"")
684 ENDIF(WIN64)
686 SET(MACOSX_BUNDLE_ICON_FILE "${CMAKE_SOURCE_DIR}/data/themes/default/icon.png")
687 SET(MACOSX_BUNDLE_GUI_IDENTIFIER "LMMS")
688 SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}")
689 SET(MACOSX_BUNDLE_BUNDLE_NAME "Linux MultiMedia Studio")
690 SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}")
691 SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}")
692 SET(MACOSX_BUNDLE_COPYRIGHT "Tobias Doerffel, 2008-2010")
694 SET(CPACK_SOURCE_GENERATOR "TBZ2")
695 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "lmms-${VERSION}")
696 INCLUDE(CPack)