Commit 6e984332 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

When OPTIONAL_DEPENDS were specified, ensure that module order is correct.

We need to ensure that the processing order for modules is correct even after
optional modules have been enabled. This overcomes random cmake configuration
errors when modules were not enabled in the right order.

Also added a dependency on boost for paraview. The dummy module currently
discards all dependencies and hence we never ended up adding dependency
for boost on paraview. This overcomes that issue.

Change-Id: I7172acd10a38f798ddb17d246107e55dcc2cc3a2
parent 22d8e2c8
......@@ -36,6 +36,7 @@ macro(add_external_project _name)
foreach (op_dep ${optional_depends})
if (${op_dep}_ENABLED)
list (APPEND arguments DEPENDS ${op_dep})
#message(STATUS "OPTIONAL DEPENDENCY ${cm-project}->${op_dep}")
endif()
endforeach()
set(${cm-project}_ARGUMENTS "${arguments}")
......@@ -47,6 +48,7 @@ macro(add_external_project _name)
set(${cm-project}_DEPENDS "")
set(${cm-project}_ARGUMENTS "")
set(${cm-project}_NEEDED_BY "")
set(${cm-project}_DEPENDS_OPTIONAL "")
set(${cm-project}_CAN_USE_SYSTEM 0)
set (doing "")
......@@ -60,8 +62,8 @@ macro(add_external_project _name)
set (doing "")
elseif (doing STREQUAL "DEPENDS")
list(APPEND ${cm-project}_DEPENDS "${arg}")
elseif ((doing STREQUAL "DEPENDS_OPTIONAL") AND ENABLE_${arg})
list(APPEND ${cm-project}_DEPENDS "${arg}")
elseif (doing STREQUAL "DEPENDS_OPTIONAL")
list(APPEND ${cm-project}_DEPENDS_OPTIONAL "${arg}")
endif()
endforeach()
......@@ -72,7 +74,10 @@ macro(add_external_project _name)
if (USE_SYSTEM_${cm-project})
set(${cm-project}_DEPENDS "")
set(${cm-project}_DEPENDS_OPTIONAL "")
endif()
set(${cm-project}_DEPENDS_ANY
${${cm-project}_DEPENDS} ${${cm-project}_DEPENDS_OPTIONAL})
endif()
endmacro()
......@@ -117,11 +122,27 @@ macro(process_dependencies)
endforeach()
list(SORT CM_PROJECTS_ENABLED) # Deterministic order.
# Order list to satisfy dependencies. We don't include the use-system
# libraries in the depedency walk.
# Order list to satisfy dependencies.
# First only use the non-optional dependencies.
include(TopologicalSort)
topological_sort(CM_PROJECTS_ENABLED "" _DEPENDS)
# Now generate a project order using both, optional and non-optional
# dependencies.
set (CM_PROJECTS_ORDER ${CM_PROJECTS_ENABLED})
topological_sort(CM_PROJECTS_ORDER "" _DEPENDS_ANY)
# Update CM_PROJECTS_ENABLED to be in the correct order taking into
# consideration optional dependencies.
set (new_order)
foreach (cm-project IN LISTS CM_PROJECTS_ORDER)
list(FIND CM_PROJECTS_ENABLED "${cm-project}" found)
if (found GREATER -1)
list(APPEND new_order "${cm-project}")
endif()
endforeach()
set (CM_PROJECTS_ENABLED ${new_order})
# build information about what project needs what.
foreach (cm-project IN LISTS CM_PROJECTS_ENABLED)
enable_project(${cm-project} "")
......
......@@ -6,7 +6,7 @@ endif()
add_external_project(paraview
DEPENDS_OPTIONAL
ffmpeg hdf5 libxml3 manta matplotlib mpi numpy png python qt visitbridge zlib silo cgns
boost ffmpeg hdf5 libxml3 manta matplotlib mpi numpy png python qt visitbridge zlib silo cgns
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=ON
......
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