Commit 693aff57 authored by Ghislain MARY's avatar Ghislain MARY

Add the notion of targets so that it is possible to build only sub-parts of linphone.

For example, it is possible to build belle-sip only with the "belle-sip" target. Or ortp only with the "ortp" target.
The "linphone" target (the default one) will build everything.
parent 80eea7f3
......@@ -27,6 +27,7 @@ include(FeatureSummary)
set(LINPHONE_BUILDER_CONFIG_FILE "configs/config-desktop.cmake" CACHE STRING "Path to the linphone builder configuration file.")
set(LINPHONE_BUILDER_WORK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/WORK" CACHE PATH "Working directory for the build.")
set(LINPHONE_BUILDER_TARGET "linphone" CACHE STRING "Target to build: one of belle-sip, ortp, ms2, ms2-plugins, linphone.")
# Include macros definition to be used by builders
......@@ -44,6 +45,10 @@ endif()
linphone_builder_get_autotools_configuration()
# Create targets list from the given LINPHONE_BUILDER_TARGET
linphone_builder_create_targets_list()
# Include project configuration according to the toolchain
get_filename_component(LINPHONE_BUILDER_CONFIG_FILE ${LINPHONE_BUILDER_CONFIG_FILE} ABSOLUTE)
message(STATUS "Using configuration file '${LINPHONE_BUILDER_CONFIG_FILE}'")
......
......@@ -24,85 +24,127 @@
include(cmake/LinphoneBuilderOptions.cmake)
# List of the projects to build. The order is important and must follow the dependencies.
set(LINPHONE_BUILDER_BUILDERS
antlr3c
polarssl
xml2
)
add_custom_target(TARGET_linphone_builder ALL)
if(${ENABLE_UNIT_TESTS})
list(APPEND LINPHONE_BUILDER_BUILDERS cunit)
endif(${ENABLE_UNIT_TESTS})
if(${ENABLE_SRTP})
list(APPEND LINPHONE_BUILDER_BUILDERS srtp)
endif(${ENABLE_SRTP})
if(${ENABLE_ZRTP})
list(APPEND LINPHONE_BUILDER_BUILDERS bzrtp)
endif(${ENABLE_ZRTP})
if(${ENABLE_GSM})
list(APPEND LINPHONE_BUILDER_BUILDERS gsm)
endif(${ENABLE_GSM})
if(${ENABLE_OPUS})
list(APPEND LINPHONE_BUILDER_BUILDERS opus)
endif(${ENABLE_OPUS})
if(${ENABLE_SPEEX})
list(APPEND LINPHONE_BUILDER_BUILDERS speex)
endif(${ENABLE_SPEEX})
if(${ENABLE_FFMPEG})
list(APPEND LINPHONE_BUILDER_BUILDERS ffmpeg)
endif(${ENABLE_FFMPEG})
if(${ENABLE_VPX})
list(APPEND LINPHONE_BUILDER_BUILDERS vpx)
endif(${ENABLE_VPX})
if("${BUILD_V4L}" STREQUAL "yes")
list(APPEND LINPHONE_BUILDER_BUILDERS v4l)
endif("${BUILD_V4L}" STREQUAL "yes")
list(APPEND LINPHONE_BUILDER_BUILDERS
ortp
ms2
)
# Build belle-sip and its dependencies if it is in the targets list
list(FIND LINPHONE_BUILDER_TARGETS "belle-sip" _target_found)
if(_target_found GREATER -1)
add_custom_target(TARGET_bellesip ALL)
add_dependencies(TARGET_linphone_builder TARGET_bellesip)
linphone_builder_add_builder_to_target(TARGET_bellesip antlr3c)
linphone_builder_add_builder_to_target(TARGET_bellesip polarssl)
if(${ENABLE_UNIT_TESTS})
linphone_builder_add_builder_to_target(TARGET_bellesip cunit)
endif()
if(${ENABLE_TUNNEL})
linphone_builder_add_builder_to_target(TARGET_bellesip tunnel)
endif()
linphone_builder_add_builder_to_target(TARGET_bellesip bellesip)
endif()
if(${ENABLE_TUNNEL})
list(APPEND LINPHONE_BUILDER_BUILDERS tunnel)
endif(${ENABLE_TUNNEL})
list(APPEND LINPHONE_BUILDER_BUILDERS bellesip)
# Build ortp and its dependencies if it is in the targets list
list(FIND LINPHONE_BUILDER_TARGETS "ortp" _target_found)
if(_target_found GREATER -1)
add_custom_target(TARGET_ortp ALL)
add_dependencies(TARGET_linphone_builder TARGET_ortp)
if(${ENABLE_UNIT_TESTS})
linphone_builder_add_builder_to_target(TARGET_ortp cunit)
endif()
if(${ENABLE_SRTP})
linphone_builder_add_builder_to_target(TARGET_ortp srtp)
endif()
if(${ENABLE_ZRTP})
linphone_builder_add_builder_to_target(TARGET_ortp xml2)
linphone_builder_add_builder_to_target(TARGET_ortp bzrtp)
endif()
linphone_builder_add_builder_to_target(TARGET_ortp ortp)
endif()
if(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
list(APPEND LINPHONE_BUILDER_BUILDERS opencoreamr)
endif(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
if(${ENABLE_AMRWB})
list(APPEND LINPHONE_BUILDER_BUILDERS voamrwbenc)
endif(${ENABLE_AMRWB})
if(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
list(APPEND LINPHONE_BUILDER_BUILDERS msamr)
endif(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
if(${ENABLE_G729})
list(APPEND LINPHONE_BUILDER_BUILDERS bcg729)
endif(${ENABLE_G729})
if(${ENABLE_ILBC})
list(APPEND LINPHONE_BUILDER_BUILDERS libilbcrfc3951 msilbc)
endif(${ENABLE_ILBC})
if(${ENABLE_ISAC})
list(APPEND LINPHONE_BUILDER_BUILDERS msisac)
endif(${ENABLE_ISAC})
if(${ENABLE_SILK})
list(APPEND LINPHONE_BUILDER_BUILDERS mssilk)
endif(${ENABLE_SILK})
if(${ENABLE_OPENH264})
list(APPEND LINPHONE_BUILDER_BUILDERS openh264 msopenh264)
endif(${ENABLE_OPENH264})
if(${ENABLE_X264})
list(APPEND LINPHONE_BUILDER_BUILDERS x264 msx264)
endif(${ENABLE_X264})
list(APPEND LINPHONE_BUILDER_BUILDERS linphone)
# Build mediastreamer2 and its dependencies if it is in the targets list
list(FIND LINPHONE_BUILDER_TARGETS "ms2" _target_found)
if(_target_found GREATER -1)
add_custom_target(TARGET_ms2 ALL)
add_dependencies(TARGET_linphone_builder TARGET_ms2)
add_dependencies(TARGET_ms2 TARGET_ortp)
if(${ENABLE_UNIT_TESTS})
linphone_builder_add_builder_to_target(TARGET_ms2 cunit)
endif()
if(${ENABLE_GSM})
linphone_builder_add_builder_to_target(TARGET_ms2 gsm)
endif()
if(${ENABLE_OPUS})
linphone_builder_add_builder_to_target(TARGET_ms2 opus)
endif()
if(${ENABLE_SPEEX})
linphone_builder_add_builder_to_target(TARGET_ms2 speex)
endif()
if(${ENABLE_FFMPEG})
linphone_builder_add_builder_to_target(TARGET_ms2 ffmpeg)
endif()
if(${ENABLE_VPX})
linphone_builder_add_builder_to_target(TARGET_ms2 vpx)
endif()
if("${BUILD_V4L}" STREQUAL "yes")
linphone_builder_add_builder_to_target(TARGET_ms2 v4l)
endif()
linphone_builder_add_builder_to_target(TARGET_ms2 ms2)
endif()
# Include builders
foreach(BUILDER ${LINPHONE_BUILDER_BUILDERS})
message(STATUS "Including builder ${BUILDER}")
include(${CMAKE_CURRENT_SOURCE_DIR}/builders/${BUILDER}.cmake)
endforeach(BUILDER)
# Build mediastreamer2 plugins and its dependencies if it is in the targets list
list(FIND LINPHONE_BUILDER_TARGETS "ms2-plugins" _target_found)
if(_target_found GREATER -1)
add_custom_target(TARGET_ms2plugins ALL)
add_dependencies(TARGET_linphone_builder TARGET_ms2plugins)
add_dependencies(TARGET_ms2plugins TARGET_ms2 TARGET_ortp)
if(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
linphone_builder_add_builder_to_target(TARGET_ms2plugins opencoreamr)
endif()
if(${ENABLE_AMRWB})
linphone_builder_add_builder_to_target(TARGET_ms2plugins voamrwbenc)
endif()
if(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
linphone_builder_add_builder_to_target(TARGET_ms2plugins msamr)
endif()
if(${ENABLE_G729})
linphone_builder_add_builder_to_target(TARGET_ms2plugins bcg729)
endif()
if(${ENABLE_ILBC})
linphone_builder_add_builder_to_target(TARGET_ms2plugins libilbcrfc3951)
linphone_builder_add_builder_to_target(TARGET_ms2plugins msilbc)
endif()
if(${ENABLE_ISAC})
linphone_builder_add_builder_to_target(TARGET_ms2plugins msisac)
endif()
if(${ENABLE_SILK})
linphone_builder_add_builder_to_target(TARGET_ms2plugins mssilk)
endif()
if(${ENABLE_OPENH264})
linphone_builder_add_builder_to_target(TARGET_ms2plugins openh264)
linphone_builder_add_builder_to_target(TARGET_ms2plugins msopenh264)
endif()
if(${ENABLE_X264})
linphone_builder_add_builder_to_target(TARGET_ms2plugins x264)
linphone_builder_add_builder_to_target(TARGET_ms2plugins msx264)
endif()
endif()
# Build linphone and its dependencies if it is in the targets list
list(FIND LINPHONE_BUILDER_TARGETS "linphone" _target_found)
if(_target_found GREATER -1)
add_custom_target(TARGET_linphone ALL)
add_dependencies(TARGET_linphone_builder TARGET_linphone)
add_dependencies(TARGET_linphone TARGET_bellesip TARGET_ortp TARGET_ms2)
linphone_builder_add_builder_to_target(TARGET_linphone xml2)
if(${ENABLE_UNIT_TESTS})
linphone_builder_add_builder_to_target(TARGET_linphone cunit)
endif()
if(${ENABLE_TUNNEL})
linphone_builder_add_builder_to_target(TARGET_linphone tunnel)
endif()
linphone_builder_add_builder_to_target(TARGET_linphone linphone)
endif()
......@@ -43,21 +43,6 @@ else(WIN32)
set(EP_linphone_LINKING_TYPE "--disable-static" "--enable-shared")
set(EP_linphone_DEPENDENCIES EP_bellesip EP_ortp EP_ms2 EP_xml2)
if(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
list(APPEND EP_linphone_DEPENDENCIES EP_msamr)
endif(${ENABLE_AMRNB} OR ${ENABLE_AMRWB})
if(${ENABLE_G729})
list(APPEND EP_linphone_DEPENDENCIES EP_bcg729)
endif(${ENABLE_G729})
if(${ENABLE_ILBC})
list(APPEND EP_linphone_DEPENDENCIES EP_msilbc)
endif(${ENABLE_ILBC})
if(${ENABLE_ISAC})
list(APPEND EP_linphone_DEPENDENCIES EP_msisac)
endif(${ENABLE_ISAC})
if(${ENABLE_SILK})
list(APPEND EP_linphone_DEPENDENCIES EP_mssilk)
endif(${ENABLE_SILK})
if(${ENABLE_SPEEX})
list(APPEND EP_linphone_CONFIGURE_OPTIONS "--enable-speex")
else(${ENABLE_SPEEX})
......@@ -68,12 +53,6 @@ else(WIN32)
else(${ENABLE_VIDEO})
list(APPEND EP_linphone_CONFIGURE_OPTIONS "--disable-video")
endif(${ENABLE_VIDEO})
if(${ENABLE_OPENH264})
list(APPEND EP_linphone_DEPENDENCIES EP_msopenh264)
endif(${ENABLE_OPENH264})
if(${ENABLE_X264})
list(APPEND EP_linphone_DEPENDENCIES EP_msx264)
endif(${ENABLE_X264})
if(${ENABLE_ZRTP})
list(APPEND EP_linphone_CONFIGURE_OPTIONS "--enable-zrtp")
......
......@@ -60,6 +60,7 @@ if(NOT PATCH_PROGRAM)
endif(NOT PATCH_PROGRAM)
set(LINPHONE_BUILDER_EP_VARS)
set(LINPHONE_BUILDER_INCLUDED_BUILDERS)
macro(linphone_builder_expand_external_project_vars)
set(LINPHONE_BUILDER_EP_ARGS "")
......@@ -153,6 +154,41 @@ function(linphone_builder_get_autotools_configuration)
endfunction(linphone_builder_get_autotools_configuration)
macro(linphone_builder_create_targets_list)
set(LINPHONE_BUILDER_TARGETS )
if("${LINPHONE_BUILDER_TARGET}" STREQUAL "belle-sip")
list(APPEND LINPHONE_BUILDER_TARGETS "belle-sip")
elseif("${LINPHONE_BUILDER_TARGET}" STREQUAL "ortp")
list(APPEND LINPHONE_BUILDER_TARGETS "ortp")
elseif("${LINPHONE_BUILDER_TARGET}" STREQUAL "ms2")
list(APPEND LINPHONE_BUILDER_TARGETS "ortp" "ms2")
elseif("${LINPHONE_BUILDER_TARGET}" STREQUAL "ms2-plugins")
list(APPEND LINPHONE_BUILDER_TARGETS "ortp" "ms2" "ms2-plugins")
elseif("${LINPHONE_BUILDER_TARGET}" STREQUAL "linphone")
list(APPEND LINPHONE_BUILDER_TARGETS "belle-sip" "ortp" "ms2" "ms2-plugins" "linphone")
else()
message(FATAL_ERROR "Invalid LINPHONE_BUILDER_TARGET '${LINPHONE_BUILDER_TARGET}'")
endif()
endmacro(linphone_builder_create_targets_list)
macro(linphone_builder_include_builder BUILDER)
list(FIND LINPHONE_BUILDER_INCLUDED_BUILDERS ${BUILDER} _already_included)
if(_already_included EQUAL -1)
message(STATUS "Including builder ${BUILDER}")
include(${CMAKE_CURRENT_SOURCE_DIR}/builders/${BUILDER}.cmake)
list(APPEND LINPHONE_BUILDER_INCLUDED_BUILDERS ${BUILDER})
endif()
unset(_already_included)
endmacro(linphone_builder_include_builder)
macro(linphone_builder_add_builder_to_target TARGETNAME BUILDER)
linphone_builder_include_builder(${BUILDER})
add_dependencies(${TARGETNAME} ${BUILDER})
endmacro(linphone_builder_add_builder_to_target)
macro(linphone_builder_apply_flags)
foreach(BUILD_CONFIG "" "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
if(NOT "${LINPHONE_BUILDER_CPPFLAGS}" STREQUAL "")
......@@ -371,7 +407,7 @@ function(linphone_builder_add_project PROJNAME)
endfunction(linphone_builder_add_project)
function(linphone_builder_add_external_projects)
foreach(BUILDER ${LINPHONE_BUILDER_BUILDERS})
foreach(BUILDER ${LINPHONE_BUILDER_INCLUDED_BUILDERS})
linphone_builder_add_project(${BUILDER})
endforeach(BUILDER)
endfunction(linphone_builder_add_external_projects)
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