Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add context ucontext for windows.
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
1 ### Make Libs
2
3 if(enable_supernovae AND NOT WIN32)
4         include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
5 else(enable_supernovae AND NOT WIN32)   
6         add_library(simgrid SHARED ${simgrid_sources})
7         add_library(simgrid_static STATIC ${simgrid_sources})
8         add_library(gras SHARED ${gras_sources})
9         if(enable_smpi)
10                 add_library(smpi SHARED ${SMPI_SRC})
11         endif(enable_smpi)
12 endif(enable_supernovae AND NOT WIN32)
13
14 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
15 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
16 if(enable_smpi)
17         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
18 endif(enable_smpi)
19
20
21 set(GRAS_DEP "-lm -lpthread")
22 set(SIMGRID_DEP "-lm")
23 set(SMPI_DEP "")
24
25 if(WIN32)
26         set(GRAS_DEP "wsock32")
27         set(SIMGRID_DEP "wsock32")
28 endif(WIN32)
29
30 if(HAVE_RUBY)
31         set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
32         exec_program("${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so" "${PROJECT_DIRECTORY}"  OUTPUT_VARIABLE LIEN_OK)
33 endif(HAVE_RUBY)
34
35 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
36         add_definitions("-D_XOPEN_SOURCE")
37 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
38
39
40 if(pthread)
41         if(with_context MATCHES pthread)
42                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
43         endif(with_context MATCHES pthread)
44         
45         if(with_context MATCHES windows)
46                 SET(GRAS_DEP "msg")
47         endif(with_context MATCHES windows)
48 endif(pthread)
49
50 if(HAVE_LUA)
51         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")
52         exec_program("${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so" "${PROJECT_DIRECTORY}"  OUTPUT_VARIABLE LIEN_OK)
53 endif(HAVE_LUA)
54
55 if(HAVE_GTNETS)
56         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
57 endif(HAVE_GTNETS)
58
59 if(HAVE_POSIX_GETTIME)
60         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
61         SET(GRAS_DEP "${GRAS_DEP} -lrt")
62 endif(HAVE_POSIX_GETTIME)
63
64 target_link_libraries(simgrid   ${SIMGRID_DEP})
65 target_link_libraries(simgrid_static    ${SIMGRID_DEP})
66 target_link_libraries(gras      ${GRAS_DEP})
67 if(enable_smpi)
68         target_link_libraries(smpi      simgrid ${SMPI_DEP})
69 endif(enable_smpi)
70
71
72 ### Make EXEs
73
74 #src/testall
75 add_subdirectory(${PROJECT_DIRECTORY}/src)
76
77 #tools/gras
78 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
79
80 #tools/tesh
81 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
82
83 #testsuite/xbt
84 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
85
86 #testsuite/surf
87 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
88
89 #testsuite/simdag
90 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
91
92 #teshsuite
93 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
94 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
95 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
96 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
97 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
98 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
99 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
100 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
101 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
102 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
103 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
104 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
105
106 #examples
107 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
108 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
109 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
110 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
111 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
112 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
113 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
114 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
115 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
116 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
117 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
118
119 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
120 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
121 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
122 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
123 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
124 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
125 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
126 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
127 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
128 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
129
130 if(HAVE_MC)
131         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
132 endif(HAVE_MC)
133
134 if(HAVE_GTNETS)
135         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
136         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
137 endif(HAVE_GTNETS)
138
139 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
140 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
141
142 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
143 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
144 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
145 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
146 if(enable_smpi)
147         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
148 endif(enable_smpi)