[a52aaa]: CMakeLists.txt Maximize Restore History

Download this file

CMakeLists.txt    400 lines (315 with data), 15.4 kB

  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
#############################################################################
## Kwave - CMakeLists.txt
## -------------------
## begin : Tue May 01 2007
## copyright : (C) 2007 by Thomas Eschenbacher
## email : Thomas.Eschenbacher@gmx.de
#############################################################################
#
#############################################################################
## #
## 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. #
## #
#############################################################################
#############################################################################
### project name ###
PROJECT(kwave)
SET(KWAVE_LINGUAS
cs:��e��tina
de:Deutsch
en:English
fr:Francais
# <- add new languages here...
)
#############################################################################
### build options: ###
# OPTION(DEBUG "build debug code [default=off]" OFF)
# OPTION(WITH_ALSA "enable playback/recording via ALSA [default=on]" ON)
# OPTION(WITH_DOC "build online documentation [default=on]" ON)
# OPTION(WITH_FLAC "enable support for FLAC files [default=on]" ON)
# OPTION(WITH_MP3 "enable support for mp3 files [default=off]" OFF)
# OPTION(WITH_OGG "enable support for ogg files [default=on]" ON)
# OPTION(WITH_OSS "enable playback/recording via OSS [default=on]" ON)
# OPTION(WITH_PHONON "enable playback via Phonon [default=off]" OFF)
# OPTION(WITH_PULSEAUDIO "enable playback/recording via PulseAudio [default=on]" ON)
# OPTION(WITH_SAMPLERATE "enable support for libsamplerate [default=on]" ON)
#############################################################################
### toplevel build targets: ###
# all - default target, build all files
# clean - clean up the current build directory
# doc - generate docbook files for online help
# html_doc - generate HTML help (for the web)
# install - install the package, with support for DESTDIR
# rpm - create a RPM package + a src.rpm file
# src_rpm - create the source RPM only
# tarball - create a tar.bz2 archive with the sources + specfile
# uninstall - uninstall the package, with support for DESTDIR
# version-labels - update all version numbers and build dates
# tarball - create a tar.gz file with the sources
#############################################################################
### check for the proper cmake version ###
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
#############################################################################
### path to additional cmake modules and includes ###
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
#############################################################################
### Kwave version number ###
INCLUDE(FindKwaveVersion)
#############################################################################
### check for the CPU we build for ###
EXECUTE_PROCESS(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "Building for target ${MACHINE}")
STRING(REGEX MATCH "(i.86-*)|(athlon-*)|(pentium-*)" _mach_x86 ${MACHINE})
IF (_mach_x86)
MESSAGE(STATUS "Found target optimized memcpy() for X86 (from xine)")
SET(ARCH_X86 1)
ENDIF (_mach_x86)
STRING(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _mach_x86_64 ${MACHINE})
IF (_mach_x86_64)
MESSAGE(STATUS "Found target optimized memcpy() for X86_64 (from xine)")
SET(ARCH_X86_64 1)
ENDIF (_mach_x86_64)
STRING(REGEX MATCH "(ppc-*)|(powerpc-*)" _mach_ppc ${MACHINE})
IF (_mach_ppc)
MESSAGE(STATUS "Found target optimized memcpy() for PPC (from xine)")
SET(ARCH_PPC 1)
ENDIF (_mach_ppc)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
#############################################################################
### cmake includes ###
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckCXXCompilerFlag)
INCLUDE(CheckTypeSize)
INCLUDE(CheckFunctionExists)
INCLUDE(KwaveL10N)
#############################################################################
SET(CMAKE_VERBOSE_MAKEFILE OFF)
#############################################################################
### toplevel compiler flags ###
CHECK_C_COMPILER_FLAG(" ${CMAKE_SHARED_LIBRARY_C_FLAGS}" C_HAVE_PIC)
CHECK_CXX_COMPILER_FLAG(" ${CMAKE_SHARED_LIBRARY_C_FLAGS}" CXX_HAVE_PIC)
IF (CXX_HAVE_PIC AND C_HAVE_PIC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
ELSE (CXX_HAVE_PIC AND C_HAVE_PIC)
MESSAGE(FATAL_ERROR "shared library support is missing")
ENDIF (CXX_HAVE_PIC AND C_HAVE_PIC)
# disable annoying warnings from Qt about strict aliasing
CHECK_CXX_COMPILER_FLAG("-Wno-strict-aliasing" CXX_NO_STRICT_ALIASING)
IF (CXX_NO_STRICT_ALIASING)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing")
ENDIF (CXX_NO_STRICT_ALIASING)
#############################################################################
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/libgui)
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/libkwave)
#############################################################################
### Qt 4 support ###
SET(QT_USE_QT3SUPPORT OFF)
SET(QT_USE_QTUITOOLS ON)
SET(QT_USE_QTCORE ON)
SET(QT_DONTUSE_QTGUI OFF)
SET(QT_USE_QTMAIN ON)
FIND_PACKAGE(Qt4 4.4.0 REQUIRED)
MESSAGE(STATUS "Found Qt4 version ${QTVERSION}")
MESSAGE(STATUS "Found Qt4 libraries in ${QT_LIBRARY_DIR}")
MESSAGE(STATUS "Found Qt4 header files in ${QT_INCLUDE_DIR}")
#############################################################################
### KDE 4 support ###
SET(KDE4_ENABLE_FPIE ON)
FIND_PROGRAM(KDECONFIG_EXECUTABLE kde4-config)
FIND_PACKAGE(KDE4 REQUIRED)
IF(WIN32)
FIND_PACKAGE(KDEWIN32 REQUIRED)
ENDIF(WIN32)
INCLUDE(KDE4Defaults)
ADD_DEFINITIONS(${KDE4_DEFINITIONS})
SET(QT_AND_KDECORE_LIBS
${QT_QTGUI_LIBRARY}
${QT_LIBRARIES}
${KDE4_THREADWEAVER_LIBRARY}
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBRARY}
${KDE4_KIO_LIBRARY}
pthread
dl
)
INCLUDE_DIRECTORIES(
${KDE4_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${QT_QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
#############################################################################
### RPATH settings ###
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "${KDE4_LIB_INSTALL_DIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
MESSAGE(STATUS "Using ${CMAKE_INSTALL_RPATH} as install RPATH")
#############################################################################
### checks for needed header files ###
CHECK_INCLUDE_FILES(sys/times.h HAVE_SYS_TIMES_H)
CHECK_INCLUDE_FILES(byteswap.h HAVE_BYTESWAP_H)
CHECK_INCLUDE_FILES(signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES(stddef.h HAVE_STDDEF_H)
SET(_inc dlfcn.h errno.h float.h limits.h sched.h stddef.h stdint.h stdio.h
stdlib.h string.h limits.h sys/time.h sys/types.h time.h pthread.h)
CHECK_INCLUDE_FILES("${_inc}" REQUIRED_STD_HEADERS)
IF (NOT REQUIRED_STD_HEADERS)
MESSAGE(FATAL_ERROR "
unable to find one or more of the following header files:
${_inc}")
ENDIF (NOT REQUIRED_STD_HEADERS)
#############################################################################
### checks for some functions ###
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
CHECK_FUNCTION_EXISTS(unlink HAVE_UNLINK)
INCLUDE(KwaveSysinfo)
#############################################################################
### libaudiofile and libsamplerate support ###
INCLUDE(KwaveLibaudiofileSupport)
INCLUDE(KwaveLibsamplerateSupport)
#############################################################################
### optionally: OSS, ALSA, PulseAudio and Phonon support ###
### for playback/recording ###
INCLUDE(KwaveOSSSupport)
INCLUDE(KwaveALSASupport)
INCLUDE(KwavePhononSupport)
INCLUDE(KwavePulseAudioSupport)
#############################################################################
### cmake includes ###
FIND_PACKAGE(RequiredProgram REQUIRED)
FIND_PACKAGE(Gettext REQUIRED)
#############################################################################
### flags for debugging ###
OPTION(DEBUG "build debug code [default=off]" OFF)
IF (DEBUG)
SET(CMAKE_DEBUG_FLAGS "-O0 -g -Wall -W -Wextra -pedantic -fno-inline -fstack-protector-all")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_DEBUG_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_DEBUG_FLAGS} -Wstrict-null-sentinel -Wold-style-cast")
ADD_DEFINITIONS(-DDEBUG -D_DEBUG)
ELSE(DEBUG)
ADD_DEFINITIONS(-DNO_DEBUG -DQT_NO_DEBUG)
ENDIF (DEBUG)
#############################################################################
### subdirs ###
ADD_SUBDIRECTORY( libgui )
ADD_SUBDIRECTORY( libkwave )
ADD_SUBDIRECTORY( kwave )
ADD_SUBDIRECTORY( plugins )
ADD_SUBDIRECTORY( po )
SET(KWAVE_BUILD_LINGUAS ${KWAVE_BUILD_LINGUAS})
OPTION(WITH_DOC "build online documentation [default=on]" ON)
IF (WITH_DOC)
ADD_SUBDIRECTORY( doc )
ENDIF (WITH_DOC)
#############################################################################
### target package-messages ###
INCLUDE(KwavePackageMessages)
#############################################################################
### RPM support ###
INCLUDE(KwaveRPMSupport)
#############################################################################
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config.h
)
#############################################################################
### KDE .desktop file / mime types ###
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/wav;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-wav;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/basic;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-aifc;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-aiff;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-ircam;")
IF (WITH_MP3)
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/mpeg;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-mp1;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-mp2;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-mp3;")
ENDIF (WITH_MP3)
IF (WITH_FLAC)
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}application/x-flac;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-flac;")
ENDIF (WITH_FLAC)
IF (WITH_OGG)
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-ogg;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}application/ogg;")
SET(KWAVE_DESKTOP_MIME_TYPES "${KWAVE_DESKTOP_MIME_TYPES}audio/x-vorbis+ogg;")
ENDIF (WITH_OGG)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/kwave/kwave.desktop.in
${CMAKE_CURRENT_BINARY_DIR}/kwave/kwave.desktop
)
#############################################################################
### Gentoo support ###
INCLUDE(KwaveEbuild)
#############################################################################
### uninstall support ###
FIND_REQUIRED_PROGRAM(RMDIR_EXECUTABLE rmdir)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY
)
#############################################################################
### "make version-labels" ###
ADD_CUSTOM_TARGET(version-labels
${CMAKE_SOURCE_DIR}/bin/set_version.sh
${CMAKE_SOURCE_DIR}
${KWAVE_VERSION_FULL}
${KWAVE_VERSION_DATE_ISO}
)
#############################################################################
### "make apidoc" ###
FIND_PROGRAM(RM_EXECUTABLE rm)
FIND_PROGRAM(DOXYGEN_EXECUTABLE doxygen)
IF (DOXYGEN_EXECUTABLE AND RM_EXECUTABLE)
SET(DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
SET(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/apidoc)
SET(DOXYGEN_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxygen.log)
MESSAGE(STATUS "Found doxygen: ${DOXYGEN_EXECUTABLE}")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/doxy.cfg.in
${DOXYFILE}
@ONLY
)
ADD_CUSTOM_TARGET(apidoc
COMMAND "${RM_EXECUTABLE}" -R -f "${CMAKE_CURRENT_BINARY_DIR}/html"
COMMAND "${DOXYGEN_EXECUTABLE}" "${DOXYFILE}"
DEPENDS ${DOXYFILE}
)
SET(KWAVE_ADDITIONAL_CLEAN_FILES
${KWAVE_ADDITIONAL_CLEAN_FILES}
${DOXYGEN_OUTPUT_DIR}
${DOXYGEN_LOGFILE}
)
ENDIF (DOXYGEN_EXECUTABLE AND RM_EXECUTABLE)
#############################################################################
### additional files for "make clean" ###
IF (KWAVE_ADDITIONAL_CLEAN_FILES)
SET_DIRECTORY_PROPERTIES(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES
"${KWAVE_ADDITIONAL_CLEAN_FILES}"
)
ENDIF (KWAVE_ADDITIONAL_CLEAN_FILES)
#############################################################################
MESSAGE(STATUS "Using CFLAGS=${CMAKE_C_FLAGS}")
MESSAGE(STATUS "Using CXXFLAGS=${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "Using LDFLAGS=${LDFLAGS}")
#############################################################################
#############################################################################