Commit cd4838bc authored by Ghislain MARY's avatar Ghislain MARY

Add CMakeLists.txt to compile using cmake.

parent 4103f0b1
cmake_minimum_required(VERSION 2.6)
project(MEDIASTREAMER2 C)
if(NOT ORTP_ROOT_DIR)
set(ORTP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../oRTP)
endif()
if(NOT ORTP_INCLUDE_DIR)
set(ORTP_INCLUDE_DIR ${ORTP_ROOT_DIR}/include)
endif()
if(NOT SPEEX_ROOT_DIR)
set(SPEEX_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../speex)
endif()
if(NOT SPEEX_INCLUDE_DIR)
set(SPEEX_INCLUDE_DIR ${SPEEX_ROOT_DIR}/include)
endif()
include_directories(
include/
src/utils/
${CMAKE_CURRENT_BINARY_DIR}/src/
)
if(USE_INSTALLED_COMPONENTS)
include_directories(${CMAKE_INSTALL_PREFIX}/include)
else()
include_directories(
${ORTP_INCLUDE_DIR}
${SPEEX_INCLUDE_DIR}
)
if(WIN32)
include_directories(${ORTP_ROOT_DIR}/build/vsx/oRTP/oRTP/)
endif(WIN32)
endif()
add_subdirectory(include)
add_subdirectory(src)
if(INSTALL_COMPONENT_IN_POSTBUILD)
add_install_target(INSTALL_libmediastreamer2 COMP_libmediastreamer2 "libmediastreamer_base libmediastreamer_voip")
endif()
BEGIN { print("#include \"mediastreamer2/msfilter.h\"\n") } { printf("extern MSFilterDesc %s;\n",$1) }
\ No newline at end of file
BEGIN { print("MSFilterDesc * ms_base_filter_descs[]={") } { printf("&%s,\n",$1) } END{ print("NULL\n};\n") }
\ No newline at end of file
BEGIN { print("MSFilterDesc * ms_voip_filter_descs[]={") } { printf("&%s,\n",$1) } END{ print("NULL\n};\n") }
\ No newline at end of file
BEGIN { FS="[()]" ; }; /^\t*MS_FILTER_DESC_EXPORT/{ printf("%s\n", $2) }
\ No newline at end of file
file(GLOB HEADER_FILES "mediastreamer2/*.h")
install(FILES ${HEADER_FILES}
COMPONENT COMP_libmediastreamer2
DESTINATION include/mediastreamer2
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
set(BASE_SOURCE_FILES
base/eventqueue.c
base/mscommon.c
base/msfilter.c
base/msqueue.c
base/mssndcard.c
base/msticker.c
base/mswebcam.c
base/mtu.c
otherfilters/itc.c
otherfilters/join.c
otherfilters/tee.c
otherfilters/void.c
)
set(BASE_GENERATED_SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/basedescs.h
)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND awk -f ../extract-filters-names.awk ${BASE_SOURCE_FILES}
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/basedescs.txt
)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND awk -f ../define-filters.awk
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/basedescs.txt
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/basedescs-tmp1.h
)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND awk -f ../define-ms_base_filter_descs.awk
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/basedescs.txt
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/basedescs-tmp2.h
)
execute_process(
COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/basedescs-tmp1.h ${CMAKE_CURRENT_BINARY_DIR}/basedescs-tmp2.h
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/basedescs.h
)
add_definitions(
-DMEDIASTREAMER2_EXPORTS
-DMEDIASTREAMER2_INTERNAL_EXPORTS
-DHAVE_SPEEXDSP
-DORTP_INET6
-D_TRUE_TIME
-DMS2_INTERNAL
-DMS2_FILTERS
)
if(WIN32)
add_definitions(
-DWINDOW_NATIVE
)
set(BASE_LIBS ws2_32 ole32 oleaut32 winmm uuid)
endif(WIN32)
set(BASE_LIBS ${LIBS} libortp)
add_library(libmediastreamer_base SHARED ${BASE_SOURCE_FILES} ${BASE_GENERATED_SOURCE_FILES})
set_target_properties(libmediastreamer_base PROPERTIES VERSION 2.9.2 SOVERSION 3)
target_link_libraries(libmediastreamer_base ${BASE_LIBS})
install(TARGETS libmediastreamer_base
COMPONENT COMP_libmediastreamer2
DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
if(USE_INSTALLED_COMPONENTS)
add_dependencies(libmediastreamer_base INSTALL_libortp)
endif()
set(VOIP_SOURCE_FILES
audiofilters/alaw.c
audiofilters/audiomixer.c
audiofilters/chanadapt.c
#audiofilters/devices.c
#audiofilters/devices.h
audiofilters/dtmfgen.c
audiofilters/equalizer.c
#audiofilters/genericplc.c
#audiofilters/gsm.c
audiofilters/l16.c
audiofilters/msconf.c
audiofilters/msfileplayer.c
audiofilters/msfilerec.c
audiofilters/msg722.c
audiofilters/msresample.c
audiofilters/msspeex.c
audiofilters/msvolume.c
audiofilters/speexec.c
audiofilters/tonedetector.c
audiofilters/ulaw.c
audiofilters/waveheader.h
audiofilters/winsnd3.c
otherfilters/msrtp.c
utils/_kiss_fft_guts.h
utils/dsptools.c
utils/g711common.h
utils/g722.h
utils/g722_decode.c
utils/g722_encode.c
utils/kiss_fft.c
utils/kiss_fft.h
utils/kiss_fftr.c
utils/kiss_fftr.h
voip/audioconference.c
voip/audiostream.c
voip/bitratecontrol.c
voip/bitratedriver.c
voip/ice.c
#voip/layouts.c
voip/mediastream.c
voip/msvoip.c
voip/private.h
voip/qosanalyzer.c
voip/qualityindicator.c
voip/ringstream.c
voip/rfc3984.c
)
set(VOIP_GENERATED_SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/voipdescs.h
)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND awk -f ../extract-filters-names.awk ${VOIP_SOURCE_FILES}
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/voipdescs.txt
)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND awk -f ../define-filters.awk
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/voipdescs.txt
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/voipdescs-tmp1.h
)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND awk -f ../define-ms_voip_filter_descs.awk
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/voipdescs.txt
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/voipdescs-tmp2.h
)
execute_process(
COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/voipdescs-tmp1.h ${CMAKE_CURRENT_BINARY_DIR}/voipdescs-tmp2.h
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/voipdescs.h
)
if(WIN32)
set(VOIP_LIBS ws2_32 ole32 oleaut32 winmm uuid)
endif(WIN32)
set(VOIP_LIBS ${VOIP_LIBS} libortp libmediastreamer_base libspeex libspeexdsp)
add_library(libmediastreamer_voip SHARED ${VOIP_SOURCE_FILES} ${VOIP_GENERATED_SOURCE_FILES})
set_target_properties(libmediastreamer_voip PROPERTIES VERSION 2.9.2 SOVERSION 3)
target_link_libraries(libmediastreamer_voip ${VOIP_LIBS})
install(TARGETS libmediastreamer_voip
COMPONENT COMP_libmediastreamer2
DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
if(USE_INSTALLED_COMPONENTS)
add_dependencies(libmediastreamer_voip
INSTALL_libortp
INSTALL_libspeex)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment