1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
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(CheckLibraryExists)
15 INCLUDE(FindPkgConfig)
17 SET(VERSION_MAJOR "0")
18 SET(VERSION_MINOR "4")
19 SET(VERSION_PATCH "90")
20 #SET(VERSION_SUFFIX "")
21 IF(NOT VERSION_SUFFIX)
22 IF(EXISTS ${CMAKE_SOURCE_DIR}/.svn)
23 INCLUDE(FindSubversion)
25 SET(ORIG_LANG "$ENV{LANG}")
27 EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
28 COMMAND ${Subversion_SVN_EXECUTABLE} info
29 COMMAND grep "^Revision:"
30 OUTPUT_VARIABLE SVN_REV)
31 SET(ENV{LANG} "${ORIG_LANG}")
32 STRING(REGEX MATCH "[0-9]+" VERSION_SUFFIX "${SVN_REV}")
33 ENDIF(Subversion_FOUND)
34 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/.svn)
35 ENDIF(NOT VERSION_SUFFIX)
37 SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
39 SET(VERSION "${VERSION}-${VERSION_SUFFIX}")
43 INCLUDE(DetectMachine)
46 OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON)
47 OPTION(WANT_CALF "Include CALF LADSPA plugins" ON)
48 OPTION(WANT_CAPS "Include C* Audio Plugin Suite (LADSPA plugins)" ON)
49 OPTION(WANT_CMT "Include Computer Music Toolkit LADSPA plugins" ON)
50 OPTION(WANT_JACK "Include JACK (Jack Audio Connection Kit) support" ON)
51 OPTION(WANT_LV2 "Include LV2 support" ON)
52 OPTION(WANT_OGGVORBIS "Include OGG/Vorbis support" ON)
53 OPTION(WANT_PULSEAUDIO "Include PulseAudio support" ON)
54 OPTION(WANT_PORTAUDIO "Include PortAudio support" ON)
55 OPTION(WANT_SDL "Include SDL (Simple DirectMedia Layer) support" ON)
56 OPTION(WANT_SF2 "Include SoundFont2 player plugin" ON)
57 OPTION(WANT_STK "Include Stk (Synthesis Toolkit) support" ON)
58 OPTION(WANT_SYSTEM_SR "Use system's libsamplerate" ON)
59 OPTION(WANT_SWH "Include Steve Harris's LADSPA plugins" ON)
60 OPTION(WANT_TAP "Include Tom's Audio Processing LADSPA plugins" ON)
61 OPTION(WANT_VST "Include VST support" ON)
62 OPTION(WANT_VST_NOWINE "Include partial VST support (without wine)" OFF)
63 OPTION(WANT_WINMM "Include WinMM MIDI support" OFF)
64 OPTION(WANT_ZIP "Include zip support" ON)
65 OPTION(WANT_FLAC "Include flac support" ON)
70 SET(WANT_PULSEAUDIO OFF)
71 SET(WANT_SYSTEM_SR OFF)
73 SET(LMMS_HAVE_WINMM TRUE)
74 SET(STATUS_ALSA "<not supported on this platform>")
75 SET(STATUS_JACK "<not supported on this platform>")
76 SET(STATUS_PULSEAUDIO "<not supported on this platform>")
77 SET(STATUS_WINMM "OK")
78 ELSE(LMMS_BUILD_WIN32)
79 SET(STATUS_WINMM "<not supported on this platform>")
80 ENDIF(LMMS_BUILD_WIN32)
84 CHECK_INCLUDE_FILES(stdint.h LMMS_HAVE_STDINT_H)
85 CHECK_INCLUDE_FILES(stdbool.h LMMS_HAVE_STDBOOL_H)
86 CHECK_INCLUDE_FILES(stdlib.h LMMS_HAVE_STDLIB_H)
87 CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H)
88 CHECK_INCLUDE_FILES(semaphore.h LMMS_HAVE_SEMAPHORE_H)
89 CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H)
90 CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H)
91 CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
92 CHECK_INCLUDE_FILES(sys/shm.h LMMS_HAVE_SYS_SHM_H)
93 CHECK_INCLUDE_FILES(sys/time.h LMMS_HAVE_SYS_TIME_H)
94 CHECK_INCLUDE_FILES(sys/wait.h LMMS_HAVE_SYS_WAIT_H)
95 CHECK_INCLUDE_FILES(sys/select.h LMMS_HAVE_SYS_SELECT_H)
96 CHECK_INCLUDE_FILES(stdarg.h LMMS_HAVE_STDARG_H)
97 CHECK_INCLUDE_FILES(signal.h LMMS_HAVE_SIGNAL_H)
98 CHECK_INCLUDE_FILES(sched.h LMMS_HAVE_SCHED_H)
99 CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
100 CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
101 CHECK_INCLUDE_FILES(fcntl.h LMMS_HAVE_FCNTL_H)
102 CHECK_INCLUDE_FILES(sys/ioctl.h LMMS_HAVE_SYS_IOCTL_H)
103 CHECK_INCLUDE_FILES(ctype.h LMMS_HAVE_CTYPE_H)
104 CHECK_INCLUDE_FILES(string.h LMMS_HAVE_STRING_H)
105 CHECK_INCLUDE_FILES(process.h LMMS_HAVE_PROCESS_H)
106 CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)
109 SET(QT_MIN_VERSION "4.6.0" COMPONENTS QtCore QtGui QtXml QtNetwork)
110 FIND_PACKAGE(Qt4 REQUIRED)
112 SET(QT_USE_QTNETWORK 1)
113 EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_TRANSLATIONS" OUTPUT_VARIABLE QT_TRANSLATIONS_DIR)
114 IF(EXISTS "${QT_TRANSLATIONS_DIR}")
115 MESSAGE("-- Found Qt translations in ${QT_TRANSLATIONS_DIR}")
116 ADD_DEFINITIONS(-D'QT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}"')
117 ENDIF(EXISTS "${QT_TRANSLATIONS_DIR}")
119 STRING(REPLACE "-DQT_DLL" "" QT_DEFINITIONS "${QT_DEFINITIONS}")
121 INCLUDE(${QT_USE_FILE})
123 # check for libsndfile
124 PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.11)
125 IF(NOT SNDFILE_FOUND)
126 MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.11 - please install, remove CMakeCache.txt and try again!")
127 ENDIF(NOT SNDFILE_FOUND)
130 SET(LMMS_HAVE_CALF TRUE)
131 SET(STATUS_CALF "OK")
133 SET(STATUS_CALF "not built as requested")
137 SET(LMMS_HAVE_CAPS TRUE)
138 SET(STATUS_CAPS "OK")
140 SET(STATUS_CAPS "not built as requested")
144 SET(LMMS_HAVE_CMT TRUE)
147 SET(STATUS_CMT "not built as requested")
151 SET(LMMS_HAVE_SWH TRUE)
154 SET(STATUS_SWH "not built as requested")
158 SET(LMMS_HAVE_TAP TRUE)
161 SET(STATUS_TAP "not built as requested")
167 SET(SDL_BUILDING_LIBRARY TRUE)
170 SET(LMMS_HAVE_SDL TRUE)
173 SET(STATUS_SDL "not found, please install libsdl1.2-dev (or similiar) "
174 "if you require SDL support")
177 IF(NOT LMMS_HAVE_SDL)
178 SET(SDL_INCLUDE_DIR "")
179 ELSE(NOT LMMS_HAVE_SDL)
180 IF(NOT SDL_INCLUDE_DIR)
181 SET(SDL_INCLUDE_DIR ${CMAKE_FIND_ROOT_PATH}/include)
182 ENDIF(NOT SDL_INCLUDE_DIR)
183 ENDIF(NOT LMMS_HAVE_SDL)
189 SET(LMMS_HAVE_ZIP TRUE)
192 SET(STATUS_ZIP "not found, install libzip-dev (or similar) "
193 "if you want to import FL .zip files")
197 # check for libflac++
201 SET(LMMS_HAVE_FLAC TRUE)
202 SET(STATUS_FLAC "OK")
204 SET(STATUS_FLAC "not found, install libflac++-dev (or similar) "
205 "if you want flac as an export format")
213 SET(LMMS_HAVE_STK TRUE)
216 SET(STK_INCLUDE_DIR "")
217 SET(STATUS_STK "not found, please install libstk0-dev (or similiar) "
218 "if you require the Mallets instrument")
223 # check for PortAudio
225 FIND_PACKAGE(Portaudio)
227 SET(LMMS_HAVE_PORTAUDIO TRUE)
228 SET(STATUS_PORTAUDIO "OK")
229 ELSE(PORTAUDIO_FOUND)
230 SET(STATUS_PORTAUDIO "not found, please install portaudio19-dev (or similiar, version >= 1.9) "
231 "if you require PortAudio support")
232 ENDIF(PORTAUDIO_FOUND)
233 ENDIF(WANT_PORTAUDIO)
236 # check for PulseAudio
238 FIND_PACKAGE(PulseAudio)
240 SET(LMMS_HAVE_PULSEAUDIO TRUE)
241 SET(STATUS_PULSEAUDIO "OK")
242 ELSE(PULSEAUDIO_FOUND)
243 SET(STATUS_PULSEAUDIO "not found, please install libpulse-dev (or similiar) "
244 "if you require PulseAudio support")
245 ENDIF(PULSEAUDIO_FOUND)
246 ENDIF(WANT_PULSEAUDIO)
247 IF(NOT LMMS_HAVE_PULSEAUDIO)
248 SET(PULSEAUDIO_INCLUDE_DIR "")
249 SET(PULSEAUDIO_LIBRARIES "")
250 ENDIF(NOT LMMS_HAVE_PULSEAUDIO)
253 # check for OGG/Vorbis-libraries
255 FIND_PACKAGE(OggVorbis)
257 SET(LMMS_HAVE_OGGVORBIS TRUE)
258 SET(STATUS_OGGVORBIS "OK")
259 ELSE(OGGVORBIS_FOUND)
260 SET(STATUS_OGGVORBIS "not found, libogg-dev and libvorbis-dev (or similiar) "
261 "is highly recommended")
262 ENDIF(OGGVORBIS_FOUND)
263 ENDIF(WANT_OGGVORBIS)
266 # check whether to enable OSS-support
267 IF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
268 SET(LMMS_HAVE_OSS TRUE)
270 ELSE(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
271 SET(STATUS_OSS "<not found or not supported on this platform>")
272 ENDIF(LMMS_HAVE_SOUNDCARD_H OR LMMS_HAVE_SYS_SOUNDCARD_H)
279 SET(LMMS_HAVE_ALSA TRUE)
280 SET(STATUS_ALSA "OK")
282 SET(STATUS_ALSA "not found, please install libasound2-dev (or similiar) "
283 "if you require ALSA support")
286 IF(NOT LMMS_HAVE_ALSA)
287 SET(ASOUND_LIBRARY "")
288 ENDIF(NOT LMMS_HAVE_ALSA)
291 IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
292 FIND_PACKAGE(Threads)
293 ENDIF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
297 PKG_CHECK_MODULES(JACK jack>=0.77)
299 SET(LMMS_HAVE_JACK TRUE)
300 SET(STATUS_JACK "OK")
302 SET(STATUS_JACK "not found, please install libjack0.100.0-dev (or similiar) "
303 "if you require JACK support")
308 # check for FFTW3F-library
309 PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0)
312 # check for Fluidsynth
314 PKG_CHECK_MODULES(FLUIDSYNTH fluidsynth>=1.0.7)
316 SET(LMMS_HAVE_FLUIDSYNTH TRUE)
317 SET(STATUS_FLUIDSYNTH "OK")
318 ELSE(FLUIDSYNTH_FOUND)
319 SET(STATUS_FLUIDSYNTH "not found, libfluidsynth-dev (or similiar)"
320 "is highly recommended")
321 ENDIF(FLUIDSYNTH_FOUND)
324 # check for LV2 (this has an implicit dependency on RDF as far as I can tell)
326 CHECK_INCLUDE_FILES(lv2.h LMMS_HAVE_LV2CORE)
327 # compatibility for slv2 <= 0.6.2
328 CHECK_INCLUDE_FILES(slv2/scalepoints.h LMMS_HAVE_SLV2_SCALEPOINTS_H)
330 CHECK_LIBRARY_EXISTS(slv2 slv2_world_new "" LMMS_HAVE_SLV2)
332 # MESSAGE("SLV2 Exists : '${LMMS_HAVE_SLV2}'")
333 # MESSAGE("SLV2 Library : '${SLV2_LIBRARY}'") #RIGHT
334 # MESSAGE("SLV2 Libraries : '${SLV2_LIBRARIES}'") # WRONG
336 CHECK_LIBRARY_EXISTS(rdf librdf_new_world "" LMMS_HAVE_RDF)
338 ### TODO : mdda : Install requires :
339 # Fedora CCRMA : Want "lv2core"
340 # Fedora CCRMA : Want "slv2"
344 IF(NOT LMMS_HAVE_LV2CORE)
345 SET(STATUS_LV2 "LV2 devel packages not found : need lv2core(-devel)")
346 ENDIF(NOT LMMS_HAVE_LV2CORE)
348 IF(NOT LMMS_HAVE_SLV2)
349 SET(STATUS_LV2 "LV2 (Host) devel packages not found : need libslv2-dev, slv2-devel or similiar")
350 ENDIF(NOT LMMS_HAVE_SLV2)
352 IF(NOT LMMS_HAVE_RDF)
353 SET(STATUS_LV2 "LV2 (RDF) devel packages not found : need librdf0-dev, redland-devel or similiar")
354 ENDIF(NOT LMMS_HAVE_RDF)
356 IF("${STATUS_LV2}" STREQUAL "OK")
357 FIND_LIBRARY(SLV2_LIBRARY NAMES slv2 PATH /usr/lib /usr/local/lib)
358 FIND_LIBRARY(RDF_LIBRARY NAMES rdf PATH /usr/lib /usr/local/lib)
359 SET(LMMS_SUPPORT_LV2 TRUE)
360 SET(LMMS_HAVE_LV2 TRUE)
361 ENDIF("${STATUS_LV2}" STREQUAL "OK")
367 INCLUDE(CheckIncludeFileCXX)
368 SET(CMAKE_REQUIRED_FLAGS_ORIG ${CMAKE_REQUIRED_FLAGS})
369 SET(CMAKE_REQUIRED_INCLUDES_ORIG ${CMAKE_REQUIRED_INCLUDES})
370 SET(CMAKE_CXX_COMPILER_ORIG ${CMAKE_CXX_COMPILER})
372 SET(CMAKE_REQUIRED_FLAGS -m32 ${CMAKE_REQUIRED_FLAGS})
373 ENDIF(LMMS_HOST_X86_64)
374 CHECK_LIBRARY_EXISTS(wine wine_init "" HAVE_LIBWINE)
375 SET(CMAKE_CXX_COMPILER /usr/bin/wineg++)
376 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include/wine/windows /usr/include/wine/windows)
377 CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
378 SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_ORIG})
379 SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_ORIG})
380 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_ORIG})
381 IF(HAVE_LIBWINE AND HAVE_WINDOWS_H)
382 SET(LMMS_SUPPORT_VST TRUE)
384 ELSE(HAVE_LIBWINE AND HAVE_WINDOWS_H)
385 SET(STATUS_VST "not found, please install (lib)wine-dev (or similiar) - 64 bit systems additionally need gcc-multilib and g++-multilib")
386 ENDIF(HAVE_LIBWINE AND HAVE_WINDOWS_H)
389 SET(LMMS_SUPPORT_VST TRUE)
391 ENDIF(LMMS_BUILD_WIN32)
394 # check for libsamplerate
396 PKG_CHECK_MODULES(SAMPLERATE samplerate>=0.1.7)
398 SET(LMMS_HAVE_SAMPLERATE TRUE)
399 ENDIF(SAMPLERATE_FOUND)
400 ENDIF(WANT_SYSTEM_SR)
401 IF(NOT LMMS_HAVE_SAMPLERATE)
402 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate)
403 SET(CMAKE_CROSSCOMPILING_ORIG "${CMAKE_CROSSCOMPILING}")
404 SET(CMAKE_CROSSCOMPILING "")
405 INCLUDE(ChecksForLibSamplerate)
406 SET(LIBSAMPLERATE_SOURCES
407 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/samplerate.c
408 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/samplerate.h
409 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_sinc.c
410 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/high_qual_coeffs.h
411 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/mid_qual_coeffs.h
412 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/fastest_coeffs.h
413 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/common.h
414 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_config.h
415 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/float_cast.h
416 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_zoh.c
417 ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/src_linear.c)
418 SET(CMAKE_CROSSCOMPILING "${CMAKE_CROSSCOMPILING_ORIG}")
419 ENDIF(NOT LMMS_HAVE_SAMPLERATE)
422 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmmsconfig.h.in ${CMAKE_BINARY_DIR}/lmmsconfig.h)
423 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmmsversion.h.in ${CMAKE_BINARY_DIR}/lmmsversion.h)
424 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmms.rc.in ${CMAKE_BINARY_DIR}/lmms.rc)
425 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc.in ${CMAKE_BINARY_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc)
428 #SET(CMAKE_BUILD_TYPE relwithdebug)
429 SET(CMAKE_C_FLAGS "-O2 -g -Wall ${CMAKE_C_FLAGS}")
430 SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions -Wall ${CMAKE_CXX_FLAGS}")
431 #SET(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS}")
432 #SET(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CXX_FLAGS}")
435 FILE(GLOB_RECURSE lmms_INCLUDES ${CMAKE_SOURCE_DIR}/include/*.h)
436 FILE(GLOB lmms_UI ${CMAKE_SOURCE_DIR}/src/gui/Forms/*.ui)
437 FILE(GLOB_RECURSE lmms_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp)
439 SET(lmms_MOC ${lmms_INCLUDES})
441 SET(lmms_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/COPYING)
443 QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw)
444 QT4_WRAP_UI(lmms_UI_out ${lmms_UI})
447 # embedded resources stuff
449 # compile buildtools native
450 SET(BIN2RES_CPP ${CMAKE_SOURCE_DIR}/buildtools/bin2res.cpp)
451 SET(BIN2RES ${CMAKE_BINARY_DIR}/bin2res)
452 ADD_CUSTOM_COMMAND(OUTPUT ${BIN2RES} COMMAND g++ ARGS ${BIN2RES_CPP} -o ${BIN2RES} DEPENDS ${BIN2RES_CPP})
454 ADD_EXECUTABLE(bin2res buildtools/bin2res.cpp)
455 GET_TARGET_PROPERTY(BIN2RES bin2res LOCATION)
456 ENDIF(WIN32 OR WIN64)
458 SET(LMMS_ER_H ${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h)
460 # we somehow have to make LMMS-binary depend on MOC-files
461 ADD_FILE_DEPENDENCIES(${CMAKE_BINARY_DIR}/lmmsconfig.h ${lmms_MOC_out})
463 ADD_CUSTOM_COMMAND(OUTPUT ${LMMS_ER_H} COMMAND ${BIN2RES} ARGS ${lmms_EMBEDDED_RESOURCES} > ${LMMS_ER_H} DEPENDS ${BIN2RES})
465 # build CPU specific optimized modules
466 IF(LMMS_HOST_X86 OR LMMS_HOST_X86_64)
469 SET(opt_targets mmx sse sse2)
471 SET(opt_targets sse sse2)
474 FOREACH(opt_target ${opt_targets})
476 STRING(TOUPPER ${opt_target} OPT_TARGET)
478 SET(BASIC_OPS_X86_TARGET_S "")
479 SET(CPU_X86_C "${CMAKE_SOURCE_DIR}/src/core/CpuX86.c")
480 SET(CPU_X86_TARGET_O "${CMAKE_BINARY_DIR}/CpuX86_${opt_target}.o")
482 IF(NOT "${OPT_TARGET}" STREQUAL "MMX")
483 SET(FPMATH_FLAGS "-mfpmath=sse")
484 ENDIF(NOT "${OPT_TARGET}" STREQUAL "MMX")
485 IF("${CMAKE_C_COMPILER_ARG1}" STREQUAL " gcc")
486 SET(CMAKE_C_COMPILER_ARG1 gcc)
487 ENDIF("${CMAKE_C_COMPILER_ARG1}" STREQUAL " gcc")
488 SET(CFLAGS ${CMAKE_C_FLAGS})
489 SEPARATE_ARGUMENTS(CFLAGS)
490 SET(COMPILE_CMD ${CMAKE_C_COMPILER} ${CPU_X86_C} ${CFLAGS} -O2 -fno-stack-protector -ftree-vectorize -fomit-frame-pointer -c -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_BINARY_DIR} -g0 -DBUILD_${OPT_TARGET} -m${opt_target} ${FPMATH_FLAGS})
491 ADD_CUSTOM_COMMAND(OUTPUT ${CPU_X86_TARGET_O} COMMAND ${COMPILE_CMD} -o ${CPU_X86_TARGET_O} DEPENDS ${CPU_X86_C})
492 ADD_CUSTOM_TARGET(debug-${opt_target} COMMAND ${COMPILE_CMD} -o ${CPU_X86_TARGET_O}.s -S -ftree-vectorizer-verbose=2)
493 SET(cpu_objects ${cpu_objects} ${CPU_X86_TARGET_O})
495 ENDFOREACH(opt_target ${opt_targets})
497 ENDIF(LMMS_HOST_X86 OR LMMS_HOST_X86_64)
501 SET(WINRC "${CMAKE_BINARY_DIR}/lmmsrc.obj")
502 ADD_CUSTOM_COMMAND(OUTPUT ${WINRC}
504 -I${CMAKE_SOURCE_DIR}
505 -o${CMAKE_BINARY_DIR}/lmmsrc.obj
506 -i${CMAKE_BINARY_DIR}/lmms.rc
507 DEPENDS ${CMAKE_BINARY_DIR}/lmms.rc)
508 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
510 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
515 # make sub-directories
516 ADD_SUBDIRECTORY(plugins)
517 ADD_SUBDIRECTORY(data)
524 SET(EXTRA_LIBRARIES "-lwinmm")
527 ADD_DEFINITIONS(-D'LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/"' -D'PLUGIN_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/lmms/"' ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS})
529 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} ${FLAC_INCLUDE_DIR})
530 LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${ASOUND_LIBRARY_DIR} ${JACK_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS})
531 LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${FLAC_LIBRARIES} ${SLV2_LIBRARY} ${EXTRA_LIBRARIES})
533 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")
535 ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${cpu_objects} ${lmms_INCLUDES} ${LIBSAMPLERATE_SOURCES} ${LMMS_ER_H} ${lmms_UI_out} lmmsconfig.h lmmsversion.h ${WINRC} ${CMAKE_BINARY_DIR}/lmms.1.gz)
539 SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows")
540 ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND ${STRIP} ${CMAKE_BINARY_DIR}/lmms.exe)
542 INSTALL(TARGETS lmms RUNTIME DESTINATION .)
544 ${MINGW_PREFIX}/bin/QtCore4.dll
545 ${MINGW_PREFIX}/bin/QtGui4.dll
546 ${MINGW_PREFIX}/bin/QtXml4.dll
547 ${MINGW_PREFIX}/bin/QtNetwork4.dll
548 ${MINGW_PREFIX}/bin/libsndfile-1.dll
549 ${MINGW_PREFIX}/bin/libvorbis-0.dll
550 ${MINGW_PREFIX}/bin/libvorbisenc-2.dll
551 ${MINGW_PREFIX}/bin/libvorbisfile-3.dll
552 ${MINGW_PREFIX}/bin/libogg-0.dll
553 ${MINGW_PREFIX}/bin/libfluidsynth-1.dll
554 ${MINGW_PREFIX}/bin/libfftw3f-3.dll
555 ${MINGW_PREFIX}/bin/libFLAC-8.dll
556 ${MINGW_PREFIX}/bin/libportaudio-2.dll
557 ${MINGW_PREFIX}/bin/SDL.dll
558 ${MINGW_PREFIX}/bin/libglib-2.0-0.dll
559 ${MINGW_PREFIX}/bin/libgthread-2.0-0.dll
562 ELSE(LMMS_BUILD_WIN32)
563 IF(NOT LMMS_BUILD_APPLE)
564 SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E")
565 ENDIF(NOT LMMS_BUILD_APPLE)
567 INSTALL(TARGETS lmms RUNTIME DESTINATION bin)
568 INSTALL(FILES ${CMAKE_BINARY_DIR}/lmms.1.gz DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
570 ENDIF(LMMS_BUILD_WIN32)
573 # rules for building localizations
575 FILE(GLOB lmms_LOCALES data/locale/*.ts)
578 FOREACH(_ts_file ${lmms_LOCALES})
579 STRING(REPLACE "${CMAKE_SOURCE_DIR}/data/locale/" "" _ts_target "${_ts_file}")
580 STRING(REPLACE ".ts" ".qm" _qm_file "${_ts_file}")
581 STRING(REPLACE ".ts" ".qm" _qm_target "${_ts_target}")
582 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})
583 ADD_CUSTOM_TARGET(${_qm_target} COMMAND ${QT_LRELEASE_EXECUTABLE} ${_ts_file} -qm ${_qm_file})
584 LIST(APPEND ts_targets "${_ts_target}")
585 LIST(APPEND qm_targets "${_qm_target}")
586 ENDFOREACH(_ts_file ${lmms_LOCALES})
588 ADD_CUSTOM_TARGET(update-locales)
589 FOREACH(_item ${ts_targets})
590 ADD_DEPENDENCIES(update-locales ${_item})
591 ENDFOREACH(_item ${ts_targets})
593 ADD_CUSTOM_TARGET(finalize-locales)
594 FOREACH(_item ${qm_targets})
595 ADD_DEPENDENCIES(finalize-locales ${_item})
596 ENDFOREACH(_item ${qm_targets})
602 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/)
603 IF(NOT LMMS_HAVE_SAMPLERATE)
604 INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/3rdparty/samplerate/samplerate.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lmms/)
605 ENDIF(NOT LMMS_HAVE_SAMPLERATE)
606 ENDIF(LMMS_BUILD_LINUX)
608 # package ZynAddSubFX into win32 build
610 IF(EXISTS ${CMAKE_SOURCE_DIR}/extras)
611 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extras/data/presets)
612 FILE(GLOB ZASF_BINARIES ${CMAKE_SOURCE_DIR}/extras/plugins/zynaddsubfx/zynaddsubfx.dll ${CMAKE_SOURCE_DIR}/extras/plugins/zynaddsubfx/remote_zynaddsubfx.exe)
613 INSTALL(FILES ${ZASF_BINARIES} DESTINATION ${PLUGIN_DIR})
614 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/extras)
615 ENDIF(LMMS_BUILD_WIN32)
618 # add distclean-target
620 ADD_CUSTOM_TARGET(distclean
622 COMMAND rm -rf `find -name cmake_install.cmake` `find -name Makefile` `find -type d -name CMakeFiles` CMakeCache.txt lmmsconfig.h lmms.1.gz)
627 SET(TMP "lmms-${VERSION}")
628 ADD_CUSTOM_TARGET(dist
630 COMMAND rm -rf ${TMP}
631 COMMAND mkdir -p ${TMP}
632 COMMAND cp AUTHORS build_mingw32 CMakeLists.txt configure COPYING INSTALL lmms.1 lmms.rc.in lmms.spec.in lmmsconfig.h.in README TODO ${TMP}
633 COMMAND cp -r buildtools cmake data include plugins src ${TMP}
634 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
635 COMMAND tar cjf lmms-${VERSION}.tar.bz2 ${TMP}
636 COMMAND rm -rf ${TMP})
639 # add win32-pkg-target (deprecated - use "package" target instead)
641 ADD_CUSTOM_TARGET(win32-pkg
642 COMMAND mkdir -p tmp/lmms/data
643 COMMAND mkdir -p tmp/lmms/plugins/ladspa/
644 COMMAND cp lmms.exe tmp/lmms
645 COMMAND find plugins/ -maxdepth 2 -name '*.dll' -exec cp '{}' tmp/lmms/plugins/ "';'"
646 COMMAND rm tmp/lmms/plugins/caps.dll
647 COMMAND rm tmp/lmms/plugins/tap*.dll
648 COMMAND cp plugins/ladspa_effect/caps/caps.dll tmp/lmms/plugins/ladspa/
649 COMMAND cp plugins/ladspa_effect/tap/tap*.dll tmp/lmms/plugins/ladspa/
650 COMMAND cd data && make DESTDIR=${CMAKE_BINARY_DIR}/tmp/lmms/ install
651 COMMAND mv tmp/lmms/opt/mingw32/share/lmms/* tmp/lmms/data/ && rm -rf tmp/lmms/opt
652 COMMAND cp /opt/mingw32/bin/QtCore4.dll tmp/lmms
653 COMMAND cp /opt/mingw32/bin/QtGui4.dll tmp/lmms
654 COMMAND cp /opt/mingw32/bin/QtXml4.dll tmp/lmms
655 COMMAND cp /opt/mingw32/bin/QtNetwork4.dll tmp/lmms
656 COMMAND cp /opt/mingw32/bin/libz.dll tmp/lmms
657 COMMAND cp /opt/mingw32/bin/libsndfile-1.dll tmp/lmms
658 COMMAND cp /opt/mingw32/bin/libvorbis*.dll tmp/lmms
659 COMMAND cp /opt/mingw32/bin/libogg-0.dll tmp/lmms
660 COMMAND cp /opt/mingw32/bin/libfluidsynth-1.dll tmp/lmms
661 COMMAND cp /opt/mingw32/bin/libfftw3f-3.dll tmp/lmms
662 COMMAND cp /opt/mingw32/bin/SDL.dll tmp/lmms
663 COMMAND cp /opt/mingw32/i586-pc-mingw32/bin/mingwm10.dll tmp/lmms
664 COMMAND cp -L ${CMAKE_SOURCE_DIR}/COPYING tmp/lmms/LICENSE.TXT
665 COMMAND cp -L ${CMAKE_SOURCE_DIR}/README tmp/lmms/README.TXT
666 COMMAND ${STRIP} tmp/lmms/lmms.exe tmp/lmms/plugins/*.dll tmp/lmms/plugins/ladspa/*.dll
667 COMMAND mv tmp/lmms tmp/lmms-${VERSION}
668 COMMAND cd tmp && zip -r -9 ../lmms-${VERSION}-bin-win32.zip lmms-${VERSION}/*
673 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LMMS_ER_H} ${lmms_MOC_out} ${lmms_UI_out} lmmsconfig.h lmms.1.gz")
677 # display configuration information
681 "Installation Summary\n"
682 "--------------------\n"
683 "* Install Directory : ${CMAKE_INSTALL_PREFIX}\n"
684 #"* Build type : ${CMAKE_BUILD_TYPE}\n"
685 "* Use system's libsamplerate : ${LMMS_HAVE_SAMPLERATE}\n"
689 "Supported audio interfaces\n"
690 "--------------------------\n"
691 "* ALSA : ${STATUS_ALSA}\n"
692 "* JACK : ${STATUS_JACK}\n"
693 "* OSS : ${STATUS_OSS}\n"
694 "* PortAudio : ${STATUS_PORTAUDIO}\n"
695 "* PulseAudio : ${STATUS_PULSEAUDIO}\n"
696 "* SDL : ${STATUS_SDL}\n"
700 "Supported MIDI interfaces\n"
701 "-------------------------\n"
702 "* ALSA : ${STATUS_ALSA}\n"
703 "* OSS : ${STATUS_OSS}\n"
704 "* WinMM : ${STATUS_WINMM}\n"
708 "Supported file formats for project export\n"
709 "-----------------------------------------\n"
711 "* OGG/VORBIS : ${STATUS_OGGVORBIS}\n"
712 "* FLAC : ${STATUS_FLAC}\n"
718 "* SoundFont2 player : ${STATUS_FLUIDSYNTH}\n"
719 "* Stk Mallets : ${STATUS_STK}\n"
720 "* VST-instrument hoster : ${STATUS_VST}\n"
721 "* VST-effect hoster : ${STATUS_VST}\n"
722 "* LV2 hoster : ${STATUS_LV2}\n"
723 "* CALF LADSPA plugins : ${STATUS_CALF}\n"
724 "* CAPS LADSPA plugins : ${STATUS_CAPS}\n"
725 "* CMT LADSPA plugins : ${STATUS_CMT}\n"
726 "* TAP LADSPA plugins : ${STATUS_TAP}\n"
727 "* SWH LADSPA plugins : ${STATUS_SWH}\n"
728 "* FL .zip import : ${STATUS_ZIP}\n"
733 "-----------------------------------------------------------------\n"
735 "after installing missing packages, remove CMakeCache.txt before\n"
736 "running cmake again!\n"
737 "-----------------------------------------------------------------\n"
740 INCLUDE(InstallRequiredSystemLibraries)
741 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Linux MultiMedia Studio - easy music production for everyone!")
742 SET(CPACK_PACKAGE_VENDOR "LMMS Developers")
744 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/README ${CMAKE_BINARY_DIR}/README.txt COPYONLY)
745 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/COPYING ${CMAKE_BINARY_DIR}/COPYING.txt COPYONLY)
746 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_BINARY_DIR}/README.txt")
747 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.txt")
748 ELSE(LMMS_BUILD_APPLE)
749 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
750 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
751 ENDIF(LMMS_BUILD_APPLE)
753 SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
754 SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
755 SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
757 SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}-${VERSION_SUFFIX}")
758 ENDIF(VERSION_SUFFIX)
759 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LMMS")
761 SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/data/nsis_branding.bmp")
762 SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data/lmms.ico")
763 SET(CPACK_NSIS_INSTALLED_ICON_NAME "lmms.exe")
764 SET(CPACK_NSIS_DISPLAY_NAME "Linux MultiMedia Studio (LMMS)")
765 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lmms.sourceforge.net")
766 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lmms.sourceforge.net")
767 SET(CPACK_NSIS_CONTACT "lmms-devel@lists.sourceforge.net")
768 SET(CPACK_PACKAGE_EXECUTABLES "lmms.exe;Linux MultiMedia Studio")
769 SET(CPACK_NSIS_MENU_LINKS "lmms.exe;Linux MultiMedia Studio")
770 SET(CPACK_NSIS_DEFINES "!include ${CMAKE_SOURCE_DIR}/cmake/nsis/FileAssociation.nsh")
771 SET(CPACK_PACKAGE_FILE_NAME "lmms-${VERSION}-win32")
772 SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
773 \\\${registerExtension} \\\"$INSTDIR\\\\lmms.exe\\\" \\\".mmp\\\" \\\"LMMS Project\\\"
774 \\\${registerExtension} \\\"$INSTDIR\\\\lmms.exe\\\" \\\".mmpz\\\" \\\"LMMS Project (compressed)\\\"
776 SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
777 \\\${unregisterExtension} \\\".mmp\\\" \\\"LMMS Project\\\"
778 \\\${unregisterExtension} \\\".mmpz\\\" \\\"LMMS Project (compressed)\\\"
781 SET(CPACK_STRIP_FILES "bin/lmms;${PLUGIN_DIR}/*.so")
782 SET(CPACK_PACKAGE_EXECUTABLES "lmms" "LMMS binary")
786 SET(CPACK_PACKAGE_FILE_NAME "lmms-${VERSION}-win64")
787 SET(CPACK_NSIS_DEFINES "${CPACK_NSIS_DEFINES}
788 InstallDir \\\"\\\$PROGRAMFILES64\\\\${CPACK_PACKAGE_INSTALL_DIRECTORY}\\\"")
791 SET(MACOSX_BUNDLE_ICON_FILE "${CMAKE_SOURCE_DIR}/data/themes/default/icon.png")
792 SET(MACOSX_BUNDLE_GUI_IDENTIFIER "LMMS")
793 SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}")
794 SET(MACOSX_BUNDLE_BUNDLE_NAME "Linux MultiMedia Studio")
795 SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}")
796 SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}")
797 SET(MACOSX_BUNDLE_COPYRIGHT "Tobias Doerffel, 2008-2010")
799 SET(CPACK_SOURCE_GENERATOR "TBZ2")
800 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "lmms-${VERSION}")