summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: f698b1808fd5c53265bf2753053bb2a4db2aec84 (plain)
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
#################################################
#
#  (C) 2012 Serghei Amelian
#  serghei (DOT) amelian (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

cmake_minimum_required( VERSION 2.8.12 )


##### general package setup #####################

project( tdemultimedia )

set( PACKAGE tdemultimedia )
set( VERSION R14.1.0 )

enable_testing( )


##### include essential cmake modules ###########

include( FindPkgConfig )
include( CheckIncludeFile )
include( CheckIncludeFileCXX )
include( CheckTypeSize )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( CheckFunctionExists )
include( CheckLibraryExists )
include( CheckSymbolExists )


##### include our cmake modules #################

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )


##### setup install paths #######################

include( TDESetupPaths )
tde_setup_paths( )


##### optional stuff ############################

OPTION( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_ALSA "Enable ALSA support (kscd, kmix)" ON )
option( WITH_ARTS_AKODE "Enable aRts akode plugin" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS_AUDIOFILE "Enable aRts audiofile plugin" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS_MPEGLIB "Enable aRts mpeglib pluing" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS_XINE "Enable aRts xine plugin" ${WITH_ALL_OPTIONS} )
option( WITH_CDPARANOIA "Enable CDParanoia support (mpeglib, tdeioslave-audiocd)" ${WITH_ALL_OPTIONS} )
option( WITH_FLAC "Enable FLAC support (tdeioslave)" ${WITH_ALL_OPTIONS} )
option( WITH_GSTREAMER "Enable gstreamer support (juk)" ${WITH_ALL_OPTIONS} )
option( WITH_KSCD_CDDA "Enable cdda support in kscd" ${WITH_ALL_OPTIONS} )
option( WITH_LAME "Enable lame support (krec)" ${WITH_ALL_OPTIONS} )
option( WITH_MUSICBRAINZ "Enable MusicBrainz support (juk)" OFF )
option( WITH_TAGLIB "Enable taglib support (juk, tdefile-plugins)" ${WITH_ALL_OPTIONS} )
option( WITH_THEORA "Enable Ogg/Theora support (tdefile-plugins)" ${WITH_ALL_OPTIONS} )
option( WITH_VORBIS "Enable Ogg/Vorbis support (krec, mpeglib, oggarts, tdefile-plugins)" ${WITH_ALL_OPTIONS} )


##### user requested modules ####################

option( BUILD_ALL "Build all" OFF )
option( BUILD_ARTS "Build aRts" ${BUILD_ALL} )
option( BUILD_DOC "Build documentation" ${BUILD_ALL} )
option( BUILD_JUK "Build Juk player" ${BUILD_ALL} )
option( BUILD_KABOODLE "Build Kaboodle video player" ${BUILD_ALL} )
option( BUILD_KAPPFINDER_DATA "Build data for kappfinder" ${BUILD_ALL} )
option( BUILD_KAUDIOCREATOR "Build KAudio Creator" ${BUILD_ALL} )
option( BUILD_KMIX "Build kmix" ${BUILD_ALL} )
option( BUILD_KREC "Build krec" ${BUILD_ALL} )
option( BUILD_KSCD "Build kscd player" ${BUILD_ALL} )
option( BUILD_LIBKCDDB "Build kcddb library" ${BUILD_ALL} )
option( BUILD_MPEGLIB "Build mpeg library" ${BUILD_ALL} )
option( BUILD_NOATUN "Build noatun player" ${BUILD_ALL} )
option( BUILD_TDEFILE_PLUGINS "Build tdefile plugins" ${BUILD_ALL} )
option( BUILD_TDEIOSLAVE "Build tdeio slave plugins" ${BUILD_ALL} )
option( BUILD_TDEMID "Build tdemid" ${BUILD_ALL} )


##### configure checks ##########################

include( ConfigureChecks.cmake )


###### global compiler settings #################

add_definitions(
  -DHAVE_CONFIG_H
)

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )


##### activate dependencies #####################


##### tdemultimedia directories ########################

if( BUILD_MPEGLIB ) # must be before mpeglib_artsplug
  if( NOT BUILD_ARTS )
    tde_message_fatal( "mpeglib can not be built without building arts" )
  endif( )
  add_subdirectory( mpeglib )
endif( BUILD_MPEGLIB )
if( BUILD_ARTS )
  add_subdirectory( arts )
  tde_conditional_add_subdirectory( WITH_ARTS_AKODE akode_artsplugin )
  tde_conditional_add_subdirectory( WITH_ARTS_AUDIOFILE audiofile_artsplugin )
  if( WITH_ARTS_MPEGLIB )
    if( NOT BUILD_MPEGLIB )
      tde_message_fatal( "mpeglib aRts plugin can not be built without building mpeglib" )
    endif( )
    add_subdirectory( mpeglib_artsplug )
  else( WITH_ARTS_MPEGLIB )
    tde_conditional_add_subdirectory( WITH_VORBIS oggvorbis_artsplugin )
  endif( WITH_ARTS_MPEGLIB )
  tde_conditional_add_subdirectory( WITH_ARTS_XINE xine_artsplugin )
endif( BUILD_ARTS )
tde_conditional_add_subdirectory( BUILD_DOC doc )
tde_conditional_add_subdirectory( BUILD_JUK juk )
tde_conditional_add_subdirectory( BUILD_KABOODLE kaboodle )
tde_conditional_add_subdirectory( BUILD_KAPPFINDER_DATA kappfinder-data )
if( BUILD_KAUDIOCREATOR )
  if( NOT BUILD_KSCD )
    tde_message_fatal( "kaudiocreator can not be built without building kscd" )
  endif( )
  add_subdirectory( kaudiocreator )
endif( BUILD_KAUDIOCREATOR )
tde_conditional_add_subdirectory( BUILD_KMIX kmix )
if( BUILD_KREC )
  if( NOT BUILD_ARTS )
    tde_message_fatal( "krec can not be built without building arts" )
  endif( )
  add_subdirectory( krec )
endif( BUILD_KREC )
tde_conditional_add_subdirectory( BUILD_KSCD kscd )
tde_conditional_add_subdirectory( BUILD_LIBKCDDB libkcddb )
tde_conditional_add_subdirectory( BUILD_NOATUN noatun )
tde_conditional_add_subdirectory( BUILD_TDEFILE_PLUGINS tdefile-plugins )
tde_conditional_add_subdirectory( BUILD_TDEIOSLAVE tdeioslave )
tde_conditional_add_subdirectory( BUILD_TDEMID tdemid )


##### write configure files #####################

configure_file( config.h.cmake config.h @ONLY )


##### add apidox targets ############

if( "${CMAKE_VERSION}" VERSION_LESS "3.1" )
  set( CMAKE_ENV "env" )
else()
  set( CMAKE_ENV "${CMAKE_COMMAND};-E;env" )
endif()

add_custom_target( apidox
  COMMAND ${CMAKE_ENV}
    "TQTDOCDIR=/usr/share/tqt3/doc/html"
    "DOXDATA=${HTML_INSTALL_DIR}/en/common"
    ${CMAKE_SOURCE_DIR}/admin/doxygen.sh
    --no-modulename
    ${CMAKE_SOURCE_DIR}
  COMMAND
    find ${CMAKE_BINARY_DIR}/apidocs -name '*.html' |
    xargs -r sed -i 's|${CMAKE_BINARY_DIR}/apidocs|${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs|g'
  COMMAND
    find ${CMAKE_BINARY_DIR}/apidocs -name '*.tag' |
    xargs -r sed -i 's|${CMAKE_SOURCE_DIR}/|${PROJECT_NAME}/|g'
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)

add_custom_target( install-apidox
  COMMAND ${CMAKE_COMMAND} -E echo Apidox installed in ${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs
)

install( CODE "
  if( EXISTS ${CMAKE_BINARY_DIR}/apidocs )
    file(
      INSTALL ${CMAKE_BINARY_DIR}/apidocs/
      DESTINATION ${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs
      PATTERN doxygen_sqlite3.db EXCLUDE
      PATTERN installdox-slow EXCLUDE
    )
  endif()"
)