3 ###############################
4 # Declare the library content #
5 ###############################
6 # If we want supernovae, rewrite the libs' content to use it
7 include(${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
9 # Actually declare our libraries
11 add_library(simgrid SHARED ${simgrid_sources})
12 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
15 add_library(simgrid_static STATIC ${simgrid_sources})
19 add_library(smpi SHARED ${SMPI_SRC})
20 set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
22 add_library(smpi_static STATIC ${SMPI_SRC})
26 add_dependencies(simgrid maintainer_files)
28 # if supernovaeing, we need some depends to make sure that the source gets generated
29 if (enable_supernovae)
30 add_dependencies(simgrid ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
32 add_dependencies(simgrid_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
36 add_dependencies(smpi ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
38 add_dependencies(smpi_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
43 # Compute the dependencies of SimGrid
44 #####################################
45 set(SIMGRID_DEP "-lm -lpcre")
48 if(${CONTEXT_THREADS})
49 SET(SIMGRID_DEP "${SIMGRID_DEP} -pthread")
54 ADD_CUSTOM_TARGET(link_simgrid_lua ALL
56 ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
57 ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
58 ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
61 OUTPUT ${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}
64 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
65 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/lua/
66 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE} #for test
68 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
69 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/msg/masterslave/
70 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE} #for test
72 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
73 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/simdag/
74 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE} #for test
76 SET(SIMGRID_DEP "${SIMGRID_DEP} -l${LIB_LUA_NAME}")
81 SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
84 SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt")
90 SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
94 # The availability of libunwind was checked in CompleteInFiles.cmake
95 # (that includes FindLibunwind.cmake), so simply load it now.
97 # This supposes that the host machine is either an AMD or a X86.
98 # This is deeply wrong, and should be fixed by manually loading -lunwind-PLAT (FIXME)
100 SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86_64")
102 SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86")
107 if(${NS3_VERSION} EQUAL 310)
108 SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3")
109 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_NS3_3_10")
110 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_NS3_3_10")
112 SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3-core -lns3-csma -lns3-point-to-point -lns3-internet -lns3-applications")
116 if(HAVE_POSIX_GETTIME)
117 SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
120 target_link_libraries(simgrid ${SIMGRID_DEP})
122 # Compute the dependencies of SMPI
123 ##################################
126 set(SMPI_DEP "-Wl,-U -Wl,_smpi_simulated_main")
129 target_link_libraries(smpi simgrid ${SMPI_DEP})
132 # Pass dependencies to static libs
133 ##################################
134 if(enable_lib_static)
135 target_link_libraries(simgrid_static ${SIMGRID_DEP})
136 add_dependencies(simgrid_static maintainer_files)
137 set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid)
139 target_link_libraries(smpi_static simgrid ${SMPI_DEP})
140 set_target_properties(smpi_static PROPERTIES OUTPUT_NAME smpi)
144 # Dependencies from maintainer mode
145 ###################################
146 if(enable_maintainer_mode AND BISON_EXE AND LEX_EXE)
147 add_dependencies(simgrid automaton_generated_src)