Commit e3e7cad4 authored by Ghislain MARY's avatar Ghislain MARY

Simplify CMakeLists.txt.

parent b413084e
...@@ -9,19 +9,6 @@ option(MS2_ENABLE_SPEEX "Build mediastreamer2 with the SPEEX codec." ON) ...@@ -9,19 +9,6 @@ option(MS2_ENABLE_SPEEX "Build mediastreamer2 with the SPEEX codec." ON)
option(MS2_ENABLE_VIDEO "Build mediastreamer2 with video support." ON) option(MS2_ENABLE_VIDEO "Build mediastreamer2 with video support." ON)
option(MS2_ENABLE_VPX "Build mediastreamer2 with VPX codec (needs MS2_ENABLE_VIDEO)." ON) option(MS2_ENABLE_VPX "Build mediastreamer2 with VPX codec (needs MS2_ENABLE_VIDEO)." ON)
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_directories(
include/ include/
src/utils/ src/utils/
...@@ -32,38 +19,7 @@ if(MS2_ENABLE_VIDEO) ...@@ -32,38 +19,7 @@ if(MS2_ENABLE_VIDEO)
include_directories(src/voip) include_directories(src/voip)
endif(MS2_ENABLE_VIDEO) endif(MS2_ENABLE_VIDEO)
if(USE_INSTALLED_COMPONENTS) include_directories(${CMAKE_INSTALL_PREFIX}/include)
include_directories(${CMAKE_INSTALL_PREFIX}/include)
if(MS2_ENABLE_GSM)
find_library(LIBGSM libgsm PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_GSM)
if(MS2_ENABLE_OPUS)
include_directories(${CMAKE_INSTALL_PREFIX}/include/opus)
find_library(LIBOPUS libopus PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_OPUS)
if(MS2_ENABLE_VIDEO)
if(MS2_ENABLE_FFMPEG)
find_library(LIBAVCODEC libavcodec PATHS ${CMAKE_INSTALL_PREFIX}/lib)
find_library(LIBAVUTIL libavutil PATHS ${CMAKE_INSTALL_PREFIX}/lib)
find_library(LIBSWSCALE libswscale PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_FFMPEG)
if(MS2_ENABLE_VPX)
find_library(LIBVPX libvpx PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_VPX)
endif(MS2_ENABLE_VIDEO)
else()
include_directories(${ORTP_INCLUDE_DIR})
if(MS2_ENABLE_SPEEX)
include_directories(${SPEEX_INCLUDE_DIR})
endif(MS2_ENABLE_SPEEX)
if(WIN32)
include_directories(${ORTP_ROOT_DIR}/build/vsx/oRTP/oRTP/)
endif(WIN32)
endif()
add_subdirectory(include) add_subdirectory(include)
add_subdirectory(src) add_subdirectory(src)
if(INSTALL_COMPONENT_IN_POSTBUILD)
add_install_target(INSTALL_libmediastreamer2 COMP_libmediastreamer2 "libmediastreamer_base libmediastreamer_voip")
endif()
file(GLOB HEADER_FILES "mediastreamer2/*.h") file(GLOB HEADER_FILES "mediastreamer2/*.h")
install(FILES ${HEADER_FILES} install(FILES ${HEADER_FILES}
COMPONENT COMP_libmediastreamer2
DESTINATION include/mediastreamer2 DESTINATION include/mediastreamer2
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
find_library(LIBORTP NAMES ortp)
if(MS2_ENABLE_GSM)
find_library(LIBGSM NAMES gsm)
endif(MS2_ENABLE_GSM)
if(MS2_ENABLE_OPUS)
include_directories(${CMAKE_INSTALL_PREFIX}/include/opus)
find_library(LIBOPUS NAMES opus)
endif(MS2_ENABLE_OPUS)
if(MS2_ENABLE_SPEEX)
find_library(LIBSPEEX NAMES speex)
find_library(LIBSPEEXDSP NAMES speexdsp)
endif(MS2_ENABLE_SPEEX)
if(MS2_ENABLE_VIDEO)
if(MS2_ENABLE_FFMPEG)
find_library(LIBAVCODEC NAMES avcodec)
find_library(LIBAVUTIL NAMES avutil)
find_library(LIBSWSCALE NAMES swscale)
endif(MS2_ENABLE_FFMPEG)
if(MS2_ENABLE_VPX)
find_library(LIBVPX NAMES vpx)
endif(MS2_ENABLE_VPX)
endif(MS2_ENABLE_VIDEO)
find_program(GIT git) find_program(GIT git)
set(BASE_SOURCE_FILES set(BASE_SOURCE_FILES
...@@ -89,32 +113,26 @@ if(WIN32) ...@@ -89,32 +113,26 @@ if(WIN32)
) )
set(BASE_LIBS ws2_32 ole32 oleaut32 winmm uuid) set(BASE_LIBS ws2_32 ole32 oleaut32 winmm uuid)
endif(WIN32) endif(WIN32)
set(BASE_LIBS ${LIBS} libortp) set(BASE_LIBS ${BASE_LIBS} ${LIBORTP})
add_library(libmediastreamer_base SHARED ${BASE_SOURCE_FILES} ${BASE_GENERATED_SOURCE_FILES}) add_library(mediastreamer_base SHARED ${BASE_SOURCE_FILES} ${BASE_GENERATED_SOURCE_FILES})
set_target_properties(libmediastreamer_base PROPERTIES VERSION 2.9.2 SOVERSION 3) set_target_properties(mediastreamer_base PROPERTIES VERSION 2.9.2 SOVERSION 3)
target_link_libraries(libmediastreamer_base ${BASE_LIBS}) target_link_libraries(mediastreamer_base ${BASE_LIBS})
install(TARGETS libmediastreamer_base install(TARGETS mediastreamer_base
COMPONENT COMP_libmediastreamer2
DESTINATION ${LIB_INSTALL_DIR} DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
if(WIN32) if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libmediastreamer_base.pdb install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/mediastreamer_base.pdb
COMPONENT COMP_libmediastreamer2
DESTINATION ${LIB_INSTALL_DIR} DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
endif() endif()
endif(WIN32) endif(WIN32)
if(USE_INSTALLED_COMPONENTS)
add_dependencies(libmediastreamer_base INSTALL_libortp)
endif()
set(VOIP_SOURCE_FILES set(VOIP_SOURCE_FILES
...@@ -227,6 +245,7 @@ if(MS2_ENABLE_VIDEO) ...@@ -227,6 +245,7 @@ if(MS2_ENABLE_VIDEO)
videofilters/msdscap-mingw.cc videofilters/msdscap-mingw.cc
videofilters/drawdib-display.c videofilters/drawdib-display.c
) )
set_source_files_properties(videofilters/msdscap-mingw.cc PROPERTIES LANGUAGE CXX)
endif(WIN32) endif(WIN32)
if(APPLE) if(APPLE)
list(APPEND VOIP_SOURCE_FILES list(APPEND VOIP_SOURCE_FILES
...@@ -283,10 +302,13 @@ endif(APPLE) ...@@ -283,10 +302,13 @@ endif(APPLE)
if(WIN32) if(WIN32)
set(VOIP_LIBS ws2_32 ole32 oleaut32 winmm uuid) set(VOIP_LIBS ws2_32 ole32 oleaut32 winmm uuid)
if(MS2_ENABLE_VIDEO)
list(APPEND VOIP_LIBS gdi32 user32)
endif(MS2_ENABLE_VIDEO)
endif(WIN32) endif(WIN32)
list(APPEND VOIP_LIBS list(APPEND VOIP_LIBS
libortp ${LIBORTP}
libmediastreamer_base mediastreamer_base
) )
if(MS2_ENABLE_GSM) if(MS2_ENABLE_GSM)
list(APPEND VOIP_LIBS ${LIBGSM}) list(APPEND VOIP_LIBS ${LIBGSM})
...@@ -296,8 +318,8 @@ if(MS2_ENABLE_OPUS) ...@@ -296,8 +318,8 @@ if(MS2_ENABLE_OPUS)
endif(MS2_ENABLE_OPUS) endif(MS2_ENABLE_OPUS)
if(MS2_ENABLE_SPEEX) if(MS2_ENABLE_SPEEX)
list(APPEND VOIP_LIBS list(APPEND VOIP_LIBS
libspeex ${LIBSPEEX}
libspeexdsp ${LIBSPEEXDSP}
) )
endif(MS2_ENABLE_SPEEX) endif(MS2_ENABLE_SPEEX)
if(MS2_ENABLE_VIDEO) if(MS2_ENABLE_VIDEO)
...@@ -319,28 +341,20 @@ if(MS2_ENABLE_VIDEO) ...@@ -319,28 +341,20 @@ if(MS2_ENABLE_VIDEO)
endif(APPLE) endif(APPLE)
endif(MS2_ENABLE_VIDEO) endif(MS2_ENABLE_VIDEO)
add_library(libmediastreamer_voip SHARED ${VOIP_SOURCE_FILES} ${VOIP_GENERATED_SOURCE_FILES}) add_library(mediastreamer_voip SHARED ${VOIP_SOURCE_FILES} ${VOIP_GENERATED_SOURCE_FILES})
set_target_properties(libmediastreamer_voip PROPERTIES VERSION 2.9.2 SOVERSION 3) set_target_properties(mediastreamer_voip PROPERTIES VERSION 2.9.2 SOVERSION 3 LINKER_LANGUAGE CXX)
target_link_libraries(libmediastreamer_voip ${VOIP_LIBS}) target_link_libraries(mediastreamer_voip ${VOIP_LIBS})
install(TARGETS libmediastreamer_voip install(TARGETS mediastreamer_voip
COMPONENT COMP_libmediastreamer2
DESTINATION ${LIB_INSTALL_DIR} DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
if(WIN32) if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libmediastreamer_voip.pdb install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/mediastreamer_voip.pdb
COMPONENT COMP_libmediastreamer2
DESTINATION ${LIB_INSTALL_DIR} DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
endif() endif()
endif(WIN32) endif(WIN32)
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