build: rollback linking to globally searched libraries
This commit is contained in:
@@ -538,7 +538,6 @@ macro(process_options)
|
||||
set(ENABLE_SQLITE True)
|
||||
add_definitions(-DHAVE_SQLITE3)
|
||||
include_directories(${SQLite3_INCLUDE_DIRS})
|
||||
link_libraries(${SQLite3_LIBRARIES})
|
||||
else()
|
||||
message(${HIGHLIGHTED_STATUS} "SQLite was not found")
|
||||
endif()
|
||||
@@ -638,11 +637,7 @@ macro(process_options)
|
||||
)
|
||||
else()
|
||||
message(STATUS "GTK3 was found.")
|
||||
if(${GCC})
|
||||
add_definitions(-Wno-parentheses)
|
||||
endif()
|
||||
include_directories(${GTK3_INCLUDE_DIRS} ${HarfBuzz_INCLUDE_DIRS})
|
||||
link_libraries(${GTK3_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -669,7 +664,6 @@ macro(process_options)
|
||||
message(STATUS "LibXML2 was found.")
|
||||
add_definitions(-DHAVE_LIBXML2)
|
||||
include_directories(${LIBXML2_INCLUDE_DIR})
|
||||
link_libraries(${LIBXML2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# LibRT
|
||||
@@ -688,7 +682,6 @@ macro(process_options)
|
||||
message(STATUS "LibRT was found.")
|
||||
set(ENABLE_REALTIME TRUE)
|
||||
set(HAVE_RT TRUE) # for core-config.h
|
||||
link_libraries(${LIBRT_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -747,7 +740,6 @@ macro(process_options)
|
||||
endif()
|
||||
endif()
|
||||
include_directories(${Python3_INCLUDE_DIRS})
|
||||
link_libraries(${Python3_LIBRARIES})
|
||||
else()
|
||||
message(${HIGHLIGHTED_STATUS}
|
||||
"Python: development libraries were not found"
|
||||
@@ -877,7 +869,6 @@ macro(process_options)
|
||||
message(STATUS "MPI was found.")
|
||||
add_definitions(-DNS3_MPI)
|
||||
include_directories(${MPI_CXX_INCLUDE_DIRS})
|
||||
link_libraries(${MPI_CXX_LIBRARIES})
|
||||
set(ENABLE_MPI TRUE)
|
||||
endif()
|
||||
endif()
|
||||
@@ -907,7 +898,6 @@ macro(process_options)
|
||||
message(STATUS "GSL was found.")
|
||||
add_definitions(-DHAVE_GSL)
|
||||
include_directories(${GSL_INCLUDE_DIRS})
|
||||
link_libraries(${GSL_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -2096,7 +2086,6 @@ endfunction()
|
||||
function(get_target_includes target output)
|
||||
set(include_directories)
|
||||
get_target_property(include_dirs ${target} INCLUDE_DIRECTORIES)
|
||||
list(REMOVE_DUPLICATES include_dirs)
|
||||
foreach(include_dir ${include_dirs})
|
||||
if(include_dir MATCHES "<")
|
||||
# Skip CMake build and install interface includes
|
||||
|
||||
@@ -94,7 +94,7 @@ int main (int argc, char *argv[]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SQLITE3
|
||||
#ifndef STATS_HAS_SQLITE3
|
||||
if (format == "db") {
|
||||
NS_LOG_ERROR ("sqlite support not compiled in.");
|
||||
return -1;
|
||||
@@ -300,7 +300,7 @@ int main (int argc, char *argv[]) {
|
||||
NS_LOG_INFO ("Creating omnet formatted data output.");
|
||||
output = CreateObject<OmnetDataOutput>();
|
||||
} else if (format == "db") {
|
||||
#ifdef HAVE_SQLITE3
|
||||
#ifdef STATS_HAS_SQLITE3
|
||||
NS_LOG_INFO ("Creating sqlite formatted data output.");
|
||||
output = CreateObject<SqliteDataOutput>();
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,10 @@ foreach(libname ${libs})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Prevents link errors due to symbol collisions if the same library is linked
|
||||
# multiple times
|
||||
list(REMOVE_DUPLICATES ns3-external-libs)
|
||||
|
||||
# Build the lib-ns3-static (ns3.x-static-buildtype.a/.lib) with all sublibraries
|
||||
if(${NS3_STATIC})
|
||||
add_library(
|
||||
@@ -48,6 +52,11 @@ if(${NS3_STATIC})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Required by some static libraries, such as sqlite, for some odd reason
|
||||
if(LINUX)
|
||||
list(APPEND ns3-external-static-libs -ldl)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${lib-ns3-static}
|
||||
-static
|
||||
|
||||
@@ -20,5 +20,6 @@ if(${ENABLE_MPI})
|
||||
${libnix-vector-routing}
|
||||
${libapplications}
|
||||
${libmpi}
|
||||
${MPI_CXX_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -9,12 +9,21 @@ if(${GTK3_FOUND})
|
||||
set(gtk3_headers
|
||||
model/gtk-config-store.h
|
||||
)
|
||||
set(gtk_libraries
|
||||
${GTK3_LIBRARIES}
|
||||
)
|
||||
if(${GCC})
|
||||
add_definitions(-Wno-parentheses)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${LIBXML2_FOUND})
|
||||
set(xml2_sources
|
||||
model/xml-config.cc
|
||||
)
|
||||
set(xml2_libraries
|
||||
${LIBXML2_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
build_lib(
|
||||
@@ -31,6 +40,9 @@ build_lib(
|
||||
${gtk3_headers}
|
||||
model/file-config.h
|
||||
model/config-store.h
|
||||
LIBRARIES_TO_LINK ${libcore}
|
||||
${libnetwork}
|
||||
LIBRARIES_TO_LINK
|
||||
${libcore}
|
||||
${libnetwork}
|
||||
${xml2_libraries}
|
||||
${gtk_libraries}
|
||||
)
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
# Set lib core link dependencies
|
||||
set(libraries_to_link)
|
||||
set(libraries_to_link
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
set(gsl_test_sources)
|
||||
if(${GSL_FOUND})
|
||||
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
|
||||
@@ -69,6 +75,10 @@ if(${ENABLE_REALTIME})
|
||||
model/realtime-simulator-impl.h
|
||||
model/wall-clock-synchronizer.h
|
||||
)
|
||||
set(libraries_to_link
|
||||
${libraries_to_link}
|
||||
${LIBRT}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(osclock_sources
|
||||
|
||||
@@ -47,6 +47,7 @@ if(${ENABLE_REALTIME})
|
||||
NAME main-test-sync
|
||||
SOURCE_FILES main-test-sync.cc
|
||||
LIBRARIES_TO_LINK ${libnetwork}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ build_lib(
|
||||
model/mpi-interface.h
|
||||
model/mpi-receiver.h
|
||||
model/parallel-communication-interface.h
|
||||
LIBRARIES_TO_LINK ${libcore}
|
||||
${libnetwork}
|
||||
LIBRARIES_TO_LINK
|
||||
${libcore}
|
||||
${libnetwork}
|
||||
${MPI_CXX_LIBRARIES}
|
||||
TEST_SOURCES ${example_as_test_suite}
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
link_libraries(${MPI_CXX_LIBRARIES})
|
||||
|
||||
set(base_examples
|
||||
simple-distributed
|
||||
simple-distributed-mpi-comm
|
||||
|
||||
@@ -11,6 +11,7 @@ if(${ENABLE_MPI})
|
||||
)
|
||||
set(mpi_libraries
|
||||
${libmpi}
|
||||
${MPI_CXX_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
set(sqlite_sources)
|
||||
set(sqlite_header)
|
||||
set(sqlite_libraries)
|
||||
if(${ENABLE_SQLITE})
|
||||
set(sqlite_sources
|
||||
model/sqlite-data-output.cc
|
||||
@@ -9,6 +10,9 @@ if(${ENABLE_SQLITE})
|
||||
model/sqlite-data-output.h
|
||||
model/sqlite-output.h
|
||||
)
|
||||
set(sqlite_libraries
|
||||
${SQLite3_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(source_files
|
||||
@@ -69,6 +73,7 @@ build_lib(
|
||||
SOURCE_FILES ${source_files}
|
||||
HEADER_FILES ${header_files}
|
||||
LIBRARIES_TO_LINK ${libcore}
|
||||
${sqlite_libraries}
|
||||
TEST_SOURCES
|
||||
test/average-test-suite.cc
|
||||
test/basic-data-calculators-test-suite.cc
|
||||
|
||||
@@ -4,6 +4,7 @@ build_lib(
|
||||
model/visual-simulator-impl.cc
|
||||
HEADER_FILES model/pyviz.h
|
||||
LIBRARIES_TO_LINK
|
||||
${Python3_LIBRARIES}
|
||||
${libcore}
|
||||
${libinternet}
|
||||
${libwifi}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
set(gsl_libraries)
|
||||
if(${GSL_FOUND})
|
||||
set(gsl_libraries
|
||||
${GSL_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(source_files
|
||||
helper/athstats-helper.cc
|
||||
helper/spectrum-wifi-helper.cc
|
||||
@@ -283,6 +290,7 @@ build_lib(
|
||||
${libspectrum}
|
||||
${libantenna}
|
||||
${libmobility}
|
||||
${gsl_libraries}
|
||||
TEST_SOURCES
|
||||
test/block-ack-test-suite.cc
|
||||
test/channel-access-manager-test.cc
|
||||
|
||||
@@ -1679,6 +1679,27 @@ class NS3BuildBaseTestCase(NS3BaseTestCase):
|
||||
# Remove second
|
||||
os.remove("./scratch/second.cc")
|
||||
|
||||
NS3BuildBaseTestCase.cleaned_once = False
|
||||
|
||||
def test_12_StaticBuilds(self):
|
||||
"""!
|
||||
Test if we can build a static ns-3 library and link it to static programs
|
||||
@return None
|
||||
"""
|
||||
# First enable examples and static build
|
||||
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\" --enable-examples --disable-gtk --enable-static")
|
||||
|
||||
# If configuration passes, we are half way done
|
||||
self.assertEqual(return_code, 0)
|
||||
|
||||
# Then try to build one example
|
||||
return_code, stdout, stderr = run_ns3('build sample-simulator')
|
||||
self.assertEqual(return_code, 0)
|
||||
self.assertIn("Built target", stdout)
|
||||
|
||||
# Maybe check the built binary for shared library references? Using objdump, otool, etc
|
||||
NS3BuildBaseTestCase.cleaned_once = False
|
||||
|
||||
|
||||
class NS3ExpectedUseTestCase(NS3BaseTestCase):
|
||||
"""!
|
||||
|
||||
Reference in New Issue
Block a user