Commit fdaeb9b4 authored by Ghislain MARY's avatar Ghislain MARY

Add option to build only external source code.

parent aece4530
......@@ -35,6 +35,7 @@ option(LINPHONE_BUILDER_CHECK_LASTEST "Check that the git revisions are the late
option(LINPHONE_BUILDER_BUILD_DEPENDENCIES "Build the dependencies instead of using the system libraries." YES)
set(LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH "" CACHE STRING "External path to source code that is available.")
set(LINPHONE_BUILDER_DUMMY_LIBRARIES "" CACHE STRING "Dummy libraries to be generated.")
option(LINPHONE_BUILDER_BUILD_ONLY_EXTERNAL_SOURCE_PATH "Build only the code put in external source path." NO)
# Include macros definition to be used by builders
......
......@@ -49,6 +49,7 @@ include(cmake/CheckBuildTools.cmake)
set(LINPHONE_BUILDER_EP_VARS)
set(LINPHONE_BUILDER_INCLUDED_BUILDERS)
set(LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH_BUILDERS)
macro(linphone_builder_expand_external_project_vars)
set(LINPHONE_BUILDER_EP_ARGS "")
......@@ -186,7 +187,29 @@ endmacro()
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}")
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)
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})
endif()
unset(_already_included)
else()
list(REMOVE_ITEM LINPHONE_BUILDER_INCLUDED_BUILDERS ${BUILDER})
endif()
unset(_build_from_external_source_path)
else()
message(STATUS "${TARGETNAME} depends on external project EP_${BUILDER}")
add_dependencies(${TARGETNAME} EP_${BUILDER})
endif()
endmacro()
......@@ -329,6 +352,28 @@ function(linphone_builder_configure_file_for_project PROJNAME CMD DEFAULT_CONF_F
endif()
endfunction()
macro(linphone_builder_filter_out_inexistent_dependencies PROJNAME)
if(EP_${PROJNAME}_DEPENDENCIES)
set(_new_deps )
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}")
if(_found GREATER -1 OR _external_source_path_found GREATER -1)
list(APPEND _new_deps ${_dep})
endif()
endforeach()
unset(_dep)
unset(_found)
unset(_external_source_path_found)
message("_new_deps: ${_new_deps}")
set(EP_${PROJNAME}_DEPENDENCIES ${_new_deps})
unset(_new_deps)
endif()
endmacro()
function(linphone_builder_add_project PROJNAME)
if(LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH)
foreach(SUBDIR ${EP_${PROJNAME}_EXTERNAL_SOURCE_PATHS})
......@@ -506,6 +551,9 @@ function(linphone_builder_add_project PROJNAME)
set(DOWNLOAD_SOURCE GIT_REPOSITORY ${EP_${PROJNAME}_GIT_REPOSITORY} GIT_TAG ${EP_${PROJNAME}_GIT_TAG})
endif()
linphone_builder_filter_out_inexistent_dependencies(${PROJNAME})
message("EP_${PROJNAME}_DEPENDENCIES: ${EP_${PROJNAME}_DEPENDENCIES}")
ExternalProject_Add(EP_${PROJNAME}
DEPENDS ${EP_${PROJNAME}_DEPENDENCIES}
BINARY_DIR ${ep_build}
......
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