build: Enable BSD support

This commit is contained in:
Nakayama Kenjiro
2024-06-02 07:46:55 +00:00
committed by Gabriel Ferreira
parent e1725c351b
commit 3c4019304a
7 changed files with 22 additions and 6 deletions

View File

@@ -126,6 +126,8 @@ function(write_lock)
set(lock_filename .lock-ns3_darwin_build)
elseif(WIN32)
set(lock_filename .lock-ns3_win32_build)
elseif(BSD)
set(lock_filename .lock-ns3_bsd_build)
else()
message(FATAL_ERROR "Platform not supported")
endif()

View File

@@ -30,7 +30,11 @@ endif()
# Set Linux flag if on Linux
if(UNIX AND NOT APPLE)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(LINUX TRUE)
else()
set(BSD TRUE)
endif()
add_definitions(-D__LINUX__)
endif()

View File

@@ -1159,7 +1159,11 @@ macro(process_options)
set(PLATFORM_UNSUPPORTED_POST "features. Continuing without them.")
# Remove from libs_to_build all incompatible libraries or the ones that
# dependencies couldn't be installed
if(APPLE OR WSLv1 OR WIN32)
if(APPLE
OR WSLv1
OR WIN32
OR BSD
)
set(ENABLE_TAP OFF)
set(ENABLE_EMU OFF)
set(ENABLE_FDNETDEV FALSE)

4
ns3
View File

@@ -13,7 +13,9 @@ import sys
ns3_path = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
append_to_ns3_path = functools.partial(os.path.join, ns3_path)
out_dir = os.sep.join([ns3_path, "build"])
lock_file = os.sep.join([ns3_path, ".lock-ns3_%s_build" % sys.platform])
platform = sys.platform
platform = "bsd" if "bsd" in platform else platform
lock_file = os.sep.join([ns3_path, ".lock-ns3_%s_build" % platform])
max_cpu_threads = max(1, os.cpu_count() - 1)
print_buffer = ""

View File

@@ -28,6 +28,7 @@
#include <WS2tcpip.h>
#else
#include <arpa/inet.h>
#include <sys/socket.h>
#endif
namespace ns3

View File

@@ -33,6 +33,7 @@
#include <WS2tcpip.h>
#else
#include <arpa/inet.h>
#include <sys/socket.h>
#endif
namespace ns3

View File

@@ -664,9 +664,12 @@ def sigint_hook(signal, frame):
# little less hacky, we should add a command to ns3 to return this info
# and use that result.
#
def read_ns3_config():
lock_filename = ".lock-ns3_%s_build" % sys.platform
platform = sys.platform
platform = "bsd" if "bsd" in platform else platform
lock_filename = ".lock-ns3_%s_build" % platform
def read_ns3_config():
try:
# sys.platform reports linux2 for python2 and linux for python3
with open(lock_filename, "rt", encoding="utf-8") as f:
@@ -1260,7 +1263,6 @@ def run_tests():
#
# Get the information from the build status file.
#
lock_filename = ".lock-ns3_%s_build" % sys.platform
if os.path.exists(lock_filename):
ns3_runnable_programs = get_list_from_file(lock_filename, "ns3_runnable_programs")
ns3_runnable_scripts = get_list_from_file(lock_filename, "ns3_runnable_scripts")