3 ###############################
4 # Declare the library content #
5 ###############################
7 # Actually declare our libraries
8 add_library(simgrid SHARED ${simgrid_sources})
9 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
11 add_dependencies(simgrid maintainer_files)
13 if(enable_model-checking)
14 add_executable(simgrid-mc ${MC_SIMGRID_MC_SRC})
15 target_link_libraries(simgrid-mc simgrid)
16 set_target_properties(simgrid-mc
18 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
21 # Compute the dependencies of SimGrid
22 #####################################
23 if (HAVE_BOOST_CONTEXTS)
24 set(SIMGRID_DEP "${SIMGRID_DEP} ${Boost_CONTEXT_LIBRARY}")
27 if(HAVE_PTHREAD AND ${HAVE_THREAD_CONTEXTS} AND NOT APPLE)
28 # Clang on recent Mac OS X is not happy about -pthread.
29 SET(SIMGRID_DEP "${SIMGRID_DEP} -pthread")
33 ADD_CUSTOM_TARGET(link_simgrid_lua ALL
35 ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
36 ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
37 ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
40 OUTPUT ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
41 ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
42 ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
43 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
44 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/lua/
45 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE} #for test
47 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
48 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/msg/masterslave/
49 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE} #for test
51 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
52 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/simdag/
53 COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE} #for test
55 SET(SIMGRID_DEP "${SIMGRID_DEP} ${LUA_LIBRARY} ${DL_LIBRARY}")
59 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpapi")
64 SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
67 SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt")
72 if(HAVE_MC AND HAVE_GNU_LD)
73 SET(SIMGRID_DEP "${SIMGRID_DEP} ${DL_LIBRARY}")
77 SET(SIMGRID_DEP "${SIMGRID_DEP} -lns${NS3_VERSION}-core -lns${NS3_VERSION}-csma -lns${NS3_VERSION}-point-to-point -lns${NS3_VERSION}-internet -lns${NS3_VERSION}-applications")
80 if(HAVE_POSIX_GETTIME)
81 SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
84 if("${CMAKE_SYSTEM}" MATCHES "FreeBSD")
85 set(SIMGRID_DEP "${SIMGRID_DEP} -lprocstat")
88 # Compute the dependencies of SMPI
89 ##################################
90 if(enable_smpi AND APPLE)
91 set(SIMGRID_DEP "${SIMGRID_DEP} -Wl,-U -Wl,_smpi_simulated_main")
94 target_link_libraries(simgrid ${SIMGRID_DEP})
96 # Dependencies from maintainer mode
97 ###################################
98 if(enable_maintainer_mode)
99 add_dependencies(simgrid smpi_generated_headers_call_location_tracing)
101 if(enable_maintainer_mode AND PYTHON_EXE)
102 add_dependencies(simgrid simcalls_generated_src)
104 if(enable_maintainer_mode AND BISON_EXE AND LEX_EXE)
105 add_dependencies(simgrid automaton_generated_src)