aRts audio server
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

302 righe
8.6 KiB

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