summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: c026d0ca0f2b7f6fc37e7acd4979953020024857 (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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#################################################
#
#  (C) 2010 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.6 )


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


##### project settings ##########################

project( arts )

set( ARTS_MAJOR_VERSION 1 )
set( ARTS_MINOR_VERSION 5 )
set( ARTS_MICRO_VERSION 10 )
set( ARTS_VERSION "${ARTS_MAJOR_VERSION}.${ARTS_MINOR_VERSION}.${ARTS_MICRO_VERSION}" )


##### user requested options ####################

option( WITH_ALSA "Enable ALSA support" ON )
option( WITH_AUDIOFILE "Enable audiofile (wav) support" ON )
option( WITH_VORBIS "Enable Ogg/Vorbis support" ON )
option( WITH_MAD "Enable MAD mp3 decoder support" ON )


##### paths setup ###############################

if( NOT BIN_INSTALL_DIR )
  set( BIN_INSTALL_DIR bin )
endif ( NOT BIN_INSTALL_DIR )

if( NOT LIB_INSTALL_DIR )
  set( LIB_INSTALL_DIR lib )
endif( NOT LIB_INSTALL_DIR )

if( NOT INCLUDE_INSTALL_DIR )
  set( INCLUDE_INSTALL_DIR include/${CMAKE_PROJECT_NAME} )
endif( NOT INCLUDE_INSTALL_DIR )

if( NOT PKGCONFIG_INSTALL_DIR )
  set( PKGCONFIG_INSTALL_DIR lib/pkgconfig )
endif( NOT PKGCONFIG_INSTALL_DIR )


##### check for include files ###################

include( CheckIncludeFile )

check_include_file( "sys/time.h" HAVE_SYS_TIME_H )
check_include_file( "time.h" TIME_WITH_SYS_TIME )
check_include_file( "stdio.h" HAVE_STDIO_H )
check_include_file( "stdlib.h" HAVE_STDLIB_H )
check_include_file( "string.h" HAVE_STRING_H )
check_include_file( "strings.h" HAVE_STRINGS_H )
check_include_file( "ctype.h" HAVE_CTYPE_H )
check_include_file( "malloc.h" HAVE_MALLOC_H )
check_include_file( "memory.h" HAVE_MEMORY_H )
check_include_file( "dlfcn.h" HAVE_DLFCN_H )


##### check for system libraries ################

include( CheckLibraryExists )

set( DL_LIBRARIES dl )
check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
if( NOT HAVE_LIBDL )
  unset( DL_LIBRARIES )
endif( NOT HAVE_LIBDL )

find_package( Threads )

##### check for functions #######################

include( CheckFunctionExists )

set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
set( CMAKE_REQUIRED_LIBRARIES dl )
check_function_exists( dlerror HAVE_DLERROR )
check_function_exists( strcmp HAVE_STRCMP )
check_function_exists( strchr HAVE_STRCHR )
check_function_exists( index HAVE_INDEX )
check_function_exists( strrchr HAVE_STRRCHR )
check_function_exists( rindex HAVE_RINDEX )
check_function_exists( memcpy HAVE_MEMCPY )
check_function_exists( bcopy HAVE_BCOPY )
set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
unset( bak_CMAKE_REQUIRED_LIBRARIES )


##### check for modules #########################

include( FindPkgConfig )


##### check for audiofile #######################

set( HAVE_LIBAUDIOFILE 0 )
if( WITH_AUDIOFILE )

  pkg_search_module( AUDIOFILE audiofile )
  if( AUDIOFILE_FOUND )
    set( HAVE_LIBAUDIOFILE 1 )
  else( AUDIOFILE_FOUND )
    message(FATAL_ERROR "\naudiofile (wav) support are requested, but `libaudiofile` not found" )
  endif( AUDIOFILE_FOUND )

endif( WITH_AUDIOFILE )


##### check for alsa ############################

set( HAVE_LIBASOUND2 0 )
if( WITH_ALSA )

  find_package( ALSA )

  if( ALSA_FOUND )

    # there is support only for ALSA 1.x

    set( HAVE_LIBASOUND2 1 )
    set( ALSA_PCM_OLD_SW_PARAMS_API 1 )
    set( ALSA_PCM_OLD_HW_PARAMS_API 1 )

    check_include_file( "alsa/asoundlib.h" HAVE_ALSA_ASOUNDLIB_H )
    if( NOT HAVE_ALSA_ASOUNDLIB_H )
      check_include_file( "sys/asoundlib.h" HAVE_SYS_ASOUNDLIB_H )
    endif( NOT HAVE_ALSA_ASOUNDLIB_H )

    set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
    set( CMAKE_REQUIRED_LIBRARIES ${ALSA_LIBRARIES} )
    check_function_exists( snd_pcm_resume HAVE_SND_PCM_RESUME )
    set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
    unset( bak_CMAKE_REQUIRED_LIBRARIES )

  else( ALSA_FOUND )

    message(FATAL_ERROR "\nALSA support are requested, but not found on your system" )

  endif( ALSA_FOUND )

endif( WITH_ALSA )


##### check for glib/gthread modules ############

pkg_search_module( GLIB2 glib-2.0 )

if( GLIB2_FOUND )
  pkg_search_module( GTHREAD2 gthread-2.0 )
  if( NOT GTHREAD2_FOUND )
    message(FATAL_ERROR "\ngthread-2.0 are required, but not found on your system" )
  endif( NOT GTHREAD2_FOUND )
else( GLIB2_FOUND )
  message(FATAL_ERROR "\nglib-2.0 are required, but not found on your system" )
endif( GLIB2_FOUND )


##### check for Qt3 #############################

find_package( Qt3 )
if( NOT QT_FOUND )
    message(FATAL_ERROR "\nQt3 are required, but not found on your system" )
endif( NOT QT_FOUND )


##### check for TQt #############################

pkg_search_module( TQT TQt )
if( NOT TQT_FOUND )
    message(FATAL_ERROR "\nTQt are required, but not found on your system" )
endif( NOT TQT_FOUND )


##### write config.h file #######################

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


##### write pkgconfig file ######################

configure_file( arts.pc.cmake arts.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/arts.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )


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

add_definitions(
  -DHAVE_CONFIG_H
)

set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )


##### project subdirectories ####################

add_subdirectory( libltdl )
add_subdirectory( mcop )
add_subdirectory( mcopidl )
add_subdirectory( flow )
add_subdirectory( mcop_mt )
add_subdirectory( soundserver )
add_subdirectory( artsc )
add_subdirectory( gmcop )
add_subdirectory( qtmcop )