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.

256 lines
7.3KB

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