build: Update CMake to use system threads
With the help of Gabriel Ferreira and Tommaso Pecorella.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#cmakedefine01 HAVE_STDLIB_H
|
||||
#cmakedefine01 HAVE_GETENV
|
||||
#cmakedefine01 HAVE_SIGNAL_H
|
||||
#cmakedefine01 HAVE_PTHREAD_H
|
||||
#cmakedefine HAVE_RT
|
||||
|
||||
#endif //NS3_CORE_CONFIG_H
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
# Tap Bridge : enabled
|
||||
# Tap FdNetDevice : enabled
|
||||
# Tests : not enabled (defaults to disabled)
|
||||
# Threading Primitives : enabled
|
||||
# Use sudo to set suid bit : not enabled (option --enable-sudo not selected)
|
||||
# XmlIo : enabled
|
||||
#
|
||||
|
||||
@@ -110,7 +110,10 @@ function(build_lib)
|
||||
endif()
|
||||
|
||||
# Split ns and non-ns libraries to manage their propagation properly
|
||||
set(non_ns_libraries_to_link)
|
||||
set(non_ns_libraries_to_link
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
set(ns_libraries_to_link)
|
||||
|
||||
foreach(library ${BLIB_LIBRARIES_TO_LINK})
|
||||
|
||||
@@ -688,13 +688,8 @@ macro(process_options)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG)
|
||||
find_package(Threads QUIET)
|
||||
if(${CMAKE_USE_PTHREADS_INIT})
|
||||
include_directories(${THREADS_PTHREADS_INCLUDE_DIR})
|
||||
set(HAVE_PTHREAD_H TRUE) # for core-config.h
|
||||
set(THREADS_ENABLED TRUE)
|
||||
set(THREADS_FOUND TRUE)
|
||||
else()
|
||||
message(FATAL_ERROR Pthreads are required by ns-3)
|
||||
if(NOT ${Threads_FOUND})
|
||||
message(FATAL_ERROR Threads are required by ns-3)
|
||||
endif()
|
||||
|
||||
set(Python3_LIBRARIES)
|
||||
|
||||
@@ -563,8 +563,6 @@ output that looks similar to the following:
|
||||
-- Looking for C++ include signal.h - found
|
||||
-- Looking for C++ include netpacket/packet.h
|
||||
-- Looking for C++ include netpacket/packet.h - found
|
||||
-- Looking for C++ include semaphore.h
|
||||
-- Looking for C++ include semaphore.h - found
|
||||
-- Looking for getenv
|
||||
-- Looking for getenv - found
|
||||
-- Processing src/antenna
|
||||
@@ -653,7 +651,6 @@ output that looks similar to the following:
|
||||
Tap Bridge : ON
|
||||
Tap FdNetDevice : ON
|
||||
Tests : ON
|
||||
Threading Primitives : ON
|
||||
|
||||
|
||||
Modules configured to be built:
|
||||
|
||||
@@ -120,26 +120,6 @@ elseif(
|
||||
)
|
||||
endif()
|
||||
|
||||
set(thread_sources
|
||||
model/system-thread.cc
|
||||
model/unix-fd-reader.cc
|
||||
model/unix-system-condition.cc
|
||||
model/unix-system-mutex.cc
|
||||
)
|
||||
set(thread_headers
|
||||
model/system-condition.h
|
||||
model/system-mutex.h
|
||||
model/system-thread.h
|
||||
model/unix-fd-reader.h
|
||||
)
|
||||
set(libraries_to_link
|
||||
${libraries_to_link}
|
||||
pthread
|
||||
)
|
||||
set(thread_test_sources
|
||||
test/threaded-test-suite.cc
|
||||
)
|
||||
|
||||
if(${ENABLE_EXAMPLES})
|
||||
set(example_as_test_sources
|
||||
model/example-as-test.cc
|
||||
@@ -169,7 +149,6 @@ set(source_files
|
||||
${rt_sources}
|
||||
${osclock_sources}
|
||||
${int64x64_sources}
|
||||
${thread_sources}
|
||||
${example_as_test_sources}
|
||||
${embedded_version_sources}
|
||||
helper/csv-reader.cc
|
||||
@@ -234,13 +213,13 @@ set(source_files
|
||||
model/system-wall-clock-timestamp.cc
|
||||
model/length.cc
|
||||
model/trickle-timer.cc
|
||||
model/unix-fd-reader.cc
|
||||
)
|
||||
|
||||
# Define core lib headers
|
||||
set(header_files
|
||||
${rt_headers}
|
||||
${int64x64_headers}
|
||||
${thread_headers}
|
||||
${example_as_test_headers}
|
||||
${embedded_version_headers}
|
||||
helper/csv-reader.h
|
||||
@@ -334,6 +313,7 @@ set(header_files
|
||||
model/type-name.h
|
||||
model/type-traits.h
|
||||
model/uinteger.h
|
||||
model/unix-fd-reader.h
|
||||
model/unused.h
|
||||
model/valgrind.h
|
||||
model/vector.h
|
||||
@@ -343,7 +323,6 @@ set(header_files
|
||||
set(test_sources
|
||||
${example_as_test_suite}
|
||||
${gsl_test_sources}
|
||||
${thread_test_sources}
|
||||
test/attribute-container-test-suite.cc
|
||||
test/attribute-test-suite.cc
|
||||
test/build-profile-test-suite.cc
|
||||
@@ -363,6 +342,7 @@ set(test_sources
|
||||
test/ptr-test-suite.cc
|
||||
test/sample-test-suite.cc
|
||||
test/simulator-test-suite.cc
|
||||
test/threaded-test-suite.cc
|
||||
test/time-test-suite.cc
|
||||
test/timer-test-suite.cc
|
||||
test/traced-callback-test-suite.cc
|
||||
|
||||
@@ -6,11 +6,6 @@ option(
|
||||
|
||||
set(module_enabled_features) # modulegen_customizations consumes this list
|
||||
|
||||
mark_as_advanced(ENABLE_THREADING)
|
||||
set(ENABLE_THREADING
|
||||
${HAVE_PTHREAD_H}
|
||||
)
|
||||
|
||||
check_include_file_cxx(
|
||||
net/ethernet.h
|
||||
HAVE_NET_ETHERNET_H
|
||||
|
||||
2
test.py
2
test.py
@@ -61,7 +61,6 @@ interesting_config_items = [
|
||||
"NS3_ENABLED_CONTRIBUTED_MODULES",
|
||||
"NS3_MODULE_PATH",
|
||||
"ENABLE_REAL_TIME",
|
||||
"ENABLE_THREADING",
|
||||
"ENABLE_EXAMPLES",
|
||||
"ENABLE_TESTS",
|
||||
"EXAMPLE_DIRECTORIES",
|
||||
@@ -77,7 +76,6 @@ interesting_config_items = [
|
||||
]
|
||||
|
||||
ENABLE_REAL_TIME = False
|
||||
ENABLE_THREADING = False
|
||||
ENABLE_EXAMPLES = True
|
||||
ENABLE_TESTS = True
|
||||
NSCLICK = False
|
||||
|
||||
Reference in New Issue
Block a user