From: Augustin Degomme Date: Thu, 21 Apr 2022 11:08:40 +0000 (+0200) Subject: ns3: allow use of -dev version from manually compiled one. X-Git-Tag: v3.32~316 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/82de7fcabd2f6b13f202f6cb8094f3a449dc975b ns3: allow use of -dev version from manually compiled one. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dce9a7cfb..41c59b6e91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,7 +227,7 @@ set(SIMGRID_HAVE_NS3 0) if(enable_ns3) include(FindNS3) if (SIMGRID_HAVE_NS3) - if (NS3_VERSION VERSION_LESS "3.28") + if (NOT NS3_VERSION EQUAL "3-dev" AND NS3_VERSION VERSION_LESS "3.28") message(FATAL_ERROR "SimGrid needs at least ns-3.28. Please upgrade or disable that cmake option.") endif() set(SIMGRID_HAVE_NS3 1) diff --git a/tools/cmake/Modules/FindNS3.cmake b/tools/cmake/Modules/FindNS3.cmake index 9929e627f5..89b77985da 100644 --- a/tools/cmake/Modules/FindNS3.cmake +++ b/tools/cmake/Modules/FindNS3.cmake @@ -19,10 +19,10 @@ set(SIMGRID_HAVE_NS3 0) set(NS3_HINT ${ns3_path} CACHE PATH "Path to search for NS3 lib and include") -set(NS3_KNOWN_VERSIONS "3.22" "3.23" "3.24" "3.25" "3.26" "3.27" "3.28" "3.29" "3.30" "3.31" "3.32" "3.33" "3.34" "3.35" "3.36" "3.37" "3.38" "3.39" "3.40") +set(NS3_KNOWN_VERSIONS "3-dev" "3.22" "3.23" "3.24" "3.25" "3.26" "3.27" "3.28" "3.29" "3.30" "3.31" "3.32" "3.33" "3.34" "3.35" "3.36" "3.37" "3.38" "3.39" "3.40") foreach (_ns3_ver ${NS3_KNOWN_VERSIONS}) - list(APPEND _ns3_LIB_SEARCH_DIRS "ns${_ns3_ver}-core" "ns${_ns3_ver}-core-optimized" "ns${_ns3_ver}-core-debug") + list(APPEND _ns3_LIB_SEARCH_DIRS "ns${_ns3_ver}-core" "ns${_ns3_ver}-core-optimized" "ns${_ns3_ver}-core-debug" "ns${_ns3_ver}-core-default") list(APPEND _ns3_INCLUDE_SEARCH_DIRS "include/ns${_ns3_ver}") endforeach() @@ -64,12 +64,17 @@ if(NS3_INCLUDE_DIR) set (NS3_SUFFIX "-optimized") elseif(NS3_LIBRARIES MATCHES "-debug") set (NS3_SUFFIX "-debug") + elseif(NS3_LIBRARIES MATCHES "-default") + set (NS3_SUFFIX "-default") else() set (NS3_SUFFIX "") endif() - - string(REGEX REPLACE ".*ns([.0-9]+)-core.*" "\\1" NS3_VERSION "${NS3_LIBRARIES}") - string(REGEX REPLACE "3.([.0-9]+)" "\\1" NS3_MINOR_VERSION "${NS3_VERSION}") + message(STATUS "ns-3 found ${NS3_LIBRARIES}") + string(REGEX REPLACE ".*libns(.*)-core.*" "\\1" NS3_VERSION "${NS3_LIBRARIES}") + string(REGEX REPLACE "3.([.0-9\-a-z]+)" "\\1" NS3_MINOR_VERSION "${NS3_VERSION}") + if(NS3_MINOR_VERSION MATCHES "dev") + set(NS3_MINOR_VERSION "99") + endif() get_filename_component(NS3_LIBRARY_PATH "${NS3_LIBRARIES}" PATH) # Compute NS3_PATH