CMake buildsystem

This commit is contained in:
Gabriel Ferreira
2021-11-10 22:28:44 -03:00
committed by Tom Henderson
parent a4b86694f8
commit 9c876c7f5a
135 changed files with 8925 additions and 68 deletions

7
.gitignore vendored
View File

@@ -38,3 +38,10 @@ build/
/.project
version.cache
.idea/
cmake_cache/
cmake-build-debug/
cmake-build-relwithdebinfo/
cmake-build-minsizerel/
cmake-build-release/

114
CMakeLists.txt Normal file
View File

@@ -0,0 +1,114 @@
# ######################################################################################################################
# Required CMake version #
# ######################################################################################################################
cmake_minimum_required(VERSION 3.10)
# Use ccache if available
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
message(STATUS "CCache is enabled")
# Configure ccache for pch headers
execute_process(COMMAND ${CCACHE_FOUND} --set-config=sloppiness=pch_defines,time_macros,include_file_mtime)
endif()
# ######################################################################################################################
# Project name #
# ######################################################################################################################
project(NS3 CXX C)
include(buildsupport/macros_and_definitions.cmake)
set(NS3_VER 3-dev)
# common options
option(NS3_ASSERT "Enable assert on failure" OFF)
option(NS3_DES_METRICS "Enable DES Metrics event collection" OFF)
option(NS3_EXAMPLES "Enable examples to be built" OFF)
option(NS3_LOG "Enable logging to be built" OFF)
option(NS3_TESTS "Enable tests to be built" OFF)
# fd-net-device options
option(NS3_EMU "Build with emulation support" ON)
option(NS3_PLANETLAB "Build with Planetlab support" OFF)
option(NS3_TAP "Build with Tap support" ON)
# maintenance and documentation
option(NS3_CLANG_FORMAT "Enforce cody style with clang-format" OFF)
option(NS3_CLANG_TIDY "Use clang-tidy static analysis" OFF)
option(NS3_CLANG_TIMETRACE "Collect compilation statistics to analyze the build process" OFF)
option(NS3_COVERAGE "Enable code coverage measurements and report generation" OFF)
option(NS3_COVERAGE_ZERO_COUNTERS "Zero lcov counters before running. Requires NS3_COVERAGE=ON" OFF)
option(NS3_DOCS "Generate documentation" OFF)
option(NS3_INCLUDE_WHAT_YOU_USE "Use IWYU to determine unnecessary headers included" OFF)
option(NS3_LINK_WHAT_YOU_USE "Use LWYU to determine unnecessary linked libraries" OFF)
option(NS3_SANITIZE "Build with address, leak and undefined sanitizers" OFF)
option(NS3_SANITIZE_MEMORY "Build with memory sanitizer" OFF)
option(NS3_SCAN_PYTHON_BINDINGS "Scan python bindings" OFF)
# 3rd-party libraries/programs
option(NS3_NETANIM "Build netanim" OFF)
# other options
option(NS3_ENABLE_BUILD_VERSION "Embed version info into libraries" OFF)
option(NS3_GNUPLOT "Build with Gnuplot support" OFF)
option(NS3_GSL "Build with GSL support" ON)
option(NS3_GTK3 "Build with GTK3 support" ON)
option(NS3_LINK_TIME_OPTIMIZATION "Build with link-time optimization" OFF)
option(NS3_MONOLIB "Build a single shared ns-3 library and link it against executables" OFF)
option(NS3_MPI "Build with MPI support" ON)
option(NS3_NATIVE_OPTIMIZATIONS "Build with -march=native -mtune=native" OFF)
option(NS3_NSC "Build with NSC support" OFF) # currently not supported
option(NS3_PRECOMPILE_HEADERS "Precompile module headers to speed up compilation" ON)
option(NS3_PTHREAD "Build with pthread support" 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_STATIC "Build a static ns-3 library and link it against executables" OFF)
option(NS3_VISUALIZER "Build visualizer module" OFF)
option(NS3_WARNINGS "Enable compiler warnings" ON)
option(NS3_WARNINGS_AS_ERRORS "Treat warnings as errors. Requires NS3_WARNINGS=ON" ON)
# Options that either select which modules will get built or disable modules
set(NS3_ENABLED_MODULES "" CACHE STRING "List of modules to enable (e.g. core;network;internet)")
set(NS3_DISABLED_MODULES "" CACHE STRING "List of modules to disable (e.g. lte;wimax;wave)")
# Scan module libraries
subdirlist(libs_to_build ${CMAKE_SOURCE_DIR}/src)
# Scan contribution libraries
subdirlist(contrib_libs_to_build ${CMAKE_SOURCE_DIR}/contrib)
# After scanning modules, we can filter enabled and disabled ones
filter_enabled_and_disabled_modules(libs_to_build contrib_libs_to_build NS3_ENABLED_MODULES NS3_DISABLED_MODULES)
# ######################################################################################################################
# Process options #
# ######################################################################################################################
process_options()
# ######################################################################################################################
# Add subdirectories #
# ######################################################################################################################
# Build NS3 library core
add_subdirectory(src)
# Build NS library examples
add_subdirectory(examples)
# Build scratch/simulation scripts
add_subdirectory(scratch)
# Build test utils
add_subdirectory(utils)
# Workaround for missing waf files used by test.py
generate_c4che_cachepy()
generate_buildstatus()
generate_fakewaflock()
write_fakewaf_config()
# Export package targets when installing
ns3_cmake_package()

View File

@@ -1,20 +0,0 @@
# Makefile wrapper for waf
all:
./waf
# free free to change this part to suit your requirements
configure:
./waf configure --enable-examples --enable-tests
build:
./waf build
install:
./waf install
clean:
./waf clean
distclean:
./waf distclean

View File

@@ -0,0 +1,6 @@
format:
tab_size: 2
line_width: 120
dangle_parens: true
autosort: true
max_subgroups_hwrap: 3

564
buildsupport/3rd_party/FindGTK3.cmake vendored Normal file
View File

@@ -0,0 +1,564 @@
# * FindGTK3.cmake This module can find the GTK3 widget libraries and several of its other optional components like
# gtkmm, glade, and glademm.
#
# NOTE: If you intend to use version checking, CMake 2.6.2 or later is required.
#
# Specify one or more of the following components as you call this find module. See example below.
#
# gtk gtkmm glade glademm
#
# The following variables will be defined for your use
#
# GTK3_FOUND - Were all of your specified components found? GTK3_INCLUDE_DIRS - All include directories GTK3_LIBRARIES -
# All libraries
#
# GTK3_VERSION - The version of GTK3 found (x.y.z) GTK3_MAJOR_VERSION - The major version of GTK3 GTK3_MINOR_VERSION -
# The minor version of GTK3 GTK3_PATCH_VERSION - The patch version of GTK3
#
# Optional variables you can define prior to calling this module:
#
# GTK3_DEBUG - Enables verbose debugging of the module GTK3_SKIP_MARK_AS_ADVANCED - Disable marking cache variables as
# advanced GTK3_ADDITIONAL_SUFFIXES - Allows defining additional directories to search for include files
#
# =================
# Example Usage:
#
# Call find_package() once, here are some examples to pick from:
#
# Require GTK 3.0 or later find_package(GTK3 3.0 REQUIRED gtk)
#
# if(GTK3_FOUND) include_directories(${GTK3_INCLUDE_DIRS}) add_executable(mygui mygui.cc) target_link_libraries(mygui
# ${GTK3_LIBRARIES}) endif()
#
# =============================================================================
# Copyright 2009 Kitware, Inc. Copyright 2008-2009 Philip Lowman <philip@yhbt.com> Copyright 2014-2018 Ettercap
# Development Team <info@ettercap-project.org>
#
# Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the License for more information.
# =============================================================================
# (To distribute this file outside of CMake, substitute the full License text for the above reference.)
# Version 0.1 (5/13/2011) * First cut at a GTK3 version (Heavily derived from FindGTK2.cmake)
# Version 0.2 (3/02/2018) * Run git diff against this file to see all changes
# =============================================================
# _GTK3_GET_VERSION Internal function to parse the version number in gtkversion.h _OUT_major = Major version number
# _OUT_minor = Minor version number _OUT_micro = Micro version number _gtkversion_hdr = Header file to parse
# =============================================================
function(_GTK3_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
file(READ ${_gtkversion_hdr} _contents)
if(_contents)
string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}")
string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}")
string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}")
if(NOT ${_OUT_major} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for GTK3_MAJOR_VERSION!")
endif()
if(NOT ${_OUT_minor} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for GTK3_MINOR_VERSION!")
endif()
if(NOT ${_OUT_micro} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for GTK3_MICRO_VERSION!")
endif()
set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE)
set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
else()
message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
endif()
endfunction()
# =============================================================
# _GTK3_FIND_INCLUDE_DIR Internal function to find the GTK include directories _var = variable to set _hdr = header file
# to look for
# =============================================================
function(_GTK3_FIND_INCLUDE_DIR _var _hdr)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " "_GTK3_FIND_INCLUDE_DIR( ${_var} ${_hdr} )")
endif()
set(_relatives
# If these ever change, things will break.
${GTK3_ADDITIONAL_SUFFIXES}
glibmm-2.0
glib-2.0
atk-1.0
atkmm-1.0
cairo
cairomm-1.0
gdk-pixbuf-2.0
gdkmm-2.4
giomm-2.4
gtk-3.0
gtkmm-2.4
libglade-2.0
libglademm-2.4
harfbuzz
pango-1.0
pangomm-1.4
sigc++-2.2
gtk-unix-print-2.0
)
set(_suffixes)
foreach(_d ${_relatives})
list(APPEND _suffixes ${_d})
list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include
endforeach()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " "include suffixes = ${_suffixes}")
endif()
find_path(
${_var} ${_hdr}
PATHS # On Windows, glibconfig.h is located under $PREFIX/lib/glib-2.0/include.
C:/GTK/lib/glib-2.0/include
C:/msys64/$ENV{MSYSTEM}/lib/glib-2.0
# end
/usr/local/lib64
/usr/local/lib
# fix for Ubuntu == 11.04 (Natty Narwhal)
/usr/lib/i386-linux-gnu/
/usr/lib/x86_64-linux-gnu/
# end fix for Ubuntu >= 11.10 (Oneiric Ocelot)
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
# end
/usr/lib64
/usr
/opt/gnome
/usr/openwin
/sw
/opt/local
$ENV{GTKMM_BASEPATH}
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES ${_suffixes} include lib
)
if(${_var})
set(GTK3_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS} ${${_var}} PARENT_SCOPE)
if(NOT GTK3_SKIP_MARK_AS_ADVANCED)
mark_as_advanced(${_var})
endif()
endif()
endfunction()
# =============================================================
# _GTK3_FIND_LIBRARY Internal function to find libraries packaged with GTK3 _var = library variable to create
# =============================================================
function(_GTK3_FIND_LIBRARY _var _lib _expand_vc _append_version)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )"
)
endif()
# Not GTK versions per se but the versions encoded into Windows import libraries (GtkMM 2.14.1 has a
# gtkmm-vc80-2_4.lib for example) Also the MSVC libraries use _ for . (this is handled below)
# ********* SOMEONE WITH WINDOWS NEEDS TO CHECK THIS BIT FOR V3 *********
# ********* the plain 3 is needed to get Debian Sid to find the libraries
set(_versions
3.0
3
2.20
2.18
2.16
2.14
2.12
2.10
2.8
2.6
2.4
2.2
2.0
1.20
1.18
1.16
1.14
1.12
1.10
1.8
1.6
1.4
1.2
1.0
)
set(_library)
set(_library_d)
set(_library ${_lib})
if(_expand_vc AND MSVC)
# Add vc80/vc90/vc100 midfixes
if(MSVC80)
set(_library ${_library}-vc80)
elseif(MSVC90)
set(_library ${_library}-vc90)
elseif(MSVC10)
set(_library ${_library}-vc100)
endif()
set(_library_d ${_library}-d)
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"After midfix addition = ${_library} and ${_library_d}"
)
endif()
set(_lib_list)
set(_libd_list)
if(_append_version)
foreach(_ver ${_versions})
list(APPEND _lib_list "${_library}-${_ver}")
list(APPEND _libd_list "${_library_d}-${_ver}")
endforeach()
else()
set(_lib_list ${_library})
set(_libd_list ${_library_d})
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"library list = ${_lib_list} and library debug list = ${_libd_list}"
)
endif()
# For some silly reason the MSVC libraries use _ instead of . in the version fields
if(_expand_vc AND MSVC)
set(_no_dots_lib_list)
set(_no_dots_libd_list)
foreach(_l ${_lib_list})
string(REPLACE "." "_" _no_dots_library ${_l})
list(APPEND _no_dots_lib_list ${_no_dots_library})
endforeach()
# And for debug
set(_no_dots_libsd_list)
foreach(_l ${_libd_list})
string(REPLACE "." "_" _no_dots_libraryd ${_l})
list(APPEND _no_dots_libd_list ${_no_dots_libraryd})
endforeach()
# Copy list back to original names
set(_lib_list ${_no_dots_lib_list})
set(_libd_list ${_no_dots_libd_list})
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"While searching for ${_var}, our proposed library list is ${_lib_list}"
)
endif()
find_library(
${_var}
NAMES ${_lib_list}
PATHS /opt/gnome /usr/openwin /sw $ENV{GTKMM_BASEPATH} [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES lib lib64
)
if(_expand_vc AND MSVC)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"While searching for ${_var}_DEBUG our proposed library list is ${_libd_list}"
)
endif()
find_library(
${_var}_DEBUG
NAMES ${_libd_list}
PATHS $ENV{GTKMM_BASEPATH} [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES lib
)
if(${_var} AND ${_var}_DEBUG)
if(NOT GTK3_SKIP_MARK_AS_ADVANCED)
mark_as_advanced(${_var}_DEBUG)
endif()
set(GTK3_LIBRARIES ${GTK3_LIBRARIES} optimized ${${_var}} debug ${${_var}_DEBUG})
set(GTK3_LIBRARIES ${GTK3_LIBRARIES} PARENT_SCOPE)
endif()
else()
if(NOT GTK3_SKIP_MARK_AS_ADVANCED)
mark_as_advanced(${_var})
endif()
set(GTK3_LIBRARIES ${GTK3_LIBRARIES} ${${_var}})
set(GTK3_LIBRARIES ${GTK3_LIBRARIES} PARENT_SCOPE)
# Set debug to release
set(${_var}_DEBUG ${${_var}})
set(${_var}_DEBUG ${${_var}} PARENT_SCOPE)
endif()
endfunction()
# =============================================================
#
# main()
#
set(GTK3_FOUND)
set(GTK3_INCLUDE_DIRS)
set(GTK3_LIBRARIES)
if(NOT GTK3_FIND_COMPONENTS)
# Assume they only want GTK
set(GTK3_FIND_COMPONENTS gtk)
endif()
#
# If not specified, enforce version number
#
if(GTK3_FIND_VERSION)
if(NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION)
cmake_minimum_required(VERSION 2.6.2)
endif()
set(GTK3_FAILED_VERSION_CHECK true)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " "Searching for version ${GTK3_FIND_VERSION}")
endif()
_gtk3_find_include_dir(GTK3_GTK_INCLUDE_DIR gtk/gtk.h)
if(GTK3_GTK_INCLUDE_DIR)
_gtk3_get_version(GTK3_MAJOR_VERSION GTK3_MINOR_VERSION GTK3_PATCH_VERSION ${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
set(GTK3_VERSION ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION})
if(GTK3_FIND_VERSION_EXACT)
if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION)
set(GTK3_FAILED_VERSION_CHECK false)
endif()
else()
if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION OR GTK3_VERSION VERSION_GREATER GTK3_FIND_VERSION)
set(GTK3_FAILED_VERSION_CHECK false)
endif()
endif()
else()
# If we can't find the GTK include dir, we can't do version checking
if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY)
message(FATAL_ERROR "Could not find GTK3 include directory")
endif()
return()
endif()
if(GTK3_FAILED_VERSION_CHECK)
if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY)
if(GTK3_FIND_VERSION_EXACT)
message(
FATAL_ERROR
"GTK3 version check failed.
Version ${GTK3_VERSION} was found, \
version ${GTK3_FIND_VERSION} is needed exactly."
)
else()
message(
FATAL_ERROR
"GTK3 version check failed.
Version ${GTK3_VERSION} was found, \
at least version ${GTK3_FIND_VERSION} is required"
)
endif()
endif()
# If the version check fails, exit out of the module here
return()
endif()
endif()
#
# Find all components
#
find_package(Freetype QUIET)
list(APPEND GTK3_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
list(APPEND GTK3_LIBRARIES ${FREETYPE_LIBRARIES})
foreach(_GTK3_component ${GTK3_FIND_COMPONENTS})
if(_GTK3_component STREQUAL "gtk")
_gtk3_find_include_dir(GTK3_GLIB_INCLUDE_DIR glib.h)
_gtk3_find_include_dir(GTK3_GLIBCONFIG_INCLUDE_DIR glibconfig.h)
_gtk3_find_library(GTK3_GLIB_LIBRARY glib false true)
_gtk3_find_library(GTK3_GTHREAD_LIBRARY gthread false true)
_gtk3_find_include_dir(GTK3_GOBJECT_INCLUDE_DIR gobject/gobject.h)
_gtk3_find_library(GTK3_GOBJECT_LIBRARY gobject false true)
_gtk3_find_include_dir(GTK3_GIO_INCLUDE_DIR gio/gio.h)
_gtk3_find_library(GTK3_GIO_LIBRARY gio false true)
_gtk3_find_include_dir(GTK3_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h)
_gtk3_find_library(GTK3_GDK_PIXBUF_LIBRARY gdk_pixbuf false true)
_gtk3_find_include_dir(GTK3_GDK_INCLUDE_DIR gdk/gdk.h)
_gtk3_find_include_dir(GTK3_GDKCONFIG_INCLUDE_DIR gdk/gdkconfig.h)
_gtk3_find_include_dir(GTK3_GTK_INCLUDE_DIR gtk/gtk.h)
# ********* At least on Debian the gdk & gtk libraries ********* don't have the -x11 suffix.
if(UNIX)
_gtk3_find_library(GTK3_GDK_LIBRARY gdk false true)
_gtk3_find_library(GTK3_GTK_LIBRARY gtk false true)
else()
# ********* There are various gtk3 builds/packages/bundles ********* available on Windows. Some of them follow the
# ********* classic naming scheme (libs with -win32 suffix) ********* and others prefer the original names.
# ********* Because we want to support as many packages ********* as possible, we search for both naming styles.
# ********* Starting with the original names.
# *********
# ********* Tested with both vcpkg (gtk+-3.22.19) ********* and Msys2 (gtk+-3.22.28)
_gtk3_find_library(GTK3_GDK_LIBRARY gdk false true)
_gtk3_find_library(GTK3_GTK_LIBRARY gtk false true)
_gtk3_find_library(GTK3_GDK_LIBRARY gdk-win32 false true)
_gtk3_find_library(GTK3_GTK_LIBRARY gtk-win32 false true)
endif()
_gtk3_find_include_dir(GTK3_CAIRO_INCLUDE_DIR cairo.h)
_gtk3_find_library(GTK3_CAIRO_LIBRARY cairo false false)
_gtk3_find_include_dir(GTK3_FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h)
_gtk3_find_include_dir(GTK3_PANGO_INCLUDE_DIR pango/pango.h)
_gtk3_find_library(GTK3_PANGO_LIBRARY pango false true)
_gtk3_find_include_dir(GTK3_HARFBUZZ_INCLUDE_DIR hb.h)
_gtk3_find_include_dir(GTK3_ATK_INCLUDE_DIR atk/atk.h)
_gtk3_find_library(GTK3_ATK_LIBRARY atk false true)
elseif(_GTK3_component STREQUAL "gtkmm")
_gtk3_find_include_dir(GTK3_GLIBMM_INCLUDE_DIR glibmm.h)
_gtk3_find_include_dir(GTK3_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h)
_gtk3_find_library(GTK3_GLIBMM_LIBRARY glibmm true true)
_gtk3_find_include_dir(GTK3_GDKMM_INCLUDE_DIR gdkmm.h)
_gtk3_find_include_dir(GTK3_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h)
_gtk3_find_library(GTK3_GDKMM_LIBRARY gdkmm true true)
_gtk3_find_include_dir(GTK3_GTKMM_INCLUDE_DIR gtkmm.h)
_gtk3_find_include_dir(GTK3_GTKMMCONFIG_INCLUDE_DIR gtkmmconfig.h)
_gtk3_find_library(GTK3_GTKMM_LIBRARY gtkmm true true)
_gtk3_find_include_dir(GTK3_CAIROMM_INCLUDE_DIR cairomm/cairomm.h)
_gtk3_find_library(GTK3_CAIROMM_LIBRARY cairomm true true)
_gtk3_find_include_dir(GTK3_PANGOMM_INCLUDE_DIR pangomm.h)
_gtk3_find_include_dir(GTK3_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h)
_gtk3_find_library(GTK3_PANGOMM_LIBRARY pangomm true true)
_gtk3_find_include_dir(GTK3_SIGC++_INCLUDE_DIR sigc++/sigc++.h)
_gtk3_find_include_dir(GTK3_SIGC++CONFIG_INCLUDE_DIR sigc++config.h)
_gtk3_find_library(GTK3_SIGC++_LIBRARY sigc true true)
_gtk3_find_include_dir(GTK3_GIOMM_INCLUDE_DIR giomm.h)
_gtk3_find_include_dir(GTK3_GIOMMCONFIG_INCLUDE_DIR giommconfig.h)
_gtk3_find_library(GTK3_GIOMM_LIBRARY giomm true true)
_gtk3_find_include_dir(GTK3_ATKMM_INCLUDE_DIR atkmm.h)
_gtk3_find_library(GTK3_ATKMM_LIBRARY atkmm true true)
elseif(_GTK3_component STREQUAL "glade")
_gtk3_find_include_dir(GTK3_GLADE_INCLUDE_DIR glade/glade.h)
_gtk3_find_library(GTK3_GLADE_LIBRARY glade false true)
elseif(_GTK3_component STREQUAL "glademm")
_gtk3_find_include_dir(GTK3_GLADEMM_INCLUDE_DIR libglademm.h)
_gtk3_find_include_dir(GTK3_GLADEMMCONFIG_INCLUDE_DIR libglademmconfig.h)
_gtk3_find_library(GTK3_GLADEMM_LIBRARY glademm true true)
else()
message(FATAL_ERROR "Unknown GTK3 component ${_component}")
endif()
endforeach()
#
# Solve for the GTK3 version if we haven't already
#
if(NOT GTK3_FIND_VERSION AND GTK3_GTK_INCLUDE_DIR)
_gtk3_get_version(GTK3_MAJOR_VERSION GTK3_MINOR_VERSION GTK3_PATCH_VERSION ${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
set(GTK3_VERSION ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION})
endif()
#
# Try to enforce components
#
set(_GTK3_did_we_find_everything true) # This gets set to GTK3_FOUND
include(FindPackageHandleStandardArgs)
# include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
foreach(_GTK3_component ${GTK3_FIND_COMPONENTS})
string(TOUPPER ${_GTK3_component} _COMPONENT_UPPER)
if(_GTK3_component STREQUAL "gtk")
find_package_handle_standard_args(
GTK3_${_COMPONENT_UPPER}
"Some or all of the gtk libraries were not found."
GTK3_GTK_LIBRARY
GTK3_GTK_INCLUDE_DIR
GTK3_GLIB_INCLUDE_DIR
GTK3_GLIBCONFIG_INCLUDE_DIR
GTK3_GLIB_LIBRARY
GTK3_GTHREAD_LIBRARY
GTK3_GDK_INCLUDE_DIR
GTK3_GDKCONFIG_INCLUDE_DIR
GTK3_GDK_LIBRARY
)
elseif(_GTK3_component STREQUAL "gtkmm")
find_package_handle_standard_args(
GTK3_${_COMPONENT_UPPER}
"Some or all of the gtkmm libraries were not found."
GTK3_GTKMM_LIBRARY
GTK3_GTKMM_INCLUDE_DIR
GTK3_GTKMMCONFIG_INCLUDE_DIR
GTK3_GLIBMM_INCLUDE_DIR
GTK3_GLIBMMCONFIG_INCLUDE_DIR
GTK3_GLIBMM_LIBRARY
GTK3_GDKMM_INCLUDE_DIR
GTK3_GDKMMCONFIG_INCLUDE_DIR
GTK3_GDKMM_LIBRARY
)
elseif(_GTK3_component STREQUAL "glade")
find_package_handle_standard_args(
GTK3_${_COMPONENT_UPPER} "The glade library was not found." GTK3_GLADE_LIBRARY GTK3_GLADE_INCLUDE_DIR
)
elseif(_GTK3_component STREQUAL "glademm")
find_package_handle_standard_args(
GTK3_${_COMPONENT_UPPER} "The glademm library was not found." GTK3_GLADEMM_LIBRARY GTK3_GLADEMM_INCLUDE_DIR
GTK3_GLADEMMCONFIG_INCLUDE_DIR
)
endif()
if(NOT GTK3_${_COMPONENT_UPPER}_FOUND)
set(_GTK3_did_we_find_everything false)
endif()
endforeach()
if(_GTK3_did_we_find_everything AND NOT GTK3_VERSION_CHECK_FAILED)
set(GTK3_FOUND true)
else()
# Unset our variables.
set(GTK3_FOUND false)
set(GTK3_VERSION)
set(GTK3_VERSION_MAJOR)
set(GTK3_VERSION_MINOR)
set(GTK3_VERSION_PATCH)
set(GTK3_INCLUDE_DIRS)
set(GTK3_LIBRARIES)
endif()
if(GTK3_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GTK3_INCLUDE_DIRS)
endif()

View File

@@ -0,0 +1,176 @@
# Copyright (c) 2012, Intel Corporation Copyright (c) 2019 Sony Interactive Entertainment Inc.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Try to find Harfbuzz include and library directories.
#
# After successful discovery, this will set for inclusion where needed: HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz
# headers HarfBuzz_LIBRARIES - containg the HarfBuzz library
#[=======================================================================[.rst:
FindHarfBuzz
--------------
Find HarfBuzz headers and libraries.
Imported Targets
^^^^^^^^^^^^^^^^
``HarfBuzz::HarfBuzz``
The HarfBuzz library, if found.
``HarfBuzz::ICU``
The HarfBuzz ICU library, if found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
``HarfBuzz_FOUND``
true if (the requested version of) HarfBuzz is available.
``HarfBuzz_VERSION``
the version of HarfBuzz.
``HarfBuzz_LIBRARIES``
the libraries to link against to use HarfBuzz.
``HarfBuzz_INCLUDE_DIRS``
where to find the HarfBuzz headers.
``HarfBuzz_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
#]=======================================================================]
find_package(PkgConfig QUIET)
pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz)
set(HarfBuzz_COMPILE_OPTIONS ${PC_HARFBUZZ_CFLAGS_OTHER})
set(HarfBuzz_VERSION ${PC_HARFBUZZ_CFLAGS_VERSION})
find_path(
HarfBuzz_INCLUDE_DIR
NAMES hb.h
HINTS ${PC_HARFBUZZ_INCLUDEDIR} ${PC_HARFBUZZ_INCLUDE_DIRS}
PATH_SUFFIXES harfbuzz
)
find_library(HarfBuzz_LIBRARY NAMES ${HarfBuzz_NAMES} harfbuzz HINTS ${PC_HARFBUZZ_LIBDIR} ${PC_HARFBUZZ_LIBRARY_DIRS})
if(HarfBuzz_INCLUDE_DIR AND NOT HarfBuzz_VERSION)
if(EXISTS "${HarfBuzz_INCLUDE_DIR}/hb-version.h")
file(READ "${HarfBuzz_INCLUDE_DIR}/hb-version.h" _harfbuzz_version_content)
string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\.[0-9]+\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}")
set(HarfBuzz_VERSION "${CMAKE_MATCH_1}")
endif()
endif()
if("${HarfBuzz_FIND_VERSION}" VERSION_GREATER "${HarfBuzz_VERSION}")
message(FATAL_ERROR "Required version (" ${HarfBuzz_FIND_VERSION} ") is higher than found version ("
${HarfBuzz_VERSION} ")"
)
endif()
# Find components
if(HarfBuzz_INCLUDE_DIR AND HarfBuzz_LIBRARY)
set(_HarfBuzz_REQUIRED_LIBS_FOUND ON)
set(HarfBuzz_LIBS_FOUND "HarfBuzz (required): ${HarfBuzz_LIBRARY}")
else()
set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF)
set(HarfBuzz_LIBS_NOT_FOUND "HarfBuzz (required)")
endif()
if("ICU" IN_LIST HarfBuzz_FIND_COMPONENTS)
pkg_check_modules(PC_HARFBUZZ_ICU QUIET harfbuzz-icu)
set(HarfBuzz_ICU_COMPILE_OPTIONS ${PC_HARFBUZZ_ICU_CFLAGS_OTHER})
find_path(
HarfBuzz_ICU_INCLUDE_DIR
NAMES hb-icu.h
HINTS ${PC_HARFBUZZ_ICU_INCLUDEDIR} ${PC_HARFBUZZ_ICU_INCLUDE_DIRS}
PATH_SUFFIXES harfbuzz
)
find_library(
HarfBuzz_ICU_LIBRARY NAMES ${HarfBuzz_ICU_NAMES} harfbuzz-icu HINTS ${PC_HARFBUZZ_ICU_LIBDIR}
${PC_HARFBUZZ_ICU_LIBRARY_DIRS}
)
if(HarfBuzz_ICU_LIBRARY)
if(HarfBuzz_FIND_REQUIRED_ICU)
list(APPEND HarfBuzz_LIBS_FOUND "ICU (required): ${HarfBuzz_ICU_LIBRARY}")
else()
list(APPEND HarfBuzz_LIBS_FOUND "ICU (optional): ${HarfBuzz_ICU_LIBRARY}")
endif()
else()
if(HarfBuzz_FIND_REQUIRED_ICU)
set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF)
list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (required)")
else()
list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (optional)")
endif()
endif()
endif()
if(NOT HarfBuzz_FIND_QUIETLY)
if(HarfBuzz_LIBS_FOUND)
message(STATUS "Found the following HarfBuzz libraries:")
foreach(found ${HarfBuzz_LIBS_FOUND})
message(STATUS " ${found}")
endforeach()
endif()
if(HarfBuzz_LIBS_NOT_FOUND)
message(STATUS "The following HarfBuzz libraries were not found:")
foreach(found ${HarfBuzz_LIBS_NOT_FOUND})
message(STATUS " ${found}")
endforeach()
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
HarfBuzz
FOUND_VAR HarfBuzz_FOUND
REQUIRED_VARS HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY _HarfBuzz_REQUIRED_LIBS_FOUND
VERSION_VAR HarfBuzz_VERSION
)
if(HarfBuzz_LIBRARY AND NOT TARGET HarfBuzz::HarfBuzz)
add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED GLOBAL)
set_target_properties(
HarfBuzz::HarfBuzz
PROPERTIES IMPORTED_LOCATION "${HarfBuzz_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${HarfBuzz_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}"
)
endif()
if(HarfBuzz_ICU_LIBRARY AND NOT TARGET HarfBuzz::ICU)
add_library(HarfBuzz::ICU UNKNOWN IMPORTED GLOBAL)
set_target_properties(
HarfBuzz::ICU
PROPERTIES IMPORTED_LOCATION "${HarfBuzz_ICU_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${HarfBuzz_ICU_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_ICU_INCLUDE_DIR}"
)
endif()
mark_as_advanced(HarfBuzz_INCLUDE_DIR HarfBuzz_ICU_INCLUDE_DIR HarfBuzz_LIBRARY HarfBuzz_ICU_LIBRARY)
if(HarfBuzz_FOUND)
set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY} ${HarfBuzz_ICU_LIBRARY})
set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR} ${HarfBuzz_ICU_INCLUDE_DIR})
endif()

139
buildsupport/3rd_party/FindInt128.cmake vendored Normal file
View File

@@ -0,0 +1,139 @@
# # COPYRIGHT
#
# All contributions by Emanuele Ruffaldi Copyright (c) 2016-2019, E All rights reserved.
#
# All other contributions: Copyright (c) 2019, the respective contributors. All rights reserved.
#
# Each contributor holds copyright over their respective contributions. The project versioning (Git) records all such
# contribution source information.
#
# LICENSE
#
# The BSD 3-Clause License
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with the distribution.
#
# * Neither the name of tiny-dnn nor the names of its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# SOURCE: https://github.com/eruffaldi/cppPosit/blob/master/include/FindInt128.cmake
#
# * this module looks for 128 bit integer support. It sets up the type defs in util/int128_types.hpp. Simply add
# ${INT128_FLAGS} to the compiler flags.
include(CheckTypeSize)
include(CheckCXXSourceCompiles)
macro(CHECK_128_BIT_HASH_FUNCTION VAR_NAME DEF_NAME)
# message("Testing for presence of 128 bit unsigned integer hash function for ${VAR_NAME}.")
check_cxx_source_compiles(
"
#include <functional>
#include <cstdint>
int main(int argc, char** argv) {
std::hash<${VAR_NAME}>()(0);
return 0;
}"
has_hash_${VAR_NAME}
)
if(has_hash_${VAR_NAME})
# message("std::hash<${VAR_NAME}> defined.")
set(${DEF_NAME} 1)
else()
# message("std::hash<${VAR_NAME}> not defined.")
endif()
endmacro()
macro(CHECK_INT128 INT128_NAME VARIABLE DEFINE_NAME)
if(NOT INT128_FOUND)
# message("Testing for 128 bit integer support with ${INT128_NAME}.")
check_type_size("${INT128_NAME}" int128_t_${DEFINE_NAME})
if(HAVE_int128_t_${DEFINE_NAME})
if(int128_t_${DEFINE_NAME} EQUAL 16)
# message("Found: Enabling support for 128 bit integers using ${INT128_NAME}.")
set(INT128_FOUND 1)
check_128_bit_hash_function(${INT128_NAME} HAS_INT128_STD_HASH)
set(${VARIABLE} "${DEFINE_NAME}")
else()
# message("${INT128_NAME} has incorrect size, can't use.")
endif()
endif()
endif()
endmacro()
macro(CHECK_UINT128 UINT128_NAME VARIABLE DEFINE_NAME)
if(NOT UINT128_FOUND)
# message("Testing for 128 bit unsigned integer support with ${UINT128_NAME}.")
check_type_size("${UINT128_NAME}" uint128_t_${DEFINE_NAME})
if(HAVE_uint128_t_${DEFINE_NAME})
if(uint128_t_${DEFINE_NAME} EQUAL 16)
# message("Found: Enabling support for 128 bit integers using ${UINT128_NAME}.")
set(UINT128_FOUND 1)
check_128_bit_hash_function(${UINT128_NAME} HAS_UINT128_STD_HASH)
set(${VARIABLE} "${DEFINE_NAME}")
else()
# message("${UINT128_NAME} has incorrect size, can't use.")
endif()
endif()
endif()
endmacro()
macro(FIND_INT128_TYPES)
check_int128("long long" INT128_DEF "HAVEint128_as_long_long")
check_int128("int128_t" INT128_DEF "HAVEint128_t")
check_int128("__int128_t" INT128_DEF "HAVE__int128_t")
check_int128("__int128" INT128_DEF "HAVE__int128")
check_int128("int128" INT128_DEF "HAVEint128")
if(INT128_FOUND)
set(INT128_FLAGS "-D${INT128_DEF}")
if(HAS_INT128_STD_HASH)
set(INT128_FLAGS "${INT128_FLAGS} -DHASH_FOR_INT128_DEFINED")
endif()
endif()
check_uint128("unsigned long long" UINT128_DEF "HAVEuint128_as_u_long_long")
check_uint128("uint128_t" UINT128_DEF "HAVEuint128_t")
check_uint128("__uint128_t" UINT128_DEF "HAVE__uint128_t")
check_uint128("__uint128" UINT128_DEF "HAVE__uint128")
check_uint128("uint128" UINT128_DEF "HAVEuint128")
check_uint128("unsigned __int128_t" UINT128_DEF "HAVEunsigned__int128_t")
check_uint128("unsigned int128_t" UINT128_DEF "HAVEunsignedint128_t")
check_uint128("unsigned __int128" UINT128_DEF "HAVEunsigned__int128")
check_uint128("unsigned int128" UINT128_DEF "HAVEunsignedint128")
if(UINT128_FOUND)
set(INT128_FLAGS "${INT128_FLAGS} -D${UINT128_DEF}")
if(HAS_UINT128_STD_HASH)
set(INT128_FLAGS "${INT128_FLAGS} -DHASH_FOR_UINT128_DEFINED")
endif()
endif()
# MSVC doesn't support 128 bit soft operations, which is weird since they support 128 bit numbers... Clang does
# support, but didn't expose them https://reviews.llvm.org/D41813
if(${MSVC})
set(UINT128_FOUND False)
endif()
endmacro()

19
buildsupport/3rd_party/FindSphinx.cmake vendored Normal file
View File

@@ -0,0 +1,19 @@
# CMake find_package() Module for Sphinx documentation generator http://sphinx-doc.org/
#
# Example usage:
#
# find_package(Sphinx)
#
# If successful the following variables will be defined SPHINX_FOUND SPHINX_EXECUTABLE
find_program(SPHINX_EXECUTABLE NAMES sphinx-build sphinx-build2 DOC "Path to sphinx-build executable")
# Handle REQUIRED and QUIET arguments this will also set SPHINX_FOUND to true if SPHINX_EXECUTABLE exists
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sphinx "Failed to locate sphinx-build executable" SPHINX_EXECUTABLE)
# Provide options for controlling different types of output
option(SPHINX_OUTPUT_HTML "Output standalone HTML files" ON)
option(SPHINX_OUTPUT_MAN "Output man pages" ON)
option(SPHINX_WARNINGS_AS_ERRORS "When building documentation treat warnings as errors" ON)

View File

@@ -0,0 +1,185 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
find_package(Qt4 COMPONENTS QtGui QUIET)
find_package(Qt5 COMPONENTS Core Widgets PrintSupport Gui QUIET)
if((NOT ${Qt4_FOUND}) AND (NOT ${Qt5_FOUND}))
message(FATAL_ERROR "You need Qt installed to build NetAnim")
endif()
# Qt 4 requires these inclusions
if(NOT ${Qt5_found})
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
include_directories(${QT_INCLUDES})
endif()
# Used by qt
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(source_files
animatormode.cpp
animatorscene.cpp
animatorview.cpp
animlink.cpp
animnode.cpp
animpacket.cpp
animpropertybrowser.cpp
animresource.cpp
animxmlparser.cpp
countertablesscene.cpp
flowmonstatsscene.cpp
flowmonxmlparser.cpp
graphpacket.cpp
interfacestatsscene.cpp
log.cpp
logqt.cpp
main.cpp
mode.cpp
netanim.cpp
packetsmode.cpp
packetsscene.cpp
packetsview.cpp
qcustomplot.cpp
qtpropertybrowser/src/fileedit.cpp
qtpropertybrowser/src/fileeditfactory.cpp
qtpropertybrowser/src/filepathmanager.cpp
qtpropertybrowser/src/qtbuttonpropertybrowser.cpp
qtpropertybrowser/src/qteditorfactory.cpp
qtpropertybrowser/src/qtgroupboxpropertybrowser.cpp
qtpropertybrowser/src/qtpropertybrowser.cpp
qtpropertybrowser/src/qtpropertybrowserutils.cpp
qtpropertybrowser/src/qtpropertymanager.cpp
qtpropertybrowser/src/qttreepropertybrowser.cpp
qtpropertybrowser/src/qtvariantproperty.cpp
resizeableitem.cpp
routingstatsscene.cpp
routingxmlparser.cpp
statsmode.cpp
statsview.cpp
table.cpp
textbubble.cpp
)
set(header_files
abort.h
animatorconstants.h
animatormode.h
animatorscene.h
animatorview.h
animevent.h
animlink.h
animnode.h
animpacket.h
animpropertybrowser.h
animresource.h
animxmlparser.h
common.h
countertablesscene.h
flowmonstatsscene.h
flowmonxmlparser.h
graphpacket.h
interfacestatsscene.h
logqt.h
mode.h
netanim.h
packetsmode.h
packetsscene.h
packetsview.h
qcustomplot.h
qtpropertybrowser/src/QtAbstractEditorFactoryBase
qtpropertybrowser/src/QtAbstractPropertyBrowser
qtpropertybrowser/src/QtAbstractPropertyManager
qtpropertybrowser/src/QtBoolPropertyManager
qtpropertybrowser/src/QtBrowserItem
qtpropertybrowser/src/QtButtonPropertyBrowser
qtpropertybrowser/src/QtCharEditorFactory
qtpropertybrowser/src/QtCharPropertyManager
qtpropertybrowser/src/QtCheckBoxFactory
qtpropertybrowser/src/QtColorEditorFactory
qtpropertybrowser/src/QtColorPropertyManager
qtpropertybrowser/src/QtCursorEditorFactory
qtpropertybrowser/src/QtCursorPropertyManager
qtpropertybrowser/src/QtDateEditFactory
qtpropertybrowser/src/QtDatePropertyManager
qtpropertybrowser/src/QtDateTimeEditFactory
qtpropertybrowser/src/QtDateTimePropertyManager
qtpropertybrowser/src/QtDoublePropertyManager
qtpropertybrowser/src/QtDoubleSpinBoxFactory
qtpropertybrowser/src/QtEnumEditorFactory
qtpropertybrowser/src/QtEnumPropertyManager
qtpropertybrowser/src/QtFlagPropertyManager
qtpropertybrowser/src/QtFontEditorFactory
qtpropertybrowser/src/QtFontPropertyManager
qtpropertybrowser/src/QtGroupBoxPropertyBrowser
qtpropertybrowser/src/QtGroupPropertyManager
qtpropertybrowser/src/QtIntPropertyManager
qtpropertybrowser/src/QtKeySequenceEditorFactory
qtpropertybrowser/src/QtKeySequencePropertyManager
qtpropertybrowser/src/QtLineEditFactory
qtpropertybrowser/src/QtLocalePropertyManager
qtpropertybrowser/src/QtPointFPropertyManager
qtpropertybrowser/src/QtPointPropertyManager
qtpropertybrowser/src/QtProperty
qtpropertybrowser/src/QtRectFPropertyManager
qtpropertybrowser/src/QtRectPropertyManager
qtpropertybrowser/src/QtScrollBarFactory
qtpropertybrowser/src/QtSizeFPropertyManager
qtpropertybrowser/src/QtSizePolicyPropertyManager
qtpropertybrowser/src/QtSizePropertyManager
qtpropertybrowser/src/QtSliderFactory
qtpropertybrowser/src/QtSpinBoxFactory
qtpropertybrowser/src/QtStringPropertyManager
qtpropertybrowser/src/QtTimeEditFactory
qtpropertybrowser/src/QtTimePropertyManager
qtpropertybrowser/src/QtTreePropertyBrowser
qtpropertybrowser/src/QtVariantEditorFactory
qtpropertybrowser/src/QtVariantProperty
qtpropertybrowser/src/QtVariantPropertyManager
qtpropertybrowser/src/fileedit.h
qtpropertybrowser/src/fileeditfactory.h
qtpropertybrowser/src/filepathmanager.h
qtpropertybrowser/src/qtbuttonpropertybrowser.h
qtpropertybrowser/src/qteditorfactory.h
qtpropertybrowser/src/qtgroupboxpropertybrowser.h
qtpropertybrowser/src/qtpropertybrowser.h
qtpropertybrowser/src/qtpropertybrowserutils_p.h
qtpropertybrowser/src/qtpropertymanager.h
qtpropertybrowser/src/qttreepropertybrowser.h
qtpropertybrowser/src/qtvariantproperty.h
resizeableitem.h
routingstatsscene.h
routingxmlparser.h
statisticsconstants.h
statsmode.h
statsview.h
table.h
textbubble.h
timevalue.h
)
set(resource_files resources.qrc qtpropertybrowser/src/qtpropertybrowser.qrc)
add_executable(netanim ${source_files} ${resource_files})
if(Qt4_FOUND)
target_link_libraries(netanim PUBLIC ${libcore} Qt4::QtGui)
else()
target_link_libraries(netanim PUBLIC ${libcore} Qt5::Widgets Qt5::Core Qt5::PrintSupport Qt5::Gui)
endif()
target_include_directories(netanim PUBLIC qtpropertybrowser/src)
set_runtime_outputdirectory(netanim ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bin)

View File

@@ -0,0 +1,3 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/ns3Targets.cmake")

View File

@@ -0,0 +1,10 @@
#ifndef NS3_CONFIG_STORE_CONFIG_H
#define NS3_CONFIG_STORE_CONFIG_H
#cmakedefine PYTHONDIR "@PYTHONDIR@"
#cmakedefine PYTHONARCHDIR "@PYTHONARCHDIR@"
#cmakedefine HAVE_PYEMBED
#cmakedefine HAVE_PYEXT
#cmakedefine HAVE_PYTHON_H
#endif //NS3_CONFIG_STORE_CONFIG_H

View File

@@ -0,0 +1,21 @@
#ifndef NS3_CORE_CONFIG_H
#define NS3_CORE_CONFIG_H
#cmakedefine HAVE_UINT128_T
#cmakedefine01 HAVE___UINT128_T
#cmakedefine INT64X64_USE_128
#cmakedefine INT64X64_USE_DOUBLE
#cmakedefine INT64X64_USE_CAIRO
#cmakedefine01 HAVE_STDINT_H
#cmakedefine01 HAVE_INTTYPES_H
#cmakedefine HAVE_SYS_INT_TYPES_H
#cmakedefine01 HAVE_SYS_TYPES_H
#cmakedefine01 HAVE_SYS_STAT_H
#cmakedefine01 HAVE_DIRENT_H
#cmakedefine01 HAVE_STDLIB_H
#cmakedefine01 HAVE_GETENV
#cmakedefine01 HAVE_SIGNAL_H
#cmakedefine HAVE_PTHREAD_H
#cmakedefine HAVE_RT
#endif //NS3_CORE_CONFIG_H

View File

@@ -0,0 +1,48 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
macro(ns3_cmake_package)
install(EXPORT ns3ExportTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ns3 FILE ns3Targets.cmake)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"buildsupport/Config.cmake.in" "ns3Config.cmake" INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ns3
PATH_VARS CMAKE_INSTALL_LIBDIR
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ns3ConfigVersion.cmake VERSION ${NS3_VER} COMPATIBILITY ExactVersion
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ns3Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ns3ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ns3
)
install(DIRECTORY ${CMAKE_HEADER_OUTPUT_DIRECTORY} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Hack to get the install_manifest.txt file before finishing the installation, which we can then install along with
# ns3 to make uninstallation trivial
set(sep "/")
install(
CODE "string(REPLACE \";\" \"\\n\" MY_CMAKE_INSTALL_MANIFEST_CONTENT \"\$\{CMAKE_INSTALL_MANIFEST_FILES\}\")\n\
string(REPLACE \"/\" \"${sep}\" MY_CMAKE_INSTALL_MANIFEST_CONTENT_FINAL \"\$\{MY_CMAKE_INSTALL_MANIFEST_CONTENT\}\")\n\
file(WRITE manifest.txt \"\$\{MY_CMAKE_INSTALL_MANIFEST_CONTENT_FINAL\}\")"
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ns3)
endmacro()
# You will need administrative privileges to run this
add_custom_target(
uninstall COMMAND rm -R `cat ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/ns3/manifest.txt` && rm -R
${CMAKE_INSTALL_FULL_LIBDIR}/cmake/ns3 && rm -R ${CMAKE_INSTALL_FULL_INCLUDEDIR}/ns3
)

View File

@@ -0,0 +1,46 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
macro(process_contribution contribution_list)
# Create handles to reference contrib libraries
foreach(libname ${contribution_list})
library_target_name(${libname} targetname)
set(lib${libname} ${targetname} CACHE INTERNAL "")
set(lib${libname}-obj ${targetname}-obj CACHE INTERNAL "")
endforeach()
# Add contribution folders to be built
foreach(contribname ${contribution_list})
add_subdirectory("contrib/${contribname}")
endforeach()
endmacro()
# cmake-format: off
macro(
build_contrib_example
name
source_files
header_files
libraries_to_link
)
# cmake-format: on
build_lib_example_impl(
"contrib/${contribname}" "${name}" "${source_files}" "${header_files}" "${libraries_to_link}"
)
endmacro()
macro(build_contrib_lib name source_files header_files libraries_to_link test_sources)
build_lib_impl(
"contrib" "${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}"
)
endmacro()

View File

@@ -0,0 +1,44 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
if(${NS3_COVERAGE})
find_program(GCOVp gcov)
if(GCOVp)
add_definitions(--coverage)
link_libraries(-lgcov)
endif()
find_program(LCOVp lcov)
if(NOT LCOVp)
message(FATAL_ERROR "LCOV is required but it is not installed.")
endif()
if(${NS3_COVERAGE_ZERO_COUNTERS})
set(zero_counters "--lcov-zerocounters")
endif()
# The following target will run test.py --nowaf to generate the code coverage files .gcno and .gcda output will be in
# ${CMAKE_BINARY_DIR} a.k.a. cmake_cache or cmake-build-${build_suffix}
# Create output directory for coverage info and html
file(MAKE_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/coverage)
# Extract code coverage results and build html report
add_custom_target(
coverage_gcc
COMMAND lcov -o ns3.info -c --directory ${CMAKE_BINARY_DIR} ${zero_counters}
COMMAND genhtml ns3.info
WORKING_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/coverage
DEPENDS run_test_py
)
endif()

View File

@@ -0,0 +1,386 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
# cmake-format: off
#
# This macro processes a ns-3 module
#
# Arguments:
# folder = src or contrib/contributor_module
# libname = core, wifi, contributor_module
# source_files = "list;of;.cc;files;"
# header_files = "list;of;public;.h;files;"
# libraries_to_link = "list;of;${library_names};"
# test_sources = "list;of;.cc;test;files;"
#
# Hidden argument (this is not a function, so you don't really need to pass arguments explicitly)
# deprecated_header_files = "list;of;deprecated;.h;files", copy won't get triggered if deprecated_header_files isn't set
# ignore_pch = TRUE or FALSE, prevents the PCH from including undesired system libraries (e.g. custom GLIBC for DCE)
macro(
build_lib_impl
folder
libname
source_files
header_files
libraries_to_link
test_sources
#deprecated_header_files
#ignore_pch
)
# cmake-format: on
message(STATUS "Processing ${folder}/${libname}")
# Add library to a global list of libraries
if("${folder}" MATCHES "src")
set(ns3-libs "${lib${libname}};${ns3-libs}" CACHE INTERNAL "list of processed upstream modules")
else()
set(ns3-contrib-libs "${lib${libname}};${ns3-contrib-libs}" CACHE INTERNAL "list of processed contrib modules")
endif()
if(NOT ${XCODE})
# Create object library with sources and headers, that will be used in lib-ns3-static and the shared library
add_library(${lib${libname}-obj} OBJECT "${source_files}" "${header_files}")
if(${NS3_PRECOMPILE_HEADERS} AND (NOT ${ignore_pch}))
target_precompile_headers(${lib${libname}-obj} REUSE_FROM stdlib_pch)
endif()
# Create shared library with previously created object library (saving compilation time for static libraries)
add_library(${lib${libname}} SHARED $<TARGET_OBJECTS:${lib${libname}-obj}>)
else()
# Xcode and CMake don't play well when using object libraries, so we have a specific path for that
add_library(${lib${libname}} SHARED "${source_files}")
if(${NS3_PRECOMPILE_HEADERS} AND (NOT ${ignore_pch}))
target_precompile_headers(${lib${libname}} REUSE_FROM stdlib_pch)
endif()
endif()
if(${NS3_CLANG_TIMETRACE})
add_dependencies(timeTraceReport ${lib${libname}})
endif()
# Split ns and non-ns libraries to manage their propagation properly
set(non_ns_libraries_to_link)
set(ns_libraries_to_link)
foreach(library ${libraries_to_link})
# Remove lib prefix from module name (e.g. libcore -> core)
string(REPLACE "lib" "" module_name "${library}")
if(${module_name} IN_LIST ns3-all-modules)
list(APPEND ns_libraries_to_link ${library})
else()
list(APPEND non_ns_libraries_to_link ${library})
endif()
unset(module_name)
endforeach()
# ns-3 libraries are linked publicly, to make sure other modules can find each other without being directly linked
target_link_libraries(${lib${libname}} PUBLIC ${LIB_AS_NEEDED_PRE} "${ns_libraries_to_link}" ${LIB_AS_NEEDED_POST})
# non-ns-3 libraries are linked privately, not propagating unnecessary libraries such as pthread, librt, etc
target_link_libraries(
${lib${libname}} PRIVATE ${LIB_AS_NEEDED_PRE} "${non_ns_libraries_to_link}" ${LIB_AS_NEEDED_POST}
)
# set output name of library
set_target_properties(${lib${libname}} PROPERTIES OUTPUT_NAME ns${NS3_VER}-${libname}${build_profile_suffix})
if(${NS3_STATIC} OR ${NS3_MONOLIB})
set(ns3-external-libs "${non_ns_libraries_to_link};${ns3-external-libs}"
CACHE INTERNAL "list of non-ns libraries to link to NS3_STATIC and NS3_MONOLIB"
)
set(lib-ns3-static-objs "$<TARGET_OBJECTS:${lib${libname}-obj}>;${lib-ns3-static-objs}"
CACHE INTERNAL "list of object files from module used by NS3_STATIC and NS3_MONOLIB"
)
endif()
# Write a module header that includes all headers from that module
write_module_header("${libname}" "${header_files}")
# Copy all header files to outputfolder/include before each build
copy_headers_before_building_lib(${libname} ${CMAKE_HEADER_OUTPUT_DIRECTORY} "${header_files}" public)
if(deprecated_header_files)
copy_headers_before_building_lib(
${libname} ${CMAKE_HEADER_OUTPUT_DIRECTORY} "${deprecated_header_files}" deprecated
)
endif()
# Build tests if requested
if(${NS3_TESTS})
list(LENGTH test_sources test_source_len)
if(${test_source_len} GREATER 0)
# Create libname of output library test of module
set(test${libname} test-lib${libname} CACHE INTERNAL "")
set(ns3-libs-tests "${test${libname}};${ns3-libs-tests}" CACHE INTERNAL "list of test libraries")
# Create shared library containing tests of the module
add_library(${test${libname}} SHARED "${test_sources}")
# Link test library to the module library
if(${NS3_MONOLIB})
target_link_libraries(${test${libname}} ${LIB_AS_NEEDED_PRE} ${lib-ns3-monolib} ${LIB_AS_NEEDED_POST})
else()
target_link_libraries(
${test${libname}} ${LIB_AS_NEEDED_PRE} ${lib${libname}} "${libraries_to_link}" ${LIB_AS_NEEDED_POST}
)
endif()
set_target_properties(
${test${libname}} PROPERTIES OUTPUT_NAME ns${NS3_VER}-${libname}-test${build_profile_suffix}
)
target_compile_definitions(${test${libname}} PRIVATE NS_TEST_SOURCEDIR="${folder}/${libname}/test")
if(${NS3_PRECOMPILE_HEADERS} AND (NOT ${ignore_pch}))
target_precompile_headers(${test${libname}} REUSE_FROM stdlib_pch)
endif()
endif()
endif()
# Build lib examples if requested
if(${NS3_EXAMPLES})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/examples)
add_subdirectory(examples)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/example)
add_subdirectory(example)
endif()
endif()
# Get architecture pair for python bindings
set(arch gcc_ILP32)
set(arch_flag)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(arch gcc_LP64)
set(arch_flag -m64)
endif()
# Add target to scan python bindings
if(${NS3_SCAN_PYTHON_BINDINGS} AND EXISTS ${CMAKE_HEADER_OUTPUT_DIRECTORY}/${libname}-module.h)
set(bindings_output_folder ${PROJECT_SOURCE_DIR}/${folder}/${libname}/bindings)
file(MAKE_DIRECTORY ${bindings_output_folder})
set(module_api ${bindings_output_folder}/modulegen__${arch}.py)
set(modulescan_modular_command ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bindings/python/ns3modulescan-modular.py)
# To build the header map for the module, we start by copying the headers and prepending the dictionary start
set(header_map "{\\\"${header_files};")
# We then remove model/ helper/ prefixes e.g. {'model/angles.h;model/antenna-model.h;... ->
# {'angles.h;antenna-model.h;...)
string(REPLACE "model/" "" header_map "${header_map}")
string(REPLACE "helper/" "" header_map "${header_map}")
# Now we replace list entry separators (;) with ending of the string quote ("), followed by the relative module e.g.
# {"model/angles.h;model/antenna-model.h;... -> {"angles.h" : "antenna", "antenna-model.h": "antenna", "...)
string(REPLACE ";" "\\\": \\\"${libname}\\\", \\\"" header_map "${header_map}")
# We now remove the last character ("), which needs to be replaced with a (}), to close the dictionary e.g.
# "antenna-model.h" : "antenna", " -> "antenna-model.h" : "antenna"
string(LENGTH "${header_map}" header_map_len)
math(EXPR header_map_len "${header_map_len}-3")
string(SUBSTRING "${header_map}" 0 ${header_map_len} header_map)
# Append end of dictionary (})
string(APPEND header_map "}")
add_custom_target(
apiscan-${lib${libname}}
COMMAND ${modulescan_modular_command} ${CMAKE_OUTPUT_DIRECTORY} ${libname} ${header_map} ${module_api}
${arch_flag}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${lib${libname}}
)
add_dependencies(apiscan-all apiscan-${lib${libname}})
endif()
# Build pybindings if requested and if bindings subfolder exists in NS3/src/libname
if(${NS3_PYTHON_BINDINGS} AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/bindings")
set(bindings_output_folder ${CMAKE_OUTPUT_DIRECTORY}/${folder}/${libname}/bindings)
file(MAKE_DIRECTORY ${bindings_output_folder})
set(module_src ${bindings_output_folder}/ns3module.cc)
set(module_hdr ${bindings_output_folder}/ns3module.h)
string(REPLACE "-" "_" libname_sub ${libname}) # '-' causes problems (e.g. csma-layout), replace with '_' (e.g.
# csma_layout)
# Set prefix of binding to _ if a ${libname}.py exists, and copy the ${libname}.py to the output folder
set(prefix)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/bindings/${libname}.py)
set(prefix _)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/${libname}.py
DESTINATION ${CMAKE_OUTPUT_DIRECTORY}/bindings/python/ns
)
endif()
# Run modulegen-modular to generate the bindings sources
if((NOT EXISTS ${module_hdr}) OR (NOT EXISTS ${module_src})) # OR TRUE) # to force reprocessing
string(REPLACE ";" "," ENABLED_FEATURES "${ns3-libs}")
set(modulegen_modular_command GCC_RTTI_ABI_COMPLETE=True NS3_ENABLED_FEATURES="${ENABLED_FEATURES}"
${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bindings/python/ns3modulegen-modular.py
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_OUTPUT_DIRECTORY} ${modulegen_modular_command}
${CMAKE_CURRENT_SOURCE_DIR} ${arch} ${prefix}${libname_sub} ${module_src}
TIMEOUT 60
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_FILE ${module_hdr}
ERROR_FILE ${bindings_output_folder}/ns3modulegen.log
RESULT_VARIABLE error_code
)
if(${error_code} OR NOT (EXISTS ${module_hdr}))
message(
FATAL_ERROR "Something went wrong during processing of the python bindings of module ${libname}."
" Make sure the correct versions of Pybindgen and Pygccxml are installed (use the pip ones)."
)
if(EXISTS ${module_src})
file(REMOVE ${module_src})
endif()
endif()
endif()
# Add core module helper sources
set(python_module_files ${module_hdr} ${module_src})
if(${libname} STREQUAL "core")
list(APPEND python_module_files ${CMAKE_CURRENT_SOURCE_DIR}/bindings/module_helpers.cc
${CMAKE_CURRENT_SOURCE_DIR}/bindings/scan-header.h
)
endif()
add_library(${libname}-bindings SHARED "${python_module_files}")
target_include_directories(${libname}-bindings PUBLIC ${Python3_INCLUDE_DIRS} ${bindings_output_folder})
# If there is any, remove the "lib" prefix of libraries (search for "set(lib${libname}")
list(LENGTH ns_libraries_to_link num_libraries)
if(num_libraries GREATER "0")
string(REPLACE ";" "-bindings;" bindings_to_link "${ns_libraries_to_link};") # add -bindings suffix to all
# lib${name}
string(REPLACE "lib" "" bindings_to_link "${bindings_to_link}") # remove lib prefix from all lib${name}-bindings
endif()
target_link_libraries(
${libname}-bindings PUBLIC ${LIB_AS_NEEDED_PRE} ${lib${libname}} "${bindings_to_link}" "${libraries_to_link}"
${LIB_AS_NEEDED_POST}
)
target_include_directories(${libname}-bindings PRIVATE ${PROJECT_SOURCE_DIR}/src/core/bindings)
# Set binding library name and output folder
set_target_properties(
${libname}-bindings PROPERTIES OUTPUT_NAME ${prefix}${libname_sub} PREFIX ""
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/bindings/python/ns
)
set(ns3-python-bindings-modules "${libname}-bindings;${ns3-python-bindings-modules}"
CACHE INTERNAL "list of modules python bindings"
)
# Make sure all bindings are built before building the visualizer module that makes use of them
if(NOT (${name} STREQUAL visualizer))
add_dependencies(${libvisualizer} ${libname}-bindings)
endif()
endif()
# Handle package export
install(TARGETS ${lib${name}} EXPORT ns3ExportTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endmacro()
# cmake-format: off
#
# This macro processes a ns-3 module example
#
# Arguments: folder = src or contrib/contributor_module libname = core, wifi, contributor_module (this is implicit, as
# it is called by build_lib_impl)
# name = example name (e.g. command-line-example)
# source_files = "cmake;list;of;.cc;files;"
# header_files = "cmake;list;of;public;.h;files;"
# libraries_to_link = "cmake;list;of;${library_names};"
#
macro(
build_lib_example_impl
folder
name
source_files
header_files
libraries_to_link
)
# cmake-format: on
set(missing_dependencies FALSE)
foreach(lib ${libraries_to_link})
string(REPLACE "lib" "" lib ${lib})
if(NOT (${lib} IN_LIST ns3-all-modules))
set(missing_dependencies TRUE)
endif()
endforeach()
if(NOT missing_dependencies)
# Create shared library with sources and headers
add_executable(${name} "${source_files}" "${header_files}")
if(${NS3_STATIC})
target_link_libraries(${name} ${LIB_AS_NEEDED_PRE_STATIC} ${lib-ns3-static})
elseif(${NS3_MONOLIB})
target_link_libraries(${name} ${LIB_AS_NEEDED_PRE} ${lib-ns3-monolib} ${LIB_AS_NEEDED_POST})
else()
target_link_libraries(
${name} ${LIB_AS_NEEDED_PRE} ${lib${libname}} ${libraries_to_link} ${optional_visualizer_lib}
${LIB_AS_NEEDED_POST}
)
endif()
if(${NS3_PRECOMPILE_HEADERS} AND (NOT ${ignore_pch}))
target_precompile_headers(${name} REUSE_FROM stdlib_pch_exec)
endif()
set_runtime_outputdirectory(${name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${folder}/examples/)
endif()
endmacro()
# This macro processes a ns-3 module header file (module_name-module.h)
#
# Arguments: name = module name (e.g. core, wifi) header_files = "cmake;list;of;public;.h;files;"
macro(write_module_header name header_files)
string(TOUPPER ${name} uppercase_name)
string(REPLACE "-" "_" final_name ${uppercase_name})
# Common module_header
list(APPEND contents "#ifdef NS3_MODULE_COMPILATION ")
list(
APPEND
contents
"
error \"Do not include ns3 module aggregator headers from other modules; these are meant only for end user scripts.\" "
)
list(APPEND contents "
#endif "
)
list(APPEND contents "
#ifndef NS3_MODULE_"
)
list(APPEND contents ${final_name})
list(APPEND contents "
// Module headers: "
)
# Write each header listed to the contents variable
foreach(header ${header_files})
get_filename_component(head ${header} NAME)
list(APPEND contents "
#include <ns3/${head}>"
)
# include \"ns3/${head}\"")
endforeach()
# Common module footer
list(APPEND contents "
#endif "
)
file(WRITE ${CMAKE_HEADER_OUTPUT_DIRECTORY}/${name}-module.h ${contents})
endmacro()

View File

@@ -0,0 +1,53 @@
# Determine if the git repository is an ns-3 repository
#
# A repository is considered an ns-3 repository if it has at least one tag that matches the regex ns-3*
function(check_git_repo_has_ns3_tags HAS_TAGS GIT_VERSION_TAG)
execute_process(COMMAND ${GIT} describe --tags --abbrev=0 --match ns-3.[0-9]* OUTPUT_VARIABLE GIT_TAG_OUTPUT)
string(REPLACE "\r" "" GIT_TAG_OUTPUT ${GIT_TAG_OUTPUT}) # remove CR (carriage return)
string(REPLACE "\n" "" GIT_TAG_OUTPUT ${GIT_TAG_OUTPUT}) # remove LF (line feed)
# Check if tag exists and return values to the caller
string(LENGTH GIT_TAG_OUTPUT GIT_TAG_OUTPUT_LEN)
set(${HAS_TAGS} FALSE PARENT_SCOPE)
set(${GIT_VERSION_TAG} "" PARENT_SCOPE)
if(${GIT_TAG_OUTPUT_LEN} GREATER "0")
set(${HAS_TAGS} TRUE PARENT_SCOPE)
set(${GIT_VERSION_TAG} ${GIT_TAG_OUTPUT} PARENT_SCOPE)
endif()
endfunction()
# Function to generate version fields from an ns-3 git repository
function(check_ns3_closest_tags CLOSEST_TAG VERSION_TAG_DISTANCE VERSION_COMMIT_HASH VERSION_DIRTY_FLAG)
execute_process(COMMAND ${GIT} describe --tags --dirty --long OUTPUT_VARIABLE GIT_TAG_OUTPUT)
string(REPLACE "\r" "" GIT_TAG_OUTPUT ${GIT_TAG_OUTPUT}) # remove CR (carriage return)
string(REPLACE "\n" "" GIT_TAG_OUTPUT ${GIT_TAG_OUTPUT}) # remove LF (line feed)
# Split ns-3.<version>.<patch>(-RC<digit>)-distance-commit(-dirty) into a list
# ns;3.<version>.<patch>;(RC<digit);distance;commit(;dirty)
string(REPLACE "-" ";" TAG_LIST "${GIT_TAG_OUTPUT}")
list(GET TAG_LIST 0 NS)
list(GET TAG_LIST 1 VERSION)
if(${GIT_TAG_OUTPUT} MATCHES "RC")
list(GET TAG_LIST 2 RC)
set(${CLOSEST_TAG} "${NS}-${VERSION}-${RC}" PARENT_SCOPE)
list(GET TAG_LIST 3 DISTANCE)
list(GET TAG_LIST 4 HASH)
else()
set(${CLOSEST_TAG} "${NS}-${VERSION}" PARENT_SCOPE)
list(GET TAG_LIST 2 DISTANCE)
list(GET TAG_LIST 3 HASH)
endif()
set(${VERSION_TAG_DISTANCE} ${DISTANCE} PARENT_SCOPE)
set(${VERSION_COMMIT_HASH} "${HASH}" PARENT_SCOPE)
set(${VERSION_DIRTY_FLAG} 0 PARENT_SCOPE)
if(${GIT_TAG_OUTPUT} MATCHES "dirty")
set(${VERSION_DIRTY_FLAG} 1 PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,28 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
function(generate_buildstatus)
# Build build-status.py file consumed by test.py
set(buildstatus_contents "#! /usr/bin/env python3\n\n")
string(APPEND buildstatus_contents "ns3_runnable_programs = [")
foreach(executable ${ns3-execs})
string(APPEND buildstatus_contents "'${executable}', ")
endforeach()
string(APPEND buildstatus_contents "]\n\n")
string(APPEND buildstatus_contents "ns3_runnable_scripts = [") # missing support
string(APPEND buildstatus_contents "]\n\n")
file(WRITE ${CMAKE_OUTPUT_DIRECTORY}/build-status.py "${buildstatus_contents}")
endfunction(generate_buildstatus)

View File

@@ -0,0 +1,75 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
function(cache_cmake_flag cmake_flag cache_entry output_string)
if(${${cmake_flag}})
set(${output_string} "${${output_string}}${cache_entry} = True\n" PARENT_SCOPE)
else()
set(${output_string} "${${output_string}}${cache_entry} = False\n" PARENT_SCOPE)
endif()
endfunction(cache_cmake_flag)
function(generate_c4che_cachepy)
# Build _cache.py file consumed by test.py
set(cache_contents "")
string(APPEND cache_contents "NS3_ENABLED_MODULES = [")
foreach(module_library ${ns3-libs}) # fetch core module libraries
string(APPEND cache_contents "'")
string(REPLACE "lib" "" module_name ${module_library}) # lib${libname} into libname
string(APPEND cache_contents "ns3-${module_name}', ")
endforeach()
string(APPEND cache_contents "]\n")
string(APPEND cache_contents "NS3_ENABLED_CONTRIBUTED_MODULES = [")
foreach(module_library ${ns3-contrib-libs}) # fetch core module libraries
string(APPEND cache_contents "'")
string(REPLACE "lib" "" module_name ${module_library}) # lib${libname} into libname
string(APPEND cache_contents "ns3-${module_name}', ")
endforeach()
string(APPEND cache_contents "]\n")
string(REPLACE ":" "', '" PATH_LIST $ENV{PATH})
string(APPEND cache_contents
"NS3_MODULE_PATH = ['${PATH_LIST}', '${CMAKE_OUTPUT_DIRECTORY}', '${CMAKE_LIBRARY_OUTPUT_DIRECTORY}']\n"
)
cache_cmake_flag(NS3_NSC "NSC_ENABLED" cache_contents) # missing support
cache_cmake_flag(ENABLE_REALTIME "ENABLE_REAL_TIME" cache_contents)
cache_cmake_flag(NS3_PTHREAD "ENABLE_THREADING" cache_contents)
cache_cmake_flag(NS3_EXAMPLES "ENABLE_EXAMPLES" cache_contents)
cache_cmake_flag(NS3_TESTS "ENABLE_TESTS" cache_contents)
cache_cmake_flag(NS3_OPENFLOW "ENABLE_OPENFLOW" cache_contents)
cache_cmake_flag(NS3_CLICK "NSCLICK" cache_contents)
cache_cmake_flag(NS3_BRITE "ENABLE_BRITE" cache_contents)
cache_cmake_flag(NS3_PYTHON_BINDINGS "ENABLE_PYTHON_BINDINGS" cache_contents)
string(APPEND cache_contents "EXAMPLE_DIRECTORIES = [")
foreach(example_folder ${ns3-example-folders})
string(APPEND cache_contents "'${example_folder}', ")
endforeach()
string(APPEND cache_contents "]\n")
string(APPEND cache_contents "APPNAME = 'ns'\n")
string(APPEND cache_contents "BUILD_PROFILE = '${build_profile}'\n")
string(APPEND cache_contents "VERSION = '3-dev' \n")
string(APPEND cache_contents "PYTHON = ['${Python3_EXECUTABLE}']\n")
find_program(VALGRIND valgrind)
if("${VALGRIND}" STREQUAL "VALGRIND-NOTFOUND")
string(APPEND cache_contents "VALGRIND_FOUND = False \n")
else()
string(APPEND cache_contents "VALGRIND_FOUND = True \n")
endif()
file(WRITE ${CMAKE_OUTPUT_DIRECTORY}/c4che/_cache.py "${cache_contents}")
endfunction(generate_c4che_cachepy)

View File

@@ -0,0 +1,114 @@
# cmake-format: off
#
# A sample of what Waf currently produces
# ---- Summary of optional NS-3 features:
# Build profile : debug
# Build directory :
# BRITE Integration : not enabled (BRITE not enabled (see option --with-brite))
# DES Metrics event collection : not enabled (defaults to disabled)
# DPDK NetDevice : not enabled (libdpdk not found, $RTE_SDK and/or $RTE_TARGET environment variable not set or incorrect)
# Emulation FdNetDevice : enabled
# Examples : not enabled (defaults to disabled)
# File descriptor NetDevice : enabled
# GNU Scientific Library (GSL) : enabled
# Gcrypt library : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
# GtkConfigStore : enabled
# MPI Support : not enabled (option --enable-mpi not selected)
# NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick))
# NS-3 OpenFlow Integration : not enabled (OpenFlow not enabled (see option --with-openflow))
# Netmap emulation FdNetDevice : not enabled (needs net/netmap_user.h)
# Network Simulation Cradle : not enabled (NSC not found (see option --with-nsc))
# PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
# PyViz visualizer : not enabled (Missing python modules: pygraphviz, gi.repository.GooCanvas)
# Python API Scanning Support : not enabled (castxml too old)
# Python Bindings : enabled
# Real Time Simulator : enabled
# SQLite stats support : enabled
# 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
#
# cmake-format: on
# Now the CMake part
macro(check_on_or_off user_config_switch confirmation_flag)
if(${user_config_switch})
if(${confirmation_flag})
string(APPEND out "ON\n")
else()
string(APPEND out "OFF (not found)\n")
endif()
else()
string(APPEND out "OFF\n")
endif()
endmacro()
macro(write_fakewaf_config)
set(out "---- Summary of optional NS-3 features:\n")
string(APPEND out "Build profile : ${build_profile}\n")
string(APPEND out "Build directory : ${CMAKE_OUTPUT_DIRECTORY}\n")
string(APPEND out "BRITE Integration : ")
check_on_or_off("ON" "${NS3_BRITE}")
string(APPEND out "DES Metrics event collection : ${NS3_DES_METRICS}\n")
string(APPEND out "DPDK NetDevice : ")
check_on_or_off("ON" "${ENABLE_DPDKDEVNET}")
string(APPEND out "Emulation FdNetDevice : ")
check_on_or_off("${NS3_EMU}" "${ENABLE_EMU}")
string(APPEND out "Examples : ${NS3_EXAMPLES}\n")
string(APPEND out "File descriptor NetDevice : ")
check_on_or_off("ON" "${ENABLE_FDNETDEV}")
string(APPEND out "GNU Scientific Library (GSL) : ")
check_on_or_off("${NS3_GSL}" "${GSL_FOUND}")
# string(APPEND out "Gcrypt library : not enabled (libgcrypt not found: you can use libgcrypt-config to
# find its location.)
string(APPEND out "GtkConfigStore : ")
check_on_or_off("${NS3_GTK3}" "${GTK3_FOUND}")
string(APPEND out "MPI Support : ")
check_on_or_off("${NS3_MPI}" "${MPI_FOUND}")
string(APPEND out "NS-3 Click Integration : ")
check_on_or_off("ON" "${NS3_CLICK}")
string(APPEND out "NS-3 OpenFlow Integration : ")
check_on_or_off("ON" "${NS3_OPENFLOW}")
string(APPEND out "Netmap emulation FdNetDevice : ")
check_on_or_off("${NS3_EMU}" "${ENABLE_NETMAP_EMU}")
string(APPEND out "Network Simulation Cradle : flag is set to ${NS3_NSC}, but currently not supported\n")
string(APPEND out "PlanetLab FdNetDevice : flag is set to ${NS3_PLANETLAB}, but currently not supported\n")
string(APPEND out "PyViz visualizer : ${NS3_VISUALIZER}\n")
# string(APPEND out "Python API Scanning Support : not enabled (castxml too old)
string(APPEND out "Python Bindings : ${NS3_PYTHON_BINDINGS}\n")
string(APPEND out "Real Time Simulator : ")
check_on_or_off("${NS3_REALTIME}" "${ENABLE_REALTIME}")
string(APPEND out "SQLite stats support : ")
check_on_or_off("${NS3_SQLITE}" "${ENABLE_SQLITE}")
string(APPEND out "Tap Bridge : ${NS3_TAP}\n")
string(APPEND out "Tap FdNetDevice : ")
check_on_or_off("${NS3_TAP}" "${ENABLE_TAP}")
string(APPEND out "Tests : ${NS3_TESTS}\n")
string(APPEND out "Threading Primitives : ")
check_on_or_off("${NS3_PTHREAD}" "${THREADS_ENABLED}")
# string(APPEND out "Use sudo to set suid bit : not enabled (option --enable-sudo not selected) string(APPEND out
# "XmlIo : enabled
file(WRITE ${PROJECT_BINARY_DIR}/ns3wafconfig.txt ${out})
message(STATUS ${out})
endmacro()

View File

@@ -0,0 +1,31 @@
# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
function(generate_fakewaflock)
set(fakewaflock_contents "")
string(APPEND fakewaflock_contents "launch_dir = '${PROJECT_SOURCE_DIR}'\n")
string(APPEND fakewaflock_contents "run_dir = '${PROJECT_SOURCE_DIR}'\n")
string(APPEND fakewaflock_contents "top_dir = '${PROJECT_SOURCE_DIR}'\n")
string(APPEND fakewaflock_contents "out_dir = '${CMAKE_OUTPUT_DIRECTORY}'\n")
set(fakewaflock_filename)
if(LINUX)
set(fakewaflock_filename .lock-waf_linux_build)
elseif(APPLE)
set(fakewaflock_filename .lock-waf_darwin_build)
else()
message(FATAL_ERROR "Platform not supported")
endif()
file(WRITE ${PROJECT_SOURCE_DIR}/${fakewaflock_filename} ${fakewaflock_contents})
endfunction(generate_fakewaflock)

0
buildsupport/empty.cc Normal file
View File

View File

@@ -0,0 +1 @@
int main(){}

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
echo >>"$1"/iwyu.log include-what-you-use "${@:2}"
exec include-what-you-use "${@:2}" 2> >(tee -a "$1"/iwyu.log >&2)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,145 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2018 Lawrence Livermore National Laboratory
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathew Bielejeski <bielejeski1@llnl.gov>
*/
#ifndef NS3_VERSION_DEFINES_H_
#define NS3_VERSION_DEFINES_H_
/**
* \file
* \ingroup buildversion
* Defines the macro values for printing the build version.
* These will be populated by the build system.
*/
/**
* \ingroup buildversion
* @{
*/
/**
* The first tag found which matches the pattern ns-3*.
*
* The expected format of the ns-3 version tag is: ns-3.<minor>[.patch][-release_candidate]
*
* The tag is found by starting at the tip of the current branch and walking
* back towards the root.
*
* Type: string literal
*/
#cmakedefine NS3_VERSION_TAG "@NS3_VERSION_TAG@"
/**
* The tag closest to the tip of the current branch
*
* The tag is found by starting at the tip of the current branch and
* walking back towards the root.
*
* This value will be the same as #NS3_VERSION_TAG when #NS3_VERSION_TAG is
* the closest tag.
*
* Type: string literal
*/
#cmakedefine NS3_VERSION_CLOSEST_TAG "@NS3_VERSION_CLOSEST_TAG@"
/**
* The major version extracted from #NS3_VERSION_TAG
*
* For a tag with the format ns-<digit>.<digit>[.digit], the major
* version is the number after ns- and before the first period.
*
* Type: integer
*/
#cmakedefine NS3_VERSION_MAJOR @NS3_VERSION_MAJOR@
/**
* The minor version extracted from #NS3_VERSION_TAG
*
* For a tag with the format ns-<digit>.<digit>[.digit], the minor
* version is the number after the first period.
*
* Type: integer
*/
#cmakedefine NS3_VERSION_MINOR @NS3_VERSION_MINOR@
/**
* The patch number extracted from #NS3_VERSION_TAG
*
* For a tag with the format ns-<digit>.<digit>[.digit], the patch
* is the number after the last period.
*
* The patch value is optional and may not be present in the tag.
* In cases where the patch value is not present, the field will be set to 0
*
* Type: integer
*/
#cmakedefine NS3_VERSION_PATCH @NS3_VERSION_PATCH@
/**
* The portion of the #NS3_VERSION_TAG indicating the version
* of the release candidate (if applicable).
*
* In order for this field to contain a value, the #NS3_VERSION_TAG
* must have the format ns-<digit>.<digit>[.digit][-RC<digit>].
* The contents of the release candidate will be the RC<digit>
* portion of the tag.
*
* Type: string literal
*/
#cmakedefine NS3_VERSION_RELEASE_CANDIDATE "@NS3_VERSION_RELEASE_CANDIDATE@"
/**
* The number of repository commits between #NS3_VERSION_CLOSEST_TAG
* and the branch HEAD.
*
* Type: integer
*/
#cmakedefine NS3_VERSION_TAG_DISTANCE @NS3_VERSION_TAG_DISTANCE@
/**
* Hash value which uniquely identifies the commit of the
* branch HEAD.
* The first character of the commit hash is 'g' to indicate this hash is
* a git hash
*
* Type: string literal
*/
#cmakedefine NS3_VERSION_COMMIT_HASH "@NS3_VERSION_COMMIT_HASH@"
/**
* Flag indicating whether the repository working tree had uncommitted
* changes when the library was built.
*
* The flag will be 1 if there were uncommitted changes, 0 otherwise.
*
* Type: integer
*/
#cmakedefine01 NS3_VERSION_DIRTY_FLAG
/**
* Indicates the build profile that was specified by the --build-profile option
* of "waf configure"
*
* Type: string literal
*/
#cmakedefine NS3_VERSION_BUILD_PROFILE "@NS3_VERSION_BUILD_PROFILE@"
/** @} */
#endif

10
examples/CMakeLists.txt Normal file
View File

@@ -0,0 +1,10 @@
if(${NS3_EXAMPLES})
subdirlist(examples_to_build ${CMAKE_CURRENT_SOURCE_DIR})
# Process subdirectories
foreach(examplefolder ${examples_to_build})
add_subdirectory(${examplefolder})
set(ns3-example-folders "${examplefolder};${ns3-example-folders}" CACHE INTERNAL "list of example folders")
endforeach()
endif()

View File

@@ -0,0 +1,5 @@
set(name three-gpp-v2v-channel-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility} ${libpropagation} ${libspectrum} ${libantenna} ${libbuildings})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,11 @@
set(name energy-model-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility} ${libwifi} ${libenergy} ${libinternet} ${libconfig-store})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name energy-model-with-harvesting-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility} ${libwifi} ${libenergy} ${libinternet} ${libconfig-store})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,5 @@
set(name simple-error-model)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,53 @@
set(name fragmentation-ipv6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fragmentation-ipv6-two-MTU)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name icmpv6-redirect)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name loose-routing-ipv6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name ping6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name radvd)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name radvd-two-prefix)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name test-ipv6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wsn-ping6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblr-wpan} ${libinternet} ${libsixlowpan} ${libmobility} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,5 @@
set(name matrix-topology)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libnetanim} ${libmobility} ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,5 @@
set(name object-names)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,7 @@
if(${ENABLE_REALTIME})
set(name realtime-udp-echo)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()

View File

@@ -0,0 +1,95 @@
set(name dynamic-global-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name static-routing-slash32)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name global-routing-slash32)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name global-injection-slash32)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name simple-global-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name simple-alternate-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name mixed-global-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libcsma} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name simple-routing-ping6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name manet-routing-compare)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link
${libwifi}
${libdsr}
${libdsdv}
${libaodv}
${libolsr}
${libinternet}
${libapplications}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name ripng-simple-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name rip-simple-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libinternet-apps})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name global-routing-multi-switch-plus-router)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link
${libcore}
${libnetwork}
${libapplications}
${libinternet}
${libbridge}
${libcsma}
${libpoint-to-point}
${libcsma}
${libinternet}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name simple-multicast-flooding)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libnetwork} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,23 @@
set(name socket-bound-static-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libcsma} ${libpoint-to-point} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name socket-bound-tcp-static-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libcsma} ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name socket-options-ipv4)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libcsma} ${libpoint-to-point} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name socket-options-ipv6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libcsma} ${libpoint-to-point} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,5 @@
set(name wifi-example-sim)
set(source_files ${name}.cc wifi-example-apps.cc)
set(header_files wifi-example-apps.h)
set(libraries_to_link ${libstats} ${libinternet} ${libmobility} ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,83 @@
if(${NS3_NSC})
set(name tcp-nsc-lfn)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-nsc-zoo)
set(source_files ${name}.cc)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-nsc-comparison)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()
set(name tcp-large-transfer)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-star-server)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name star)
set(source_files ${name}.cc)
set(libraries_to_link ${libnetanim} ${libpoint-to-point} ${libpoint-to-point-layout} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-bbr-example)
set(source_files ${name}.cc)
set(libraries_to_link
${libpoint-to-point}
${libinternet}
${libapplications}
${libtraffic-control}
${libnetwork}
${libinternet-apps}
${libflow-monitor}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-bulk-send)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-pcap-nanosec-example)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libapplications} ${libinternet})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-variants-comparison)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-pacing)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-linux-reno)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libtraffic-control} ${libnetwork})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tcp-validation)
set(source_files ${name}.cc)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libtraffic-control} ${libnetwork}
${libinternet-apps}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name dctcp-example)
set(source_files ${name}.cc)
set(libraries_to_link ${libcore} ${libnetwork} ${libinternet} ${libpoint-to-point} ${libapplications}
${libtraffic-control}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,41 @@
set(name traffic-control)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libpoint-to-point} ${libapplications} ${libtraffic-control} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name queue-discs-benchmark)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libpoint-to-point} ${libapplications} ${libinternet-apps} ${libtraffic-control}
${libflow-monitor}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name red-vs-fengadaptive)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libpoint-to-point} ${libpoint-to-point-layout} ${libapplications}
${libtraffic-control}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name red-vs-nlred)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libpoint-to-point} ${libpoint-to-point-layout} ${libapplications}
${libtraffic-control}
)
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name tbf-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libpoint-to-point} ${libapplications} ${libtraffic-control})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name cobalt-vs-codel)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libpoint-to-point} ${libapplications} ${libtraffic-control})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,47 @@
set(name hello-simulator)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name first)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name second)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libpoint-to-point} ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name third)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libpoint-to-point} ${libcsma} ${libwifi} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fourth)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fifth)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name sixth)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name seventh)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libstats} ${libpoint-to-point} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,11 @@
set(name udp-client-server)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name udp-trace-client-server)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,5 @@
set(name udp-echo)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,233 @@
set(name mixed-wired-wireless)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications} ${libolsr} ${libnetanim})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-80211e-txop)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-80211n-mimo)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-adhoc)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-aggregation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-ap)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-backward-compatibility)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-blockack)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-clear-channel-cmu)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-dsss-validation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-he-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-hidden-terminal)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-ht-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-mixed-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-multi-tos)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-multirate)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libwifi} ${libolsr} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-ofdm-he-validation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-ofdm-ht-validation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-ofdm-validation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-ofdm-vht-validation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility} ${libwifi} ${libconfig-store} ${libstats})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-error-models-comparison)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-power-adaptation-distance)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-power-adaptation-interference)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications} ${libflow-monitor})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-rate-adaptation-distance)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-simple-adhoc)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-simple-adhoc-grid)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libwifi} ${libolsr})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-simple-ht-hidden-stations)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-simple-infra)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-simple-interference)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libwifi})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-sleep)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-spatial-reuse)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-spectrum-per-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-spectrum-per-interference)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-spectrum-saturation-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-tcp)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-timing-attributes)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-txop-aggregation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-vht-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wifi-wired-bridging)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libcsma} ${libbridge} ${libapplications})
build_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

722
ns3 Executable file
View File

@@ -0,0 +1,722 @@
#! /usr/bin/env python3
import argparse
import glob
import os
import re
import shutil
import subprocess
import sys
from utils import read_config_file
def on_off_argument(parser, option_name, help_on, help_off=None):
parser.add_argument('--enable-%s' % option_name,
help=('Enable %s' % help_on) if help_off is None else help_on,
action="store_true", default=None)
parser.add_argument('--disable-%s' % option_name,
help=('Disable %s' % help_on) if help_off is None else help_off,
action="store_true", default=None)
return parser
def on_off(condition):
return "ON" if condition else "OFF"
def on_off_condition(args, cmake_flag, option_name):
enable_option = args.__getattribute__("enable_" + option_name)
disable_option = args.__getattribute__("disable_" + option_name)
cmake_arg = None
if enable_option is not None or disable_option is not None:
cmake_arg = "-DNS3_%s=%s" % (cmake_flag, on_off(enable_option and not disable_option))
return cmake_arg
def parse_args(argv):
parser = argparse.ArgumentParser("ns-3 wrapper for the CMake build system")
sub_parser = parser.add_subparsers()
parser_configure = sub_parser.add_parser('configure', help='configure --help')
parser_configure.add_argument('configure',
nargs='?',
action='store', default=True)
parser_configure.add_argument('-d', '--build-profile',
help='Build profile',
dest='build_profile',
choices=["debug", "release", "optimized"],
action="store", type=str, default=None)
parser_configure.add_argument('-G',
help=('CMake generator '
'(e.g. https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)'),
action="store", type=str, default=None)
parser_configure.add_argument('--cxx-standard',
help='Compile NS-3 with the given C++ standard',
type=str, default=None)
parser_configure = on_off_argument(parser_configure, "asserts", "the asserts regardless of the compile mode")
parser_configure = on_off_argument(parser_configure, "logs", "the logs regardless of the compile mode")
parser_configure = on_off_argument(parser_configure, "tests", "the ns-3 tests")
parser_configure = on_off_argument(parser_configure, "examples", "the ns-3 examples")
parser_configure = on_off_argument(parser_configure, "static", "Build a single static library with all ns-3",
"Restore the shared libraries")
parser_configure = on_off_argument(parser_configure, "mpi", "the MPI support for distributed simulation")
parser_configure = on_off_argument(parser_configure, "des-metrics",
"Logging all events in a json file with the name of the executable "
"(which must call CommandLine::Parse(argc, argv)")
parser_configure = on_off_argument(parser_configure, "gcov", "code coverage analysis")
parser_configure = on_off_argument(parser_configure, "gtk", "GTK support in ConfigStore")
parser_configure = on_off_argument(parser_configure, "warnings", "compiler warnings")
parser_configure = on_off_argument(parser_configure, "werror", "Treat compiler warnings as errors",
"Treat compiler warnings as warnings")
parser_configure.add_argument('--enable-modules',
help='List of modules to build (e.g. core;network;internet)',
action="store", type=str, default=None)
parser_configure.add_argument('--disable-modules',
help='List of modules not to build (e.g. lte;wimax)',
action="store", type=str, default=None)
parser_configure.add_argument('--lcov-report',
help=('Generate a code coverage report '
'(use this option after configuring with --enable-gcov and running a program)'),
action="store_true", default=None)
parser_configure.add_argument('--lcov-zerocounters',
help=('Zero the lcov counters'
'(use this option before rerunning a program'
'when generating repeated lcov reports)'),
action="store_true", default=None)
parser_configure.add_argument('--with-brite',
help=('Use BRITE integration support, given by the indicated path,'
' to allow the use of the BRITE topology generator'),
type=str, default=None)
parser_configure.add_argument('--with-click',
help='Path to Click source or installation prefix for NS-3 Click Integration support',
type=str, default=None)
parser_configure.add_argument('--with-openflow',
help='Path to OFSID source for NS-3 OpenFlow Integration support',
type=str, default=None)
parser_configure.add_argument('--force-refresh',
help='Force refresh the CMake cache by deleting'
'the cache and reconfiguring the project',
action="store_true", default=None)
parser_build = sub_parser.add_parser('build', help='build --help')
parser_build.add_argument('build',
help='Build the entire project or the specified target and dependencies',
action="store", nargs='*', default=None)
parser_clean = sub_parser.add_parser('clean', help='clean --help')
parser_clean.add_argument('clean',
nargs="?",
action="store", default=True)
parser.add_argument('--verbose',
help="Print underlying commands",
action="store_true", default=None)
parser.add_argument('--check-config',
help='Print the current configuration.',
action="store_true", default=None)
parser.add_argument('--cwd',
help='Set the working directory for a program.',
action="store", type=str, default=None)
parser.add_argument('--no-task-lines',
help="Don't print task lines, i.e. messages saying which tasks are being executed.",
action="store_true", default=None)
parser.add_argument('--run',
help=('Run a locally built program; argument can be a program name,'
' or a command starting with the program name.'),
type=str, default='')
parser.add_argument('--run-no-build',
help=(
'Run a locally built program without rebuilding the project;'
'argument can be a program name, or a command starting with the program name.'),
type=str, default='')
parser.add_argument('--visualize',
help='Modify --run arguments to enable the visualizer',
action="store_true", default=None)
parser.add_argument('--command-template',
help=('Template of the command used to run the program given by --run;'
' It should be a shell command string containing %s inside,'
' which will be replaced by the actual program.'),
type=str, default=None)
parser.add_argument('--pyrun',
help=('Run a python program using locally built ns3 python module;'
' argument is the path to the python program, optionally followed'
' by command-line options that are passed to the program.'),
type=str, default='')
parser.add_argument('--pyrun-no-build',
help=(
'Run a python program using locally built ns3 python module without rebuilding the project;'
' argument is the path to the python program, optionally followed'
' by command-line options that are passed to the program.'),
type=str, default='')
parser.add_argument('--gdb',
help='Change the default command template to run programs and unit tests with gdb',
action="store_true", default=None)
parser.add_argument('--valgrind',
help='Change the default command template to run programs and unit tests with valgrind',
action="store_true", default=None)
# parser.add_argument('--shell',
# help=('DEPRECATED (run ./waf shell)'),
# action="store_true", default=None)
# parser.add_argument('--enable-sudo',
# help=('Use sudo to setup suid bits on ns3 executables.'),
# dest='enable_sudo', action='store_true',
# default=None)
parser.add_argument('--check',
help='DEPRECATED (run ./test.py)',
action='store_true', default=None)
# parser.add_argument('--doxygen-no-build',
# help=('Run doxygen to generate html documentation from source comments, '
# 'but do not wait for ns-3 to finish the full build.'),
# action="store_true", default=None)
# parser.add_argument('--docset',
# help=(
# 'Create Docset, without building. This requires the docsetutil tool from Xcode 9.2 or earlier.'
# 'See Bugzilla 2196 for more details.'),
# action="store_true", default=None,
# dest="docset_build")
return parser.parse_args(argv)
def check_build_profile(ns3_path):
# Check the c4cache for the build type (in case there are multiple cmake cache folders
c4che_path = os.sep.join([ns3_path, "build", "c4che", "_cache.py"])
build_profile = None
ns3_version = None
ns3_modules = None
if os.path.exists(c4che_path):
c4che_info = {}
exec(open(c4che_path).read(), globals(), c4che_info)
build_profile = c4che_info["BUILD_PROFILE"]
ns3_version = c4che_info["VERSION"]
ns3_modules = c4che_info["NS3_ENABLED_MODULES"]
return build_profile, ns3_version, ns3_modules
def clean_cmake_artifacts(ns3_path, verbose=False):
if verbose:
print("rm -R %s/build" % ns3_path)
shutil.rmtree(ns3_path + os.sep + "build", ignore_errors=True)
cmake_cache_files = glob.glob("./**/CMakeCache.txt", recursive=True)
for cmake_cache_file in cmake_cache_files:
dirname = os.path.dirname(cmake_cache_file)
if verbose:
print("rm -R %s" % dirname)
shutil.rmtree(dirname, ignore_errors=True)
def search_cmake_cache(ns3_path, build_profile):
# Search for the CMake cache
cmake_cache_files = glob.glob("%s/**/CMakeCache.txt" % ns3_path, recursive=True)
current_cmake_cache_folder = None
current_cmake_generator = None
if cmake_cache_files:
# In case there are multiple cache files, get the correct one
for cmake_cache_file in cmake_cache_files:
# We found the right cache folder
if current_cmake_cache_folder and current_cmake_generator:
break
# Still looking for it
current_cmake_cache_folder = None
current_cmake_generator = None
with open(cmake_cache_file, "r") as f:
lines = f.read().split("\n")
while len(lines):
line = lines[0]
lines.pop(0)
# Check for EOF
if current_cmake_cache_folder and current_cmake_generator:
break
# Check the build profile
if "CMAKE_BUILD_TYPE" in line:
if build_profile == line.split("=")[-1].lower():
current_cmake_cache_folder = os.path.dirname(cmake_cache_file)
# Check the generator
if "CMAKE_GENERATOR" in line:
current_cmake_generator = line.split("=")[-1]
if not current_cmake_generator:
# Search for available generators
cmake_generator_map = {"make": "Unix Makefiles",
"ninja": "Ninja",
"xcodebuild": "Xcode"
}
available_generators = []
for generator in cmake_generator_map.keys():
if shutil.which(generator):
available_generators.append(generator)
# Select the first one
if len(available_generators) == 0:
raise Exception("No generator available.")
current_cmake_generator = cmake_generator_map[available_generators[0]]
return current_cmake_cache_folder, current_cmake_generator
def check_config(current_cmake_cache_folder):
waf_like_config_table = current_cmake_cache_folder + os.sep + "ns3wafconfig.txt"
if not os.path.exists(waf_like_config_table):
raise Exception("Project was not configured")
with open(waf_like_config_table, "r") as f:
print(f.read())
def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_generator, output, verbose=False):
# Aggregate all flags to configure CMake
cmake_args = [cmake]
first_run = False
if not os.path.exists(current_cmake_cache_folder + os.sep + "CMakeCache.txt"):
first_run = True
if "configure" in args:
if first_run:
# Set default build type to default if a previous cache doesn't exist
if args.build_profile is None:
args.build_profile = "debug"
# Set generator if a previous cache doesn't exist
if args.G is None:
args.G = current_cmake_generator
# C++ standard
if args.cxx_standard is not None:
cmake_args.append("-DCMAKE_CXX_STANDARD=%s" % args.cxx_standard)
# Build type
if args.build_profile is not None:
args.build_profile = args.build_profile.lower()
if args.build_profile not in ["debug", "release", "optimized"]:
raise Exception("Unknown build type")
else:
if args.build_profile == "debug":
cmake_args.append("-DCMAKE_BUILD_TYPE=debug")
else:
cmake_args.append("-DCMAKE_BUILD_TYPE=release")
cmake_args.append("-DNS3_NATIVE_OPTIMIZATIONS=%s" % on_off((args.build_profile == "optimized")))
options = (("ASSERT", "asserts"),
("LOG", "logs"),
("TESTS", "tests"),
("EXAMPLES", "examples"),
("COVERAGE", "gcov"),
("DES_METRICS", "des_metrics"),
("STATIC", "static"),
("MPI", "mpi"),
("GTK3", "gtk"),
("WARNINGS", "warnings"),
("WARNINGS_AS_ERRORS", "werror")
)
for (cmake_flag, option_name) in options:
arg = on_off_condition(args, cmake_flag, option_name)
if arg:
cmake_args.append(arg)
if args.lcov_zerocounters is not None:
cmake_args.append("-DNS3_COVERAGE_ZERO_COUNTERS=%s" % on_off(args.lcov_zerocounters))
# Brite, Click and Openflow
if args.with_brite is not None:
cmake_args.append("-DNS3_WITH_BRITE=%s" % args.with_brite)
if args.with_click is not None:
cmake_args.append("-DNS3_WITH_CLICK=%s" % args.with_click)
if args.with_openflow is not None:
cmake_args.append("-DNS3_WITH_OPENFLOW=%s" % args.with_openflow)
# Build and link visualizer
if args.visualize is not None:
cmake_args.append("-DNS3_VISUALIZER=%s" % on_off(args.visualize))
# Process enabled/disabled modules
if args.enable_modules:
cmake_args.append("-DNS3_ENABLED_MODULES=%s" % args.enable_modules)
if args.disable_modules:
cmake_args.append("-DNS3_DISABLED_MODULES=%s" % args.disable_modules)
# Try to set specified generator (will probably fail if there is an old cache)
if args.G:
cmake_args.append("-G%s" % args.G)
if "configure" not in args:
if first_run:
print("You need to configure ns-3 first: try ./ns3 configure")
exit(0)
# Configure cmake
cmake_args.append("..") # for now, assuming the cmake_cache directory is inside the ns-3-dev folder
# Echo out the configure command
if verbose:
print("cd %s; %s" % (current_cmake_cache_folder, " ".join(cmake_args)))
# Run cmake
subprocess.run(cmake_args, cwd=current_cmake_cache_folder, stdout=output)
return first_run
def get_program_shortcuts(ns3_path, build_profile, ns3_version):
build_status_file = os.sep.join([ns3_path, "build", "build-status.py"])
# Import programs from build-status.py
programs_dict = {}
exec(open(build_status_file).read(), globals(), programs_dict)
# We can now build a map to simplify things for users (at this point we could remove versioning prefix/suffix)
ns3_program_map = {}
for program in programs_dict["ns3_runnable_programs"]:
if "pch_exec" in program:
continue
temp_path = program.split("build")[-1].split(os.sep)
# Remove version prefix and buildtype suffix from shortcuts (or keep them too?)
temp_path[-1] = temp_path[-1].replace("-" + build_profile, "").replace("ns" + ns3_version + "-", "")
# Check if there is a .cc file for that specific program
source_file_path = os.sep.join(temp_path) + ".cc"
source_shortcut = False
if os.path.exists(ns3_path + source_file_path):
source_shortcut = True
program = program.strip()
while len(temp_path):
# Shortcuts: /src/aodv/examples/aodv can be accessed with aodv/examples/aodv, examples/aodv, aodv
shortcut_path = os.sep.join(temp_path)
ns3_program_map[shortcut_path] = program
if source_shortcut:
ns3_program_map[shortcut_path + ".cc"] = program
temp_path.pop(0)
return ns3_program_map
def cmake_build(current_cmake_cache_folder, output, target=None, verbose=False):
cmake_build_command = "cmake --build . -j %d%s" % (os.cpu_count(), (" --target %s" % target) if target else "")
if verbose:
print("cd %s; %s" % (current_cmake_cache_folder, cmake_build_command))
subprocess.run(cmake_build_command.split(), cwd=current_cmake_cache_folder, stdout=output)
def extract_cmakecache_settings(current_cmake_cache_folder):
try:
with open(current_cmake_cache_folder + os.sep + "CMakeCache.txt", "r", encoding="utf-8") as f:
contents = f.read()
except FileNotFoundError as e:
raise e
current_settings = re.findall("(NS3_.*):.*=(.*)", contents) # extract NS3 specific settings
current_settings.extend(re.findall("(CMAKE_BUILD_TYPE):.*=(.*)", contents)) # extract buildtype
current_settings.extend(re.findall("(CMAKE_GENERATOR):.*=(.*)", contents)) # extract generator
return dict(current_settings)
def reconfigure_cmake_to_force_refresh(cmake, current_cmake_cache_folder, output, verbose=False):
import json
settings_bak_file = "settings.json"
# Extract settings or recover from the backup
if not os.path.exists(settings_bak_file):
settings = extract_cmakecache_settings(current_cmake_cache_folder)
else:
with open(settings_bak_file, "r", encoding="utf-8") as f:
settings = json.load(f)
# Delete cache folder and then recreate it
if verbose:
print("rm -R %s; mkdir %s" % current_cmake_cache_folder * 2)
shutil.rmtree(current_cmake_cache_folder)
os.mkdir(current_cmake_cache_folder)
# Save settings backup to prevent loss
with open(settings_bak_file, "w", encoding="utf-8") as f:
json.dump(settings, f, indent=2)
# Reconfigure CMake preserving previous NS3 settings
cmake_args = [cmake]
for setting in settings.items():
if setting[1]:
cmake_args.append("-D%s=%s" % setting)
cmake_args.append("..")
# Echo out the configure command
if verbose:
print("cd %s; %s" % (current_cmake_cache_folder, " ".join(cmake_args)))
# Call cmake
ret = subprocess.run(cmake_args, cwd=current_cmake_cache_folder, stdout=output)
# If it succeeds, delete backup, otherwise raise exception
if ret.returncode == 0:
os.remove(settings_bak_file)
else:
raise Exception("Reconfiguring CMake to force refresh failed. "
"A backup of the settings was saved in %s" % settings_bak_file)
def get_target_to_build(program_name, ns3_version, build_profile):
build_profile_suffix = "" if build_profile in ["release"] else "-" + build_profile
return re.findall("%s-(.*)%s" % (ns3_version, build_profile_suffix), program_name)[0]
def check_ns3rc_config_file(args):
(config_file_exists, modules_enabled, examples_enabled, tests_enabled) = read_config_file()
if not config_file_exists:
return args
if not args.enable_modules and len(modules_enabled) > 0 and modules_enabled[0] != "all_modules":
args.enable_modules = ";".join(modules_enabled)
if not args.enable_examples and not args.disable_examples:
if examples_enabled:
args.enable_examples = True
else:
args.disable_examples = True
if not args.enable_tests and not args.disable_tests:
if tests_enabled:
args.enable_tests = True
else:
args.disable_tests = True
return args
def configuration_step(ns3_path, current_cmake_cache_folder, current_cmake_generator, args, run_only, configure_and_run,
output):
# There are a few cases where we want to reconfigure/refresh the cmake cache
# MANUALLY (does require ./ns3 configure)
# 1. When we want to change settings (e.g. --enable-something or -DNS3_something=ON in CMake-land)
# AUTOMATICALLY (does not require ./ns3 configure)
# 2. When we want to add/remove source files from modules (e.g. add a new .cc file to a CMakeLists.txt)
# If we are not only running with --run-no-build or --pyrun-no-build
if not run_only or configure_and_run:
# Create a new cmake_cache folder if one does not exist
if not current_cmake_cache_folder:
current_cmake_cache_folder = ns3_path + os.sep + "cmake_cache" + os.sep
if not os.path.exists(current_cmake_cache_folder):
if args.verbose:
print("mkdir %s" % current_cmake_cache_folder)
os.mkdir(current_cmake_cache_folder)
current_cmake_cache_folder = os.path.abspath(current_cmake_cache_folder)
# Search for the CMake binary
cmake = shutil.which("cmake")
if not cmake:
raise Exception("CMake was not found")
# FORCE REFRESH IS ONLY TRIGGERED MANUALLY
# If --force-refresh, we load settings from the CMakeCache, delete it, then reconfigure CMake to
# force refresh cached packages/libraries that were installed/removed, without losing the current settings
if "configure" in args and args.force_refresh:
reconfigure_cmake_to_force_refresh(cmake, current_cmake_cache_folder, output, args.verbose)
exit(0)
# Call cmake to configure/reconfigure/refresh the project
first_run = configure_cmake(cmake,
args,
current_cmake_cache_folder,
current_cmake_generator,
output,
args.verbose
)
# If manually configuring, we end the script earlier
if "configure" in args:
exit(0)
return first_run, current_cmake_cache_folder
return False, current_cmake_cache_folder
def build_step(args,
configure_and_run,
target_to_run,
current_cmake_cache_folder,
ns3_modules,
ns3_version,
build_profile,
output):
# There are two scenarios where we build everything: ./ns3 build and ./ns3 --check
if args.check or ("build" in args and len(args.build) == 0):
cmake_build(current_cmake_cache_folder, output=output, verbose=args.verbose)
if "build" in args:
# We can exit early if only building
exit(0)
# If we are building specific targets, we build them one by one
if "build" in args:
# Build targets in the list
for target in args.build:
if target in ns3_modules:
target = "lib" + target
else:
target = os.path.basename(target) # This will get rid of path to the executables
cmake_build(current_cmake_cache_folder, target=target, output=output, verbose=args.verbose)
# We can also exit earlier in this case
exit(0)
# The remaining case is when we want to build something to run
if configure_and_run:
cmake_build(current_cmake_cache_folder,
target=get_target_to_build(os.path.basename(target_to_run), ns3_version, build_profile),
output=output,
verbose=args.verbose
)
def main():
# Parse arguments
args = parse_args(sys.argv[1:])
ns3_path = os.path.dirname(os.path.abspath(__file__))
output = subprocess.DEVNULL if args.no_task_lines else None
# no arguments were passed, so can't possibly be reconfiguring anything, then we refresh and rebuild
if len(sys.argv) == 1:
args.build = []
# Load settings from config file
args = check_ns3rc_config_file(args)
# Clean project if needed
if "clean" in args and args.clean:
clean_cmake_artifacts(ns3_path, verbose=args.verbose)
# We end things earlier when cleaning
return
# Get build profile
build_profile, ns3_version, ns3_modules = check_build_profile(ns3_path)
# Check if running something or reconfiguring ns-3
run_only = args.run_no_build or args.pyrun_no_build
configure_and_run = args.run or args.pyrun
target_to_run = None
if not args.check and (run_only or configure_and_run):
target_to_run = max(args.run_no_build, args.pyrun_no_build, args.run, args.pyrun)
if len(target_to_run) > 0:
target_to_run = target_to_run.split()
target_to_run, target_args = target_to_run[0], target_to_run[1:]
else:
raise Exception("You need to specify a program to run")
# Get current CMake cache folder and CMake generator (used when reconfiguring)
current_cmake_cache_folder, current_cmake_generator = search_cmake_cache(ns3_path, build_profile)
if args.check_config:
check_config(current_cmake_cache_folder)
# We end things earlier if only checking the current project configuration
return
first_run, current_cmake_cache_folder = configuration_step(ns3_path,
current_cmake_cache_folder,
current_cmake_generator,
args,
run_only,
configure_and_run,
output
)
# re-run build profile check to get up-to-date information before loading the program shortcuts
if first_run:
build_profile, ns3_version, ns3_modules = check_build_profile(ns3_path)
# We could also replace the "ns3-" prefix used in c4che with the "lib" prefix currently used in cmake
ns3_modules = [module.replace("ns3-", "") for module in ns3_modules]
# Now that CMake is configured, we can look for c++ targets in build-status.py
ns3_programs = get_program_shortcuts(ns3_path, build_profile, ns3_version)
# If we have a target to run, replace shortcut with full path or raise exception
if run_only or configure_and_run:
if target_to_run in ns3_programs:
target_to_run = ns3_programs[target_to_run]
else:
raise Exception("Couldn't find the specified program: %s" % target_to_run)
build_step(args,
configure_and_run,
target_to_run,
current_cmake_cache_folder,
ns3_modules,
ns3_version,
build_profile,
output
)
# If we're only trying to run the target, we need to check if it actually exists first
if (run_only or configure_and_run) and not os.path.exists(target_to_run):
raise Exception("Executable has not been built yet")
# Finally, we try to run it
if args.check or run_only or configure_and_run:
path_sep = ";" if os.name == "nt" else ":"
paths_to_add = path_sep.join(["%s/build/" % ns3_path,
"%s/build/lib" % ns3_path,
"%s/build/bindings/python" % ns3_path,
])
proc_env = {"PATH": os.getenv("PATH") + path_sep + paths_to_add,
"LD_LIBRARY_PATH": paths_to_add,
"PYTHON_PATH": paths_to_add,
}
# running from ns-3-dev (ns3_path) or cwd
working_dir = args.cwd if args.cwd else ns3_path
debugging_software = []
# running valgrind?
if args.valgrind:
debugging_software.append(shutil.which("valgrind"))
# running gdb?
if args.gdb:
debugging_software.extend([shutil.which("gdb"), "--args"])
# running with visualizer?
if args.visualize:
target_args.append("--SimulatorImplementationType=ns3::VisualSimulatorImpl")
# running test.py/check?
if args.check:
target_to_run = ns3_path + os.sep + "test.py"
target_args = ["--nowaf"]
# running with command template?
if args.command_template:
commands = (args.command_template % target_to_run).split()
target_to_run = commands[0]
target_args = commands[1:] + target_args
program_arguments = [*debugging_software, target_to_run, *target_args]
if args.verbose:
exported_variables = "export "
for item in proc_env.items():
exported_variables += "=".join(item) + " "
print("cd %s; %s; %s" % (working_dir, exported_variables, " ".join(program_arguments)))
try:
subprocess.run(program_arguments, env=proc_env, cwd=working_dir)
except KeyboardInterrupt:
print("Process was interrupted by the user")
return 0
main()

1
scratch/.gitignore vendored
View File

@@ -3,3 +3,4 @@
!.gitignore
!subdir/
!scratch-simulator.cc
!CMakeLists.txt

25
scratch/CMakeLists.txt Normal file
View File

@@ -0,0 +1,25 @@
file(GLOB_RECURSE scratches ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
set(DONT_BUILD)
foreach(scratch_src ${scratches})
# Get source filename without path or extension
get_filename_component(scratch_name ${scratch_src} NAME)
string(REGEX REPLACE "\\.[^.]*$" "" scratch_name ${scratch_name})
# Get source absolute path and transform into relative path
get_filename_component(scratch_absolute_directory ${scratch_src} DIRECTORY)
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" scratch_directory ${scratch_absolute_directory})
# Build scratch if not listed as a DONT_BUILD
string(FIND "${DONT_BUILD}" "${scratch_name}" res)
if(res LESS 0)
add_executable(${scratch_name} "${scratch_src}")
if(${NS3_STATIC})
target_link_libraries(${scratch_name} ${LIB_AS_NEEDED_PRE_STATIC} ${lib-ns3-static})
else()
target_link_libraries(${scratch_name} "${ns3-libs}" "${ns3-contrib-libs}")
endif()
set_runtime_outputdirectory(${scratch_name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/scratch/${scratch_directory}/)
endif()
endforeach()

55
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,55 @@
set(libs "${libs_to_build}")
# Process the visualizer module first if enabled
if(${ENABLE_VISUALIZER})
add_subdirectory(visualizer)
list(REMOVE_ITEM libs visualizer)
endif()
# Process subdirectories
foreach(libname ${libs})
add_subdirectory(${libname})
endforeach()
# Build the lib-ns3-static (ns3.x-static-buildtype.a/.lib) with all sublibraries
if(${NS3_STATIC})
add_library(${lib-ns3-static} STATIC ${PROJECT_SOURCE_DIR}/buildsupport/empty.cc "${lib-ns3-static-objs}")
# Replace shared library suffix and check if static version exists before linking
set(ns3-external-static-libs)
foreach(sharedlib ${ns3-external-libs})
if(NOT (${sharedlib} MATCHES ".so"))
continue()
endif()
string(REPLACE ".so" ".a" output ${sharedlib})
if(EXISTS ${output})
list(APPEND ns3-external-static-libs ${output})
else()
message(FATAL_ERROR "Static library version of ${sharedlib} was not found")
endif()
endforeach()
target_link_libraries(
${lib-ns3-static}
-static
-static-libstdc++
-static-libgcc
${LIB_AS_NEEDED_PRE_STATIC}
${ns3-external-static-libs}
${LIB_AS_NEEDED_POST_STATIC}
)
if(${NS3_CLANG_TIMETRACE})
add_dependencies(timeTraceReport ${lib-ns3-static})
endif()
endif()
# Build the lib-ns3-static (ns3.x-monolib-buildtype.dll/.dylib/.so) with all sublibraries
if(${NS3_MONOLIB})
add_library(${lib-ns3-monolib} SHARED ${PROJECT_SOURCE_DIR}/buildsupport/empty.cc "${lib-ns3-static-objs}")
set_target_properties(${lib-ns3-monolib} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
target_link_libraries(${lib-ns3-monolib} ${LIB_AS_NEEDED_PRE} ${ns3-external-libs} ${LIB_AS_NEEDED_POST})
if(${NS3_CLANG_TIMETRACE})
add_dependencies(timeTraceReport ${lib-ns3-monolib})
endif()
endif()

View File

@@ -0,0 +1,32 @@
set(name antenna)
set(source_files
model/angles.cc
model/antenna-model.cc
model/cosine-antenna-model.cc
model/isotropic-antenna-model.cc
model/parabolic-antenna-model.cc
model/phased-array-model.cc
model/three-gpp-antenna-model.cc
model/uniform-planar-array.cc
)
set(header_files
model/angles.h
model/antenna-model.h
model/cosine-antenna-model.h
model/isotropic-antenna-model.h
model/parabolic-antenna-model.h
model/phased-array-model.h
model/three-gpp-antenna-model.h
model/uniform-planar-array.h
)
# link to dependencies
set(libraries_to_link ${libcore})
set(test_sources test/test-angles.cc test/test-degrees-radians.cc test/test-isotropic-antenna.cc
test/test-cosine-antenna.cc test/test-parabolic-antenna.cc test/test-uniform-planar-array.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

32
src/aodv/CMakeLists.txt Normal file
View File

@@ -0,0 +1,32 @@
set(name aodv)
set(source_files
helper/aodv-helper.cc
model/aodv-dpd.cc
model/aodv-id-cache.cc
model/aodv-neighbor.cc
model/aodv-packet.cc
model/aodv-routing-protocol.cc
model/aodv-rqueue.cc
model/aodv-rtable.cc
)
set(header_files
helper/aodv-helper.h
model/aodv-dpd.h
model/aodv-id-cache.h
model/aodv-neighbor.h
model/aodv-packet.h
model/aodv-routing-protocol.h
model/aodv-rqueue.h
model/aodv-rtable.h
)
# link to dependencies
set(libraries_to_link ${libinternet} ${libwifi})
set(test_sources test/aodv-id-cache-test-suite.cc test/aodv-regression.cc test/aodv-test-suite.cc test/loopback.cc
test/bug-772.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name aodv)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libinternet} ${libaodv} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,62 @@
set(name applications)
set(source_files
helper/bulk-send-helper.cc
helper/on-off-helper.cc
helper/packet-sink-helper.cc
helper/three-gpp-http-helper.cc
helper/udp-client-server-helper.cc
helper/udp-echo-helper.cc
model/application-packet-probe.cc
model/bulk-send-application.cc
model/onoff-application.cc
model/packet-loss-counter.cc
model/packet-sink.cc
model/seq-ts-echo-header.cc
model/seq-ts-header.cc
model/seq-ts-size-header.cc
model/three-gpp-http-client.cc
model/three-gpp-http-header.cc
model/three-gpp-http-server.cc
model/three-gpp-http-variables.cc
model/udp-client.cc
model/udp-echo-client.cc
model/udp-echo-server.cc
model/udp-server.cc
model/udp-trace-client.cc
)
set(header_files
helper/bulk-send-helper.h
helper/on-off-helper.h
helper/packet-sink-helper.h
helper/three-gpp-http-helper.h
helper/udp-client-server-helper.h
helper/udp-echo-helper.h
model/application-packet-probe.h
model/bulk-send-application.h
model/onoff-application.h
model/packet-loss-counter.h
model/packet-sink.h
model/seq-ts-echo-header.h
model/seq-ts-header.h
model/seq-ts-size-header.h
model/three-gpp-http-client.h
model/three-gpp-http-header.h
model/three-gpp-http-server.h
model/three-gpp-http-variables.h
model/udp-client.h
model/udp-echo-client.h
model/udp-echo-server.h
model/udp-server.h
model/udp-trace-client.h
)
# link to dependencies
set(libraries_to_link ${libinternet} ${libstats})
set(test_sources test/three-gpp-http-client-server-test.cc test/bulk-send-application-test-suite.cc
test/udp-client-server-test.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name three-gpp-http-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libapplications} ${libpoint-to-point} ${libinternet} ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

12
src/bridge/CMakeLists.txt Normal file
View File

@@ -0,0 +1,12 @@
set(name bridge)
set(source_files helper/bridge-helper.cc model/bridge-channel.cc model/bridge-net-device.cc)
set(header_files helper/bridge-helper.h model/bridge-channel.h model/bridge-net-device.h)
# link to dependencies
set(libraries_to_link ${libnetwork})
set(test_sources)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,11 @@
set(name csma-bridge)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libbridge} ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name csma-bridge-one-hop)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libbridge} ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

31
src/brite/CMakeLists.txt Normal file
View File

@@ -0,0 +1,31 @@
set(NS3_WITH_BRITE "" CACHE PATH "Build with brite support")
set(NS3_BRITE "OFF" CACHE INTERNAL "ON if Brite is found in NS3_WITH_BRITE")
if(NOT NS3_WITH_BRITE)
return()
endif()
find_library(brite_dep brite PATHS ${NS3_WITH_BRITE} PATH_SUFFIXES /build /build/lib /lib)
find_file(brite_header Brite.h HINTS ${NS3_WITH_BRITE} PATH_SUFFIXES /build /build/include /include)
if(NOT (brite_dep AND brite_header))
message(STATUS "Brite was not found in ${NS3_WITH_BRITE}")
return()
endif()
# Only process module if include folder and library have been found
get_filename_component(brite_include_folder ${brite_header} DIRECTORY)
include_directories(${brite_include_folder})
set(NS3_BRITE "ON" CACHE INTERNAL "ON if Brite is found in NS3_WITH_BRITE")
set(name brite)
set(source_files helper/brite-topology-helper.cc)
set(header_files helper/brite-topology-helper.h)
# link to dependencies
set(libraries_to_link ${libnetwork} ${libcore} ${libinternet} ${libpoint-to-point} ${brite_dep})
set(test_sources test/brite-test-topology.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,22 @@
set(name brite-generic-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libbrite} ${libinternet} ${libpoint-to-point} ${libnix-vector-routing} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
if(${ENABLE_MPI})
set(name brite-MPI-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link
${libbrite}
${libinternet}
${libpoint-to-point}
${libnix-vector-routing}
${libapplications}
${libmpi}
${MPI_CXX_LIBRARIES}
)
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
target_include_directories(${name} PUBLIC ${MPI_CXX_INCLUDE_DIRS})
endif()

View File

@@ -0,0 +1,49 @@
set(name buildings)
set(source_files
helper/building-allocator.cc
helper/building-container.cc
helper/building-position-allocator.cc
helper/buildings-helper.cc
model/building-list.cc
model/building.cc
model/buildings-channel-condition-model.cc
model/buildings-propagation-loss-model.cc
model/hybrid-buildings-propagation-loss-model.cc
model/itu-r-1238-propagation-loss-model.cc
model/mobility-building-info.cc
model/oh-buildings-propagation-loss-model.cc
model/random-walk-2d-outdoor-mobility-model.cc
model/three-gpp-v2v-channel-condition-model.cc
)
set(header_files
helper/building-allocator.h
helper/building-container.h
helper/building-position-allocator.h
helper/buildings-helper.h
model/building-list.h
model/building.h
model/buildings-channel-condition-model.h
model/buildings-propagation-loss-model.h
model/hybrid-buildings-propagation-loss-model.h
model/itu-r-1238-propagation-loss-model.h
model/mobility-building-info.h
model/oh-buildings-propagation-loss-model.h
model/random-walk-2d-outdoor-mobility-model.h
model/three-gpp-v2v-channel-condition-model.h
)
set(libraries_to_link ${libmobility} ${libpropagation} ${libconfig-store})
set(test_sources
test/building-position-allocator-test.cc
test/buildings-helper-test.cc
test/buildings-pathloss-test.cc
test/buildings-shadowing-test.cc
test/buildings-channel-condition-model-test.cc
test/outdoor-random-walk-test.cc
test/three-gpp-v2v-channel-condition-model-test.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,17 @@
set(name buildings-pathloss-profiler)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libconfig-store} ${libmobility} ${libbuildings})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name outdoor-group-mobility-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libbuildings})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name outdoor-random-walk-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libbuildings})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

39
src/click/CMakeLists.txt Normal file
View File

@@ -0,0 +1,39 @@
set(NS3_WITH_CLICK "" CACHE PATH "Build with click support")
set(NS3_CLICK "OFF" CACHE INTERNAL "ON if Click is found in NS3_WITH_CLICK")
if(NOT NS3_WITH_CLICK)
return()
endif()
find_library(click_dep click PATHS ${NS3_WITH_CLICK} PATH_SUFFIXES /build /build/lib /lib)
find_file(click_header simclick.h HINTS ${NS3_WITH_CLICK} PATH_SUFFIXES /build /include /build/include
/build/include/click /include/click
)
if(NOT (click_dep AND click_header))
message(STATUS "Click was not found in ${NS3_WITH_CLICK}")
return()
endif()
get_filename_component(openflow_header_include_folder ${openflow_header} DIRECTORY) # include/click/ (simclick.h)
get_filename_component(openflow_header_include_folder ${openflow_header_include_folder} DIRECTORY) # include/(click)
include_directories(${openflow_header_include_folder})
set(NS3_CLICK "ON" CACHE INTERNAL "ON if Click is found in NS3_WITH_CLICK")
add_definitions(-DNS3_CLICK)
set(name click)
set(source_files helper/click-internet-stack-helper.cc model/ipv4-click-routing.cc model/ipv4-l3-click-protocol.cc)
set(header_files helper/click-internet-stack-helper.h model/ipv4-click-routing.h model/ipv4-l3-click-protocol.h)
set(libraries_to_link ${libcore} ${libnetwork} ${libinternet} ${click_dep})
set(test_sources test/ipv4-click-routing-test.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")
# click install headers when finished and we can't start compiling before that happens
if(NOT ${XCODE})
add_dependencies(${libclick-obj} ${click_dep})
endif()

View File

@@ -0,0 +1,37 @@
link_libraries(click_dep)
set(name nsclick-simple-lan)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libclick} ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name nsclick-raw-wlan)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libclick} ${libwifi} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name nsclick-udp-client-server-csma)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libclick} ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name nsclick-udp-client-server-wifi)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libclick} ${libwifi} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name nsclick-routing)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libclick} ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name nsclick-defines)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libclick})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,35 @@
set(name config-store)
if(${GTK3_FOUND})
set(gtk3_sources model/display-functions.cc model/gtk-config-store.cc model/model-node-creator.cc
model/model-typeid-creator.cc
)
set(gtk3_headers model/gtk-config-store.h)
include_directories(${GTK3_INCLUDE_DIRS} ${HarfBuzz_INCLUDE_DIRS})
set(gtk_libraries ${GTK3_LIBRARIES})
endif()
if(${LIBXML2_FOUND})
set(xml2_sources model/xml-config.cc)
set(xml2_libraries ${LIBXML2_LIBRARIES})
include_directories(${LIBXML2_INCLUDE_DIR})
endif()
set(source_files
${gtk3_sources}
${xml2_sources}
model/attribute-default-iterator.cc
model/attribute-iterator.cc
model/config-store.cc
model/file-config.cc
model/raw-text-config.cc
)
set(header_files ${gtk3_headers} model/file-config.h model/config-store.h)
set(libraries_to_link ${libcore} ${libnetwork} ${xml2_libraries} ${gtk_libraries})
set(test_sources)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name config-store-save)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libconfig-store})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

292
src/core/CMakeLists.txt Normal file
View File

@@ -0,0 +1,292 @@
# Set module name
set(name core)
# Set lib core link dependencies
set(libraries_to_link)
set(gsl_test_sources)
if(${GSL_FOUND})
include_directories(${GSL_INCLUDE_DIRS})
set(libraries_to_link ${libraries_to_link} ${GSL_LIBRARIES})
set(gsl_test_sources test/rng-test-suite.cc test/random-variable-stream-test-suite.cc)
endif()
# Check for dependencies and add sources accordingly
check_include_file_cxx("boost/units/quantity.hpp" HAVE_BOOST_UNITS_QUANTITY)
check_include_file_cxx("boost/units/systems/si.hpp" HAVE_BOOST_UNITS_SI)
if(${HAVE_BOOST_UNITS_QUANTITY} AND ${HAVE_BOOST_UNITS_SI})
add_definitions(-DHAVE_BOOST -DHAVE_BOOST_UNITS)
message(STATUS "Boost Units have been found.")
else()
message(STATUS "Boost Units are an optional feature of length.cc."
" Ubuntu ships it within the libboost-dev package."
" You may need to clean up the CMake cache after installing it to pass this check."
)
endif()
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)
if(${ENABLE_REALTIME})
set(libraries_to_link ${libraries_to_link} ${LIBRT})
endif()
set(osclock_sources)
set(osclock_sources model/unix-system-wall-clock-ms.cc)
set(int64x64_sources)
set(int64x64_headers)
if(${INT64X64} MATCHES "INT128")
set(int64x64_sources model/int64x64-128.cc)
set(int64x64_headers model/int64x64-128.h)
elseif(${INT64X64} MATCHES "DOUBLE")
set(int64x64_headers model/int64x64-double.h)
elseif(${INT64X64} MATCHES "CAIRO")
set(int64x64_sources model/int64x64-cairo.cc)
set(int64x64_headers model/int64x64-cairo.h model/cairo-wideint-private.h)
endif()
set(thread_sources)
set(thread_headers)
set(thread_test_sources)
if(${NS3_PTHREAD})
if(${THREADS_FOUND})
set(thread_sources model/unix-fd-reader.cc)
set(thread_headers model/unix-fd-reader.h)
set(thread_sources ${thread_sources} model/system-thread.cc model/unix-system-mutex.cc
model/unix-system-condition.cc
)
set(thread_headers ${thread_headers} model/system-mutex.h model/system-thread.h model/system-condition.h)
set(libraries_to_link ${libraries_to_link} pthread)
set(thread_test_sources test/threaded-test-suite.cc)
endif()
endif()
if(${NS3_EXAMPLES})
set(example_as_test_sources model/example-as-test.cc)
set(example_as_test_headers model/example-as-test.h)
set(example_as_test_suite test/examples-as-tests-test-suite.cc)
endif()
# Embedded version support
set(embedded_version_sources)
set(embedded_version_headers)
if(${NS3_ENABLE_BUILD_VERSION})
set(embedded_version_sources model/version.cc)
set(embedded_version_headers model/version.h)
endif()
# Define core lib sources
set(source_files
${rt_sources}
${osclock_sources}
${int64x64_sources}
${thread_sources}
${valgrind_sources}
${example_as_test_sources}
${embedded_version_sources}
helper/csv-reader.cc
helper/random-variable-stream-helper.cc
helper/event-garbage-collector.cc
model/time.cc
model/event-id.cc
model/scheduler.cc
model/list-scheduler.cc
model/map-scheduler.cc
model/heap-scheduler.cc
model/calendar-scheduler.cc
model/priority-queue-scheduler.cc
model/event-impl.cc
model/simulator.cc
model/simulator-impl.cc
model/default-simulator-impl.cc
model/timer.cc
model/watchdog.cc
model/synchronizer.cc
model/make-event.cc
model/log.cc
model/breakpoint.cc
model/type-id.cc
model/attribute-construction-list.cc
model/object-base.cc
model/ref-count-base.cc
model/object.cc
model/test.cc
model/random-variable-stream.cc
model/rng-seed-manager.cc
model/rng-stream.cc
model/command-line.cc
model/type-name.cc
model/attribute.cc
model/boolean.cc
model/integer.cc
model/uinteger.cc
model/enum.cc
model/double.cc
model/int64x64.cc
model/string.cc
model/pointer.cc
model/object-ptr-container.cc
model/object-factory.cc
model/global-value.cc
model/trace-source-accessor.cc
model/config.cc
model/callback.cc
model/names.cc
model/vector.cc
model/fatal-impl.cc
model/system-path.cc
model/hash-function.cc
model/hash-murmur3.cc
model/hash-fnv.cc
model/hash.cc
model/des-metrics.cc
model/ascii-file.cc
model/node-printer.cc
model/show-progress.cc
model/time-printer.cc
model/system-wall-clock-timestamp.cc
model/length.cc
model/trickle-timer.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
helper/event-garbage-collector.h
helper/random-variable-stream-helper.h
model/abort.h
model/ascii-file.h
model/ascii-test.h
model/assert.h
model/attribute-accessor-helper.h
model/attribute-construction-list.h
model/attribute-container-accessor-helper.h
model/attribute-container.h
model/attribute-helper.h
model/attribute.h
model/boolean.h
model/breakpoint.h
model/build-profile.h
model/calendar-scheduler.h
model/callback.h
model/command-line.h
model/config.h
model/default-deleter.h
model/default-simulator-impl.h
model/deprecated.h
model/des-metrics.h
model/double.h
model/empty.h
model/enum.h
model/event-id.h
model/event-impl.h
model/fatal-error.h
model/fatal-impl.h
model/global-value.h
model/hash-fnv.h
model/hash-function.h
model/hash-murmur3.h
model/hash.h
model/heap-scheduler.h
model/int-to-type.h
model/int64x64-double.h
model/int64x64.h
model/integer.h
model/length.h
model/list-scheduler.h
model/log-macros-disabled.h
model/log-macros-enabled.h
model/log.h
model/make-event.h
model/map-scheduler.h
model/math.h
model/names.h
model/node-printer.h
model/non-copyable.h
model/nstime.h
model/object-base.h
model/object-factory.h
model/object-map.h
model/object-ptr-container.h
model/object-vector.h
model/object.h
model/pair.h
model/pointer.h
model/priority-queue-scheduler.h
model/ptr.h
model/random-variable-stream.h
model/ref-count-base.h
model/rng-seed-manager.h
model/rng-stream.h
model/scheduler.h
model/show-progress.h
model/simple-ref-count.h
model/simulation-singleton.h
model/simulator-impl.h
model/simulator.h
model/singleton.h
model/string.h
model/synchronizer.h
model/system-path.h
model/system-wall-clock-ms.h
model/system-wall-clock-timestamp.h
model/test.h
model/time-printer.h
model/timer-impl.h
model/timer.h
model/trace-source-accessor.h
model/traced-callback.h
model/traced-value.h
model/trickle-timer.h
model/type-id.h
model/type-name.h
model/type-traits.h
model/uinteger.h
model/unused.h
model/valgrind.h
model/vector.h
model/watchdog.h
)
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
test/callback-test-suite.cc
test/command-line-test-suite.cc
test/config-test-suite.cc
test/event-garbage-collector-test-suite.cc
test/global-value-test-suite.cc
test/hash-test-suite.cc
test/int64x64-test-suite.cc
test/length-test-suite.cc
test/many-uniform-random-variables-one-get-value-call-test-suite.cc
test/names-test-suite.cc
test/object-test-suite.cc
test/one-uniform-random-variable-many-get-value-calls-test-suite.cc
test/pair-value-test-suite.cc
test/ptr-test-suite.cc
test/sample-test-suite.cc
test/simulator-test-suite.cc
test/time-test-suite.cc
test/timer-test-suite.cc
test/traced-callback-test-suite.cc
test/trickle-timer-test-suite.cc
test/type-id-test-suite.cc
test/type-traits-test-suite.cc
test/watchdog-test-suite.cc
)
# Build core lib
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,105 @@
set(name main-callback)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name sample-simulator)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-ptr)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-random-variable-stream)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libconfig-store} ${libstats})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name sample-random-variable)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name sample-random-variable-stream)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name command-line-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fatal-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name hash-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name sample-log-time-format)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name test-string-value-formatting)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name sample-show-progress)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
if(${NS3_ENABLE_BUILD_VERSION})
set(name build-version-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()
if(${ENABLE_REALTIME})
set(name main-test-sync)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()
set(name length-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name empirical-random-variable-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libflow-monitor})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name system-path-examples)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -88,7 +88,7 @@ ExampleAsTestCase::DoRun (void)
std::stringstream ss;
// Use bash as shell to allow use of PIPESTATUS
ss << "bash -c './waf --run-no-build " << m_program
ss << "bash -c './ns3 --run-no-build " << m_program
<< " --command-template=\"" << GetCommandTemplate () << "\""
// redirect std::clog, std::cerr to std::cout

View File

@@ -0,0 +1,11 @@
set(name csma-layout)
set(source_files model/csma-star-helper.cc)
set(header_files model/csma-star-helper.h)
set(libraries_to_link ${libnetwork} ${libinternet} ${libcsma} ${libpoint-to-point})
set(test_sources)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name csma-star)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libcsma-layout} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

13
src/csma/CMakeLists.txt Normal file
View File

@@ -0,0 +1,13 @@
set(name csma)
set(source_files helper/csma-helper.cc model/backoff.cc model/csma-channel.cc model/csma-net-device.cc)
set(header_files helper/csma-helper.h model/backoff.h model/csma-channel.h model/csma-net-device.h)
# Set lib csma link dependencies
set(libraries_to_link ${libnetwork})
set(test_sources)
# Build csma lib
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,35 @@
set(name csma-one-subnet)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name csma-broadcast)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name csma-packet-socket)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name csma-multicast)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name csma-raw-ip-socket)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name csma-ping)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcsma} ${libinternet} ${libapplications} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

15
src/dsdv/CMakeLists.txt Normal file
View File

@@ -0,0 +1,15 @@
set(name dsdv)
set(source_files helper/dsdv-helper.cc model/dsdv-packet-queue.cc model/dsdv-packet.cc model/dsdv-routing-protocol.cc
model/dsdv-rtable.cc
)
set(header_files helper/dsdv-helper.h model/dsdv-packet-queue.h model/dsdv-packet.h model/dsdv-routing-protocol.h
model/dsdv-rtable.h
)
set(libraries_to_link ${libinternet})
set(test_sources test/dsdv-testcase.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name dsdv-manet)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libwifi} ${libinternet} ${libdsdv} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

40
src/dsr/CMakeLists.txt Normal file
View File

@@ -0,0 +1,40 @@
set(name dsr)
set(source_files
helper/dsr-helper.cc
helper/dsr-main-helper.cc
model/dsr-errorbuff.cc
model/dsr-fs-header.cc
model/dsr-gratuitous-reply-table.cc
model/dsr-maintain-buff.cc
model/dsr-network-queue.cc
model/dsr-option-header.cc
model/dsr-options.cc
model/dsr-passive-buff.cc
model/dsr-rcache.cc
model/dsr-routing.cc
model/dsr-rreq-table.cc
model/dsr-rsendbuff.cc
)
set(header_files
helper/dsr-helper.h
helper/dsr-main-helper.h
model/dsr-errorbuff.h
model/dsr-fs-header.h
model/dsr-gratuitous-reply-table.h
model/dsr-maintain-buff.h
model/dsr-network-queue.h
model/dsr-option-header.h
model/dsr-options.h
model/dsr-passive-buff.h
model/dsr-rcache.h
model/dsr-routing.h
model/dsr-rreq-table.h
model/dsr-rsendbuff.h
)
set(libraries_to_link ${libinternet} ${libwifi})
set(test_sources test/dsr-test-suite.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,14 @@
set(name dsr)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link
${libcore}
${libnetwork}
${libinternet}
${libapplications}
${libmobility}
${libconfig-store}
${libwifi}
${libdsr}
)
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

47
src/energy/CMakeLists.txt Normal file
View File

@@ -0,0 +1,47 @@
set(name energy)
set(source_files
helper/basic-energy-harvester-helper.cc
helper/basic-energy-source-helper.cc
helper/energy-harvester-container.cc
helper/energy-harvester-helper.cc
helper/energy-model-helper.cc
helper/energy-source-container.cc
helper/li-ion-energy-source-helper.cc
helper/rv-battery-model-helper.cc
model/basic-energy-harvester.cc
model/basic-energy-source.cc
model/device-energy-model-container.cc
model/device-energy-model.cc
model/energy-harvester.cc
model/energy-source.cc
model/li-ion-energy-source.cc
model/rv-battery-model.cc
model/simple-device-energy-model.cc
)
set(header_files
helper/basic-energy-harvester-helper.h
helper/basic-energy-source-helper.h
helper/energy-harvester-container.h
helper/energy-harvester-helper.h
helper/energy-model-helper.h
helper/energy-source-container.h
helper/li-ion-energy-source-helper.h
helper/rv-battery-model-helper.h
model/basic-energy-harvester.h
model/basic-energy-source.h
model/device-energy-model-container.h
model/device-energy-model.h
model/energy-harvester.h
model/energy-source.h
model/li-ion-energy-source.h
model/rv-battery-model.h
model/simple-device-energy-model.h
)
set(libraries_to_link ${libnetwork})
set(test_sources test/basic-energy-harvester-test.cc test/li-ion-energy-source-test.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,17 @@
set(name li-ion-energy-source)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libenergy})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name rv-battery-model-test)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libenergy} ${libwifi})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name basic-energy-model-test)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libenergy} ${libwifi})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,150 @@
set(name fd-net-device)
set(ENABLE_THREADING ${HAVE_PTHREAD_H})
check_include_file_cxx(net/ethernet.h HAVE_NET_ETHERNET_H)
check_include_file_cxx(netpacket/packet.h HAVE_PACKET_H)
check_include_file_cxx(net/if.h HAVE_IF_NETS_H)
check_include_file_cxx(linux/if_tun.h HAVE_IF_TUN_H)
check_include_file_cxx(net/netmap_user.h HAVE_NETMAP_USER_H)
check_include_file_cxx(sys/ioctl.h HAVE_SYS_IOCTL_H)
include(FindPkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(DPDK libdpdk)
endif()
set(ENABLE_FDNETDEV False CACHE INTERNAL "")
set(ENABLE_DPDKDEVNET False CACHE INTERNAL "")
set(ENABLE_TAP False CACHE INTERNAL "")
set(ENABLE_EMU False CACHE INTERNAL "")
set(ENABLE_NETMAP_EMU False CACHE INTERNAL "")
if(${THREADS_ENABLED} AND HAVE_NET_ETHERNET_H)
set(ENABLE_FDNETDEV True CACHE INTERNAL "")
if(PKG_CONFIG_FOUND AND DPDK_FOUND)
set(ENABLE_DPDKDEVNET True CACHE INTERNAL "")
endif()
if(HAVE_IF_NETS_H
AND HAVE_IF_TUN_H
AND HAVE_SYS_IOCTL_H
AND ${NS3_TAP}
)
set(ENABLE_TAP True CACHE INTERNAL "")
endif()
if(HAVE_IF_NETS_H
AND HAVE_PACKET_H
AND HAVE_SYS_IOCTL_H
AND ${NS3_EMU}
)
set(ENABLE_EMU True CACHE INTERNAL "")
add_definitions(-DHAVE_PACKET_H)
endif()
if(HAVE_IF_NETS_H AND HAVE_NETMAP_USER_H AND HAVE_SYS_IOCTL_H)
set(ENABLE_NETMAP_EMU True CACHE INTERNAL "")
add_definitions(-DHAVE_NETMAP_USER_H)
endif()
endif()
if(${ENABLE_FDNETDEV})
set(fd-net-device_creators)
macro(exec_name name)
set(${name} ${name})
endmacro()
if(${ENABLE_EMU})
set(emu_sources helper/emu-fd-net-device-helper.cc)
set(emu_headers helper/emu-fd-net-device-helper.h)
exec_name(raw-sock-creator)
add_executable(raw-sock-creator helper/creator-utils.cc helper/encode-decode.cc helper/raw-sock-creator.cc)
add_definitions(-DRAW_SOCK_CREATOR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${raw-sock-creator}")
set_runtime_outputdirectory(raw-sock-creator ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/)
list(APPEND fd-net-device_creators raw-sock-creator)
endif()
if(${ENABLE_TAP})
set(tap_sources helper/tap-fd-net-device-helper.cc)
set(tap_headers helper/tap-fd-net-device-helper.h)
exec_name(tap-device-creator)
add_executable(tap-device-creator helper/creator-utils.cc helper/encode-decode.cc helper/tap-device-creator.cc)
add_definitions(-DTAP_DEV_CREATOR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/${tap-device-creator}")
set_runtime_outputdirectory(tap-device-creator ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/)
list(APPEND fd-net-device_creators tap-device-creator)
endif()
if(${ENABLE_TAP} AND ${NS3_PLANETLAB}) # todo: find planetlab libraries
set(planetlab_sources helper/planetlab-fd-net-device-helper.cc)
set(planetlab_headers helper/planetlab-fd-net-device-helper.h)
exec_name(planetlab-tap-creator)
add_executable(
planetlab-tap-creator helper/creator-utils.cc helper/encode-decode.cc helper/planetlab-tap-creator.cc
)
add_definitions(-DPLANETLAB_TAP_CREATOR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${planetlab-tap-creator}")
target_link_libraries(planetlab-tap-creator ${PLANETLAB_LIBRARIES})
set_runtime_outputdirectory(planetlab-tap-creator ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/)
list(APPEND fd-net-device_creators planetlab-tap-creator)
endif()
if(${ENABLE_NETMAP_EMU})
set(netmap_sources helper/netmap-net-device-helper.cc model/netmap-net-device.cc)
set(netmap_headers helper/netmap-net-device-helper.h model/netmap-net-device.h)
exec_name(netmap-device-creator)
add_executable(
netmap-device-creator helper/creator-utils.cc helper/encode-decode.cc helper/netmap-device-creator.cc
)
add_definitions(-DNETMAP_DEV_CREATOR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${netmap-device-creator}")
set_runtime_outputdirectory(netmap-device-creator ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/)
list(APPEND fd-net-device_creators netmap-device-creator)
endif()
if(${ENABLE_DPDKDEVNET})
set(dpdk_sources model/dpdk-net-device.cc helper/dpdk-net-device-helper.cc)
set(dpdk_headers model/dpdk-net-device.h helper/dpdk-net-device-helper.h)
add_definitions(-DHAVE_DPDK_USER_H)
endif()
set(source_files
${tap_sources}
${emu_sources}
${planetlab_sources}
${netmap_sources}
${dpdk_sources}
helper/creator-utils.cc
helper/encode-decode.cc
helper/fd-net-device-helper.cc
model/fd-net-device.cc
)
set(header_files ${tap_headers} ${emu_headers} ${planetlab_headers} ${dpdk_headers} model/fd-net-device.h
helper/fd-net-device-helper.h
)
set(libraries_to_link ${libnetwork} ${LIB_AS_NEEDED_PRE} ${DPDK_LIBRARIES} ${LIB_AS_NEEDED_POST})
set(test_sources)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")
if(${ENABLE_DPDKDEVNET})
target_include_directories(${libfd-net-device-obj} PRIVATE ${DPDK_INCLUDE_DIRS})
target_compile_options(${libfd-net-device-obj} PRIVATE ${DPDK_CFLAGS})
endif()
list(LENGTH fd-net-device_creators num_creators)
if(${num_creators} GREATER 0)
add_dependencies(${libfd-net-device} ${fd-net-device_creators})
endif()
endif()

View File

@@ -0,0 +1,81 @@
include_directories(${DPDK_INCLUDE_DIRS})
set(name dummy-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fd2fd-onoff)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
if(${ENABLE_REALTIME})
set(name realtime-dummy-network)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name realtime-fd2fd-onoff)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()
if(${ENABLE_EMU})
set(name fd-emu-ping)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fd-emu-udp-echo)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fd-emu-onoff)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fd-emu-send)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libapplications} ${libinternet-apps} ${libtraffic-control})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fd-emu-tc)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libapplications} ${libinternet-apps} ${libtraffic-control})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()
if(${ENABLE_TAP})
set(name fd-tap-ping)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name fd-tap-ping6)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libinternet-apps} ${libcsma})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()
if(${NS3_PLANETLAB})
set(name fd-planetlab-ping)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libfd-net-device} ${libinternet} ${libinternet-apps})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()

View File

@@ -0,0 +1,29 @@
set(name flow-monitor)
set(source_files
helper/flow-monitor-helper.cc
model/flow-classifier.cc
model/flow-monitor.cc
model/flow-probe.cc
model/ipv4-flow-classifier.cc
model/ipv4-flow-probe.cc
model/ipv6-flow-classifier.cc
model/ipv6-flow-probe.cc
)
set(header_files
helper/flow-monitor-helper.h
model/flow-classifier.h
model/flow-monitor.h
model/flow-probe.h
model/ipv4-flow-classifier.h
model/ipv4-flow-probe.h
model/ipv6-flow-classifier.h
model/ipv6-flow-probe.h
)
set(libraries_to_link ${libinternet} ${libconfig-store})
set(test_sources)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,41 @@
set(name internet-apps)
set(source_files
helper/dhcp-helper.cc
helper/ping6-helper.cc
helper/radvd-helper.cc
helper/v4ping-helper.cc
helper/v4traceroute-helper.cc
model/dhcp-client.cc
model/dhcp-header.cc
model/dhcp-server.cc
model/ping6.cc
model/radvd-interface.cc
model/radvd-prefix.cc
model/radvd.cc
model/v4ping.cc
model/v4traceroute.cc
)
set(header_files
helper/dhcp-helper.h
helper/ping6-helper.h
helper/radvd-helper.h
helper/v4ping-helper.h
helper/v4traceroute-helper.h
model/dhcp-client.h
model/dhcp-header.h
model/dhcp-server.h
model/ping6.h
model/radvd-interface.h
model/radvd-prefix.h
model/radvd.h
model/v4ping.h
model/v4traceroute.h
)
set(libraries_to_link ${libinternet})
set(test_sources test/dhcp-test.cc test/ipv6-radvd-test.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name dhcp-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libinternet-apps} ${libcsma} ${libpoint-to-point} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

344
src/internet/CMakeLists.txt Normal file
View File

@@ -0,0 +1,344 @@
set(name internet)
set(nsc_sources)
set(nsc_headers)
if(${NS3_NSC})
set(nsc_sources nsc-sysctl.cc nsc-tcp-l4-protocol.cc nsc-tcp-socket-factory-impl.cc nsc-tcp-socket-impl.cc)
set(nsc_headers nsc-sysctl.h nsc-tcp-l4-protocol.h nsc-tcp-socket-factory-impl.h nsc-tcp-socket-impl.h)
endif()
set(source_files
${nsc_sources}
helper/internet-stack-helper.cc
helper/internet-trace-helper.cc
helper/ipv4-address-helper.cc
helper/ipv4-global-routing-helper.cc
helper/ipv4-interface-container.cc
helper/ipv4-list-routing-helper.cc
helper/ipv4-routing-helper.cc
helper/ipv4-static-routing-helper.cc
helper/ipv6-address-helper.cc
helper/ipv6-interface-container.cc
helper/ipv6-list-routing-helper.cc
helper/ipv6-routing-helper.cc
helper/ipv6-static-routing-helper.cc
helper/rip-helper.cc
helper/ripng-helper.cc
model/arp-cache.cc
model/arp-header.cc
model/arp-l3-protocol.cc
model/arp-queue-disc-item.cc
model/candidate-queue.cc
model/global-route-manager-impl.cc
model/global-route-manager.cc
model/global-router-interface.cc
model/icmpv4-l4-protocol.cc
model/icmpv4.cc
model/icmpv6-header.cc
model/icmpv6-l4-protocol.cc
model/ip-l4-protocol.cc
model/ipv4-address-generator.cc
model/ipv4-end-point-demux.cc
model/ipv4-end-point.cc
model/ipv4-global-routing.cc
model/ipv4-header.cc
model/ipv4-interface-address.cc
model/ipv4-interface.cc
model/ipv4-l3-protocol.cc
model/ipv4-list-routing.cc
model/ipv4-packet-filter.cc
model/ipv4-packet-info-tag.cc
model/ipv4-packet-probe.cc
model/ipv4-queue-disc-item.cc
model/ipv4-raw-socket-factory-impl.cc
model/ipv4-raw-socket-factory.cc
model/ipv4-raw-socket-impl.cc
model/ipv4-route.cc
model/ipv4-routing-protocol.cc
model/ipv4-routing-table-entry.cc
model/ipv4-static-routing.cc
model/ipv4.cc
model/ipv6-address-generator.cc
model/ipv6-autoconfigured-prefix.cc
model/ipv6-end-point-demux.cc
model/ipv6-end-point.cc
model/ipv6-extension-demux.cc
model/ipv6-extension-header.cc
model/ipv6-extension.cc
model/ipv6-header.cc
model/ipv6-interface-address.cc
model/ipv6-interface.cc
model/ipv6-l3-protocol.cc
model/ipv6-list-routing.cc
model/ipv6-option-demux.cc
model/ipv6-option-header.cc
model/ipv6-option.cc
model/ipv6-packet-filter.cc
model/ipv6-packet-info-tag.cc
model/ipv6-packet-probe.cc
model/ipv6-pmtu-cache.cc
model/ipv6-queue-disc-item.cc
model/ipv6-raw-socket-factory-impl.cc
model/ipv6-raw-socket-factory.cc
model/ipv6-raw-socket-impl.cc
model/ipv6-route.cc
model/ipv6-routing-protocol.cc
model/ipv6-routing-table-entry.cc
model/ipv6-static-routing.cc
model/ipv6.cc
model/loopback-net-device.cc
model/ndisc-cache.cc
model/pending-data.cc
model/rip-header.cc
model/rip.cc
model/ripng-header.cc
model/ripng.cc
model/rtt-estimator.cc
model/tcp-bbr.cc
model/tcp-bic.cc
model/tcp-congestion-ops.cc
model/tcp-cubic.cc
model/tcp-dctcp.cc
model/tcp-header.cc
model/tcp-highspeed.cc
model/tcp-htcp.cc
model/tcp-hybla.cc
model/tcp-illinois.cc
model/tcp-l4-protocol.cc
model/tcp-ledbat.cc
model/tcp-linux-reno.cc
model/tcp-lp.cc
model/tcp-option-rfc793.cc
model/tcp-option-sack-permitted.cc
model/tcp-option-sack.cc
model/tcp-option-ts.cc
model/tcp-option-winscale.cc
model/tcp-option.cc
model/tcp-prr-recovery.cc
model/tcp-rate-ops.cc
model/tcp-recovery-ops.cc
model/tcp-rx-buffer.cc
model/tcp-scalable.cc
model/tcp-socket-base.cc
model/tcp-socket-factory-impl.cc
model/tcp-socket-factory.cc
model/tcp-socket-state.cc
model/tcp-socket.cc
model/tcp-tx-buffer.cc
model/tcp-tx-item.cc
model/tcp-vegas.cc
model/tcp-veno.cc
model/tcp-westwood.cc
model/tcp-yeah.cc
model/udp-header.cc
model/udp-l4-protocol.cc
model/udp-socket-factory-impl.cc
model/udp-socket-factory.cc
model/udp-socket-impl.cc
model/udp-socket.cc
)
set(private_header_files)
set(header_files
${header_files}
helper/internet-stack-helper.h
helper/internet-trace-helper.h
helper/ipv4-address-helper.h
helper/ipv4-global-routing-helper.h
helper/ipv4-interface-container.h
helper/ipv4-list-routing-helper.h
helper/ipv4-routing-helper.h
helper/ipv4-static-routing-helper.h
helper/ipv6-address-helper.h
helper/ipv6-interface-container.h
helper/ipv6-list-routing-helper.h
helper/ipv6-routing-helper.h
helper/ipv6-static-routing-helper.h
helper/rip-helper.h
helper/ripng-helper.h
model/arp-cache.h
model/arp-header.h
model/arp-l3-protocol.h
model/arp-queue-disc-item.h
model/candidate-queue.h
model/global-route-manager-impl.h
model/global-route-manager.h
model/global-router-interface.h
model/icmpv4-l4-protocol.h
model/icmpv4.h
model/icmpv6-header.h
model/icmpv6-l4-protocol.h
model/ip-l4-protocol.h
model/ipv4-address-generator.h
model/ipv4-end-point-demux.h
model/ipv4-end-point.h
model/ipv4-global-routing.h
model/ipv4-header.h
model/ipv4-interface-address.h
model/ipv4-interface.h
model/ipv4-l3-protocol.h
model/ipv4-list-routing.h
model/ipv4-packet-filter.h
model/ipv4-packet-info-tag.h
model/ipv4-packet-probe.h
model/ipv4-queue-disc-item.h
model/ipv4-raw-socket-factory.h
model/ipv4-raw-socket-impl.h
model/ipv4-route.h
model/ipv4-routing-protocol.h
model/ipv4-routing-table-entry.h
model/ipv4-static-routing.h
model/ipv4.h
model/ipv6-address-generator.h
model/ipv6-end-point-demux.h
model/ipv6-end-point.h
model/ipv6-extension-demux.h
model/ipv6-extension-header.h
model/ipv6-extension.h
model/ipv6-header.h
model/ipv6-interface-address.h
model/ipv6-interface.h
model/ipv6-l3-protocol.h
model/ipv6-list-routing.h
model/ipv6-option-header.h
model/ipv6-option.h
model/ipv6-packet-filter.h
model/ipv6-packet-info-tag.h
model/ipv6-packet-probe.h
model/ipv6-pmtu-cache.h
model/ipv6-queue-disc-item.h
model/ipv6-raw-socket-factory.h
model/ipv6-route.h
model/ipv6-routing-protocol.h
model/ipv6-routing-table-entry.h
model/ipv6-static-routing.h
model/ipv6.h
model/loopback-net-device.h
model/ndisc-cache.h
model/rip-header.h
model/rip.h
model/ripng-header.h
model/ripng.h
model/rtt-estimator.h
model/tcp-bbr.h
model/tcp-bic.h
model/tcp-congestion-ops.h
model/tcp-cubic.h
model/tcp-dctcp.h
model/tcp-header.h
model/tcp-highspeed.h
model/tcp-htcp.h
model/tcp-hybla.h
model/tcp-illinois.h
model/tcp-l4-protocol.h
model/tcp-ledbat.h
model/tcp-linux-reno.h
model/tcp-lp.h
model/tcp-option-rfc793.h
model/tcp-option-sack-permitted.h
model/tcp-option-sack.h
model/tcp-option-ts.h
model/tcp-option-winscale.h
model/tcp-option.h
model/tcp-prr-recovery.h
model/tcp-rate-ops.h
model/tcp-recovery-ops.h
model/tcp-rx-buffer.h
model/tcp-scalable.h
model/tcp-socket-base.h
model/tcp-socket-factory.h
model/tcp-socket-state.h
model/tcp-socket.h
model/tcp-tx-buffer.h
model/tcp-tx-item.h
model/tcp-vegas.h
model/tcp-veno.h
model/tcp-westwood.h
model/tcp-yeah.h
model/udp-header.h
model/udp-l4-protocol.h
model/udp-socket-factory.h
model/udp-socket-impl.h
model/udp-socket.h
model/windowed-filter.h
)
set(libraries_to_link ${libnetwork} ${libcore} ${libbridge} ${libtraffic-control})
set(test_sources
test/global-route-manager-impl-test-suite.cc
test/icmp-test.cc
test/ipv4-address-generator-test-suite.cc
test/ipv4-address-helper-test-suite.cc
test/ipv4-deduplication-test.cc
test/ipv4-forwarding-test.cc
test/ipv4-fragmentation-test.cc
test/ipv4-global-routing-test-suite.cc
test/ipv4-header-test.cc
test/ipv4-list-routing-test-suite.cc
test/ipv4-packet-info-tag-test-suite.cc
test/ipv4-raw-test.cc
test/ipv4-rip-test.cc
test/ipv4-static-routing-test-suite.cc
test/ipv4-test.cc
test/ipv6-address-duplication-test.cc
test/ipv6-address-generator-test-suite.cc
test/ipv6-address-helper-test-suite.cc
test/ipv6-dual-stack-test-suite.cc
test/ipv6-extension-header-test-suite.cc
test/ipv6-forwarding-test.cc
test/ipv6-fragmentation-test.cc
test/ipv6-list-routing-test-suite.cc
test/ipv6-packet-info-tag-test-suite.cc
test/ipv6-raw-test.cc
test/ipv6-ripng-test.cc
test/ipv6-test.cc
test/rtt-test.cc
test/tcp-advertised-window-test.cc
test/tcp-bbr-test.cc
test/tcp-bic-test.cc
test/tcp-bytes-in-flight-test.cc
test/tcp-classic-recovery-test.cc
test/tcp-close-test.cc
test/tcp-cong-avoid-test.cc
test/tcp-datasentcb-test.cc
test/tcp-dctcp-test.cc
test/tcp-ecn-test.cc
test/tcp-endpoint-bug2211.cc
test/tcp-error-model.cc
test/tcp-fast-retr-test.cc
test/tcp-general-test.cc
test/tcp-header-test.cc
test/tcp-highspeed-test.cc
test/tcp-htcp-test.cc
test/tcp-hybla-test.cc
test/tcp-illinois-test.cc
test/tcp-ledbat-test.cc
test/tcp-linux-reno-test.cc
test/tcp-loss-test.cc
test/tcp-lp-test.cc
test/tcp-option-test.cc
test/tcp-pacing-test.cc
test/tcp-pkts-acked-test.cc
test/tcp-prr-recovery-test.cc
test/tcp-rate-ops-test.cc
test/tcp-rto-test.cc
test/tcp-rtt-estimation.cc
test/tcp-rx-buffer-test.cc
test/tcp-sack-permitted-test.cc
test/tcp-scalable-test.cc
test/tcp-slow-start-test.cc
test/tcp-syn-connection-failed-test.cc
test/tcp-test.cc
test/tcp-timestamp-test.cc
test/tcp-tx-buffer-test.cc
test/tcp-vegas-test.cc
test/tcp-veno-test.cc
test/tcp-wscaling-test.cc
test/tcp-yeah-test.cc
test/tcp-zero-window-test.cc
test/udp-test.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name main-simple)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libinternet} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,52 @@
set(name lr-wpan)
set(source_files
helper/lr-wpan-helper.cc
model/lr-wpan-csmaca.cc
model/lr-wpan-error-model.cc
model/lr-wpan-fields.cc
model/lr-wpan-interference-helper.cc
model/lr-wpan-lqi-tag.cc
model/lr-wpan-mac-header.cc
model/lr-wpan-mac-pl-headers.cc
model/lr-wpan-mac-trailer.cc
model/lr-wpan-mac.cc
model/lr-wpan-net-device.cc
model/lr-wpan-phy.cc
model/lr-wpan-spectrum-signal-parameters.cc
model/lr-wpan-spectrum-value-helper.cc
)
set(header_files
helper/lr-wpan-helper.h
model/lr-wpan-csmaca.h
model/lr-wpan-error-model.h
model/lr-wpan-fields.h
model/lr-wpan-interference-helper.h
model/lr-wpan-lqi-tag.h
model/lr-wpan-mac-header.h
model/lr-wpan-mac-pl-headers.h
model/lr-wpan-mac-trailer.h
model/lr-wpan-mac.h
model/lr-wpan-net-device.h
model/lr-wpan-phy.h
model/lr-wpan-spectrum-signal-parameters.h
model/lr-wpan-spectrum-value-helper.h
)
set(libraries_to_link ${libnetwork} ${libcore} ${libmobility} ${libspectrum} ${libpropagation})
set(test_sources
test/lr-wpan-ack-test.cc
test/lr-wpan-cca-test.cc
test/lr-wpan-collision-test.cc
test/lr-wpan-ed-test.cc
test/lr-wpan-error-model-test.cc
test/lr-wpan-packet-test.cc
test/lr-wpan-pd-plme-sap-test.cc
test/lr-wpan-spectrum-value-helper-test.cc
test/lr-wpan-ifs-test.cc
test/lr-wpan-slotted-csmaca-test.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,29 @@
set(name lr-wpan-data)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblr-wpan})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lr-wpan-error-distance-plot)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblr-wpan} ${libstats})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lr-wpan-error-model-plot)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblr-wpan} ${libstats})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lr-wpan-packet-print)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblr-wpan})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lr-wpan-phy-test)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblr-wpan})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

345
src/lte/CMakeLists.txt Normal file
View File

@@ -0,0 +1,345 @@
set(name lte)
if(${NS3_EMU})
set(emu_sources helper/emu-epc-helper.cc)
set(emu_headers helper/emu-epc-helper.h)
set(emu_libraries ${libfd-net-device})
endif()
set(source_files
${emu_sources}
helper/cc-helper.cc
helper/epc-helper.cc
helper/lte-global-pathloss-database.cc
helper/lte-helper.cc
helper/lte-hex-grid-enb-topology-helper.cc
helper/lte-stats-calculator.cc
helper/mac-stats-calculator.cc
helper/no-backhaul-epc-helper.cc
helper/phy-rx-stats-calculator.cc
helper/phy-stats-calculator.cc
helper/phy-tx-stats-calculator.cc
helper/point-to-point-epc-helper.cc
helper/radio-bearer-stats-calculator.cc
helper/radio-bearer-stats-connector.cc
helper/radio-environment-map-helper.cc
model/a2-a4-rsrq-handover-algorithm.cc
model/a3-rsrp-handover-algorithm.cc
model/component-carrier-enb.cc
model/component-carrier-ue.cc
model/component-carrier.cc
model/cqa-ff-mac-scheduler.cc
model/epc-enb-application.cc
model/epc-enb-s1-sap.cc
model/epc-gtpc-header.cc
model/epc-gtpu-header.cc
model/epc-mme-application.cc
model/epc-pgw-application.cc
model/epc-s11-sap.cc
model/epc-s1ap-sap.cc
model/epc-sgw-application.cc
model/epc-tft-classifier.cc
model/epc-tft.cc
model/epc-ue-nas.cc
model/epc-x2-header.cc
model/epc-x2-sap.cc
model/epc-x2.cc
model/eps-bearer-tag.cc
model/eps-bearer.cc
model/fdbet-ff-mac-scheduler.cc
model/fdmt-ff-mac-scheduler.cc
model/fdtbfq-ff-mac-scheduler.cc
model/ff-mac-common.cc
model/ff-mac-csched-sap.cc
model/ff-mac-sched-sap.cc
model/ff-mac-scheduler.cc
model/lte-amc.cc
model/lte-anr-sap.cc
model/lte-anr.cc
model/lte-as-sap.cc
model/lte-asn1-header.cc
model/lte-ccm-mac-sap.cc
model/lte-ccm-rrc-sap.cc
model/lte-chunk-processor.cc
model/lte-common.cc
model/lte-control-messages.cc
model/lte-enb-cmac-sap.cc
model/lte-enb-component-carrier-manager.cc
model/lte-enb-cphy-sap.cc
model/lte-enb-mac.cc
model/lte-enb-net-device.cc
model/lte-enb-phy-sap.cc
model/lte-enb-phy.cc
model/lte-enb-rrc.cc
model/lte-ffr-algorithm.cc
model/lte-ffr-distributed-algorithm.cc
model/lte-ffr-enhanced-algorithm.cc
model/lte-ffr-rrc-sap.cc
model/lte-ffr-sap.cc
model/lte-ffr-soft-algorithm.cc
model/lte-fr-hard-algorithm.cc
model/lte-fr-no-op-algorithm.cc
model/lte-fr-soft-algorithm.cc
model/lte-fr-strict-algorithm.cc
model/lte-handover-algorithm.cc
model/lte-handover-management-sap.cc
model/lte-harq-phy.cc
model/lte-interference.cc
model/lte-mac-sap.cc
model/lte-mi-error-model.cc
model/lte-net-device.cc
model/lte-pdcp-header.cc
model/lte-pdcp-sap.cc
model/lte-pdcp-tag.cc
model/lte-pdcp.cc
model/lte-phy-tag.cc
model/lte-phy.cc
model/lte-radio-bearer-info.cc
model/lte-radio-bearer-tag.cc
model/lte-rlc-am-header.cc
model/lte-rlc-am.cc
model/lte-rlc-header.cc
model/lte-rlc-sap.cc
model/lte-rlc-sdu-status-tag.cc
model/lte-rlc-sequence-number.cc
model/lte-rlc-tag.cc
model/lte-rlc-tm.cc
model/lte-rlc-um.cc
model/lte-rlc.cc
model/lte-rrc-header.cc
model/lte-rrc-protocol-ideal.cc
model/lte-rrc-protocol-real.cc
model/lte-rrc-sap.cc
model/lte-spectrum-phy.cc
model/lte-spectrum-signal-parameters.cc
model/lte-spectrum-value-helper.cc
model/lte-ue-ccm-rrc-sap.cc
model/lte-ue-cmac-sap.cc
model/lte-ue-component-carrier-manager.cc
model/lte-ue-cphy-sap.cc
model/lte-ue-mac.cc
model/lte-ue-net-device.cc
model/lte-ue-phy-sap.cc
model/lte-ue-phy.cc
model/lte-ue-power-control.cc
model/lte-ue-rrc.cc
model/lte-vendor-specific-parameters.cc
model/no-op-component-carrier-manager.cc
model/no-op-handover-algorithm.cc
model/pf-ff-mac-scheduler.cc
model/pss-ff-mac-scheduler.cc
model/rem-spectrum-phy.cc
model/rr-ff-mac-scheduler.cc
model/simple-ue-component-carrier-manager.cc
model/tdbet-ff-mac-scheduler.cc
model/tdmt-ff-mac-scheduler.cc
model/tdtbfq-ff-mac-scheduler.cc
model/tta-ff-mac-scheduler.cc
)
set(header_files
${emu_headers}
helper/cc-helper.h
helper/epc-helper.h
helper/lte-global-pathloss-database.h
helper/lte-helper.h
helper/lte-hex-grid-enb-topology-helper.h
helper/lte-stats-calculator.h
helper/mac-stats-calculator.h
helper/no-backhaul-epc-helper.h
helper/phy-rx-stats-calculator.h
helper/phy-stats-calculator.h
helper/phy-tx-stats-calculator.h
helper/point-to-point-epc-helper.h
helper/radio-bearer-stats-calculator.h
helper/radio-bearer-stats-connector.h
helper/radio-environment-map-helper.h
model/a2-a4-rsrq-handover-algorithm.h
model/a3-rsrp-handover-algorithm.h
model/component-carrier-enb.h
model/component-carrier-ue.h
model/component-carrier.h
model/cqa-ff-mac-scheduler.h
model/epc-enb-application.h
model/epc-enb-s1-sap.h
model/epc-gtpc-header.h
model/epc-gtpu-header.h
model/epc-mme-application.h
model/epc-pgw-application.h
model/epc-s11-sap.h
model/epc-s1ap-sap.h
model/epc-sgw-application.h
model/epc-tft-classifier.h
model/epc-tft.h
model/epc-ue-nas.h
model/epc-x2-header.h
model/epc-x2-sap.h
model/epc-x2.h
model/eps-bearer-tag.h
model/eps-bearer.h
model/fdbet-ff-mac-scheduler.h
model/fdmt-ff-mac-scheduler.h
model/fdtbfq-ff-mac-scheduler.h
model/ff-mac-common.h
model/ff-mac-csched-sap.h
model/ff-mac-sched-sap.h
model/ff-mac-scheduler.h
model/lte-amc.h
model/lte-anr-sap.h
model/lte-anr.h
model/lte-as-sap.h
model/lte-asn1-header.h
model/lte-ccm-mac-sap.h
model/lte-ccm-rrc-sap.h
model/lte-chunk-processor.h
model/lte-common.h
model/lte-control-messages.h
model/lte-enb-cmac-sap.h
model/lte-enb-component-carrier-manager.h
model/lte-enb-cphy-sap.h
model/lte-enb-mac.h
model/lte-enb-net-device.h
model/lte-enb-phy-sap.h
model/lte-enb-phy.h
model/lte-enb-rrc.h
model/lte-ffr-algorithm.h
model/lte-ffr-distributed-algorithm.h
model/lte-ffr-enhanced-algorithm.h
model/lte-ffr-rrc-sap.h
model/lte-ffr-sap.h
model/lte-ffr-soft-algorithm.h
model/lte-fr-hard-algorithm.h
model/lte-fr-no-op-algorithm.h
model/lte-fr-soft-algorithm.h
model/lte-fr-strict-algorithm.h
model/lte-handover-algorithm.h
model/lte-handover-management-sap.h
model/lte-harq-phy.h
model/lte-interference.h
model/lte-mac-sap.h
model/lte-mi-error-model.h
model/lte-net-device.h
model/lte-pdcp-header.h
model/lte-pdcp-sap.h
model/lte-pdcp-tag.h
model/lte-pdcp.h
model/lte-phy-tag.h
model/lte-phy.h
model/lte-radio-bearer-info.h
model/lte-radio-bearer-tag.h
model/lte-rlc-am-header.h
model/lte-rlc-am.h
model/lte-rlc-header.h
model/lte-rlc-sap.h
model/lte-rlc-sdu-status-tag.h
model/lte-rlc-sequence-number.h
model/lte-rlc-tag.h
model/lte-rlc-tm.h
model/lte-rlc-um.h
model/lte-rlc.h
model/lte-rrc-header.h
model/lte-rrc-protocol-ideal.h
model/lte-rrc-protocol-real.h
model/lte-rrc-sap.h
model/lte-spectrum-phy.h
model/lte-spectrum-signal-parameters.h
model/lte-spectrum-value-helper.h
model/lte-ue-ccm-rrc-sap.h
model/lte-ue-cmac-sap.h
model/lte-ue-component-carrier-manager.h
model/lte-ue-cphy-sap.h
model/lte-ue-mac.h
model/lte-ue-net-device.h
model/lte-ue-phy-sap.h
model/lte-ue-phy.h
model/lte-ue-power-control.h
model/lte-ue-rrc.h
model/lte-vendor-specific-parameters.h
model/no-op-component-carrier-manager.h
model/no-op-handover-algorithm.h
model/pf-ff-mac-scheduler.h
model/pss-ff-mac-scheduler.h
model/rem-spectrum-phy.h
model/rr-ff-mac-scheduler.h
model/simple-ue-component-carrier-manager.h
model/tdbet-ff-mac-scheduler.h
model/tdmt-ff-mac-scheduler.h
model/tdtbfq-ff-mac-scheduler.h
model/tta-ff-mac-scheduler.h
)
set(libraries_to_link
${emu_libraries}
${libcore}
${libnetwork}
${libspectrum}
${libstats}
${libbuildings}
${libvirtual-net-device}
${libpoint-to-point}
${libapplications}
${libinternet}
${libcsma}
)
set(test_sources
test/epc-test-gtpu.cc
test/epc-test-s1u-downlink.cc
test/epc-test-s1u-uplink.cc
test/lte-ffr-simple.cc
test/lte-simple-helper.cc
test/lte-simple-net-device.cc
test/lte-simple-spectrum-phy.cc
test/lte-test-aggregation-throughput-scale.cc
test/lte-test-carrier-aggregation-configuration.cc
test/lte-test-carrier-aggregation.cc
test/lte-test-cell-selection.cc
test/lte-test-cqa-ff-mac-scheduler.cc
test/lte-test-cqi-generation.cc
test/lte-test-deactivate-bearer.cc
test/lte-test-downlink-power-control.cc
test/lte-test-downlink-sinr.cc
test/lte-test-earfcn.cc
test/lte-test-entities.cc
test/lte-test-fdbet-ff-mac-scheduler.cc
test/lte-test-fdmt-ff-mac-scheduler.cc
test/lte-test-fdtbfq-ff-mac-scheduler.cc
test/lte-test-frequency-reuse.cc
test/lte-test-harq.cc
test/lte-test-interference-fr.cc
test/lte-test-interference.cc
test/lte-test-ipv6-routing.cc
test/lte-test-link-adaptation.cc
test/lte-test-mimo.cc
test/lte-test-pathloss-model.cc
test/lte-test-pf-ff-mac-scheduler.cc
test/lte-test-phy-error-model.cc
test/lte-test-pss-ff-mac-scheduler.cc
test/lte-test-radio-link-failure.cc
test/lte-test-rlc-am-e2e.cc
test/lte-test-rlc-am-transmitter.cc
test/lte-test-rlc-um-e2e.cc
test/lte-test-rlc-um-transmitter.cc
test/lte-test-rr-ff-mac-scheduler.cc
test/lte-test-spectrum-value-helper.cc
test/lte-test-tdbet-ff-mac-scheduler.cc
test/lte-test-tdmt-ff-mac-scheduler.cc
test/lte-test-tdtbfq-ff-mac-scheduler.cc
test/lte-test-tta-ff-mac-scheduler.cc
test/lte-test-ue-measurements.cc
test/lte-test-ue-phy.cc
test/lte-test-uplink-power-control.cc
test/lte-test-uplink-sinr.cc
test/test-asn1-encoding.cc
test/test-epc-tft-classifier.cc
test/test-lte-antenna.cc
test/test-lte-epc-e2e-data.cc
test/test-lte-handover-delay.cc
test/test-lte-handover-target.cc
test/test-lte-rlc-header.cc
test/test-lte-rrc.cc
test/test-lte-x2-handover-measures.cc
test/test-lte-x2-handover.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,133 @@
set(name lena-cqi-threshold)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-dual-stripe)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-fading)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-intercell-interference)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-pathloss-traces)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-profiling)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-rem)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-rem-sector-antenna)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-rlc-traces)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-simple)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-simple-epc)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-deactivate-bearer)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-x2-handover)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-x2-handover-measures)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-frequency-reuse)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-distributed-ffr)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-uplink-power-control)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-ipv6-addr-conf)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-ipv6-ue-rh)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-ipv6-ue-ue)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lena-radio-link-failure)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
if(${NS3_EMU})
set(name lena-simple-epc-emu)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${liblte} ${fd-net-device})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
endif()

88
src/mesh/CMakeLists.txt Normal file
View File

@@ -0,0 +1,88 @@
set(name mesh)
set(source_files
helper/dot11s/dot11s-installer.cc
helper/flame/flame-installer.cc
helper/mesh-helper.cc
helper/mesh-stack-installer.cc
model/dot11s/airtime-metric.cc
model/dot11s/dot11s-mac-header.cc
model/dot11s/hwmp-protocol-mac.cc
model/dot11s/hwmp-protocol.cc
model/dot11s/hwmp-rtable.cc
model/dot11s/hwmp-tag.cc
model/dot11s/ie-dot11s-beacon-timing.cc
model/dot11s/ie-dot11s-configuration.cc
model/dot11s/ie-dot11s-id.cc
model/dot11s/ie-dot11s-metric-report.cc
model/dot11s/ie-dot11s-peer-management.cc
model/dot11s/ie-dot11s-peering-protocol.cc
model/dot11s/ie-dot11s-perr.cc
model/dot11s/ie-dot11s-prep.cc
model/dot11s/ie-dot11s-preq.cc
model/dot11s/ie-dot11s-rann.cc
model/dot11s/peer-link-frame.cc
model/dot11s/peer-link.cc
model/dot11s/peer-management-protocol-mac.cc
model/dot11s/peer-management-protocol.cc
model/flame/flame-header.cc
model/flame/flame-protocol-mac.cc
model/flame/flame-protocol.cc
model/flame/flame-rtable.cc
model/mesh-information-element-vector.cc
model/mesh-l2-routing-protocol.cc
model/mesh-point-device.cc
model/mesh-wifi-beacon.cc
model/mesh-wifi-interface-mac.cc
)
set(header_files
helper/dot11s/dot11s-installer.h
helper/flame/flame-installer.h
helper/mesh-helper.h
helper/mesh-stack-installer.h
model/dot11s/dot11s-mac-header.h
model/dot11s/hwmp-protocol.h
model/dot11s/hwmp-rtable.h
model/dot11s/ie-dot11s-beacon-timing.h
model/dot11s/ie-dot11s-configuration.h
model/dot11s/ie-dot11s-id.h
model/dot11s/ie-dot11s-metric-report.h
model/dot11s/ie-dot11s-peer-management.h
model/dot11s/ie-dot11s-peering-protocol.h
model/dot11s/ie-dot11s-perr.h
model/dot11s/ie-dot11s-prep.h
model/dot11s/ie-dot11s-preq.h
model/dot11s/ie-dot11s-rann.h
model/dot11s/peer-link-frame.h
model/dot11s/peer-link.h
model/dot11s/peer-management-protocol.h
model/flame/flame-header.h
model/flame/flame-protocol-mac.h
model/flame/flame-protocol.h
model/flame/flame-rtable.h
model/mesh-information-element-vector.h
model/mesh-l2-routing-protocol.h
model/mesh-point-device.h
model/mesh-wifi-beacon.h
model/mesh-wifi-interface-mac-plugin.h
model/mesh-wifi-interface-mac.h
)
set(libraries_to_link ${libinternet} ${libwifi} ${libapplications})
set(test_sources
test/dot11s/dot11s-test-suite.cc
test/dot11s/hwmp-proactive-regression.cc
test/dot11s/hwmp-reactive-regression.cc
test/dot11s/hwmp-simplest-regression.cc
test/dot11s/hwmp-target-flags-regression.cc
test/dot11s/pmp-regression.cc
test/dot11s/regression.cc
test/flame/flame-regression.cc
test/flame/flame-test-suite.cc
test/flame/regression.cc
test/mesh-information-element-vector-test-suite.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,5 @@
set(name mesh)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libinternet} ${libmobility} ${libwifi} ${libmesh} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,62 @@
set(name mobility)
set(source_files
helper/group-mobility-helper.cc
helper/mobility-helper.cc
helper/ns2-mobility-helper.cc
model/box.cc
model/constant-acceleration-mobility-model.cc
model/constant-position-mobility-model.cc
model/constant-velocity-helper.cc
model/constant-velocity-mobility-model.cc
model/gauss-markov-mobility-model.cc
model/geographic-positions.cc
model/hierarchical-mobility-model.cc
model/mobility-model.cc
model/position-allocator.cc
model/random-direction-2d-mobility-model.cc
model/random-walk-2d-mobility-model.cc
model/random-waypoint-mobility-model.cc
model/rectangle.cc
model/steady-state-random-waypoint-mobility-model.cc
model/waypoint-mobility-model.cc
model/waypoint.cc
)
set(header_files
helper/group-mobility-helper.h
helper/mobility-helper.h
helper/ns2-mobility-helper.h
model/box.h
model/constant-acceleration-mobility-model.h
model/constant-position-mobility-model.h
model/constant-velocity-helper.h
model/constant-velocity-mobility-model.h
model/gauss-markov-mobility-model.h
model/geographic-positions.h
model/hierarchical-mobility-model.h
model/mobility-model.h
model/position-allocator.h
model/random-direction-2d-mobility-model.h
model/random-walk-2d-mobility-model.h
model/random-waypoint-mobility-model.h
model/rectangle.h
model/steady-state-random-waypoint-mobility-model.h
model/waypoint-mobility-model.h
model/waypoint.h
)
set(libraries_to_link ${libnetwork})
set(test_sources
test/box-line-intersection-test.cc
test/geo-to-cartesian-test.cc
test/mobility-test-suite.cc
test/mobility-trace-test-suite.cc
test/ns2-mobility-helper-test-suite.cc
test/rand-cart-around-geo-test.cc
test/steady-state-random-waypoint-mobility-model-test.cc
test/waypoint-mobility-model-test.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,41 @@
set(name bonnmotion-ns2-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-grid-topology)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility} ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-random-topology)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-random-walk)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name mobility-trace-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility} ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name ns2-mobility-trace)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libcore} ${libmobility})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name reference-point-group-mobility-example)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetwork} ${libmobility})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

28
src/mpi/CMakeLists.txt Normal file
View File

@@ -0,0 +1,28 @@
set(name mpi)
include_directories(${MPI_CXX_INCLUDE_DIRS})
set(source_files
model/distributed-simulator-impl.cc
model/granted-time-window-mpi-interface.cc
model/mpi-interface.cc
model/mpi-receiver.cc
model/null-message-mpi-interface.cc
model/null-message-simulator-impl.cc
model/parallel-communication-interface.h
model/remote-channel-bundle-manager.cc
model/remote-channel-bundle.cc
)
set(header_files model/mpi-interface.h model/mpi-receiver.h model/parallel-communication-interface.h)
set(libraries_to_link ${libcore} ${libnetwork} ${MPI_CXX_LIBRARIES})
set(example_as_test_suite)
if(${NS3_EXAMPLES})
set(example_as_test_suite test/mpi-test-suite.cc)
endif()
set(test_sources ${example_as_test_suite})
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,40 @@
include_directories(${MPI_CXX_INCLUDE_DIRS})
link_libraries(${MPI_CXX_LIBRARIES})
set(name simple-distributed)
set(source_files ${name}.cc mpi-test-fixtures.cc)
set(header_files)
set(libraries_to_link ${libmpi} ${libpoint-to-point} ${libinternet} ${libnix-vector-routing} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name third-distributed)
set(source_files ${name}.cc mpi-test-fixtures.cc)
set(header_files)
set(libraries_to_link
${libmpi}
${libpoint-to-point}
${libinternet}
${libmobility}
${libwifi}
${libcsma}
${libapplications}
)
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name nms-p2p-nix-distributed)
set(source_files ${name}.cc mpi-test-fixtures.cc)
set(header_files)
set(libraries_to_link ${libmpi} ${libpoint-to-point} ${libinternet} ${libnix-vector-routing} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name simple-distributed-empty-node)
set(source_files ${name}.cc mpi-test-fixtures.cc)
set(header_files)
set(libraries_to_link ${libmpi} ${libpoint-to-point} ${libinternet} ${libnix-vector-routing} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name simple-distributed-mpi-comm)
set(source_files ${name}.cc mpi-test-fixtures.cc)
set(header_files)
set(libraries_to_link ${libmpi} ${libpoint-to-point} ${libinternet} ${libnix-vector-routing} ${libapplications})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,23 @@
set(name netanim)
set(source_files model/animation-interface.cc)
set(header_files model/animation-interface.h)
set(libraries_to_link
${libinternet}
${libmobility}
${libwimax}
${libwifi}
${libcsma}
${liblte}
${libuan}
${libenergy}
${liblr-wpan}
${libwave}
${libpoint-to-point-layout}
)
set(test_sources test/netanim-test.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,49 @@
set(name dumbbell-animation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetanim} ${libapplications} ${libpoint-to-point-layout})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name grid-animation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetanim} ${libapplications} ${libpoint-to-point-layout})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name star-animation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetanim} ${libapplications} ${libpoint-to-point-layout})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name wireless-animation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link
${libnetanim}
${libapplications}
${libpoint-to-point}
${libcsma}
${libwifi}
${libmobility}
${libnetwork}
)
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name uan-animation)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetanim} ${libinternet} ${libmobility} ${libapplications} ${libuan})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name colors-link-description)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetanim} ${libapplications} ${libpoint-to-point-layout})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name resources-counters)
set(source_files ${name}.cc)
set(header_files)
set(libraries_to_link ${libnetanim} ${libapplications} ${libpoint-to-point-layout})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

169
src/network/CMakeLists.txt Normal file
View File

@@ -0,0 +1,169 @@
set(name network)
set(source_files
helper/application-container.cc
helper/delay-jitter-estimation.cc
helper/net-device-container.cc
helper/node-container.cc
helper/packet-socket-helper.cc
helper/simple-net-device-helper.cc
helper/trace-helper.cc
model/address.cc
model/application.cc
model/buffer.cc
model/byte-tag-list.cc
model/channel-list.cc
model/channel.cc
model/chunk.cc
model/header.cc
model/net-device.cc
model/nix-vector.cc
model/node-list.cc
model/node.cc
model/packet-metadata.cc
model/packet-tag-list.cc
model/packet.cc
model/socket-factory.cc
model/socket.cc
model/tag-buffer.cc
model/tag.cc
model/trailer.cc
utils/address-utils.cc
utils/bit-deserializer.cc
utils/bit-serializer.cc
utils/crc32.cc
utils/data-rate.cc
utils/drop-tail-queue.cc
utils/dynamic-queue-limits.cc
utils/error-channel.cc
utils/error-model.cc
utils/ethernet-header.cc
utils/ethernet-trailer.cc
utils/flow-id-tag.cc
utils/inet-socket-address.cc
utils/inet6-socket-address.cc
utils/ipv4-address.cc
utils/ipv6-address.cc
utils/llc-snap-header.cc
utils/mac16-address.cc
utils/mac48-address.cc
utils/mac64-address.cc
utils/mac8-address.cc
utils/net-device-queue-interface.cc
utils/output-stream-wrapper.cc
utils/packet-burst.cc
utils/packet-data-calculators.cc
utils/packet-probe.cc
utils/packet-socket-address.cc
utils/packet-socket-client.cc
utils/packet-socket-factory.cc
utils/packet-socket-server.cc
utils/packet-socket.cc
utils/packetbb.cc
utils/pcap-file-wrapper.cc
utils/pcap-file.cc
utils/queue-item.cc
utils/queue-limits.cc
utils/queue-size.cc
utils/queue.cc
utils/radiotap-header.cc
utils/simple-channel.cc
utils/simple-net-device.cc
utils/sll-header.cc
)
set(header_files
helper/application-container.h
helper/delay-jitter-estimation.h
helper/net-device-container.h
helper/node-container.h
helper/packet-socket-helper.h
helper/simple-net-device-helper.h
helper/trace-helper.h
model/address.h
model/application.h
model/buffer.h
model/byte-tag-list.h
model/channel-list.h
model/channel.h
model/chunk.h
model/header.h
model/net-device.h
model/nix-vector.h
model/node-list.h
model/node.h
model/packet-metadata.h
model/packet-tag-list.h
model/packet.h
model/socket-factory.h
model/socket.h
model/tag-buffer.h
model/tag.h
model/trailer.h
utils/address-utils.h
utils/bit-deserializer.h
utils/bit-serializer.h
utils/crc32.h
utils/data-rate.h
utils/drop-tail-queue.h
utils/dynamic-queue-limits.h
utils/error-channel.h
utils/error-model.h
utils/ethernet-header.h
utils/ethernet-trailer.h
utils/flow-id-tag.h
utils/generic-phy.h
utils/inet-socket-address.h
utils/inet6-socket-address.h
utils/ipv4-address.h
utils/ipv6-address.h
utils/llc-snap-header.h
utils/lollipop-counter.h
utils/mac16-address.h
utils/mac48-address.h
utils/mac64-address.h
utils/mac8-address.h
utils/net-device-queue-interface.h
utils/output-stream-wrapper.h
utils/packet-burst.h
utils/packet-data-calculators.h
utils/packet-probe.h
utils/packet-socket-address.h
utils/packet-socket-client.h
utils/packet-socket-factory.h
utils/packet-socket-server.h
utils/packet-socket.h
utils/packetbb.h
utils/pcap-file-wrapper.h
utils/pcap-file.h
utils/pcap-test.h
utils/queue-item.h
utils/queue-limits.h
utils/queue-size.h
utils/queue.h
utils/radiotap-header.h
utils/sequence-number.h
utils/simple-channel.h
utils/simple-net-device.h
utils/sll-header.h
)
set(libraries_to_link ${libcore} ${libstats})
set(test_sources
test/bit-serializer-test.cc
test/buffer-test.cc
test/drop-tail-queue-test-suite.cc
test/error-model-test-suite.cc
test/ipv6-address-test-suite.cc
test/lollipop-counter-test.cc
test/packet-metadata-test.cc
test/packet-socket-apps-test-suite.cc
test/packet-test-suite.cc
test/packetbb-test-suite.cc
test/pcap-file-test-suite.cc
test/sequence-number-test-suite.cc
test/test-data-rate.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,26 @@
set(header_files)
set(name bit-serializer)
set(source_files ${name}.cc)
set(libraries_to_link ${libcore} ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-packet-header)
set(source_files ${name}.cc)
set(libraries_to_link ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name main-packet-tag)
set(source_files ${name}.cc)
set(libraries_to_link ${libnetwork})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name packet-socket-apps)
set(source_files ${name}.cc)
set(libraries_to_link ${libnetwork} ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")
set(name lollipop-comparisions)
set(source_files ${name}.cc)
set(libraries_to_link ${libnetwork} ${libcore})
build_lib_example("${name}" "${source_files}" "${header_files}" "${libraries_to_link}")

View File

@@ -0,0 +1,13 @@
set(name nix-vector-routing)
set(source_files helper/nix-vector-helper.cc model/nix-vector-routing.cc)
set(header_files helper/nix-vector-helper.h model/nix-vector-routing.h)
set(deprecated_header_files helper/ipv4-nix-vector-helper.h model/ipv4-nix-vector-routing.h)
set(libraries_to_link ${libinternet})
set(test_sources test/nix-test.cc)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

View File

@@ -0,0 +1,9 @@
set(header_files)
set(libraries_to_link ${libpoint-to-point} ${libinternet} ${libapplications} ${libnix-vector-routing})
set(nix_examples nix-simple nix-simple-multi-address nms-p2p-nix)
foreach(example ${nix_examples})
set(source_files ${example}.cc)
build_lib_example("${example}" "${source_files}" "${header_files}" "${libraries_to_link}")
endforeach()

15
src/olsr/CMakeLists.txt Normal file
View File

@@ -0,0 +1,15 @@
set(name olsr)
set(source_files helper/olsr-helper.cc model/olsr-header.cc model/olsr-routing-protocol.cc model/olsr-state.cc)
set(header_files helper/olsr-helper.h model/olsr-header.h model/olsr-repositories.h model/olsr-routing-protocol.h
model/olsr-state.h
)
set(libraries_to_link ${libinternet})
set(test_sources test/regression-test-suite.cc test/bug780-test.cc test/hello-regression-test.cc
test/olsr-header-test-suite.cc test/olsr-routing-protocol-test-suite.cc test/tc-regression-test.cc
)
build_lib("${name}" "${source_files}" "${header_files}" "${libraries_to_link}" "${test_sources}")

Some files were not shown because too many files have changed in this diff Show More