Commit 30fdf134 authored by Ghislain MARY's avatar Ghislain MARY

Improve CMake config-file package.

parent 0405c2c7
...@@ -350,90 +350,92 @@ include_directories( ...@@ -350,90 +350,92 @@ include_directories(
src/voip src/voip
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
)
set(MEDIASTREAMER2_INCLUDE_DIRS
${ORTP_INCLUDE_DIRS} ${ORTP_INCLUDE_DIRS}
${BCTOOLBOX_CORE_INCLUDE_DIRS} ${BCTOOLBOX_CORE_INCLUDE_DIRS}
) )
if(BZRTP_FOUND) if(BZRTP_FOUND)
include_directories(${BZRTP_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${BZRTP_INCLUDE_DIRS})
endif() endif()
if(SRTP_FOUND) if(SRTP_FOUND)
include_directories(${SRTP_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${SRTP_INCLUDE_DIRS})
endif() endif()
if(SPANDSP_FOUND) if(SPANDSP_FOUND)
include_directories(${SPANDSP_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${SPANDSP_INCLUDE_DIRS})
endif() endif()
if(GSM_FOUND) if(GSM_FOUND)
include_directories(${GSM_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${GSM_INCLUDE_DIRS})
endif() endif()
if(OPUS_FOUND) if(OPUS_FOUND)
include_directories(${OPUS_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${OPUS_INCLUDE_DIRS})
endif() endif()
if(SPEEX_FOUND) if(SPEEX_FOUND)
include_directories(${SPEEX_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${SPEEX_INCLUDE_DIRS})
endif() endif()
if(SPEEXDSP_FOUND) if(SPEEXDSP_FOUND)
include_directories(${SPEEXDSP_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIRS})
endif() endif()
if(FFMPEG_FOUND) if(FFMPEG_FOUND)
include_directories(${FFMPEG_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS})
endif() endif()
if(VPX_FOUND) if(VPX_FOUND)
include_directories(${VPX_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${VPX_INCLUDE_DIRS})
endif() endif()
if(MATROSKA2_FOUND) if(MATROSKA2_FOUND)
include_directories(${MATROSKA2_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${MATROSKA2_INCLUDE_DIRS})
endif() endif()
if(V4L_FOUND) if(V4L_FOUND)
include_directories(${V4L_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${V4L_INCLUDE_DIRS})
endif() endif()
if(ALSA_FOUND) if(ALSA_FOUND)
include_directories(${ALSA_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS})
endif() endif()
if(ARTS_FOUND) if(ARTS_FOUND)
include_directories(${ARTS_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${ARTS_INCLUDE_DIRS})
endif() endif()
if(PORTAUDIO_FOUND) if(PORTAUDIO_FOUND)
include_directories(${PORTAUDIO_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIRS})
endif() endif()
if(PULSEAUDIO_FOUND) if(PULSEAUDIO_FOUND)
include_directories(${PULSEAUDIO_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIRS})
endif() endif()
if(QSA_FOUND) if(QSA_FOUND)
include_directories(${QSA_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${QSA_INCLUDE_DIRS})
endif() endif()
if(QNXAUDIOMANAGER_FOUND) if(QNXAUDIOMANAGER_FOUND)
include_directories(${QNXAUDIOMANAGER_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${QNXAUDIOMANAGER_INCLUDE_DIRS})
endif() endif()
if(X11_FOUND) if(X11_FOUND)
include_directories(${X11_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${X11_INCLUDE_DIRS})
endif() endif()
if(XV_FOUND) if(XV_FOUND)
include_directories(${XV_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${XV_INCLUDE_DIRS})
endif() endif()
if(QTANGLE_FOUND) if(QTANGLE_FOUND)
include_directories(${QTANGLE_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${QTANGLE_INCLUDE_DIRS})
endif() endif()
if(OPENGL_FOUND) if(OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
endif() endif()
if(GLX_FOUND) if(GLX_FOUND)
include_directories(${GLX_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${GLX_INCLUDE_DIRS})
endif() endif()
if(SCREEN_FOUND) if(SCREEN_FOUND)
include_directories(${SCREEN_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${SCREEN_INCLUDE_DIRS})
endif() endif()
if(CAMAPI_FOUND) if(CAMAPI_FOUND)
include_directories(${CAMAPI_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${CAMAPI_INCLUDE_DIRS})
endif() endif()
if(PCAP_FOUND) if(PCAP_FOUND)
include_directories(${PCAP_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${PCAP_INCLUDE_DIRS})
endif() endif()
if(MSVC_INCLUDE_DIR) if(MSVC_INCLUDE_DIR)
include_directories(${MSVC_INCLUDE_DIR}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${MSVC_INCLUDE_DIR})
endif() endif()
if(TURBOJPEG_FOUND) if(TURBOJPEG_FOUND)
include_directories(${TURBOJPEG_INCLUDE_DIRS}) list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${TURBOJPEG_INCLUDE_DIRS})
endif() endif()
if(ENABLE_ANDROIDSND) if(ENABLE_ANDROIDSND)
include_directories( include_directories(
......
...@@ -33,41 +33,28 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) ...@@ -33,41 +33,28 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/Mediastreamer2Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/Mediastreamer2Targets.cmake")
endif() endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) if(@ENABLE_SHARED@)
include("${EP_ortp_CONFIG_DIR}/ORTPConfig.cmake") set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip)
include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake") set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} mediastreamer_base)
else() else()
find_package(ORTP REQUIRED) set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip-static)
find_package(BcToolbox 0.0.3 REQUIRED COMPONENTS core) get_target_property(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} LOCATION)
endif() get_target_property(MEDIASTREAMER2_LINK_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(@ENABLE_ZRTP@) if(MEDIASTREAMER2_LINK_LIBRARIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) list(APPEND MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_LINK_LIBRARIES})
include("${EP_bzrtp_CONFIG_DIR}/BZRTPConfig.cmake") list(REMOVE_ITEM MEDIASTREAMER2_LIBRARIES mediastreamer_base-static)
else() get_target_property(MEDIASTREAMER2_BASE_LIBRARIES mediastreamer_base-static LOCATION)
find_package(BZRTP) list(APPEND MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_BASE_LIBRARIES})
endif() endif()
endif() endif()
get_target_property(MEDIASTREAMER2_INCLUDE_DIRS ${MEDIASTREAMER2_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(MEDIASTREAMER2_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(MEDIASTREAMER2_INCLUDE_DIRS "${EP_ms2_INCLUDE_DIR}") list(INSERT MEDIASTREAMER2_INCLUDE_DIRS 0 "${EP_ms2_INCLUDE_DIR}")
else()
set(MEDIASTREAMER2_INCLUDE_DIRS "${MEDIASTREAMER2_CMAKE_DIR}/../../../include")
endif()
if(@ENABLE_SHARED@)
set(MEDIASTREAMER2_LIBRARIES mediastreamer_base mediastreamer_voip)
else() else()
set(MEDIASTREAMER2_LIBRARIES mediastreamer_base-static mediastreamer_voip-static) list(INSERT MEDIASTREAMER2_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${ORTP_INCLUDE_DIRS} ${BCTOOLBOX_CORE_INCLUDE_DIRS})
list(APPEND MEDIASTREAMER2_LIBRARIES ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
if(BZRTP_FOUND)
list(APPEND MEDIASTREAMER2_INCLUDE_DIRS ${BZRTP_INCLUDE_DIRS})
list(APPEND MEDIASTREAMER2_LIBRARIES ${BZRTP_LIBRARIES})
endif()
if(@QTANGLE_FOUND@)
list(APPEND MEDIASTREAMER2_INCLUDE_DIRS "@QTANGLE_INCLUDE_DIRS@")
endif() endif()
list(REMOVE_DUPLICATES MEDIASTREAMER2_INCLUDE_DIRS)
set(MEDIASTREAMER2_CPPFLAGS @MEDIASTREAMER2_CPPFLAGS@) set(MEDIASTREAMER2_CPPFLAGS @MEDIASTREAMER2_CPPFLAGS@)
set(MEDIASTREAMER2_LDFLAGS "@LINK_FLAGS_STR@") set(MEDIASTREAMER2_LDFLAGS "@LINK_FLAGS_STR@")
set(MEDIASTREAMER2_FOUND 1) set(MEDIASTREAMER2_FOUND 1)
...@@ -91,7 +91,8 @@ bc_apply_compile_flags(BASE_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C) ...@@ -91,7 +91,8 @@ bc_apply_compile_flags(BASE_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
if(ENABLE_STATIC) if(ENABLE_STATIC)
add_library(mediastreamer_base-static STATIC ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C}) add_library(mediastreamer_base-static STATIC ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C})
set_target_properties(mediastreamer_base-static PROPERTIES OUTPUT_NAME mediastreamer_base) set_target_properties(mediastreamer_base-static PROPERTIES OUTPUT_NAME mediastreamer_base)
target_link_libraries(mediastreamer_base-static ${BASE_LIBS}) target_include_directories(mediastreamer_base-static PUBLIC ${MEDIASTREAMER2_INCLUDE_DIRS})
target_link_libraries(mediastreamer_base-static INTERFACE ${BASE_LIBS})
add_dependencies(mediastreamer_base-static ms2-git-version ms2-basedescs-header) add_dependencies(mediastreamer_base-static ms2-git-version ms2-basedescs-header)
install(TARGETS mediastreamer_base-static EXPORT ${EXPORT_TARGETS_NAME}Targets install(TARGETS mediastreamer_base-static EXPORT ${EXPORT_TARGETS_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
...@@ -107,6 +108,7 @@ if(ENABLE_SHARED) ...@@ -107,6 +108,7 @@ if(ENABLE_SHARED)
# Do not version shared library on Android # Do not version shared library on Android
set_target_properties(mediastreamer_base PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION}) set_target_properties(mediastreamer_base PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION})
endif() endif()
target_include_directories(mediastreamer_base PUBLIC ${MEDIASTREAMER2_INCLUDE_DIRS})
target_link_libraries(mediastreamer_base PRIVATE ${BASE_LIBS}) target_link_libraries(mediastreamer_base PRIVATE ${BASE_LIBS})
add_dependencies(mediastreamer_base ms2-git-version ms2-basedescs-header) add_dependencies(mediastreamer_base ms2-git-version ms2-basedescs-header)
if(MSVC) if(MSVC)
...@@ -632,7 +634,8 @@ if(ENABLE_STATIC) ...@@ -632,7 +634,8 @@ if(ENABLE_STATIC)
set_target_properties(mediastreamer_voip-static PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") set_target_properties(mediastreamer_voip-static PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif() endif()
add_dependencies(mediastreamer_voip-static ${MS2_VOIP_DEPENDENCIES}) add_dependencies(mediastreamer_voip-static ${MS2_VOIP_DEPENDENCIES})
target_link_libraries(mediastreamer_voip-static mediastreamer_base-static ${VOIP_LIBS}) target_include_directories(mediastreamer_voip-static PUBLIC ${MEDIASTREAMER2_INCLUDE_DIRS})
target_link_libraries(mediastreamer_voip-static INTERFACE mediastreamer_base-static ${VOIP_LIBS})
install(TARGETS mediastreamer_voip-static EXPORT ${EXPORT_TARGETS_NAME}Targets install(TARGETS mediastreamer_voip-static EXPORT ${EXPORT_TARGETS_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
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
...@@ -651,6 +654,7 @@ if(ENABLE_SHARED) ...@@ -651,6 +654,7 @@ if(ENABLE_SHARED)
# Do not version shared library on Android # Do not version shared library on Android
set_target_properties(mediastreamer_voip PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION}) set_target_properties(mediastreamer_voip PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION})
endif() endif()
target_include_directories(mediastreamer_voip PUBLIC ${MEDIASTREAMER2_INCLUDE_DIRS})
target_link_libraries(mediastreamer_voip PRIVATE mediastreamer_base ${VOIP_LIBS}) target_link_libraries(mediastreamer_voip PRIVATE mediastreamer_base ${VOIP_LIBS})
if(MSVC) if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
......
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