4 # Try to make Mac a bit more complient to open source standards
5 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
6 add_definitions("-D_XOPEN_SOURCE")
7 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
9 ###############################
10 # Declare the library content #
11 ###############################
12 # If we want supernovae, rewrite the libs' content to use it
13 include(${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
15 # Actually declare our libraries
17 add_library(simgrid SHARED ${simgrid_sources})
18 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
20 add_library(gras SHARED ${gras_sources})
21 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
24 add_library(simgrid_static STATIC ${simgrid_sources})
25 endif(enable_lib_static)
28 add_library(smpi SHARED ${SMPI_SRC})
29 set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
31 add_library(smpi_static STATIC ${SMPI_SRC})
32 endif(enable_lib_static)
35 add_dependencies(gras maintainer_files)
36 add_dependencies(simgrid maintainer_files)
38 # if supernovaeing, we need some depends to make sure that the source gets generated
39 if (enable_supernovae)
40 add_dependencies(simgrid ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
42 add_dependencies(simgrid_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
43 endif(enable_lib_static)
44 add_dependencies(gras ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c)
47 add_dependencies(smpi ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
49 add_dependencies(smpi_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
50 endif(enable_lib_static)
52 endif(enable_supernovae)
54 # Compute the dependencies of GRAS
55 ##################################
56 set(GRAS_DEP "-lm -lpthread")
58 if(HAVE_POSIX_GETTIME)
59 SET(GRAS_DEP "${GRAS_DEP} -lrt")
60 endif(HAVE_POSIX_GETTIME)
62 # the following is probably unneed since it kills the previous
63 # GRAS_DEP (and is thus probably invalid).
64 # My guess is that pthread is never true [Mt]
65 # FIXME: KILLME if we get a working windows with that?
66 if(with_context MATCHES windows)
70 endif(with_context MATCHES windows)
71 target_link_libraries(gras ${GRAS_DEP})
73 # Compute the dependencies of SimGrid
74 #####################################
75 set(SIMGRID_DEP "-lm")
77 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpcre")
81 if(${CONTEXT_THREADS})
82 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
83 endif(${CONTEXT_THREADS})
88 SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
91 SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt")
92 endif(HAVE_AGRAPH_LIB)
93 endif(HAVE_CGRAPH_LIB)
97 SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
100 if(HAVE_POSIX_GETTIME)
101 SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
102 endif(HAVE_POSIX_GETTIME)
104 target_link_libraries(simgrid ${SIMGRID_DEP})
106 # Compute the dependencies of SMPI
107 ##################################
110 set(SMPI_LDEP "-Wl,-U -Wl,_smpi_simulated_main")
113 target_link_libraries(smpi simgrid ${SMPI_LDEP})
116 # Pass dependencies to static libs
117 ##################################
118 if(enable_lib_static)
119 target_link_libraries(simgrid_static ${SIMGRID_DEP})
120 add_dependencies(simgrid_static maintainer_files)
121 set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid)
123 target_link_libraries(smpi_static simgrid ${SMPI_LDEP})
124 set_target_properties(smpi_static PROPERTIES OUTPUT_NAME smpi)
126 endif(enable_lib_static)