aRts audio server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. #################################################
  2. #
  3. # (C) 2010 Serghei Amelian
  4. # serghei (DOT) amelian (AT) gmail.com
  5. #
  6. # Improvements and feedback are welcome
  7. #
  8. # This file is released under GPL >= 2
  9. #
  10. #################################################
  11. cmake_minimum_required( VERSION 2.8 )
  12. ##### include essential cmake modules ###########
  13. include( CheckCXXSourceCompiles )
  14. include( CheckFunctionExists )
  15. include( CheckIncludeFile )
  16. include( CheckLibraryExists )
  17. include( FindPkgConfig )
  18. ##### include our cmake modules #################
  19. set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
  20. include( TDEMacros )
  21. ##### project settings ##########################
  22. project( arts )
  23. set( ARTS_MAJOR_VERSION 1 )
  24. set( ARTS_MINOR_VERSION 5 )
  25. set( ARTS_MICRO_VERSION 10 )
  26. set( ARTS_VERSION "${ARTS_MAJOR_VERSION}.${ARTS_MINOR_VERSION}.${ARTS_MICRO_VERSION}" )
  27. ##### user requested options ####################
  28. option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
  29. option( WITH_ALSA "Enable ALSA support" ON )
  30. option( WITH_AUDIOFILE "Enable audiofile (wav) support" ON )
  31. option( WITH_VORBIS "Enable Ogg/Vorbis support" ON )
  32. option( WITH_MAD "Enable MAD mp3 decoder support" ON )
  33. option( WITH_ESOUND "Enable ESOUND support" ${WITH_ALL_OPTIONS} )
  34. option( WITH_JACK "Enable JACK support" ${WITH_ALL_OPTIONS} )
  35. option( WITH_SNDIO "Enable SNDIO support" OFF )
  36. option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
  37. ##### paths setup ###############################
  38. tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
  39. tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
  40. tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
  41. tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}" )
  42. tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" )
  43. ##### setup architecture flags ##################
  44. tde_setup_architecture_flags( )
  45. include(TestBigEndian)
  46. test_big_endian(WORDS_BIGENDIAN)
  47. ##### check for include files ###################
  48. check_include_file( "sys/time.h" HAVE_SYS_TIME_H )
  49. check_include_file( "time.h" TIME_WITH_SYS_TIME )
  50. check_include_file( "stdio.h" HAVE_STDIO_H )
  51. check_include_file( "stdlib.h" HAVE_STDLIB_H )
  52. check_include_file( "string.h" HAVE_STRING_H )
  53. check_include_file( "strings.h" HAVE_STRINGS_H )
  54. check_include_file( "ctype.h" HAVE_CTYPE_H )
  55. check_include_file( "malloc.h" HAVE_MALLOC_H )
  56. check_include_file( "memory.h" HAVE_MEMORY_H )
  57. check_include_file( "dlfcn.h" HAVE_DLFCN_H )
  58. check_include_file( "sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
  59. check_include_file( "pthread.h" HAVE_LIBPTHREAD )
  60. ##### check for system libraries ################
  61. set( DL_LIBRARIES dl )
  62. check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
  63. if( NOT HAVE_LIBDL )
  64. unset( DL_LIBRARIES )
  65. check_function_exists( dlopen HAVE_DLOPEN )
  66. if( HAVE_DLOPEN )
  67. set( HAVE_LIBDL 1 )
  68. endif( HAVE_DLOPEN )
  69. endif( NOT HAVE_LIBDL )
  70. find_package( Threads )
  71. ##### check for functions #######################
  72. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  73. set( CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARIES} )
  74. check_function_exists( dlerror HAVE_DLERROR )
  75. check_function_exists( strcmp HAVE_STRCMP )
  76. check_function_exists( strchr HAVE_STRCHR )
  77. check_function_exists( index HAVE_INDEX )
  78. check_function_exists( strrchr HAVE_STRRCHR )
  79. check_function_exists( rindex HAVE_RINDEX )
  80. check_function_exists( memcpy HAVE_MEMCPY )
  81. check_function_exists( bcopy HAVE_BCOPY )
  82. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  83. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  84. ##### check for audiofile #######################
  85. set( HAVE_LIBAUDIOFILE 0 )
  86. if( WITH_AUDIOFILE )
  87. pkg_search_module( AUDIOFILE audiofile )
  88. if( AUDIOFILE_FOUND )
  89. set( HAVE_LIBAUDIOFILE 1 )
  90. else( AUDIOFILE_FOUND )
  91. message(FATAL_ERROR "\naudiofile (wav) support are requested, but `libaudiofile` not found" )
  92. endif( AUDIOFILE_FOUND )
  93. endif( WITH_AUDIOFILE )
  94. ##### check for alsa ############################
  95. set( HAVE_LIBASOUND2 0 )
  96. if( WITH_ALSA )
  97. pkg_search_module( ALSA alsa )
  98. if( ALSA_FOUND )
  99. # there is support only for ALSA 1.x
  100. set( HAVE_LIBASOUND2 1 )
  101. set( ALSA_PCM_OLD_SW_PARAMS_API 1 )
  102. set( ALSA_PCM_OLD_HW_PARAMS_API 1 )
  103. check_include_file( "alsa/asoundlib.h" HAVE_ALSA_ASOUNDLIB_H )
  104. if( NOT HAVE_ALSA_ASOUNDLIB_H )
  105. check_include_file( "sys/asoundlib.h" HAVE_SYS_ASOUNDLIB_H )
  106. endif( NOT HAVE_ALSA_ASOUNDLIB_H )
  107. set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  108. set( CMAKE_REQUIRED_LIBRARIES ${ALSA_LIBRARIES} )
  109. check_function_exists( snd_pcm_resume HAVE_SND_PCM_RESUME )
  110. set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
  111. unset( bak_CMAKE_REQUIRED_LIBRARIES )
  112. else( ALSA_FOUND )
  113. message(FATAL_ERROR "\nALSA support are requested, but not found on your system" )
  114. endif( ALSA_FOUND )
  115. endif( WITH_ALSA )
  116. ##### check for esound #######################
  117. set( HAVE_LIBESD 0 )
  118. if( WITH_ESOUND )
  119. pkg_search_module( ESOUND esound )
  120. if( ESOUND_FOUND )
  121. set( HAVE_LIBESD 1 )
  122. else( ESOUND_FOUND )
  123. message(FATAL_ERROR "\nESOUND support is requested, but `libesd` not found" )
  124. endif( ESOUND_FOUND )
  125. endif( WITH_ESOUND )
  126. ##### check for JACK ############################
  127. set( HAVE_LIBJACK 0 )
  128. if( WITH_JACK )
  129. pkg_search_module( LIBJACK jack )
  130. if( LIBJACK_FOUND )
  131. set( HAVE_LIBJACK 1 )
  132. else( LIBJACK_FOUND )
  133. message(FATAL_ERROR "\nJACK support is requested, but `jack.pc` was not found" )
  134. endif( LIBJACK_FOUND )
  135. endif( WITH_JACK )
  136. ##### check for SNDIO ###########################
  137. set( HAVE_LIBSNDIO 0 )
  138. if( WITH_SNDIO )
  139. check_include_file( "sndio.h" HAVE_SNDIO_H )
  140. if( HAVE_SNDIO_H )
  141. set( HAVE_LIBSNDIO 1 )
  142. set( LIBSNDIO_LIBRARIES "sndio" )
  143. else( HAVE_SNDIO_H )
  144. tde_message_fatal( "SNDIO support is requested, but `sndio.h` was not found" )
  145. endif( HAVE_SNDIO_H )
  146. endif( WITH_SNDIO )
  147. ##### check for glib/gthread modules ############
  148. pkg_search_module( GLIB2 glib-2.0 )
  149. if( GLIB2_FOUND )
  150. pkg_search_module( GTHREAD2 gthread-2.0 )
  151. if( NOT GTHREAD2_FOUND )
  152. message(FATAL_ERROR "\ngthread-2.0 are required, but not found on your system" )
  153. endif( NOT GTHREAD2_FOUND )
  154. else( GLIB2_FOUND )
  155. message(FATAL_ERROR "\nglib-2.0 are required, but not found on your system" )
  156. endif( GLIB2_FOUND )
  157. ##### check for gcc visibility support #########
  158. # FIXME
  159. # This should check for [T]Qt3 visibility support
  160. if( WITH_GCC_VISIBILITY )
  161. if( NOT UNIX )
  162. message(FATAL_ERROR "\ngcc visibility support was requested, but your system is not *NIX" )
  163. endif( NOT UNIX )
  164. set( __KDE_HAVE_GCC_VISIBILITY 1 )
  165. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  166. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  167. endif( )
  168. ##### check for TQt #############################
  169. find_package( TQt )
  170. ##### write config.h file #######################
  171. configure_file( config.h.cmake config.h @ONLY )
  172. ##### write pkgconfig file ######################
  173. set( PC_LIB_REQUIRE "" )
  174. if( WITH_ALSA )
  175. list( APPEND PC_LIB_REQUIRE "alsa" )
  176. endif( WITH_ALSA )
  177. if( WITH_AUDIOFILE )
  178. list( APPEND PC_LIB_REQUIRE "audiofile" )
  179. endif( WITH_AUDIOFILE )
  180. if( WITH_VORBIS )
  181. list( APPEND PC_LIB_REQUIRE "vorbis" )
  182. list( APPEND PC_LIB_REQUIRE "vorbisfile" )
  183. endif( WITH_VORBIS )
  184. if( WITH_MAD )
  185. list( APPEND PC_LIB_REQUIRE "mad" )
  186. endif( WITH_MAD )
  187. if( WITH_ESOUND )
  188. list( APPEND PC_LIB_REQUIRE "esound" )
  189. endif( WITH_ESOUND )
  190. if( WITH_JACK )
  191. list( APPEND PC_LIB_REQUIRE "jack" )
  192. endif( WITH_JACK )
  193. list( LENGTH PC_LIB_REQUIRE PC_LIB_REQUIRES_FOUND )
  194. if( PC_LIB_REQUIRES_FOUND GREATER 0 )
  195. string( REPLACE ";" " " PC_LIB_REQUIRES "Requires: ${PC_LIB_REQUIRE}" )
  196. else( )
  197. set( PC_LIB_REQUIRES "" )
  198. endif( )
  199. string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} )
  200. string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} )
  201. string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} )
  202. configure_file( arts.pc.cmake arts.pc @ONLY )
  203. install( FILES ${CMAKE_CURRENT_BINARY_DIR}/arts.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
  204. ##### global compiler settings ##################
  205. add_definitions(
  206. -DHAVE_CONFIG_H
  207. )
  208. set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
  209. ##### project subdirectories ####################
  210. add_subdirectory( libltdl )
  211. add_subdirectory( mcop )
  212. add_subdirectory( mcopidl )
  213. add_subdirectory( flow )
  214. add_subdirectory( mcop_mt )
  215. add_subdirectory( soundserver )
  216. add_subdirectory( artsc )
  217. add_subdirectory( gmcop )
  218. add_subdirectory( qtmcop )