build, bindings: check if cppyy is available at runtime and format cmake
This commit is contained in:
@@ -33,7 +33,13 @@ def load_modules():
|
||||
ns3_output_directory = values["out_dir"]
|
||||
libraries = {x.split(".")[0]: x for x in os.listdir(os.path.join(ns3_output_directory, "lib"))}
|
||||
|
||||
import cppyy
|
||||
# Try to import Cppyy and warn the user in case it is not found
|
||||
try:
|
||||
import cppyy
|
||||
except ModuleNotFoundError:
|
||||
print("Cppyy is required by the ns-3 python bindings.")
|
||||
print("You can install it with the following command: pip install cppyy")
|
||||
exit(-1)
|
||||
|
||||
# Enable full logs for debugging
|
||||
# cppyy.set_debug(True)
|
||||
|
||||
@@ -756,12 +756,14 @@ macro(process_options)
|
||||
)
|
||||
else()
|
||||
set(ENABLE_PYTHON_BINDINGS ON)
|
||||
|
||||
set(destination_dir ${CMAKE_OUTPUT_DIRECTORY}/bindings/python/ns)
|
||||
configure_file(
|
||||
bindings/python/ns__init__.py ${destination_dir}/__init__.py COPYONLY
|
||||
)
|
||||
endif()
|
||||
|
||||
# Copy the bindings file if we have python, which will prevent python
|
||||
# scripts from failing due to the missing ns package
|
||||
set(destination_dir ${CMAKE_OUTPUT_DIRECTORY}/bindings/python/ns)
|
||||
configure_file(
|
||||
bindings/python/ns__init__.py ${destination_dir}/__init__.py COPYONLY
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ if(${ENABLE_EXAMPLES})
|
||||
CACHE INTERNAL "list of example folders"
|
||||
)
|
||||
endforeach()
|
||||
scan_python_examples(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
scan_python_examples(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
build_example(
|
||||
NAME realtime-udp-echo
|
||||
SOURCE_FILES realtime-udp-echo.cc
|
||||
LIBRARIES_TO_LINK
|
||||
NAME realtime-udp-echo
|
||||
SOURCE_FILES realtime-udp-echo.cc
|
||||
LIBRARIES_TO_LINK
|
||||
${libcsma}
|
||||
${libinternet}
|
||||
${libapplications}
|
||||
|
||||
@@ -291,4 +291,3 @@ build_example(
|
||||
SOURCE_FILES wifi-ofdm-eht-validation.cc
|
||||
LIBRARIES_TO_LINK ${libwifi}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if(NOT ${ENABLE_EMU})
|
||||
if(NOT
|
||||
${ENABLE_EMU}
|
||||
)
|
||||
message(
|
||||
${HIGHLIGHTED_STATUS}
|
||||
"tap-bridge requires emulation feature"
|
||||
|
||||
Reference in New Issue
Block a user