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
"Precompile module headers to speed up compilation" ON
)
option(NS3_PYTHON_BINDINGS "Build ns-3 python bindings" ON)
option(NS3_REALTIME "Build with realtime support" ON)
option(NS3_PYTHON_BINDINGS "Build ns-3 python bindings" OFF)
option(NS3_SQLITE "Build with SQLite support" ON)
option(NS3_STATIC "Build a static ns-3 library and link it against executables"
OFF

View File

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

View File

@@ -163,9 +163,6 @@ macro(write_configtable)
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 support : ")
check_on_or_off("${NS3_SQLITE}" "${ENABLE_SQLITE}")

View File

@@ -657,8 +657,6 @@ macro(process_options)
if(${NS3_STATIC})
# Warn users that they may be using shared libraries, which won't produce a
# standalone static library
set(ENABLE_REALTIME FALSE)
set(HAVE_RT FALSE)
message(
WARNING "Statically linking 3rd party libraries have not been tested.\n"
"Disable Brite, Click, Gtk, GSL, Mpi, Openflow and SQLite"
@@ -675,26 +673,6 @@ macro(process_options)
add_definitions(-DHAVE_LIBXML2)
include_directories(${LIBXML2_INCLUDE_DIR})
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()
set(THREADS_PREFER_PTHREAD_FLAG)

View File

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

View File

@@ -8,7 +8,7 @@
#
# See test.py for more information.
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

View File

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

View File

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

View File

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

View File

@@ -283,9 +283,7 @@ public:
: TestSuite ("threaded-simulator")
{
std::string simulatorTypes[] = {
#ifdef HAVE_RT
"ns3::RealtimeSimulatorImpl",
#endif
"ns3::DefaultSimulatorImpl"
};
std::string schedulerTypes[] = {
@@ -294,7 +292,7 @@ public:
"ns3::MapScheduler",
"ns3::CalendarScheduler"
};
unsigned int threadcounts[] = {
unsigned int threadCounts[] = {
0,
2,
10,
@@ -302,14 +300,16 @@ public:
};
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]);
AddTestCase (new ThreadedSimulatorEventsTestCase (factory, simulatorTypes[i], threadcounts[j]), TestCase::QUICK);
factory.SetTypeId (schedulerType);
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_SYS_IOCTL_H
AND ${ENABLE_TAP}
AND ${ENABLE_REALTIME}
AND ${ENABLE_EMU}
)
set(ENABLE_TAPNETDEV

View File

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

View File

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