Commit 1f8a8850 authored by Ghislain MARY's avatar Ghislain MARY

Group external source path builders in a single external project if asked to.

parent 9a825fd3
......@@ -585,15 +585,19 @@ function(linphone_builder_add_external_project PROJNAME)
endfunction()
function(linphone_builder_add_builtin_project PROJNAME)
message("linphone_builder_add_builtin_project(${PROJNAME}): ${EP_${PROJNAME}_SOURCE_DIR}")
macro(linphone_builder_add_grouped_external_source_path_project PROJNAME FILENAME)
message("linphone_builder_add_grouped_external_source_path_project(${PROJNAME}): ${EP_${PROJNAME}_SOURCE_DIR}")
linphone_builder_filter_out_inexistent_dependencies(${PROJNAME})
message("EP_${PROJNAME}_DEPENDENCIES: ${EP_${PROJNAME}_DEPENDENCIES}")
add_subdirectory("${EP_${PROJNAME}_SOURCE_DIR}" "${LINPHONE_BUILDER_WORK_DIR}/Build/${PROJNAME}")
file(APPEND "${FILENAME}" "add_subdirectory(\"${EP_${PROJNAME}_SOURCE_DIR}\" \"${LINPHONE_BUILDER_WORK_DIR}/Build/${PROJNAME}\")\n")
list(APPEND EP_linphone_builder_LINKING_TYPES "${EP_${PROJNAME}_LINKING_TYPE}")
list(APPEND EP_linphone_builder_CMAKE_OPTIONS "${EP_${PROJNAME}_CMAKE_OPTIONS}")
list(APPEND EP_linphone_builder_ADDITIONAL_CMAKE_OPTIONS "-DEP_${PROJNAME}_INCLUDE_DIR=${EP_${PROJNAME}_SOURCE_DIR}/include")
list(APPEND EP_linphone_builder_ADDITIONAL_CMAKE_OPTIONS "-DEP_${PROJNAME}_CONFIG_DIR=${LINPHONE_BUILDER_WORK_DIR}/Build/${PROJNAME}")
if(EP_${PROJNAME}_DEPENDENCIES)
add_dependencies(EP_${PROJNAME} ${EP_${PROJNAME}_DEPENDENCIES})
endif()
endfunction()
endmacro()
function(linphone_builder_add_external_projects)
message("LINPHONE_BUILDER_INCLUDED_BUILDERS: ${LINPHONE_BUILDER_INCLUDED_BUILDERS}")
......@@ -608,13 +612,30 @@ endfunction()
function(linphone_builder_add_grouped_external_source_path_projects)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS AND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS)
make_directory("${LINPHONE_BUILDER_WORK_DIR}/Source/EP_linphone_builder")
set(_linphone_builder_file "${LINPHONE_BUILDER_WORK_DIR}/Source/EP_linphone_builder/CMakeLists.txt")
file(WRITE "${_linphone_builder_file}" "cmake_minimum_required(VERSION 3.0)\n")
file(APPEND "${_linphone_builder_file}" "project(EP_linphone_builder)\n")
set(EP_linphone_builder_CMAKE_OPTIONS )
set(EP_linphone_builder_ADDITIONAL_CMAKE_OPTIONS "-DLINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS=ON")
set(EP_linphone_builder_LINKING_TYPES )
foreach(BUILDER ${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS})
linphone_builder_add_builtin_project(${BUILDER})
linphone_builder_add_grouped_external_source_path_project(${BUILDER} "${_linphone_builder_file}")
endforeach()
get_target_property(_linphone_deps linphone LINK_LIBRARIES)
get_target_property(_ms2_deps mediastreamer_voip LINK_LIBRARIES)
message("_linphone_deps: ${_linphone_deps}")
message("_ms2_deps: ${_ms2_deps}")
list(REMOVE_DUPLICATES EP_linphone_builder_LINKING_TYPES)
list(LENGTH EP_linphone_builder_LINKING_TYPES _conflicting_linking_types)
if(_conflicting_linking_types GREATER 1)
message(FATAL_ERROR "Conflicing linking types in grouped external source path projects: ${EP_linphone_builder_LINKING_TYPES}")
else()
set(EP_linphone_builder_LINKING_TYPE ${EP_linphone_builder_LINKING_TYPES})
endif()
list(REMOVE_DUPLICATES EP_linphone_builder_CMAKE_OPTIONS)
# TODO: Check for conflicting CMAKE_OPTIONS
list(APPEND EP_linphone_builder_CMAKE_OPTIONS ${EP_linphone_builder_ADDITIONAL_CMAKE_OPTIONS})
linphone_builder_add_external_project("linphone_builder")
add_dependencies(TARGET_linphone_builder EP_linphone_builder)
unset(_conflicting_linking_types)
unset(_linphone_builder_file)
endif()
endfunction()
......
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