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.3KB

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