source: mediastreamer2/src/CMakeLists.txt @ 1395:8f17c5f08497

Last change on this file since 1395:8f17c5f08497 was 1395:8f17c5f08497, checked in by laurent <laurent@…>, 2 years ago

spelling mistake

File size: 4.2 KB
Line 
1set(PACKAGE "mediastreamer2")
2set(PACKAGE_BUGREPORT "mediastreamer2")
3set(PACKAGE_NAME "mediastreamer2")
4set(PACKAGE_STRING "${PACKAGE} ${ORTP_VERSION}")
5set(PACKAGE_PLUGINS_DIR "plugins/")
6
7if(ANDROID)
8  set(CMAKE_THREAD_LIBS_INIT "-lc")
9  set(MS_LIBS ${MS_LIBS} m)
10endif()
11include(FindThreads)
12
13set(MS_SRCS mscommon.c msfilter.c msqueue.c msticker.c alaw.c ulaw.c mssndcard.c msrtp.c
14        dtmfgen.c ice.c tee.c msconf.c msjoin.c msvolume.c mswebcam.c mtu.c void.c eventqueue.c
15        dsptools.c kiss_fft.c  kiss_fftr.c equalizer.c audiostream.c)
16
17if(USE_CSL)
18  add_definitions( -DHAVE_CSL )
19endif(USE_CSL)
20
21if(LINUX AND NOT ANDROID)
22  set(MS_SRCS ${MS_SRCS} oss.c)
23  find_library(ALSA  asound)
24  if (ALSA)
25    set(MS_SRCS  ${MS_SRCS} alsa.c)
26    set(MS_LIBS  ${MS_LIBS} ${ALSA})
27    add_definitions(-D__ALSA_ENABLED__)
28  endif(ALSA)
29  add_definitions(-DHAVE_DLOPEN)
30endif(LINUX AND NOT ANDROID)
31
32if(ANDROID)
33  set(MS_SRCS  ${MS_SRCS} msandroid.cpp)
34endif()
35
36if(IPHONE)
37  set(MS_SRCS  ${MS_SRCS} msiounit.c)
38endif()
39
40if(WIN32)
41  include_directories(../build/win32native/)
42  set(MS_SRCS ${MS_SRCS} winsnd3.c ../build/win32native/mediastreamer2.def msfileplayer_win.c msfilerec_win.c)
43 
44else(WIN32)
45  set(MS_SRCS ${MS_SRCS} msfileplayer.c msfilerec.c)
46endif(WIN32)
47
48find_file(GSM_GSM_H gsm/gsm.h PATHS ${GSM_INCLUDE_DIRS})
49if(GSM_GSM_H)
50  find_library(GSM_LIB gsm)
51endif(GSM_GSM_H)
52
53if(GSM_LIB)
54  include_directories(${GSM_INCLUDE_DIRS})
55  set(MS_LIBS ${MS_LIBS} ${GSM_LIB})
56  set(MS_SRCS ${MS_SRCS} gsm.c)
57else(GSM_LIB)
58  include_directories(${GSM_INCLUDE_DIRS})
59  set(MS_LIBS ${MS_LIBS} ${GSM_LIBRARIES})
60  set(MS_SRCS ${MS_SRCS} gsm.c)
61endif(GSM_LIB)
62
63find_file(SPEEX_H speex/speex.h PATHS ${SPEEX_INCLUDE_DIRS})
64if(SPEEX_H)
65  set(MS_LIBS  ${MS_LIBS} ${SPEEX_LIBRARIES} ${SPEEXDSP_LIBRARIES})
66  set(MS_SRCS ${MS_SRCS} msspeex.c msresample.c speexec.c)
67  include_directories(${SPEEX_INCLUDE_DIRS})
68else(SPEEX_H)
69  add_definitions(-DDISABLE_SPEEX)
70endif(SPEEX_H)
71
72if(PORTAUDIO_FOUND)
73  add_definitions(
74    -D__PORTAUDIO_ENABLED__
75  )
76  set(MS_SRCS  ${MS_SRCS} pasnd.c)
77  set(MS_LIBS  ${MS_LIBS} ${PORTAUDIO_LIBRARIES})
78endif(PORTAUDIO_FOUND)
79
80if(NOT CMAKE_UNDER_CE AND NOT IPHONE)
81        TEST_BIG_ENDIAN(BIG_ENDIAN)
82        if(BIG_ENDIAN)
83          add_definitions(
84                -DORTP_BIGENDIAN
85                -DWORDS_BIGENDIAN
86          )
87        endif(BIG_ENDIAN)
88endif(NOT CMAKE_UNDER_CE AND NOT IPHONE)
89
90#FIXME: it's won't work if the MS_FILTER_DESC_EXPORTs are in middle of the file, will work only if they are declared at end
91if(NOT WIN32)
92        # We want to generated the alldescs.h file
93        # Step 1:
94        #   Find all calls to MS_FILTER_DESC_EXPORT macro in the source file and extract the arguments
95        foreach(f ${MS_SRCS})
96         file(READ ${f} fc)
97         string(REGEX MATCHALL "MS_FILTER_DESC_EXPORT\(.*\)" mcs ${fc})
98         #message("matches for ${f} are ${mcs}")
99         set(fds ${fds} ${mcs})
100        endforeach(f)
101
102        string(REPLACE "MS_FILTER_DESC_EXPORT\(" "" fds ${fds})
103        string(REPLACE "\)" " " fds ${fds})
104        string(REPLACE "\n" "" fds ${fds})
105        string(REPLACE " " ";" fds ${fds})
106        set(fds ${fds})
107
108        # Here the 'fds' variable contains the list of filter names
109        #message("fds = ${fds}")
110
111        # Step 2:  Generate the file which refernces all the descriptors
112        set(fn "${CMAKE_CURRENT_BINARY_DIR}/alldescs.h")
113        file(WRITE ${fn} "#include \"mediastreamer2/msfilter.h\"\n\n")
114        foreach(fd ${fds})
115          file(APPEND ${fn} "extern MSFilterDesc ${fd};\n")
116        endforeach(fd)
117        file(APPEND ${fn} "MSFilterDesc *ms_filter_descs[]={\n")
118        foreach(fd ${fds})
119          file(APPEND ${fn} "&${fd},\n")
120        endforeach(fd)
121        file(APPEND ${fn} "0\n};\n")
122endif(NOT WIN32)
123
124configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mediastreamer-config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/mediastreamer-config.h")
125add_definitions(
126        -DHAVE_CONFIG_H
127        )
128
129include_directories(${mediastreamer_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR} ${ORTP_INCLUDE_DIRS})
130set(MEDIASTREAMER_INCLUDE_DIRS ${mediastreamer_SOURCE_DIR}/include CACHE STRING "mediastreamer2 include dir")
131
132add_library(mediastreamer SHARED ${MS_SRCS})
133if(NOT ANDROID)
134set_target_properties(mediastreamer PROPERTIES VERSION ${MEDIASTREAMER_VERSION_STRING} SOVERSION
135  ${MEDIASTREAMER_VERSION_STRING})
136endif()
137target_link_libraries(mediastreamer ${MS_LIBS} ${ORTP_LIBRARIES})
138set(MEDIASTREAMER_LIBRARIES mediastreamer CACHE STRING "mediastreamer2 libraries")
Note: See TracBrowser for help on using the repository browser.