build: Add support for custom failure reason for features

This commit is contained in:
Gabriel Ferreira
2023-07-15 01:47:21 -03:00
parent 5686c9279a
commit b7cf3fb52d
2 changed files with 43 additions and 26 deletions

View File

@@ -54,12 +54,20 @@
# Now the CMake part
set(ON ON)
macro(check_on_or_off user_config_switch confirmation_flag)
if(${user_config_switch})
if(${confirmation_flag})
# Argument parsing
if(${${user_config_switch}})
if(${${confirmation_flag}})
string(APPEND out "${Green}ON${ColourReset}\n")
else()
string(APPEND out "${Red}OFF (missing dependency)${ColourReset}\n")
if(${confirmation_flag}_REASON)
string(APPEND out
"${Red}OFF (${${confirmation_flag}_REASON})${ColourReset}\n"
)
else()
string(APPEND out "${Red}OFF (missing dependency)${ColourReset}\n")
endif()
endif()
else()
string(APPEND out "OFF (not requested)\n")
@@ -120,73 +128,73 @@ macro(write_configtable)
)
string(APPEND out "Build with runtime asserts : ")
check_on_or_off("${NS3_ASSERT}" "${NS3_ASSERT}")
check_on_or_off("NS3_ASSERT" "NS3_ASSERT")
string(APPEND out "Build with runtime logging : ")
check_on_or_off("${NS3_LOG}" "${NS3_LOG}")
check_on_or_off("NS3_LOG" "NS3_LOG")
string(APPEND out "Build version embedding : ")
check_on_or_off("${NS3_ENABLE_BUILD_VERSION}" "${ENABLE_BUILD_VERSION}")
check_on_or_off("NS3_ENABLE_BUILD_VERSION" "ENABLE_BUILD_VERSION")
string(APPEND out "BRITE Integration : ")
check_on_or_off("ON" "${NS3_BRITE}")
check_on_or_off("ON" "NS3_BRITE")
string(APPEND out "DES Metrics event collection : ")
check_on_or_off("${NS3_DES_METRICS}" "${NS3_DES_METRICS}")
check_on_or_off("NS3_DES_METRICS" "NS3_DES_METRICS")
string(APPEND out "DPDK NetDevice : ")
check_on_or_off("${NS3_DPDK}" "${ENABLE_DPDKDEVNET}")
check_on_or_off("NS3_DPDK" "ENABLE_DPDKDEVNET")
string(APPEND out "Emulation FdNetDevice : ")
check_on_or_off("${ENABLE_EMU}" "${ENABLE_EMUNETDEV}")
check_on_or_off("ENABLE_EMU" "ENABLE_EMUNETDEV")
string(APPEND out "Examples : ")
check_on_or_off("${ENABLE_EXAMPLES}" "${ENABLE_EXAMPLES}")
check_on_or_off("ENABLE_EXAMPLES" "ENABLE_EXAMPLES")
string(APPEND out "File descriptor NetDevice : ")
check_on_or_off("ON" "${ENABLE_FDNETDEV}")
check_on_or_off("ON" "ENABLE_FDNETDEV")
string(APPEND out "GNU Scientific Library (GSL) : ")
check_on_or_off("${NS3_GSL}" "${GSL_FOUND}")
check_on_or_off("NS3_GSL" "GSL_FOUND")
string(APPEND out "GtkConfigStore : ")
check_on_or_off("${NS3_GTK3}" "${GTK3_FOUND}")
check_on_or_off("NS3_GTK3" "GTK3_FOUND")
string(APPEND out "LibXml2 support : ")
check_on_or_off("ON" "${LIBXML2_FOUND}")
check_on_or_off("ON" "LIBXML2_FOUND")
string(APPEND out "MPI Support : ")
check_on_or_off("${NS3_MPI}" "${MPI_FOUND}")
check_on_or_off("NS3_MPI" "MPI_FOUND")
string(APPEND out "ns-3 Click Integration : ")
check_on_or_off("ON" "${NS3_CLICK}")
check_on_or_off("ON" "NS3_CLICK")
string(APPEND out "ns-3 OpenFlow Integration : ")
check_on_or_off("ON" "${NS3_OPENFLOW}")
check_on_or_off("ON" "NS3_OPENFLOW")
string(APPEND out "Netmap emulation FdNetDevice : ")
check_on_or_off("${ENABLE_EMU}" "${ENABLE_NETMAP_EMU}")
check_on_or_off("ENABLE_EMU" "ENABLE_NETMAP_EMU")
string(APPEND out "PyViz visualizer : ")
check_on_or_off("${NS3_VISUALIZER}" "${ENABLE_VISUALIZER}")
check_on_or_off("NS3_VISUALIZER" "ENABLE_VISUALIZER")
string(APPEND out "Python Bindings : ")
check_on_or_off("${NS3_PYTHON_BINDINGS}" "${ENABLE_PYTHON_BINDINGS}")
check_on_or_off("NS3_PYTHON_BINDINGS" "ENABLE_PYTHON_BINDINGS")
string(APPEND out "SQLite support : ")
check_on_or_off("${NS3_SQLITE}" "${ENABLE_SQLITE}")
check_on_or_off("NS3_SQLITE" "ENABLE_SQLITE")
string(APPEND out "Eigen3 support : ")
check_on_or_off("${NS3_EIGEN}" "${ENABLE_EIGEN}")
check_on_or_off("NS3_EIGEN" "ENABLE_EIGEN")
string(APPEND out "Tap Bridge : ")
check_on_or_off("${ENABLE_TAP}" "${ENABLE_TAP}")
check_on_or_off("ENABLE_TAP" "ENABLE_TAP")
string(APPEND out "Tap FdNetDevice : ")
check_on_or_off("${ENABLE_TAP}" "${ENABLE_TAPNETDEV}")
check_on_or_off("ENABLE_TAP" "ENABLE_TAPNETDEV")
string(APPEND out "Tests : ")
check_on_or_off("${ENABLE_TESTS}" "${ENABLE_TESTS}")
check_on_or_off("ENABLE_TESTS" "ENABLE_TESTS")
# string(APPEND out "Use sudo to set suid bit : not enabled (option
# --enable-sudo not selected) string(APPEND out "XmlIo : enabled

View File

@@ -935,6 +935,7 @@ macro(process_options)
message(${HIGHLIGHTED_STATUS}
"Python: development libraries were not found"
)
set(ENABLE_PYTHON_BINDINGS_REASON "missing Python development libraries")
endif()
else()
if(${NS3_PYTHON_BINDINGS})
@@ -942,6 +943,7 @@ macro(process_options)
${HIGHLIGHTED_STATUS}
"Python: an incompatible version of Python was found, python bindings will be disabled"
)
set(ENABLE_PYTHON_BINDINGS_REASON "incompatible Python version")
endif()
endif()
@@ -952,11 +954,15 @@ macro(process_options)
${HIGHLIGHTED_STATUS}
"Bindings: python bindings require Python, but it could not be found"
)
set(ENABLE_PYTHON_BINDINGS_REASON "missing dependency: python")
elseif(APPLE AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
# Warn users that Cppyy on ARM Macs isn't supported yet
message(${HIGHLIGHTED_STATUS}
"Bindings: macOS silicon detected -- see issue 930"
)
set(ENABLE_PYTHON_BINDINGS_REASON
"macOS silicon detected -- see issue 930"
)
else()
check_python_packages("cppyy" missing_packages)
if(missing_packages)
@@ -964,6 +970,9 @@ macro(process_options)
${HIGHLIGHTED_STATUS}
"Bindings: python bindings disabled due to the following missing dependencies: ${missing_packages}"
)
set(ENABLE_PYTHON_BINDINGS_REASON
"missing dependency: ${missing_packages}"
)
else()
set(ENABLE_PYTHON_BINDINGS ON)
endif()