3 ###############################
4 # Declare the library content #
5 ###############################
6 # Actually declare our libraries
8 add_library(simgrid SHARED ${simgrid_sources})
9 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
11 add_library(gras SHARED ${gras_sources})
12 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
15 add_library(simgrid_static STATIC ${simgrid_sources})
16 endif(enable_lib_static)
19 add_library(smpi SHARED ${SMPI_SRC})
20 set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
22 add_library(smpi_static STATIC ${SMPI_SRC})
23 endif(enable_lib_static)
26 add_dependencies(gras maintainer_files)
27 add_dependencies(simgrid maintainer_files)
29 # Compute the dependencies of GRAS
30 ##################################
31 set(GRAS_DEP "-lm -lpthread")
33 if(HAVE_POSIX_GETTIME)
34 SET(GRAS_DEP "${GRAS_DEP} -lrt")
35 endif(HAVE_POSIX_GETTIME)
37 # the following is probably unneed since it kills the previous
38 # GRAS_DEP (and is thus probably invalid).
39 # My guess is that pthread is never true [Mt]
40 # FIXME: KILLME if we get a working windows with that?
41 if(with_context MATCHES windows)
45 endif(with_context MATCHES windows)
46 target_link_libraries(gras ${GRAS_DEP})
48 # Compute the dependencies of SimGrid
49 #####################################
50 set(SIMGRID_DEP "-lm -lpcre")
53 if(${CONTEXT_THREADS})
54 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
55 endif(${CONTEXT_THREADS})
59 ADD_CUSTOM_TARGET(link_simgrid_lua ALL
61 ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
62 ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
63 ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
66 OUTPUT ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
67 ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
68 ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
69 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
70 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/lua/
71 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE} #for test
73 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
74 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/msg/masterslave/
75 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE} #for test
77 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
78 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/simdag/
79 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE} #for test
81 SET(SIMGRID_DEP "${SIMGRID_DEP} -l${LIB_LUA_NAME}")
86 SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
89 SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt")
90 endif(HAVE_AGRAPH_LIB)
91 endif(HAVE_CGRAPH_LIB)
95 SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
99 if(${NS3_VERSION} EQUAL 310)
100 SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3")
101 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_NS3_3_10")
102 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_NS3_3_10")
103 else(${NS3_VERSION} EQUAL 310)
104 SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3-core -lns3-csma -lns3-point-to-point -lns3-internet -lns3-applications")
105 endif(${NS3_VERSION} EQUAL 310)
108 if(HAVE_POSIX_GETTIME)
109 SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
110 endif(HAVE_POSIX_GETTIME)
112 target_link_libraries(simgrid ${SIMGRID_DEP})
114 # Compute the dependencies of SMPI
115 ##################################
118 set(SMPI_LDEP "-Wl,-U -Wl,_smpi_simulated_main")
121 target_link_libraries(smpi simgrid ${SMPI_LDEP})
124 # Pass dependencies to static libs
125 ##################################
126 if(enable_lib_static)
127 target_link_libraries(simgrid_static ${SIMGRID_DEP})
128 add_dependencies(simgrid_static maintainer_files)
129 set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid)
131 target_link_libraries(smpi_static simgrid ${SMPI_LDEP})
132 set_target_properties(smpi_static PROPERTIES OUTPUT_NAME smpi)
134 endif(enable_lib_static)