endif(HAVE_GTNETS)
if(HAVE_NS3)
- SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3")
+ if(${NS3_VERSION} EQUAL 310)
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_NS3_3_10")
+ else(${NS3_VERSION} EQUAL 310)
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3-core -lns3-csma -lns3-point-to-point")
+ endif(${NS3_VERSION} EQUAL 310)
endif(HAVE_NS3)
if(HAVE_POSIX_GETTIME)
${ns3_path}
)
+find_library(HAVE_NS3_CORE_LIB
+ NAME ns3-core
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ $ENV{HOME}
+ PATH_SUFFIXES lib64 lib ns3/lib
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr
+ ${ns3_path}
+)
+
find_path(HAVE_CORE_MODULE_H
NAME ns3/core-module.h
HINTS
endif(HAVE_NS3_LIB)
mark_as_advanced(HAVE_NS3_LIB)
-if(HAVE_NS3_LIB AND HAVE_CORE_MODULE_H)
- set(HAVE_NS3 1)
- string(REPLACE "/libns3.${LIB_EXE}" "" HAVE_NS3_LIB "${HAVE_NS3_LIB}")
+message(STATUS "Looking for lib ns3-core")
+if(HAVE_NS3_CORE_LIB)
+message(STATUS "Looking for lib ns3-core - found")
+else(HAVE_NS3_CORE_LIB)
+message(STATUS "Looking for lib ns3-core - not found")
+endif(HAVE_NS3_CORE_LIB)
+mark_as_advanced(HAVE_NS3_LIB)
+
+if(HAVE_CORE_MODULE_H)
+ if(HAVE_NS3_LIB)
+ message(STATUS "Warning: NS-3 version <= 3.10")
+ set(HAVE_NS3 1)
+ set(NS3_VERSION 310)
+ string(REPLACE "/libns3.${LIB_EXE}" "" HAVE_NS3_LIB "${HAVE_NS3_LIB}")
+ endif(HAVE_NS3_LIB)
+ if(HAVE_NS3_CORE_LIB)
+ message(STATUS "Warning: NS-3 version > 3.10")
+ set(HAVE_NS3 1)
+ set(NS3_VERSION 312)
+ string(REPLACE "/libns3-core.${LIB_EXE}" "" HAVE_NS3_LIB "${HAVE_NS3_CORE_LIB}")
+ endif(HAVE_NS3_CORE_LIB)
+endif(HAVE_CORE_MODULE_H)
+
+if(HAVE_NS3)
string(REGEX MATCH "${HAVE_NS3_LIB}" operation "$ENV{LD_LIBRARY_PATH}")
-
if(NOT operation)
-
message(STATUS "Warning: To use NS-3 don't forget to set LD_LIBRARY_PATH with: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HAVE_NS3_LIB}")
set(HAVE_NS3 0)
-
else(NOT operation)
string(REGEX MATCH "-L${HAVE_NS3_LIB} " operation1 "${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-I${HAVE_CORE_MODULE_H} -L${HAVE_NS3_LIB} ")
endif(NOT operation)
-
-endif(HAVE_NS3_LIB AND HAVE_CORE_MODULE_H)
\ No newline at end of file
+else(HAVE_NS3)
+ message(STATUS "Warning: To use NS-3 Please install ns3 at least version 3.10 (http://www.nsnam.org/releases/)")
+endif(HAVE_NS3)
\ No newline at end of file
#include "xbt/log.h"
#include "xbt/dynar.h"
-#include "ns3/core-module.h"
-#include "ns3/simulator-module.h"
-#include "ns3/node-module.h"
-#include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
-#include "ns3/global-route-manager.h"
-#include "ns3/ipv4-global-routing-helper.h"
-
using namespace ns3;
extern xbt_lib_t host_lib;
#ifdef __cplusplus
#include "ns3/core-module.h"
-#include "ns3/helper-module.h"
-#include "ns3/simulator-module.h"
-#include "ns3/node-module.h"
-#include "ns3/helper-module.h"
-#include "ns3/global-routing-module.h"
-#include "ns3/tcp-socket-factory.h"
+
+#ifdef _NS3_3_10
+ /*NS3 3.10*/
+ #include "ns3/helper-module.h"
+ #include "ns3/simulator-module.h"
+ #include "ns3/node-module.h"
+ #include "ns3/helper-module.h"
+ #include "ns3/global-routing-module.h"
+ #include "ns3/tcp-socket-factory.h"
+#else
+ /*NS3 3.12*/
+ #include "ns3/node.h"
+ #include "ns3/global-route-manager.h"
+ #include "ns3/csma-helper.h"
+ #include "ns3/internet-stack-helper.h"
+ #include "ns3/ipv4-address-helper.h"
+ #include "ns3/point-to-point-helper.h"
+ #include "ns3/packet-sink-helper.h"
+ #include "ns3/inet-socket-address.h"
+#endif
using namespace ns3;
using namespace std;