core: (fixes #416) remove librt checks

This commit is contained in:
Tommaso Pecorella
2021-11-19 01:14:24 +01:00
committed by Tommaso Pecorella
parent e7abd0f462
commit 5e551a2180
13 changed files with 48 additions and 106 deletions

View File

@@ -79,8 +79,7 @@ set(NS3_OUTPUT_DIRECTORY "" CACHE STRING "Directory to store built artifacts")
option(NS3_PRECOMPILE_HEADERS option(NS3_PRECOMPILE_HEADERS
"Precompile module headers to speed up compilation" ON "Precompile module headers to speed up compilation" ON
) )
option(NS3_PYTHON_BINDINGS "Build ns-3 python bindings" ON) option(NS3_PYTHON_BINDINGS "Build ns-3 python bindings" OFF)
option(NS3_REALTIME "Build with realtime support" ON)
option(NS3_SQLITE "Build with SQLite support" ON) option(NS3_SQLITE "Build with SQLite support" ON)
option(NS3_STATIC "Build a static ns-3 library and link it against executables" option(NS3_STATIC "Build a static ns-3 library and link it against executables"
OFF OFF

View File

@@ -15,6 +15,5 @@
#cmakedefine01 HAVE_STDLIB_H #cmakedefine01 HAVE_STDLIB_H
#cmakedefine01 HAVE_GETENV #cmakedefine01 HAVE_GETENV
#cmakedefine01 HAVE_SIGNAL_H #cmakedefine01 HAVE_SIGNAL_H
#cmakedefine HAVE_RT
#endif //NS3_CORE_CONFIG_H #endif //NS3_CORE_CONFIG_H

View File

@@ -163,9 +163,6 @@ macro(write_configtable)
string(APPEND out "Python Bindings : ") 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 "Real Time Simulator : ")
check_on_or_off("${NS3_REALTIME}" "${ENABLE_REALTIME}")
string(APPEND out "SQLite support : ") string(APPEND out "SQLite support : ")
check_on_or_off("${NS3_SQLITE}" "${ENABLE_SQLITE}") check_on_or_off("${NS3_SQLITE}" "${ENABLE_SQLITE}")

View File

@@ -657,8 +657,6 @@ macro(process_options)
if(${NS3_STATIC}) if(${NS3_STATIC})
# Warn users that they may be using shared libraries, which won't produce a # Warn users that they may be using shared libraries, which won't produce a
# standalone static library # standalone static library
set(ENABLE_REALTIME FALSE)
set(HAVE_RT FALSE)
message( message(
WARNING "Statically linking 3rd party libraries have not been tested.\n" WARNING "Statically linking 3rd party libraries have not been tested.\n"
"Disable Brite, Click, Gtk, GSL, Mpi, Openflow and SQLite" "Disable Brite, Click, Gtk, GSL, Mpi, Openflow and SQLite"
@@ -675,26 +673,6 @@ macro(process_options)
add_definitions(-DHAVE_LIBXML2) add_definitions(-DHAVE_LIBXML2)
include_directories(${LIBXML2_INCLUDE_DIR}) include_directories(${LIBXML2_INCLUDE_DIR})
endif() endif()
# LibRT
mark_as_advanced(LIBRT)
set(ENABLE_REALTIME FALSE)
if(${NS3_REALTIME})
if(APPLE)
message(
STATUS "Lib RT is not supported on Mac OS X. Continuing without it."
)
else()
find_library(LIBRT rt QUIET)
if(NOT ${LIBRT_FOUND})
message(FATAL_ERROR "LibRT was not found.")
else()
message(STATUS "LibRT was found.")
set(ENABLE_REALTIME TRUE)
set(HAVE_RT TRUE) # for core-config.h
endif()
endif()
endif()
endif() endif()
set(THREADS_PREFER_PTHREAD_FLAG) set(THREADS_PREFER_PTHREAD_FLAG)

View File

@@ -1,10 +1,8 @@
if(${ENABLE_REALTIME}) build_example(
build_example( NAME realtime-udp-echo
NAME realtime-udp-echo SOURCE_FILES realtime-udp-echo.cc
SOURCE_FILES realtime-udp-echo.cc LIBRARIES_TO_LINK
LIBRARIES_TO_LINK ${libcsma}
${libcsma} ${libinternet}
${libinternet} ${libapplications}
${libapplications} )
)
endif()

View File

@@ -8,7 +8,7 @@
# #
# See test.py for more information. # See test.py for more information.
cpp_examples = [ cpp_examples = [
("realtime-udp-echo", "ENABLE_REAL_TIME == True", "True"), ("realtime-udp-echo", "True", "True"),
] ]
# A list of Python examples to run in order to ensure that they remain # A list of Python examples to run in order to ensure that they remain

View File

@@ -64,27 +64,6 @@ else()
) )
endif() endif()
set(rt_sources)
set(rt_headers)
if(${ENABLE_REALTIME})
set(rt_sources
model/realtime-simulator-impl.cc
model/wall-clock-synchronizer.cc
)
set(rt_headers
model/realtime-simulator-impl.h
model/wall-clock-synchronizer.h
)
set(libraries_to_link
${libraries_to_link}
${LIBRT}
)
endif()
set(osclock_sources
model/unix-system-wall-clock-ms.cc
)
set(int64x64_sources) set(int64x64_sources)
set(int64x64_headers) set(int64x64_headers)
@@ -146,8 +125,6 @@ endif()
# Define core lib sources # Define core lib sources
set(source_files set(source_files
${rt_sources}
${osclock_sources}
${int64x64_sources} ${int64x64_sources}
${example_as_test_sources} ${example_as_test_sources}
${embedded_version_sources} ${embedded_version_sources}
@@ -210,15 +187,17 @@ set(source_files
model/node-printer.cc model/node-printer.cc
model/show-progress.cc model/show-progress.cc
model/time-printer.cc model/time-printer.cc
model/system-wall-clock-ms.cc
model/system-wall-clock-timestamp.cc model/system-wall-clock-timestamp.cc
model/length.cc model/length.cc
model/trickle-timer.cc model/trickle-timer.cc
model/unix-fd-reader.cc model/unix-fd-reader.cc
model/realtime-simulator-impl.cc
model/wall-clock-synchronizer.cc
) )
# Define core lib headers # Define core lib headers
set(header_files set(header_files
${rt_headers}
${int64x64_headers} ${int64x64_headers}
${example_as_test_headers} ${example_as_test_headers}
${embedded_version_headers} ${embedded_version_headers}
@@ -317,6 +296,8 @@ set(header_files
model/valgrind.h model/valgrind.h
model/vector.h model/vector.h
model/watchdog.h model/watchdog.h
model/realtime-simulator-impl.h
model/wall-clock-synchronizer.h
) )
set(test_sources set(test_sources

View File

@@ -42,14 +42,12 @@ if(${ENABLE_BUILD_VERSION})
) )
endif() endif()
if(${ENABLE_REALTIME}) build_lib_example(
build_lib_example( NAME main-test-sync
NAME main-test-sync SOURCE_FILES main-test-sync.cc
SOURCE_FILES main-test-sync.cc LIBRARIES_TO_LINK ${libnetwork}
LIBRARIES_TO_LINK ${libnetwork} ${CMAKE_THREAD_LIBS_INIT}
${CMAKE_THREAD_LIBS_INIT} )
)
endif()
build_lib_example( build_lib_example(
NAME empirical-random-variable-example NAME empirical-random-variable-example

View File

@@ -18,7 +18,6 @@
#include <ctime> // clock_t #include <ctime> // clock_t
#include <sys/time.h> // gettimeofday #include <sys/time.h> // gettimeofday
// clock_getres: glibc < 2.17, link with librt
#include "log.h" #include "log.h"
#include "wall-clock-synchronizer.h" #include "wall-clock-synchronizer.h"

View File

@@ -283,9 +283,7 @@ public:
: TestSuite ("threaded-simulator") : TestSuite ("threaded-simulator")
{ {
std::string simulatorTypes[] = { std::string simulatorTypes[] = {
#ifdef HAVE_RT
"ns3::RealtimeSimulatorImpl", "ns3::RealtimeSimulatorImpl",
#endif
"ns3::DefaultSimulatorImpl" "ns3::DefaultSimulatorImpl"
}; };
std::string schedulerTypes[] = { std::string schedulerTypes[] = {
@@ -294,7 +292,7 @@ public:
"ns3::MapScheduler", "ns3::MapScheduler",
"ns3::CalendarScheduler" "ns3::CalendarScheduler"
}; };
unsigned int threadcounts[] = { unsigned int threadCounts[] = {
0, 0,
2, 2,
10, 10,
@@ -302,14 +300,16 @@ public:
}; };
ObjectFactory factory; ObjectFactory factory;
for (unsigned int i = 0; i < (sizeof(simulatorTypes) / sizeof(simulatorTypes[0])); ++i) for (auto &simulatorType : simulatorTypes)
{ {
for (unsigned int j = 0; j < (sizeof(threadcounts) / sizeof(threadcounts[0])); ++j) for (auto &schedulerType : schedulerTypes)
{ {
for (unsigned int k = 0; k < (sizeof(schedulerTypes) / sizeof(schedulerTypes[0])); ++k) for (auto &threadCount : threadCounts)
{ {
factory.SetTypeId (schedulerTypes[k]); factory.SetTypeId (schedulerType);
AddTestCase (new ThreadedSimulatorEventsTestCase (factory, simulatorTypes[i], threadcounts[j]), TestCase::QUICK); AddTestCase (
new ThreadedSimulatorEventsTestCase (factory, simulatorType, threadCount),
TestCase::QUICK);
} }
} }
} }

View File

@@ -100,7 +100,6 @@ if(HAVE_NET_ETHERNET_H)
AND HAVE_IF_TUN_H AND HAVE_IF_TUN_H
AND HAVE_SYS_IOCTL_H AND HAVE_SYS_IOCTL_H
AND ${ENABLE_TAP} AND ${ENABLE_TAP}
AND ${ENABLE_REALTIME}
AND ${ENABLE_EMU} AND ${ENABLE_EMU}
) )
set(ENABLE_TAPNETDEV set(ENABLE_TAPNETDEV

View File

@@ -18,26 +18,24 @@ build_lib_example(
${libapplications} ${libapplications}
) )
if(${ENABLE_REALTIME}) build_lib_example(
build_lib_example( NAME realtime-dummy-network
NAME realtime-dummy-network SOURCE_FILES realtime-dummy-network.cc
SOURCE_FILES realtime-dummy-network.cc LIBRARIES_TO_LINK
LIBRARIES_TO_LINK ${libfd-net-device}
${libfd-net-device} ${libinternet}
${libinternet} ${libapplications}
${libapplications} ${libinternet-apps}
${libinternet-apps} )
)
build_lib_example( build_lib_example(
NAME realtime-fd2fd-onoff NAME realtime-fd2fd-onoff
SOURCE_FILES realtime-fd2fd-onoff.cc SOURCE_FILES realtime-fd2fd-onoff.cc
LIBRARIES_TO_LINK LIBRARIES_TO_LINK
${libfd-net-device} ${libfd-net-device}
${libinternet} ${libinternet}
${libapplications} ${libapplications}
) )
endif()
if(${ENABLE_EMU}) if(${ENABLE_EMU})
build_lib_example( build_lib_example(

View File

@@ -1,11 +1,7 @@
if((NOT if(NOT ${ENABLE_EMU})
${ENABLE_REALTIME})
OR (NOT
${ENABLE_EMU})
)
message( message(
${HIGHLIGHTED_STATUS} ${HIGHLIGHTED_STATUS}
"tap-bridge requires emulation and realtime features" "tap-bridge requires emulation feature"
) )
message( message(
${HIGHLIGHTED_STATUS} ${HIGHLIGHTED_STATUS}