if(enable_pcre STREQUAL "AUTO" OR enable_pcre STREQUAL "ON")
include(FindPCRE)
endif(enable_pcre STREQUAL "AUTO" OR enable_pcre STREQUAL "ON")
+set(HAVE_GTNETS 0)
if(enable_gtnets)
include(FindGTnets)
endif(enable_gtnets)
if(enable_lua)
include(FindLua51Simgrid)
endif(enable_lua)
+set(HAVE_NS3 0)
+if(enable_ns3)
+ include(FindNS3)
+endif(enable_ns3)
# Checks for header libraries functions.
CHECK_LIBRARY_EXISTS(pthread pthread_create "" pthread)
set(top_builddir ${CMAKE_HOME_DIRECTORY})
set(libdir ${exec_prefix}/lib)
set(CMAKE_LINKARGS "${CMAKE_BINARY_DIR}/lib")
-set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:${GTNETS_LIB_PATH}:$LD_LIBRARY_PATH")
+set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:${GTNETS_LIB_PATH}:${HAVE_NS3_LIB}:$LD_LIBRARY_PATH")
configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/smpif.h @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
endif(HAVE_GTNETS)
+if(HAVE_NS3)
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3")
+endif(HAVE_NS3)
+
if(HAVE_POSIX_GETTIME)
SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
endif(HAVE_POSIX_GETTIME)
/opt/csw
/sw
/usr
+ ${gtnets_path}
)
string(REPLACE "/libgtnets.${LIB_EXE}" "" GTNETS_LIB_PATH "${HAVE_GTNETS_LIB}")
--- /dev/null
+find_library(HAVE_NS3_LIB
+ NAME ns3
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ $ENV{HOME}
+ PATH_SUFFIXES lib64 lib lib64/ns3 lib/ns3
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr
+ ${ns3_path}
+)
+
+find_path(HAVE_CORE_MODULE_H
+ NAME ns3/core-module.h
+ HINTS
+ $ENV{HOME}
+ PATH_SUFFIXES include include/ns3
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr
+ ${ns3_path}
+)
+
+message(STATUS "Looking for core-module.h")
+if(HAVE_CORE_MODULE_H)
+message(STATUS "Looking for core-module.h - found")
+else(HAVE_CORE_MODULE_H)
+message(STATUS "Looking for core-module.h - not found")
+endif(HAVE_CORE_MODULE_H)
+mark_as_advanced(HAVE_CORE_MODULE_H)
+
+message(STATUS "Looking for lib ns3")
+if(HAVE_NS3_LIB)
+message(STATUS "Looking for lib ns3 - found")
+else(HAVE_NS3_LIB)
+message(STATUS "Looking for lib ns3 - not found")
+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}")
+ 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}")
+ if(NOT operation1)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${HAVE_NS3_LIB} ")
+ endif(NOT operation1)
+
+ 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
set(BIBTEX2HTML ${BIBTEX2HTML} CACHE PATH "Path to bibtex2html")
set(gtnets_path ${gtnets_path} CACHE PATH "Path to gtnets lib and include")
+set(ns3_path ${ns3_path} CACHE PATH "Path to ns3 lib and include")
set(custom_flags ${custom_flags} CACHE FORCE "Customers flags add to cmake_c_flag")
if(NOT CMAKE_INSTALL_PREFIX)
set(pipol_user ${pipol_user} CACHE TYPE INTERNAL FORCE)
option(enable_gtnets "Whether gtnets model is activated." on)
+option(enable_ns3 "Whether ns3 model is activated." off)
option(enable_smpi "This variable set smpi lib." on)
option(enable_lua "Whether the lua bindings are activated." on)
set(enable_pcre ${enable_pcre} CACHE FORCE "Whether the pcre lib is activated.")
message("")
if(NOT APPLE AND NOT WIN32)
message(" Compile Gtnets : ${HAVE_GTNETS}")
+message(" Compile NS-3 : ${HAVE_NS3}")
message(" Gtnets path : ${gtnets_path}")
+message(" NS-3 path : ${ns3_path}")
endif(NOT APPLE AND NOT WIN32)
message(" Compile Lua : ${HAVE_LUA}")
message(" Compile Smpi : ${enable_smpi}")