Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename lib simgrid_static to libsimgrid.
[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 "ruby1.8")
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 -llua5.1")
39 endif(HAVE_LUA)
40
41 if(HAVE_GTNETS)
42         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
43 endif(HAVE_GTNETS)
44
45 if(NOT HAVE_RUBY_H)
46         string(REPLACE "ruby1.8 -l" "" SIMGRID_DEP ${SIMGRID_DEP})
47         string(REPLACE "ruby1.8" "" SIMGRID_DEP ${SIMGRID_DEP})
48 endif(NOT HAVE_RUBY_H)
49
50 target_link_libraries(simgrid   ${SIMGRID_DEP} -fprofile-arcs)
51 target_link_libraries(simgrid_static    ${SIMGRID_DEP} -fprofile-arcs)
52 target_link_libraries(gras      ${GRAS_DEP} -fprofile-arcs)
53 target_link_libraries(smpi      simgrid ${SMPI_DEP} -fprofile-arcs)
54
55 SET_TARGET_PROPERTIES(simgrid_static PROPERTIES OUTPUT_NAME "simgrid")
56 SET_TARGET_PROPERTIES(simgrid_static PROPERTIES PREFIX "lib")
57
58
59 ### Make EXEs
60
61 #tools
62 #tools/gras
63 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
64
65 #tools/tesh
66 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
67
68 #testsuite/xbt
69 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
70
71 #testsuite/surf
72 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
73
74 #testsuite/simdag
75 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
76
77 #teshsuite
78 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
79 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
80 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
81 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
82 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
83 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
84 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
85 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
86 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
87 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
88 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
89 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
90
91 #examples
92 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
93 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
94 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
95 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
96 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
97 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
98 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
99 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
100 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
101 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
102 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
103
104 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
105 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
106 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
107 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
108 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
109 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
110 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
111 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
112 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
113 if(HAVE_GTNETS)
114         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
115         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
116 endif(HAVE_GTNETS)
117
118 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
119 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
120
121 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
122 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
123 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
124 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
125 add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
126
127 if(HAVE_JAVA)
128         message("Make : src/simgrid.jar with : ${JAVA_COMPILE}")
129         exec_program("rm -rf ${PROJECT_DIRECTORY}/src/.classes" OUTPUT_VARIABLE "SIM_JAR_OK")
130         exec_program("rm ${PROJECT_DIRECTORY}/src/simgrid.jar" OUTPUT_VARIABLE "SIM_JAR_OK")
131         exec_program("mkdir ${PROJECT_DIRECTORY}/src/.classes" OUTPUT_VARIABLE "SIM_JAR_OK")
132         foreach(file ${JMSG_JAVA_SRC})
133                 set(java_src_to_compile "${java_src_to_compile} ${file}")       
134         endforeach(file ${JMSG_JAVA_SRC})
135         #message("files java : ${java_src_to_compile}")
136         exec_program("${JAVA_COMPILE}" ARGS "-d ${PROJECT_DIRECTORY}/src/.classes -cp ${PROJECT_DIRECTORY}/src/.classes ${java_src_to_compile}" OUTPUT_VARIABLE "SIM_COMPILE_OK")       
137         exec_program("mkdir ${PROJECT_DIRECTORY}/src/.classes/surf" OUTPUT_VARIABLE "SIM_JAR_OK")
138         exec_program("cp ${PROJECT_DIRECTORY}/src/surf/simgrid.dtd ${PROJECT_DIRECTORY}/src/.classes/surf/simgrid.dtd" OUTPUT_VARIABLE "SIM_JAR_OK")
139         exec_program("${JAVA_ARCHIVE}" ARGS "cvf ./src/simgrid.jar -C ${PROJECT_DIRECTORY}/src/.classes ." OUTPUT_VARIABLE "SIM_JAR_OK")
140
141         message("Make examples/java with : ${JAVA_COMPILE}")
142         exec_program("rm ${PROJECT_DIRECTORY}/examples/java/basic/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
143         exec_program("${JAVA_COMPILE}" ARGS "-d ${PROJECT_DIRECTORY}/examples/java/basic -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/basic/*.java"  OUTPUT_VARIABLE "SIM_JAR_OK")
144         exec_program("rm ${PROJECT_DIRECTORY}/examples/java/ping_pong/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
145         exec_program("${JAVA_COMPILE}" ARGS "-d ${PROJECT_DIRECTORY}/examples/java/ping_pong -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/ping_pong/*.java"  OUTPUT_VARIABLE "SIM_JAR_OK")
146         exec_program("rm ${PROJECT_DIRECTORY}/examples/java/comm_time/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
147         exec_program("${JAVA_COMPILE}" ARGS "-d ${PROJECT_DIRECTORY}/examples/java/comm_time -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/comm_time/*.java"  OUTPUT_VARIABLE "SIM_JAR_OK")
148         exec_program("rm ${PROJECT_DIRECTORY}/examples/java/suspend/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
149         exec_program("${JAVA_COMPILE}" ARGS "-d ${PROJECT_DIRECTORY}/examples/java/suspend -cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${PROJECT_DIRECTORY}/examples/java/suspend/*.java"  OUTPUT_VARIABLE "SIM_JAR_OK")
150
151 endif(HAVE_JAVA)