build: CMake bugfixes

Fixes include:
- Handling of relative paths used as output directories
- Accepting comma separated lists of modules to enable/disable
- Echoing all CMake commands at the end of the execution of ns3 script
- More informative optional features summary output
- Replace absolute paths with relative paths in the printed CMake output for less verbose output
- Set debug build type on the CMake side to ensure ccmake doesn't crash
- Prefix INT64X64 with NS3 to indicate user switch
- Compiler version check
- Removal of verbose option
- Suppress empty enabled/disabled module tables

Features include:
- Test for installation/uninstallation of ns-3 as a CMake package
- Test importing ns-3 as a CMake package and use in a 3rd-party project
- Test to check VERSION usage
- ns3 option to enable/disable sanitizers
- Associate headers to libraries targets
This commit is contained in:
Gabriel Ferreira
2021-12-10 02:13:43 +00:00
parent 0e32b5304b
commit f6ef415392
20 changed files with 730 additions and 265 deletions

View File

@@ -63,10 +63,10 @@ macro(check_on_or_off user_config_switch confirmation_flag)
if(${confirmation_flag})
string(APPEND out "ON\n")
else()
string(APPEND out "OFF (not found)\n")
string(APPEND out "OFF (missing dependency)\n")
endif()
else()
string(APPEND out "OFF\n")
string(APPEND out "OFF (not requested)\n")
endif()
endmacro()
@@ -111,14 +111,18 @@ macro(write_fakewaf_config)
string(APPEND out "BRITE Integration : ")
check_on_or_off("ON" "${NS3_BRITE}")
string(APPEND out "DES Metrics event collection : ${NS3_DES_METRICS}\n")
string(APPEND out "DES Metrics event collection : ")
check_on_or_off("${NS3_DES_METRICS}" "${NS3_DES_METRICS}")
string(APPEND out "DPDK NetDevice : ")
check_on_or_off("ON" "${ENABLE_DPDKDEVNET}")
string(APPEND out "Emulation FdNetDevice : ")
check_on_or_off("${NS3_EMU}" "${ENABLE_EMU}")
check_on_or_off("${ENABLE_EMU}" "${ENABLE_EMUNETDEV}")
string(APPEND out "Examples : ")
check_on_or_off("${ENABLE_EXAMPLES}" "${ENABLE_EXAMPLES}")
string(APPEND out "Examples : ${EXAMPLES_ENABLED}\n")
string(APPEND out "File descriptor NetDevice : ")
check_on_or_off("ON" "${ENABLE_FDNETDEV}")
@@ -141,7 +145,7 @@ macro(write_fakewaf_config)
check_on_or_off("ON" "${NS3_OPENFLOW}")
string(APPEND out "Netmap emulation FdNetDevice : ")
check_on_or_off("${NS3_EMU}" "${ENABLE_NETMAP_EMU}")
check_on_or_off("${ENABLE_EMU}" "${ENABLE_NETMAP_EMU}")
string(
APPEND
@@ -153,21 +157,29 @@ macro(write_fakewaf_config)
out
"PlanetLab FdNetDevice : flag is set to ${NS3_PLANETLAB}, but currently not supported\n"
)
string(APPEND out "PyViz visualizer : ${NS3_VISUALIZER}\n")
string(APPEND out "PyViz visualizer : ")
check_on_or_off("${NS3_VISUALIZER}" "${ENABLE_VISUALIZER}")
# string(APPEND out "Python API Scanning Support : not enabled (castxml too
# old)
string(APPEND out "Python Bindings : ${NS3_PYTHON_BINDINGS}\n")
string(APPEND out "Python Bindings : ")
check_on_or_off("${NS3_PYTHON_BINDINGS}" "${ENABLE_PYTHON_BINDINGS}")
string(APPEND out "Real Time Simulator : ")
check_on_or_off("${NS3_REALTIME}" "${ENABLE_REALTIME}")
string(APPEND out "SQLite stats support : ")
check_on_or_off("${NS3_SQLITE}" "${ENABLE_SQLITE}")
string(APPEND out "Tap Bridge : ${NS3_TAP}\n")
string(APPEND out "Tap FdNetDevice : ")
check_on_or_off("${NS3_TAP}" "${ENABLE_TAP}")
string(APPEND out "Tap Bridge : ")
check_on_or_off("${ENABLE_TAP}" "${ENABLE_TAP}")
string(APPEND out "Tap FdNetDevice : ")
check_on_or_off("${ENABLE_TAP}" "${ENABLE_TAPNETDEV}")
string(APPEND out "Tests : ")
check_on_or_off("${ENABLE_TESTS}" "${ENABLE_TESTS}")
string(APPEND out "Tests : ${TESTS_ENABLED}\n")
string(APPEND out "Threading Primitives : ")
check_on_or_off("${NS3_PTHREAD}" "${THREADS_ENABLED}")
@@ -176,10 +188,16 @@ macro(write_fakewaf_config)
string(APPEND out "\n\n")
set(really-enabled-modules ${ns3-libs};${ns3-contrib-libs})
print_formatted_table_with_modules(
"Modules that can be built" "${really-enabled-modules}" "out"
)
string(APPEND out "\n")
if(${ENABLE_TESTS})
list(APPEND really-enabled-modules libtest) # test is an object library and
# is treated differently
endif()
if(really-enabled-modules)
print_formatted_table_with_modules(
"Modules configured to be built" "${really-enabled-modules}" "out"
)
string(APPEND out "\n")
endif()
set(disabled-modules)
foreach(module ${ns3-all-enabled-modules})
@@ -187,10 +205,13 @@ macro(write_fakewaf_config)
list(APPEND disabled-modules ${module})
endif()
endforeach()
print_formatted_table_with_modules(
"Modules that cannot be built" "${disabled-modules}" "out"
)
string(APPEND out "\n")
if(disabled-modules)
print_formatted_table_with_modules(
"Modules that cannot be built" "${disabled-modules}" "out"
)
string(APPEND out "\n")
endif()
file(WRITE ${PROJECT_BINARY_DIR}/ns3wafconfig.txt ${out})
message(STATUS ${out})