CMakeLists.txt 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. #
  2. # cmake file that generate build files for freetdm.
  3. # this automatically includes the tests and also
  4. # mod_freetdm
  5. #
  6. # Arnaldo M Pereira <arnaldo@sangoma.com>
  7. #
  8. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  9. PROJECT(freetdm)
  10. ADD_SUBDIRECTORY(sample)
  11. ADD_SUBDIRECTORY(mod_freetdm)
  12. # includes
  13. SET(freetdm_INCLUDES
  14. ${PROJECT_SOURCE_DIR}/src/include
  15. ${PROJECT_SOURCE_DIR}/src/isdn/include
  16. ${PROJECT_SOURCE_DIR}/src/include/private
  17. ${PROJECT_SOURCE_DIR}/src/ftmod/ftmod_sangoma_boost
  18. )
  19. INCLUDE_DIRECTORIES(${freetdm_INCLUDES})
  20. LINK_DIRECTORIES(${freetdm_BINARY_DIR})
  21. # optional includes
  22. IF(DEFINED SNGSS7)
  23. SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_ss7)
  24. ENDIF(DEFINED SNGSS7)
  25. IF(DEFINED SNGISDN)
  26. SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn)
  27. ENDIF(DEFINED SNGISDN)
  28. # definitions / CFLAGS
  29. ADD_DEFINITIONS(-DFTDM_CONFIG_DIR="/FIXME" -DFTDM_MOD_DIR="/FIXME")
  30. IF(DEFINED WIN32)
  31. ADD_DEFINITIONS(-DFREETDM_EXPORTS -DTELETONE_EXPORTS -DMOD_EXPORTS -DDLL_EXPORTS)
  32. ENDIF(DEFINED WIN32)
  33. IF(DEFINED SNGISDN)
  34. SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn)
  35. ENDIF(DEFINED SNGISDN)
  36. # lib sources
  37. SET(freetdm_SOURCES
  38. ${PROJECT_SOURCE_DIR}/src/hashtable.c
  39. ${PROJECT_SOURCE_DIR}/src/hashtable_itr.c
  40. ${PROJECT_SOURCE_DIR}/src/ftdm_io.c
  41. ${PROJECT_SOURCE_DIR}/src/ftdm_queue.c
  42. ${PROJECT_SOURCE_DIR}/src/ftdm_sched.c
  43. ${PROJECT_SOURCE_DIR}/src/ftdm_call_utils.c
  44. ${PROJECT_SOURCE_DIR}/src/ftdm_config.c
  45. ${PROJECT_SOURCE_DIR}/src/ftdm_callerid.c
  46. ${PROJECT_SOURCE_DIR}/src/fsk.c
  47. ${PROJECT_SOURCE_DIR}/src/uart.c
  48. ${PROJECT_SOURCE_DIR}/src/g711.c
  49. ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c
  50. ${PROJECT_SOURCE_DIR}/src/libteletone_generate.c
  51. ${PROJECT_SOURCE_DIR}/src/ftdm_buffer.c
  52. ${PROJECT_SOURCE_DIR}/src/ftdm_threadmutex.c
  53. ${PROJECT_SOURCE_DIR}/src/ftdm_dso.c
  54. ${PROJECT_SOURCE_DIR}/src/ftdm_cpu_monitor.c
  55. )
  56. # libfreetdm.so
  57. ADD_LIBRARY(${PROJECT_NAME} SHARED ${freetdm_SOURCES})
  58. IF(NOT DEFINED WIN32)
  59. TARGET_LINK_LIBRARIES(${PROJECT_NAME} m pthread dl)
  60. ENDIF(NOT DEFINED WIN32)
  61. REMOVE_DEFINITIONS(-DLL_EXPORTS)
  62. # tools & tests
  63. IF(NOT DEFINED WIN32)
  64. FOREACH(TOOL testtones testpri testr2 testapp testcid)
  65. ADD_EXECUTABLE(${TOOL} ${PROJECT_SOURCE_DIR}/src/${TOOL}.c)
  66. TARGET_LINK_LIBRARIES(${TOOL} -l${PROJECT_NAME})
  67. ADD_DEPENDENCIES(${TOOL} ${PROJECT_NAME})
  68. ENDFOREACH(TOOL)
  69. ADD_EXECUTABLE(detect_dtmf
  70. ${PROJECT_SOURCE_DIR}/src/detect_dtmf.c
  71. ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c
  72. )
  73. TARGET_LINK_LIBRARIES(detect_dtmf ${PROJECT_NAME})
  74. ADD_DEPENDENCIES(detect_dtmf ${PROJECT_NAME})
  75. ADD_EXECUTABLE(detect_tones
  76. ${PROJECT_SOURCE_DIR}/src/detect_tones.c
  77. ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c
  78. )
  79. TARGET_LINK_LIBRARIES(detect_tones ${PROJECT_NAME})
  80. ADD_DEPENDENCIES(detect_tones ${PROJECT_NAME})
  81. ADD_EXECUTABLE(testanalog
  82. ${PROJECT_SOURCE_DIR}/src/testanalog.c
  83. )
  84. TARGET_LINK_LIBRARIES(testanalog -l${PROJECT_NAME})
  85. ADD_DEPENDENCIES(testanalog ${PROJECT_NAME})
  86. # optional tests/tools
  87. IF(HAVE_SCTP)
  88. ADD_EXECUTABLE(testboost src/testboost.c)
  89. TARGET_LINK_LIBRARIES(testboost ${PROJECT_NAME})
  90. ENDIF(HAVE_SCTP)
  91. ELSE(NOT DEFINED WIN32)
  92. MESSAGE(WARNING "Not building tools/tests on WIN32 yet.")
  93. ENDIF(NOT DEFINED WIN32)
  94. #
  95. # ftmod modules
  96. #
  97. SET(ftmod_DIR ${PROJECT_SOURCE_DIR}/src/ftmod)
  98. IF(DEFINED WIN32)
  99. SET(ftmod_ADDITIONAL_SOURCES
  100. ${PROJECT_SOURCE_DIR}/src/ftdm_io.c
  101. ${PROJECT_SOURCE_DIR}/src/ftdm_config.c
  102. ${PROJECT_SOURCE_DIR}/src/ftdm_queue.c
  103. ${PROJECT_SOURCE_DIR}/src/g711.c
  104. )
  105. SET(module_list skel analog analog_em)
  106. ELSE(DEFINED WIN32)
  107. SET(module_list skel analog analog_em zt)
  108. ENDIF(DEFINED WIN32)
  109. # build default modules
  110. FOREACH(module ${module_list})
  111. ADD_LIBRARY(ftmod_${module} MODULE ${ftmod_DIR}/ftmod_${module}/ftmod_${module}.c ${ftmod_ADDITIONAL_SOURCES})
  112. TARGET_LINK_LIBRARIES(ftmod_${module} ${PROJECT_NAME})
  113. ENDFOREACH(module)
  114. # build isdn ftmod
  115. IF(DEFINED BUILD_FTMOD_ISDN)
  116. SET(ftmod_isdn_SOURCES
  117. ${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateNT.c
  118. ${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateTE.c
  119. ${PROJECT_SOURCE_DIR}/src/isdn/mfifo.c
  120. ${PROJECT_SOURCE_DIR}/src/isdn/Q921.c
  121. ${PROJECT_SOURCE_DIR}/src/isdn/Q931api.c
  122. ${PROJECT_SOURCE_DIR}/src/isdn/Q931.c
  123. ${PROJECT_SOURCE_DIR}/src/isdn/Q931ie.c
  124. ${PROJECT_SOURCE_DIR}/src/isdn/Q931mes.c
  125. ${PROJECT_SOURCE_DIR}/src/isdn/Q931StateNT.c
  126. ${PROJECT_SOURCE_DIR}/src/isdn/Q931StateTE.c
  127. ${PROJECT_SOURCE_DIR}/src/isdn/nationalmes.c
  128. ${PROJECT_SOURCE_DIR}/src/isdn/nationalStateNT.c
  129. ${PROJECT_SOURCE_DIR}/src/isdn/nationalStateTE.c
  130. ${PROJECT_SOURCE_DIR}/src/isdn/DMSmes.c
  131. ${PROJECT_SOURCE_DIR}/src/isdn/DMSStateNT.c
  132. ${PROJECT_SOURCE_DIR}/src/isdn/DMSStateTE.c
  133. ${PROJECT_SOURCE_DIR}/src/isdn/5ESSmes.c
  134. ${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateNT.c
  135. ${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateTE.c
  136. ${PROJECT_SOURCE_DIR}/src/isdn/Q932mes.c
  137. ${ftmod_DIR}/ftmod_isdn/ftmod_isdn.c
  138. )
  139. IF(NOT DEFINED WIN32)
  140. ADD_DEFINITIONS(-D_GNU_SOURCE)
  141. ENDIF(NOT DEFINED WIN32)
  142. ADD_LIBRARY(ftmod_isdn MODULE ${ftmod_isdn_SOURCES})
  143. TARGET_LINK_LIBRARIES(ftmod_isdn ${PROJECT_NAME})
  144. ENDIF(DEFINED BUILD_FTMOD_ISDN)
  145. # from now on, optionals
  146. IF(DEFINED LIBSANGOMA)
  147. ADD_LIBRARY(ftmod_wanpipe MODULE ${ftmod_DIR}/ftmod_wanpipe/ftmod_wanpipe.c)
  148. IF(DEFINED WIN32)
  149. MESSAGE(WARNING "FIXME: look for wanpipe headers on win32")
  150. ELSE(DEFINED WIN32)
  151. ADD_DEFINITIONS(-D__LINUX__)
  152. INCLUDE_DIRECTORIES(/usr/include/wanpipe)
  153. ENDIF(DEFINED WIN32)
  154. TARGET_LINK_LIBRARIES(ftmod_wanpipe sangoma ${PROJECT_NAME})
  155. ENDIF(DEFINED LIBSANGOMA)
  156. IF(DEFINED HAVE_SCTP)
  157. ADD_LIBRARY(ftmod_sangoma_boost MODULE
  158. ${ftmod_DIR}/ftmod_sangoma_boost/sangoma_boost_client.c
  159. ${ftmod_DIR}/ftmod_sangoma_boost/ftmod_sangoma_boost.c
  160. )
  161. TARGET_LINK_LIBRARIES(ftmod_sangoma_boost ${PROJECT_NAME})
  162. ENDIF(DEFINED HAVE_SCTP)
  163. IF(DEFINED LIBPRI)
  164. ADD_LIBRARY(ftmod_libpri MODULE
  165. ${ftmod_DIR}/ftmod_libpri/libpri_client.c
  166. ${ftmod_DIR}/ftmod_libpri/ftmod_libpri.c
  167. )
  168. TARGET_LINK_LIBRARIES(ftmod_libpri ${PROJECT_NAME})
  169. ENDIF(DEFINED LIBPRI)
  170. IF(DEFINED PRITAP)
  171. ADD_LIBRARY(ftmod_pritap MODULE
  172. ${ftmod_DIR}/ftmod_pritap/pritap_client.c
  173. ${ftmod_DIR}/ftmod_pritap/ftmod_pritap.c
  174. )
  175. TARGET_LINK_LIBRARIES(ftmod_pritap ${PROJECT_NAME} pri)
  176. ENDIF(DEFINED PRITAP)
  177. IF(DEFINED SNGSS7)
  178. ADD_LIBRARY(ftmod_sangoma_ss7 MODULE
  179. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c
  180. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c
  181. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c
  182. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c
  183. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c
  184. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c
  185. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c
  186. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c
  187. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c
  188. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c
  189. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c
  190. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c
  191. ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c
  192. )
  193. IF(NOT DEFINED WIN32)
  194. ADD_DEFINITIONS(-D_GNU_SOURCE)
  195. ENDIF(NOT DEFINED WIN32)
  196. TARGET_LINK_LIBRARIES(ftmod_sangoma_ss7 ${PROJECT_NAME} sng_ss7)
  197. ENDIF(DEFINED SNGSS7)
  198. IF(DEFINED SNGISDN)
  199. ADD_LIBRARY(ftmod_sangoma_isdn MODULE
  200. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c
  201. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c
  202. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c
  203. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c
  204. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
  205. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c
  206. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c
  207. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c
  208. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c
  209. ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c
  210. )
  211. IF(NOT DEFINED WIN32)
  212. ADD_DEFINITIONS(-D_GNU_SOURCE)
  213. ENDIF(NOT DEFINED WIN32)
  214. TARGET_LINK_LIBRARIES(ftmod_sangoma_isdn ${PROJECT_NAME} sng_isdn)
  215. ENDIF(DEFINED SNGISDN)
  216. IF(DEFINED OPENR2)
  217. ADD_LIBRARY(ftmod_r2 MODULE ${ftmod_DIR}/ftmod_r2/ftmod_r2.c)
  218. TARGET_LINK_LIBRARIES(ftmod_r2 ${PROJECT_NAME} openr2)
  219. ENDIF(DEFINED OPENR2)