set(PACKAGE "mediastreamer2") set(PACKAGE_BUGREPORT "mediastreamer2") set(PACKAGE_NAME "mediastreamer2") set(PACKAGE_STRING "${PACKAGE} ${ORTP_VERSION}") set(PACKAGE_PLUGINS_DIR "plugins/") if(ANDROID) set(CMAKE_THREAD_LIBS_INIT "-lc") set(MS_LIBS ${MS_LIBS} m log) add_definitions(-DANDROID) endif() include(FindThreads) set(MS_SRCS mscommon.c msfilter.c msqueue.c msticker.c alaw.c ulaw.c mssndcard.c msrtp.c dtmfgen.c ice.c tee.c msconf.c msjoin.c msvolume.c mswebcam.c mtu.c void.c eventqueue.c dsptools.c kiss_fft.c kiss_fftr.c equalizer.c audiostream.c tonedetector.c itc.c audiomixer.c) if(NOT ENABLE_VIDEO) list(REMOVE_ITEM MS_SRCS mswebcam.c) else(NOT ENABLE_VIDEO) add_definitions(-DVIDEO_ENABLED) endif(NOT ENABLE_VIDEO) add_definitions(-DMS2_INTERNAL) if(USE_CSL) add_definitions(-DHAVE_CSL) endif(USE_CSL) if(LINUX AND NOT ANDROID) set(MS_SRCS ${MS_SRCS} oss.c) find_library(ALSA asound) if (ALSA) set(MS_SRCS ${MS_SRCS} alsa.c) set(MS_LIBS ${MS_LIBS} ${ALSA}) add_definitions(-D__ALSA_ENABLED__) endif(ALSA) add_definitions(-DHAVE_DLOPEN) endif(LINUX AND NOT ANDROID) if(ANDROID) set(MS_SRCS ${MS_SRCS} msandroid.cpp msjava.c) add_definitions( -include${CMAKE_CURRENT_SOURCE_DIR}/../build/android/libmediastreamer2_AndroidConfig.h) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../build/android" dummy .) if (USE_WEBRTC) set(MS_SRCS ${MS_SRCS} msandroid_webrtc.cpp) #set(MS_SRCS ${MS_SRCS} audio_device_android_jni.cc audio_device_buffer.cc # file_impl.cc audio_device_utility.cc thread.cc thread_posix.cc # critical_section_posix.cc critical_section.cc event_posix.cc # event.cc audio_device_generic.cc audio_device_impl.cc # dummy/audio_device_dummy.cc dummy/audio_device_utility_dummy.cc # audio_device_utility_android.cc atomic32.cc msandroid_webrtc.cpp) add_definitions(-DWEBRTC_ANDROID -DWEBRTC_CLOCK_TYPE_REALTIME -DWEBRTC_LINUX) endif() endif() add_definitions(-DMS2_INTERNAL) if(WIN32) include_directories(../build/win32native/) set(MS_SRCS ${MS_SRCS} winsnd3.c msfileplayer_win.c msfilerec_win.c) else(WIN32) set(MS_SRCS ${MS_SRCS} msfileplayer.c msfilerec.c) endif(WIN32) find_file(GSM_GSM_H gsm/gsm.h PATHS ${GSM_INCLUDE_DIRS}) if(GSM_GSM_H) find_library(GSM_LIB gsm) endif(GSM_GSM_H) if(GSM_LIB) include_directories(${GSM_INCLUDE_DIRS}) set(MS_LIBS ${MS_LIBS} ${GSM_LIB}) set(MS_SRCS ${MS_SRCS} gsm.c) else(GSM_LIB) include_directories(${GSM_INCLUDE_DIRS}) set(MS_LIBS ${MS_LIBS} ${GSM_LIBRARIES}) set(MS_SRCS ${MS_SRCS} gsm.c) endif(GSM_LIB) find_file(SPEEX_H speex/speex.h PATHS ${SPEEX_INCLUDE_DIRS}) if(SPEEX_H) set(MS_LIBS ${MS_LIBS} ${SPEEX_LIBRARIES} ${SPEEXDSP_LIBRARIES}) set(MS_SRCS ${MS_SRCS} msspeex.c msresample.c speexec.c) include_directories(${SPEEX_INCLUDE_DIRS}) else(SPEEX_H) add_definitions(-DDISABLE_SPEEX) endif(SPEEX_H) if(PORTAUDIO_FOUND) add_definitions( -D__PORTAUDIO_ENABLED__ ) include_directories(${PORTAUDIO_INCLUDE_DIRS}) set(MS_SRCS ${MS_SRCS} pasnd.c) set(MS_LIBS ${MS_LIBS} ${PORTAUDIO_LIBRARIES}) endif(PORTAUDIO_FOUND) if(NOT CMAKE_UNDER_CE) TEST_BIG_ENDIAN(BIG_ENDIAN) if(BIG_ENDIAN) add_definitions( -DORTP_BIGENDIAN -DWORDS_BIGENDIAN ) endif(BIG_ENDIAN) endif(NOT CMAKE_UNDER_CE) if(NOT WIN32 AND NOT ANDROID) # We want to generated the alldescs.h file # Step 1: # Find all calls to MS_FILTER_DESC_EXPORT macro in the source file and extract the arguments foreach(f ${MS_SRCS}) file(READ ${f} fc) string(REGEX MATCHALL "MS_FILTER_DESC_EXPORT[(][^\n]*_desc[)]" mcs ${fc}) message("matches for ${f} are ${mcs} .") set(fds ${fds} ${mcs}) endforeach(f) string(REPLACE "MS_FILTER_DESC_EXPORT\(" "" fds ${fds}) string(REPLACE "\)" " " fds ${fds}) string(REPLACE "\n" "" fds ${fds}) string(REPLACE " " ";" fds ${fds}) set(fds ${fds}) # Here the 'fds' variable contains the list of filter names #message("fds = ${fds}") # Step 2: Generate the file which refernces all the descriptors set(fn "${CMAKE_CURRENT_BINARY_DIR}/alldescs.h") file(WRITE ${fn} "#include \"mediastreamer2/msfilter.h\"\n\n") foreach(fd ${fds}) file(APPEND ${fn} "extern MSFilterDesc ${fd};\n") endforeach(fd) file(APPEND ${fn} "MSFilterDesc *ms_filter_descs[]={\n") foreach(fd ${fds}) file(APPEND ${fn} "&${fd},\n") endforeach(fd) file(APPEND ${fn} "0\n};\n") endif() if(IOS) add_definitions(-D__MACIOUNIT_ENABLED__) set(MS_SRCS ${MS_SRCS} msiounit.c) endif() if(NOT ANDROID) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mediastreamer-config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/mediastreamer-config.h") add_definitions( -DHAVE_CONFIG_H ) endif() include_directories(${mediastreamer_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR} ${ORTP_INCLUDE_DIRS}) set(MEDIASTREAMER_INCLUDE_DIRS ${mediastreamer_SOURCE_DIR}/include CACHE STRING "mediastreamer2 include dir") add_library(mediastreamer SHARED ${MS_SRCS}) if(NOT ANDROID) set_target_properties(mediastreamer PROPERTIES VERSION ${MEDIASTREAMER_VERSION_STRING} SOVERSION ${MEDIASTREAMER_VERSION_STRING}) endif() target_link_libraries(mediastreamer ${MS_LIBS} ${ORTP_LIBRARIES}) set(MEDIASTREAMER_LIBRARIES mediastreamer CACHE STRING "mediastreamer2 libraries")