From cce2a28a0a848e8e01233ae98922ebf74347a3ad Mon Sep 17 00:00:00 2001 From: F5 Date: Tue, 25 Oct 2022 17:11:00 +0800 Subject: [PATCH] build: Add --enable-mtp option --- CMakeLists.txt | 1 + build-support/custom-modules/ns3-configtable.cmake | 3 +++ build-support/macros-and-definitions.cmake | 10 ++++++++++ ns3 | 2 ++ 4 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2407c7517..468c18bc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ option(NS3_MONOLIB "Build a single shared ns-3 library and link it against executables" OFF ) option(NS3_MPI "Build with MPI support" OFF) +option(NS3_MTP "Build with Multithreaded simulation support" OFF) option(NS3_NATIVE_OPTIMIZATIONS "Build with -march=native -mtune=native" OFF) set(NS3_OUTPUT_DIRECTORY "" CACHE STRING "Directory to store built artifacts") option(NS3_PRECOMPILE_HEADERS diff --git a/build-support/custom-modules/ns3-configtable.cmake b/build-support/custom-modules/ns3-configtable.cmake index cf0a41ab2..57cffdbfc 100644 --- a/build-support/custom-modules/ns3-configtable.cmake +++ b/build-support/custom-modules/ns3-configtable.cmake @@ -148,6 +148,9 @@ macro(write_configtable) string(APPEND out "MPI Support : ") check_on_or_off("${NS3_MPI}" "${MPI_FOUND}") + string(APPEND out "Multithreaded Simulation : ") + check_on_or_off("${NS3_MTP}" "ON") + string(APPEND out "ns-3 Click Integration : ") check_on_or_off("ON" "${NS3_CLICK}") diff --git a/build-support/macros-and-definitions.cmake b/build-support/macros-and-definitions.cmake index 304ccdde7..e3653a82b 100644 --- a/build-support/macros-and-definitions.cmake +++ b/build-support/macros-and-definitions.cmake @@ -873,6 +873,12 @@ macro(process_options) endif() endif() + set(ENABLE_MTP FALSE) + if(${NS3_MTP}) + add_definitions(-DNS3_MTP) + set(ENABLE_MTP TRUE) + endif() + if(${NS3_VERBOSE}) set_property(GLOBAL PROPERTY TARGET_MESSAGES TRUE) set(CMAKE_FIND_DEBUG_MODE TRUE) @@ -1189,6 +1195,10 @@ macro(process_options) list(REMOVE_ITEM libs_to_build mpi) endif() + if(NOT ${ENABLE_MTP}) + list(REMOVE_ITEM libs_to_build mtp) + endif() + if(NOT ${ENABLE_VISUALIZER}) list(REMOVE_ITEM libs_to_build visualizer) endif() diff --git a/ns3 b/ns3 index 82b37237d..2fd520486 100755 --- a/ns3 +++ b/ns3 @@ -133,6 +133,7 @@ def parse_args(argv): ("logs", "the logs regardless of the compile mode"), ("monolib", "a single shared library with all ns-3 modules"), ("mpi", "the MPI support for distributed simulation"), + ("mtp", "Multithreading support for high speed parallel simulation"), ("python-bindings", "python bindings"), ("tests", "the ns-3 tests"), ("sanitizers", "address, memory leaks and undefined behavior sanitizers"), @@ -536,6 +537,7 @@ def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_gener ("LOG", "logs"), ("MONOLIB", "monolib"), ("MPI", "mpi"), + ("MTP", "mtp"), ("PYTHON_BINDINGS", "python_bindings"), ("SANITIZE", "sanitizers"), ("STATIC", "static"),