Commit b6405792 authored by Ghislain MARY's avatar Ghislain MARY

When building only external source code, do not create an external project for each builder.

parent fdaeb9b4
......@@ -73,7 +73,7 @@ else()
# Apply build flags and add external projects
linphone_builder_apply_flags()
linphone_builder_add_external_projects()
linphone_builder_add_projects()
linphone_builder_add_dummy_libraries_generation()
......
......@@ -189,17 +189,20 @@ macro(linphone_builder_add_builder_to_target TARGETNAME BUILDER)
linphone_builder_include_builder(${BUILDER})
if(LINPHONE_BUILDER_BUILD_ONLY_EXTERNAL_SOURCE_PATH AND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH)
foreach(SUBDIR ${EP_${BUILDER}_EXTERNAL_SOURCE_PATHS})
if(EXISTS "${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH}/${SUBDIR}")
set(_source_dir "${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH}/${SUBDIR}")
if(EXISTS "${_source_dir}")
message(STATUS "${TARGETNAME} depends on external source path ${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH}/${SUBDIR}")
add_dependencies(${TARGETNAME} EP_${BUILDER})
set(_build_from_external_source_path 1)
break()
endif()
endforeach()
if(_build_from_external_source_path)
list(FIND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS ${BUILDER} _already_included)
if(_already_included EQUAL -1)
message(STATUS "add external source path builder ${BUILDER}")
list(APPEND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS EP_${BUILDER})
set(EP_${BUILDER}_SOURCE_DIR "${_source_dir}")
list(APPEND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS ${BUILDER})
endif()
unset(_already_included)
else()
......@@ -358,9 +361,10 @@ macro(linphone_builder_filter_out_inexistent_dependencies PROJNAME)
message("EP_${PROJNAME}_DEPENDENCIES: ${EP_${PROJNAME}_DEPENDENCIES}")
message("LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS: ${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS}")
foreach(_dep ${EP_${PROJNAME}_DEPENDENCIES})
list(FIND LINPHONE_BUILDER_INCLUDED_BUILDERS ${_dep} _found)
list(FIND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS ${_dep} _external_source_path_found)
message("_dep: ${_dep} _found: ${_found} _external_source_path_found: ${_external_source_path_found}")
string(REGEX REPLACE "^EP_" "" _dep2 ${_dep})
list(FIND LINPHONE_BUILDER_INCLUDED_BUILDERS ${_dep2} _found)
list(FIND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS ${_dep2} _external_source_path_found)
message("_dep: ${_dep2} _found: ${_found} _external_source_path_found: ${_external_source_path_found}")
if(_found GREATER -1 OR _external_source_path_found GREATER -1)
list(APPEND _new_deps ${_dep})
endif()
......@@ -374,7 +378,7 @@ macro(linphone_builder_filter_out_inexistent_dependencies PROJNAME)
endif()
endmacro()
function(linphone_builder_add_project PROJNAME)
function(linphone_builder_add_external_project PROJNAME)
if(LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH)
foreach(SUBDIR ${EP_${PROJNAME}_EXTERNAL_SOURCE_PATHS})
if(NOT EP_${PROJNAME}_SOURCE_DIR)
......@@ -582,10 +586,40 @@ function(linphone_builder_add_project PROJNAME)
endfunction()
function(linphone_builder_add_builtin_project PROJNAME)
message("linphone_builder_add_builtin_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}")
if(EP_${PROJNAME}_DEPENDENCIES)
add_dependencies(EP_${PROJNAME} ${EP_${PROJNAME}_DEPENDENCIES})
endif()
endfunction()
function(linphone_builder_add_external_projects)
message("LINPHONE_BUILDER_INCLUDED_BUILDERS: ${LINPHONE_BUILDER_INCLUDED_BUILDERS}")
message("LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS: ${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS}")
foreach(BUILDER ${LINPHONE_BUILDER_INCLUDED_BUILDERS})
linphone_builder_add_project(${BUILDER})
list(FIND LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS ${BUILDER} _found)
if(found EQUAL -1)
linphone_builder_add_external_project(${BUILDER})
endif()
endforeach()
endfunction()
function(linphone_builder_add_builtin_projects)
foreach(BUILDER ${LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS})
linphone_builder_add_builtin_project(${BUILDER})
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}")
endfunction()
function(linphone_builder_add_projects)
linphone_builder_add_external_projects()
linphone_builder_add_builtin_projects()
endfunction()
macro(linphone_builder_add_dummy_libraries_generation)
......
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