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

Rework to prevent defining target dependencies.

parent d275ac90
############################################################################ ############################################################################
# CMakeLists.txt # CMakeLists.txt
# Copyright (C) 2014 Belledonne Communications, Grenoble France # Copyright (C) 2014-2018 Belledonne Communications, Grenoble France
# #
############################################################################ ############################################################################
# #
...@@ -60,13 +60,8 @@ else() ...@@ -60,13 +60,8 @@ else()
include(${LINPHONE_BUILDER_EXTERNAL_BUILDERS_PATH}/CMakeLists.txt) include(${LINPHONE_BUILDER_EXTERNAL_BUILDERS_PATH}/CMakeLists.txt)
endif() endif()
# Include builder options definitions according to the targets to be built # Include common builder options definitions
include(${CMAKE_CURRENT_LIST_DIR}/../options/common.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../options/common.cmake)
foreach(_target IN LISTS TARGET_${LINPHONE_BUILDER_TARGET}_DEPENDENCIES)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../options/${_target}.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../options/${_target}.cmake)
endif()
endforeach()
# Check for build tools and show an error if one of them is not present # Check for build tools and show an error if one of them is not present
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/CheckBuildTools.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../cmake/CheckBuildTools.cmake)
......
############################################################################ ############################################################################
# CMakeLists.txt # CMakeLists.txt
# Copyright (C) 2014 Belledonne Communications, Grenoble France # Copyright (C) 2014-2018 Belledonne Communications, Grenoble France
# #
############################################################################ ############################################################################
# #
...@@ -222,15 +222,20 @@ macro(lcb_add_target_dependencies TARGET_NAME) ...@@ -222,15 +222,20 @@ macro(lcb_add_target_dependencies TARGET_NAME)
endforeach() endforeach()
endmacro() endmacro()
# DEPRECATED: Use lcb_define_targets() instead
macro(lcb_define_target TARGET_NAME) macro(lcb_define_target TARGET_NAME)
unset(TARGET_${TARGET_NAME}_DEPENDENCIES)
set(_args "${ARGN}") set(_args "${ARGN}")
lcb_add_target_dependencies("${TARGET_NAME}" ${_args})
list(APPEND TARGET_${TARGET_NAME}_DEPENDENCIES "${TARGET_NAME}")
list(APPEND LINPHONE_BUILDER_TARGETS "${TARGET_NAME}") list(APPEND LINPHONE_BUILDER_TARGETS "${TARGET_NAME}")
set_property(CACHE LINPHONE_BUILDER_TARGET PROPERTY STRINGS ${LINPHONE_BUILDER_TARGETS}) set_property(CACHE LINPHONE_BUILDER_TARGET PROPERTY STRINGS ${LINPHONE_BUILDER_TARGETS})
endmacro() endmacro()
macro(lcb_define_targets)
set(_args "${ARGN}")
foreach(_arg IN LISTS _args)
lcb_define_target("${_arg}")
endforeach()
endmacro()
macro(lcb_add_builder_to_target TARGET_NAME BUILDER_NAME) macro(lcb_add_builder_to_target TARGET_NAME BUILDER_NAME)
list(APPEND TARGET_${TARGET_NAME}_BUILDERS "${BUILDER_NAME}") list(APPEND TARGET_${TARGET_NAME}_BUILDERS "${BUILDER_NAME}")
endmacro() endmacro()
...@@ -245,11 +250,6 @@ endmacro() ...@@ -245,11 +250,6 @@ endmacro()
macro(lcb_declare_target TARGET_NAME) macro(lcb_declare_target TARGET_NAME)
add_custom_target(TARGET_${TARGET_NAME} ALL) add_custom_target(TARGET_${TARGET_NAME} ALL)
add_dependencies(TARGET_linphone_builder TARGET_${TARGET_NAME}) add_dependencies(TARGET_linphone_builder TARGET_${TARGET_NAME})
foreach(_dependency IN LISTS TARGET_${TARGET_NAME}_DEPENDENCIES)
if(NOT _dependency STREQUAL "${TARGET_NAME}")
add_dependencies(TARGET_${TARGET_NAME} TARGET_${_dependency})
endif()
endforeach()
unset(_dependencies) unset(_dependencies)
linphone_builder_add_builder_to_target(TARGET_${TARGET_NAME} "${TARGET_NAME}" TRUE _dependencies) linphone_builder_add_builder_to_target(TARGET_${TARGET_NAME} "${TARGET_NAME}" TRUE _dependencies)
list(APPEND LINPHONE_BUILDER_INCLUDED_BUILDERS ${_dependencies}) list(APPEND LINPHONE_BUILDER_INCLUDED_BUILDERS ${_dependencies})
...@@ -257,9 +257,7 @@ endmacro() ...@@ -257,9 +257,7 @@ endmacro()
macro(lcb_declare_targets) macro(lcb_declare_targets)
add_custom_target(TARGET_linphone_builder ALL) add_custom_target(TARGET_linphone_builder ALL)
foreach(_target IN LISTS TARGET_${LINPHONE_BUILDER_TARGET}_DEPENDENCIES) lcb_declare_target("${LINPHONE_BUILDER_TARGET}")
lcb_declare_target("${_target}")
endforeach()
endmacro() endmacro()
...@@ -281,6 +279,9 @@ macro(linphone_builder_include_builder BUILDER INCLUDE_AFTER DEPENDENCIES _inclu ...@@ -281,6 +279,9 @@ macro(linphone_builder_include_builder BUILDER INCLUDE_AFTER DEPENDENCIES _inclu
if(EXISTS "${_builder_filepath}") if(EXISTS "${_builder_filepath}")
message(STATUS "Including builder ${BUILDER}") message(STATUS "Including builder ${BUILDER}")
set(LINPHONE_BUILDER_CURRENT_BUILDER "${BUILDER}") set(LINPHONE_BUILDER_CURRENT_BUILDER "${BUILDER}")
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../options/${BUILDER}.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../options/${BUILDER}.cmake)
endif()
include(${_builder_filepath}) include(${_builder_filepath})
if(INCLUDE_AFTER) if(INCLUDE_AFTER)
list(APPEND ${DEPENDENCIES} ${BUILDER}) list(APPEND ${DEPENDENCIES} ${BUILDER})
...@@ -986,7 +987,41 @@ macro(linphone_builder_add_grouped_external_source_path_projects) ...@@ -986,7 +987,41 @@ macro(linphone_builder_add_grouped_external_source_path_projects)
endif() endif()
endmacro() endmacro()
macro(linphone_builder_sort_builders)
set(_ordered_builders)
set(_to_process_builders ${LINPHONE_BUILDER_INCLUDED_BUILDERS})
list(LENGTH _to_process_builders _remaining_builders_count)
while(_remaining_builders_count GREATER 0)
set(_processed_builders)
foreach(_builder IN LISTS _to_process_builders)
if(NOT EP_${_builder}_DEPENDENCIES)
list(APPEND _ordered_builders ${_builder})
list(APPEND _processed_builders ${_builder})
else()
set(_to_add TRUE)
foreach(_dep IN LISTS EP_${_builder}_DEPENDENCIES)
string(SUBSTRING "${_dep}" 3 -1 _dep)
list(FIND _ordered_builders ${_dep} _found)
if(_found EQUAL -1)
set(_to_add FALSE)
endif()
endforeach()
if(_to_add)
list(APPEND _ordered_builders ${_builder})
list(APPEND _processed_builders ${_builder})
endif()
endif()
endforeach()
foreach(_builder IN LISTS _processed_builders)
list(REMOVE_ITEM _to_process_builders ${_builder})
endforeach()
list(LENGTH _to_process_builders _remaining_builders_count)
endwhile()
set(LINPHONE_BUILDER_INCLUDED_BUILDERS ${_ordered_builders})
endmacro()
macro(linphone_builder_add_projects) macro(linphone_builder_add_projects)
linphone_builder_sort_builders()
linphone_builder_add_external_projects() linphone_builder_add_external_projects()
linphone_builder_add_grouped_external_source_path_projects() linphone_builder_add_grouped_external_source_path_projects()
endmacro() endmacro()
......
############################################################################ ############################################################################
# belle-sip.cmake # bellesip.cmake
# Copyright (C) 2015 Belledonne Communications, Grenoble France # Copyright (C) 2015-2018 Belledonne Communications, Grenoble France
# #
############################################################################ ############################################################################
# #
......
############################################################################ ############################################################################
# CMakeLists.txt # CMakeLists.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France # Copyright (C) 2016-2018 Belledonne Communications, Grenoble France
# #
############################################################################ ############################################################################
# #
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
# #
############################################################################ ############################################################################
lcb_define_target("bctoolbox") lcb_define_targets(
lcb_define_target("bellesip" "bctoolbox") bctoolbox
lcb_define_target("belr" "bctoolbox") belcard
lcb_define_target("belcard" "belr") bellesip
lcb_define_target("ortp" "bctoolbox") belr
lcb_define_target("ms2" "ortp") flexisip
lcb_define_target("ms2plugins" "ms2") linphone
lcb_define_target("linphone" "bellesip" "ms2plugins" "belr") ms2
lcb_define_target("odb") ms2plugins
lcb_define_target("flexisip" "linphone") ortp
)
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