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
|
# Rosegarden
# A MIDI and audio sequencer and musical notation editor.
#
# This program is Copyright 2000-2008
# Guillaume Laurent <glaurent@telegraph-road.org>,
# Chris Cannam <cannam@all-day-breakfast.com>,
# Richard Bown <richard.bown@ferventsoftware.com>
#
# The moral rights of Guillaume Laurent, Chris Cannam, and Richard
# Bown to claim authorship of this work have been asserted.
#
# This file is Copyright 2006-2008
# Pedro Lopez-Cabanillas <plcl@users.sourceforge.net>
#
# Other copyrights also apply to some parts of this work. Please
# see the AUTHORS file and individual file headers for details.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version. See the file
# COPYING included with this distribution for more information.
# The name of our project is "ROSEGARDEN". CMakeLists files in this project can
# refer to the root source directory of the project as ${ROSEGARDEN_SOURCE_DIR}
# and to the root binary directory of the project as ${ROSEGARDEN_BINARY_DIR}
PROJECT(ROSEGARDEN)
# CMake supports KDE checks since this version number
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.2)
# Show full commands and messages. It generates a lot of console output.
# It is necessary for Eclipse warning/error parser,
# but it can be enabled anyway with "make VERBOSE=1"
SET(CMAKE_VERBOSE_MAKEFILE OFF)
# Seems that relative paths break some scripts. Don't set it ON
SET(CMAKE_USE_RELATIVE_PATHS OFF)
# Rebuild the object files if the rules have changed, but not the actual source
# files or headers (e.g. if you changed the some compiler switches)
SET(CMAKE_SKIP_RULE_DEPENDENCY OFF)
# Misc settings
SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# Additional CMake modules for 3rd party library checks reside here
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_admin")
# Mark as advanced
MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH
LIBRARY_OUTPUT_PATH
CMAKE_BACKWARDS_COMPATIBILITY)
# Rosegarden version string
SET (VERSION_MAJOR "1")
SET (VERSION_MINOR "7")
SET (VERSION_PATCH "0")
# comment out the next line for a public release
#SET (VERSION_SUFFIX "svn")
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
IF(VERSION_SUFFIX)
SET (VERSION "${VERSION}-${VERSION_SUFFIX}")
ENDIF(VERSION_SUFFIX)
ADD_DEFINITIONS(-D'VERSION="${VERSION}"')
# User options
OPTION(WANT_DEBUG "Include debug support" OFF)
OPTION(WANT_FULLDBG "Full debug support (BIG executables!)" OFF)
OPTION(WANT_SOUND "Include Sound support" ON)
OPTION(WANT_JACK "Include Jack (Jack Audio Connection Kit) support" ON)
OPTION(WANT_DSSI "Include DSSI support" ON)
OPTION(WANT_LIRC "Include LIRC (Linux Infrared Remote Control) support" OFF)
OPTION(WANT_PCH "Use precompiled headers" OFF)
OPTION(WANT_TEST "Perform unit tests" OFF)
IF(WANT_TEST)
ENABLE_TESTING()
ENDIF(WANT_TEST)
IF(NOT WANT_SOUND)
SET(WANT_JACK OFF)
SET(WANT_DSSI OFF)
ADD_DEFINITIONS(-DNO_SOUND)
ENDIF(NOT WANT_SOUND)
# Check for KDE3
FIND_PACKAGE(KDE3 REQUIRED QUIET)
IF(QT_FOUND)
ADD_DEFINITIONS(${QT_DEFINITIONS})
MESSAGE(STATUS "Found Qt3 (version ${qt_version_str})")
#MESSAGE("QT_LIBRARIES: ${QT_LIBRARIES}")
ELSE(QT_FOUND)
MESSAGE(FATAL_ERROR "Qt3 package not found")
ENDIF(QT_FOUND)
IF(KDE3_FOUND)
ADD_DEFINITIONS(${KDE3_DEFINITIONS})
#MESSAGE("KDE3PREFIX: ${KDE3PREFIX}")
KDE3_PRINT_RESULTS()
#MESSAGE("QT_AND_KDECORE_LIBS: ${QT_AND_KDECORE_LIBS}")
ELSE(KDE3_FOUND)
MESSAGE(FATAL_ERROR "KDE3 Not found")
ENDIF(KDE3_FOUND)
# Clear the flags set by FindKDE3
SET(CMAKE_CXX_FLAGS "-I/usr/include/tqt -include tqt.h")
MARK_AS_ADVANCED(KDE3_BUILD_TESTS
KDE3_ENABLE_FINAL
KDE3_DCOPIDL_EXECUTABLE
KDE3_DCOPIDL2CPP_EXECUTABLE
KDE3_INCLUDE_DIR
KDE3_KCFGC_EXECUTABLE
KDE3_KDECORE_LIBRARY
KDECONFIG_EXECUTABLE )
# Provide the KDE3 prefix as a default prefix (if the user has CMake 2.4.4)
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX ${KDE3PREFIX} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Check for PKG-CONFIG
FIND_PACKAGE(PkgConfig REQUIRED)
IF(PKG_CONFIG_FOUND)
MESSAGE(STATUS "Program pkg-config found (${PKG_CONFIG_EXECUTABLE})")
ELSE(PKG_CONFIG_FOUND)
MESSAGE(FATAL_ERROR "Program pkg-config not found")
ENDIF(PKG_CONFIG_FOUND)
# Initialize some variables
SET(HAVE_XFT FALSE)
SET(HAVE_ALSA FALSE)
SET(HAVE_JACK FALSE)
SET(HAVE_DSSI FALSE)
SET(HAVE_LIBLO FALSE)
SET(HAVE_LIBLRDF FALSE)
SET(HAVE_LADSPA FALSE)
SET(HAVE_LIRC FALSE)
SET(HAVE_FFTW3F FALSE)
# Check for Xft
PKG_CHECK_MODULES(XFT xft>=2.1.0)
IF(XFT_FOUND)
ADD_DEFINITIONS(-DHAVE_XFT)
SET(HAVE_XFT TRUE)
SET(XFT_LIBS ${XFT_LIBRARIES})
#MESSAGE("XFT_LIBS: ${XFT_LIBS}")
LIST(APPEND XFT_LIB_DIR ${XFT_LIBRARY_DIRS} ${XFT_LIBDIR})
#MESSAGE("XFT_LIB_DIR: ${XFT_LIB_DIR}")
LIST(APPEND XFT_INC_DIR ${XFT_INCLUDE_DIRS} ${XFT_INCLUDEDIR})
#MESSAGE("XFT_INC_DIR: ${XFT_INC_DIR}")
ENDIF(XFT_FOUND)
IF(WANT_SOUND)
# Check for ALSA 1.0
PKG_CHECK_MODULES(ALSA REQUIRED alsa>=1.0)
IF(ALSA_FOUND)
SET(HAVE_ALSA TRUE)
ADD_DEFINITIONS(-DHAVE_ALSA)
SET(ALSA_LIBS ${ALSA_LIBRARIES})
#MESSAGE("ALSA_LIBS: ${ALSA_LIBS}")
LIST(APPEND ALSA_LIB_DIR ${ALSA_LIBRARY_DIRS} ${ALSA_LIBDIR} )
#MESSAGE("ALSA_LIB_DIR: ${ALSA_LIB_DIR}")
LIST(APPEND ALSA_INC_DIR ${ALSA_INCLUDE_DIRS} ${ALSA_INCLUDEDIR})
#MESSAGE("ALSA_INC_DIR: ${ALSA_INC_DIR}")
ELSE(ALSA_FOUND)
MESSAGE(FATAL_ERROR "Please install the required package. Aborting")
ENDIF(ALSA_FOUND)
IF(WANT_JACK)
PKG_CHECK_MODULES(JACK jack>=0.77)
IF(JACK_FOUND)
ADD_DEFINITIONS(-DHAVE_LIBJACK)
SET(HAVE_JACK TRUE)
SET(JACK_LIBS ${JACK_LIBRARIES})
#MESSAGE("JACK_LIBS: ${JACK_LIBS}")
LIST(APPEND JACK_LIB_DIR ${JACK_LIBDIR} ${JACK_LIBRARY_DIRS})
#MESSAGE("JACK_LIB_DIR: ${JACK_LIB_DIR}")
LIST(APPEND JACK_INC_DIR ${JACK_INCLUDEDIR} ${JACK_INCLUDE_DIRS})
#MESSAGE("JACK_INC_DIR: ${JACK_INC_DIR}")
ENDIF(JACK_FOUND)
ENDIF(WANT_JACK)
IF(WANT_DSSI)
PKG_CHECK_MODULES(DSSI dssi>=0.4)
IF(DSSI_FOUND)
ADD_DEFINITIONS(-DHAVE_DSSI)
SET(HAVE_DSSI TRUE)
LIST(APPEND DSSI_INC_DIR ${DSSI_INCLUDE_DIRS} ${DSSI_INCLUDEDIR})
#MESSAGE("DSSI_INC_DIR: ${DSSI_INC_DIR}")
ENDIF(DSSI_FOUND)
ENDIF(WANT_DSSI)
PKG_CHECK_MODULES(LIBLO liblo>=0.7)
IF(LIBLO_FOUND)
ADD_DEFINITIONS(-DHAVE_LIBLO)
SET(HAVE_LIBLO TRUE)
SET(LIBLO_LIBS ${LIBLO_LIBRARIES})
#MESSAGE("LIBLO_LIBS: ${LIBLO_LIBS}")
LIST(APPEND LIBLO_LIB_DIR ${LIBLO_LIBDIR} ${LIBLO_LIBRARY_DIRS})
#MESSAGE("LIBLO_LIB_DIR: ${LIBLO_LIB_DIR}")
LIST(APPEND LIBLO_INC_DIR ${LIBLO_INCLUDEDIR} ${LIBLO_INCLUDE_DIRS})
#MESSAGE("LIBLO_INC_DIR: ${LIBLO_INC_DIR}")
ENDIF(LIBLO_FOUND)
PKG_CHECK_MODULES(LRDF lrdf>=0.3)
IF(LRDF_FOUND)
SET(HAVE_LIBLRDF TRUE)
ADD_DEFINITIONS(-DHAVE_LIBLRDF)
SET(LRDF_LIBS ${LRDF_LIBRARIES})
#MESSAGE("LRDF_LIBS: ${LRDF_LIBS}")
LIST(APPEND LRDF_LIB_DIR ${LRDF_LIBDIR} ${LRDF_LIBRARY_DIRS})
#MESSAGE("LRDF_LIB_DIR: ${LRDF_LIB_DIR}")
LIST(APPEND LRDF_INC_DIR ${LRDF_INCLUDEDIR} ${LRDF_INCLUDE_DIRS})
#MESSAGE("LRDF_INC_DIR: ${LRDF_INC_DIR}")
ENDIF(LRDF_FOUND)
FIND_PACKAGE(LADSPA QUIET)
IF(LADSPA_FOUND)
SET(HAVE_LADSPA TRUE)
ADD_DEFINITIONS(-DHAVE_LADSPA)
SET(LADSPA_INC_DIR ${LADSPA_INCLUDE_DIR})
MESSAGE(STATUS "Found LADSPA (${LADSPA_INC_DIR})")
ENDIF(LADSPA_FOUND)
ENDIF(WANT_SOUND)
PKG_CHECK_MODULES(FFTW3F REQUIRED fftw3f>=3.0.0)
IF(FFTW3F_FOUND)
ADD_DEFINITIONS(-DHAVE_FFTW3F)
SET(HAVE_FFTW3F TRUE)
SET(FFTW3F_LIBS ${FFTW3F_LIBRARIES})
#MESSAGE("FFTW3F_LIBS: ${FFTW3F_LIBS}")
LIST(APPEND FFTW3F_LIB_DIR ${FFTW3F_LIBDIR} ${FFTW3F_LIBRARY_DIRS})
#MESSAGE("FFTW3F_LIB_DIR: ${FFTW3F_LIB_DIR}")
LIST(APPEND FFTW3F_INC_DIR ${FFTW3F_INCLUDEDIR} ${FFTW3F_INCLUDE_DIRS})
#MESSAGE("FFTW3F_INC_DIR: ${FFTW3F_INC_DIR}")
ELSE(FFTW3F_FOUND)
MESSAGE(FATAL_ERROR "Please install the required package. Aborting")
ENDIF(FFTW3F_FOUND)
IF(WANT_LIRC)
FIND_PACKAGE(LIRC QUIET)
IF(LIRC_FOUND)
SET(HAVE_LIRC TRUE)
ADD_DEFINITIONS(-DHAVE_LIRC)
MESSAGE(STATUS "Found LIRC (${LIRC_LIBRARY})")
SET(LIRC_LIBS ${LIRC_LIBRARY})
SET(LIRC_INC_DIR ${LIRC_INCLUDE_DIR})
SET(LIRC_LIB_DIR ${LIRC_LIBRARY_DIR})
#MESSAGE("LIRC_LIBS: ${LIRC_LIBS}")
#MESSAGE("LIRC_LIB_DIR: ${LIRC_LIB_DIR}")
#MESSAGE("LIRC_INC_DIR: ${LIRC_INC_DIR}")
ENDIF(LIRC_FOUND)
ENDIF(WANT_LIRC)
FIND_PACKAGE(MSGFMT REQUIRED)
IF(MSGFMT_FOUND)
MESSAGE(STATUS "Program msgfmt found (${MSGFMT_EXECUTABLE})")
ENDIF(MSGFMT_FOUND)
FIND_PACKAGE(KDECONFIG)
IF(KDECONFIG_EXECUTABLE)
MESSAGE(STATUS "Program kde-config found (${KDECONFIG_EXECUTABLE})")
#MESSAGE("KDE3PREFIX: ${KDE3PREFIX}")
ENDIF(KDECONFIG_EXECUTABLE)
FIND_PACKAGE(MEINPROC REQUIRED)
IF(MEINPROC_FOUND)
MESSAGE(STATUS "Program meinproc found (${MEINPROC_EXECUTABLE})")
ENDIF(MEINPROC_FOUND)
# Check GCC for PCH support
SET(USE_PCH FALSE)
IF(WANT_PCH)
FIND_PACKAGE(PCHSupport)
IF(PCHSupport_FOUND)
SET(USE_PCH TRUE)
ADD_DEFINITIONS(-DUSE_PCH)
MESSAGE(STATUS "Enabling precompiled headers for GCC ${gcc_compiler_version}")
ENDIF(PCHSupport_FOUND)
ENDIF(WANT_PCH)
# Check PTHREAD_MUTEX_RECURSIVE
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES(
"#include <pthread.h>
int main(int argc, char **argv) {
pthread_mutexattr_t attr;
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
return 0;
}" PTHREAD_HAS_MUTEX_RECURSIVE)
IF(PTHREAD_HAS_MUTEX_RECURSIVE)
ADD_DEFINITIONS(-DHAVE_PTHREAD_MUTEX_RECURSIVE)
ENDIF(PTHREAD_HAS_MUTEX_RECURSIVE)
# End of PTHREAD_MUTEX_RECURSIVE Test
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -w -fexceptions -DNDEBUG -include tqt.h")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -Wall -fexceptions -DDEBUG -include tqt.h")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall -fexceptions -DDEBUG -include tqt.h")
MESSAGE(STATUS "Rosegarden ${VERSION} will be built for install into ${CMAKE_INSTALL_PREFIX}")
IF(WANT_DEBUG)
IF(WANT_FULLDBG)
MESSAGE(STATUS "Configured to compile including full debug information in the executables")
SET(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE)
ELSE(WANT_FULLDBG)
MESSAGE(STATUS "Configured to compile including debug information in the executables")
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE)
ENDIF(WANT_FULLDBG)
ELSE(WANT_DEBUG)
MESSAGE(STATUS "Configured to compile for release without debug information")
SET(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE)
ENDIF(WANT_DEBUG)
MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
# Warn the user if important libraries are missing
INCLUDE(UserWarnings)
# Recurse into the "src" subdirectory. This does not actually
# cause another cmake executable to run. The same process will walk through
# the project's entire directory structure.
# Output directory will be "RGbuild/"
ADD_SUBDIRECTORY(src RGbuild)
# Build and install the translations directory
ADD_SUBDIRECTORY(po RGbuild/po)
# Build and install the documentation directory
ADD_SUBDIRECTORY(docs RGbuild/docs)
# Install data files
ADD_SUBDIRECTORY(data RGbuild/data)
# install some documents...
# INSTALL( FILES AUTHORS COPYING README TRANSLATORS INSTALL rosegarden.lsm
# DESTINATION share/doc/rosegarden-${VERSION} )
# create and install the version file
FILE(WRITE version.txt "${VERSION}\n")
INSTALL( FILES version.txt
DESTINATION ${KDE3DATADIR}/rosegarden )
# uninstall custom target
CONFIGURE_FILE(
"${CMAKE_SOURCE_DIR}/cmake_admin/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# Custom target trying to clean the CMake generated files
ADD_CUSTOM_TARGET ( distclean
COMMAND rm -f {,src/,po/,docs/,data/}CMakeCache.txt
COMMAND rm -f {,src/,po/,docs/,data/}cmake_install.cmake
COMMAND rm -f {,src/,po/,docs/,data/}cmake_uninstall.cmake
COMMAND rm -f {,src/,po/,docs/,data/}CPackConfig.cmake
COMMAND rm -f {,src/,po/,docs/,data/}CPackSourceConfig.cmake
COMMAND rm -f {,src/,po/,docs/,data/}install_manifest.txt
COMMAND rm -f {,src/,po/,docs/,data/}progress.make
COMMAND rm -f {,src/,po/,docs/,data/}rosegarden.spec
COMMAND rm -f {,src/,po/,docs/,data/}Makefile
COMMAND rm -rf {,src/,po/,docs/,data/}CMakeFiles
COMMAND rm -rf {,src/,po/,docs/,data/}_CPack_Packages
COMMAND rm -rf RGbuild/*
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ADD_DEPENDENCIES(distclean clean)
# configure the RPM spec
CONFIGURE_FILE(
"${CMAKE_SOURCE_DIR}/rosegarden.spec.in"
"${CMAKE_SOURCE_DIR}/rosegarden.spec"
IMMEDIATE @ONLY)
# tarball target
ADD_CUSTOM_TARGET ( tarball
COMMAND mkdir -p rosegarden-${VERSION}
COMMAND cp -r cmake_admin rosegarden-${VERSION}
COMMAND cp -r data rosegarden-${VERSION}
COMMAND cp -r docs rosegarden-${VERSION}
COMMAND cp -r po rosegarden-${VERSION}
COMMAND cp -r src rosegarden-${VERSION}
COMMAND cp CMakeLists.txt AUTHORS COPYING Doxyfile INSTALL README rosegarden.* TRANSLATORS rosegarden-${VERSION}
COMMAND tar -cj --exclude .svn --exclude gettext-0.10.35-kde -f rosegarden-${VERSION}.tar.bz2 rosegarden-${VERSION}
COMMAND rm -rf rosegarden-${VERSION}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
|