Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Huge import with Lucas tracing modifications.
[simgrid.git] / buildtools / Cmake / src / CMakeMakeExeLib.txt
1 ### Make Libs
2
3 if(supernovae)
4         include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeSupernovae.txt)
5 else(supernovae)        
6         add_library(simgrid SHARED ${simgrid_sources})
7         add_library(simgrid_static STATIC ${simgrid_sources})
8         add_library(gras SHARED ${gras_sources})
9         add_library(smpi STATIC ${SMPI_SRC})
10 endif(supernovae)
11
12 set(GRAS_DEP "pthread")
13 set(SIMGRID_DEP ${libruby})
14 set(SMPI_DEP "")
15
16 if(HAVE_RUBY_H)
17         add_library(simgrid_ruby STATIC ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid_ruby.c)
18         set(RUBY_DEP "-lm -module")
19         target_link_libraries(simgrid_ruby      simgrid ${RUBY_DEP} -fprofile-arcs)
20 endif(HAVE_RUBY_H)
21
22 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
23         add_definitions("-D_XOPEN_SOURCE")
24 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
25
26
27 if(pthread)
28         if(with_context MATCHES pthread)
29                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
30         endif(with_context MATCHES pthread)
31         
32         if(with_context MATCHES windows)
33                 SET(GRAS_DEP "msg")
34         endif(with_context MATCHES windows)
35 endif(pthread)
36
37 if(HAVE_LUA)
38         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")
39 endif(HAVE_LUA)
40
41 if(HAVE_GTNETS)
42         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
43 endif(HAVE_GTNETS)
44
45 if(HAVE_POSIX_GETTIME)
46         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
47         SET(GRAS_DEP "${GRAS_DEP} -lrt")
48 endif(HAVE_POSIX_GETTIME)
49
50 if(NOT HAVE_RUBY_H)
51         string(REPLACE "${libruby} -l" "" SIMGRID_DEP ${SIMGRID_DEP})
52         string(REPLACE "${libruby}" "" SIMGRID_DEP ${SIMGRID_DEP})
53 endif(NOT HAVE_RUBY_H)
54
55 target_link_libraries(simgrid   ${SIMGRID_DEP} -fprofile-arcs)
56 target_link_libraries(simgrid_static    ${SIMGRID_DEP} -fprofile-arcs)
57 target_link_libraries(gras      ${GRAS_DEP} -fprofile-arcs)
58 target_link_libraries(smpi      simgrid ${SMPI_DEP} -fprofile-arcs)
59
60 #SET_TARGET_PROPERTIES(simgrid_static PROPERTIES OUTPUT_NAME "simgrid")
61 #SET_TARGET_PROPERTIES(simgrid_static PROPERTIES PREFIX "lib")
62
63
64 ### Make EXEs
65
66 #tools
67 #tools/gras
68 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
69
70 #tools/tesh
71 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
72
73 #testsuite/xbt
74 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
75
76 #testsuite/surf
77 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
78
79 #testsuite/simdag
80 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
81
82 #teshsuite
83 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
84 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
85 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
86 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
87 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
88 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
89 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
90 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
91 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
92 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
93 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
94 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
95
96 #examples
97 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
98 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
99 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
100 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
101 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
102 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
103 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
104 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
105 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
106 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
107 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
108
109 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
110 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
111 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
112 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
113 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
114 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
115 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
116 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
117 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
118 if(HAVE_GTNETS)
119         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
120         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
121 endif(HAVE_GTNETS)
122
123 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
124 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
125
126 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
127 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
128 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
129 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
131
132 if(HAVE_JAVA)
133
134         add_custom_command(TARGET simgrid
135         POST_BUILD
136         COMMAND echo "[  0%] Building JAR object src/simgrid.jar"
137         COMMAND /bin/sh ${PROJECT_DIRECTORY}/make_simgrid_java.sh
138         COMMAND echo "[100%] Building JAR object src/simgrid.jar"
139         WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
140         )
141
142         foreach(file ${JMSG_JAVA_SRC})
143                 set(java_src_to_compile "${java_src_to_compile} ${file}")       
144         endforeach(file ${JMSG_JAVA_SRC})
145
146 file(WRITE      ${PROJECT_DIRECTORY}/make_simgrid_java.sh 
147 "\#! /bin/sh\n\n")
148
149 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "rm -rf ${PROJECT_DIRECTORY}/src/.classes\n")
150 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "rm ${PROJECT_DIRECTORY}/src/simgrid.jar\n")
151 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "mkdir ${PROJECT_DIRECTORY}/src/.classes\n")
152
153 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
154 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "${JAVA_COMPILE} -d ${PROJECT_DIRECTORY}/src/.classes -cp ${PROJECT_DIRECTORY}/src/.classes ${java_src_to_compile}\n")
155
156 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
157 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "mkdir ${PROJECT_DIRECTORY}/src/.classes/surf\n")
158 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "cp ${PROJECT_DIRECTORY}/src/surf/simgrid.dtd ${PROJECT_DIRECTORY}/src/.classes/surf/simgrid.dtd\n")
159
160 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
161 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "${JAVA_ARCHIVE} cvf ./src/simgrid.jar -C ${PROJECT_DIRECTORY}/src/.classes . &>/dev/null\n")
162
163 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
164 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "echo \"[ 50%] Building JAR object src/simgrid.jar\"\n")
165
166 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
167 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "rm ${PROJECT_DIRECTORY}/examples/java/basic/*.class\n")
168 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "${JAVA_COMPILE} -d ${PROJECT_DIRECTORY}/examples/java/basic -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/basic/*.java\n")
169
170 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
171 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "rm ${PROJECT_DIRECTORY}/examples/java/ping_pong/*.class\n")
172 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "${JAVA_COMPILE} -d ${PROJECT_DIRECTORY}/examples/java/ping_pong -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/ping_pong/*.java\n")
173
174 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "\n")
175 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh  "rm ${PROJECT_DIRECTORY}/examples/java/comm_time/*.class\n")
176 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "${JAVA_COMPILE} -d ${PROJECT_DIRECTORY}/examples/java/comm_time -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/comm_time/*.java\n")
177
178 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "\n")
179 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "rm ${PROJECT_DIRECTORY}/examples/java/suspend/*.class\n")
180 file(APPEND     ${PROJECT_DIRECTORY}/make_simgrid_java.sh "${JAVA_COMPILE} -d ${PROJECT_DIRECTORY}/examples/java/suspend -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/suspend/*.java\n")
181
182 endif(HAVE_JAVA)
183
184