Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Java tests pass.
[simgrid.git] / buildtools / CPACK / src / CMakeMakeExeLib.txt
1 ### Make Libs
2
3 if(supernovae)
4         include(${PROJECT_DIRECTORY}/CPACK/src/CMakeSupernovae.txt)
5 else(supernovae)        
6         add_library(simgrid SHARED ${simgrid_sources})
7         add_library(gras SHARED ${gras_sources})
8         add_library(smpi STATIC ${SMPI_SRC})
9 endif(supernovae)
10
11 set(GRAS_DEP "pthread")
12 set(SIMGRID_DEP "ruby1.8")
13 set(SMPI_DEP "")
14
15
16 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
17         add_definitions("-D_XOPEN_SOURCE")
18 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
19
20
21 if(pthread)
22         if(with_context MATCHES pthread)
23                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
24         endif(with_context MATCHES pthread)
25         
26         if(with_context MATCHES windows)
27                 SET(GRAS_DEP "msg")
28         endif(with_context MATCHES windows)
29 endif(pthread)
30
31 if(HAVE_LUA)
32         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -llua5.1")
33 endif(HAVE_LUA)
34
35 if(HAVE_RUBY_H)
36 add_library(simgrid_ruby STATIC ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid_ruby.c)
37 set(RUBY_DEP "-lm -module")
38 target_link_libraries(simgrid_ruby      simgrid ${RUBY_DEP} -fprofile-arcs)
39 endif(HAVE_RUBY_H)
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 " "" SIMGRID_DEP ${SIMGRID_DEP})
47 endif(NOT HAVE_RUBY_H)
48
49 target_link_libraries(simgrid   ${SIMGRID_DEP} -fprofile-arcs)
50 target_link_libraries(gras      ${GRAS_DEP} -fprofile-arcs)
51 target_link_libraries(smpi      simgrid ${SMPI_DEP} -fprofile-arcs)
52
53 ### Make EXEs
54
55 #tools
56 #tools/gras
57 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
58
59 if(NOT init)
60         #tools/tesh
61         add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
62
63         #testsuite/xbt
64         add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
65
66         #testsuite/surf
67         add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
68
69         #testsuite/simdag
70         add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
71
72         #teshsuite
73         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
74         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
75         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
76         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
77         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
78         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
79         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
80         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
81         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
82         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
83         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
84         add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
85
86         #examples
87         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
88         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
89         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
90         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
91         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
92         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
93         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
94         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
95         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
96         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
97         add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
98
99         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
100         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
101         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
102         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
103         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
104         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
105         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
106         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
107         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
108         if(HAVE_GTNETS)
109                 add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
110                 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
111         endif(HAVE_GTNETS)
112
113         add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
114         add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
115
116         add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
117         add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
118         add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
119         add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
120         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
121
122         if(HAVE_JAVA)
123                 message("Make : src/simgrid.jar with : ${JAVA_COMPILE}")
124                 exec_program("rm -rf ${PROJECT_DIRECTORY}/src/.classes" OUTPUT_VARIABLE "SIM_JAR_OK")
125                 exec_program("rm ${PROJECT_DIRECTORY}/src/simgrid.jar" OUTPUT_VARIABLE "SIM_JAR_OK")
126                 exec_program("mkdir ${PROJECT_DIRECTORY}/src/.classes" OUTPUT_VARIABLE "SIM_JAR_OK")
127                 exec_program("${JAVA_COMPILE}" ARGS "-d ${PROJECT_DIRECTORY}/src/.classes -cp ${PROJECT_DIRECTORY}/src/.classes ${PROJECT_DIRECTORY}/src/java/simgrid/msg/*.java" OUTPUT_VARIABLE "SIM_JAR_OK")
128                 exec_program("mkdir ${PROJECT_DIRECTORY}/src/.classes/surf" OUTPUT_VARIABLE "SIM_JAR_OK")
129                 exec_program("cp ${PROJECT_DIRECTORY}/src/surf/simgrid.dtd ${PROJECT_DIRECTORY}/src/.classes/surf/simgrid.dtd" OUTPUT_VARIABLE "SIM_JAR_OK")
130                 exec_program("${JAVA_ARCHIVE}" ARGS "cvf ./src/simgrid.jar -C ${PROJECT_DIRECTORY}/src/.classes ." OUTPUT_VARIABLE "SIM_JAR_OK")
131
132                 message("Make examples/java with : ${JAVA_COMPILE}")
133                 exec_program("rm ${PROJECT_DIRECTORY}/examples/java/basic/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
134                 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")
135                 exec_program("rm ${PROJECT_DIRECTORY}/examples/java/ping_pong/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
136                 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")
137                 exec_program("rm ${PROJECT_DIRECTORY}/examples/java/comm_time/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
138                 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")
139                 exec_program("rm ${PROJECT_DIRECTORY}/examples/java/suspend/*.class" OUTPUT_VARIABLE "SIM_JAR_OK")
140                 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")
141
142         endif(HAVE_JAVA)
143
144 endif(NOT init)