Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java does not like uppercased packages
[simgrid.git] / examples / java / CMakeLists.txt
1 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent)
2 set(app_bittorrent_sources    ${srcdir}/Main.java  ${srcdir}/Common.java  ${srcdir}/Connection.java
3                               ${srcdir}/MessageTask.java ${srcdir}/Peer.java  ${srcdir}/Tracker.java
4                               ${srcdir}/TrackerTask.java)
5
6 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex)
7 set(app_centralizedmutex_sources  ${srcdir}/Main.java  ${srcdir}/Coordinator.java  ${srcdir}/GrantTask.java
8                               ${srcdir}/Node.java ${srcdir}/ReleaseTask.java  ${srcdir}/RequestTask.java)
9
10 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker)
11 set(app_masterworker_sources   ${srcdir}/Main.java  ${srcdir}/Master.java ${srcdir}/Worker.java) 
12
13 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/pingpong)
14 set(app_pingpong_sources       ${srcdir}/Main.java  ${srcdir}/PingPongTask.java ${srcdir}/Receiver.java 
15                                ${srcdir}/Sender.java) 
16
17 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/tokenring)
18 set(app_tokenring_sources      ${srcdir}/Main.java ${srcdir}/RelayRunner.java)
19
20 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/async/waitall)
21 set(async_waitall_sources      ${srcdir}/Main.java  ${srcdir}/Receiver.java ${srcdir}/Sender.java)
22
23 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/async/dsend)
24 set(async_dsend_sources        ${srcdir}/Main.java  ${srcdir}/Receiver.java ${srcdir}/Sender.java)
25
26 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/cloud/masterworker)
27 set(cloud_masterworker_sources ${srcdir}/Main.java  ${srcdir}/Master.java ${srcdir}/Worker.java)
28
29 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration)
30 set(cloud_migration_sources    ${srcdir}/Main.java  ${srcdir}/Daemon.java ${srcdir}/Test.java
31                                ${srcdir}/TestHostOnOff.java ${srcdir}/XVM.java)
32
33 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord)
34 set(dht_chord_sources          ${srcdir}/Main.java  ${srcdir}/ChordTask.java  ${srcdir}/Common.java
35                                ${srcdir}/FindSuccessorAnswerTask.java  ${srcdir}/FindSuccessorTask.java
36                                ${srcdir}/GetPredecessorAnswerTask.java ${srcdir}/GetPredecessorTask.java
37                                ${srcdir}/Node.java  ${srcdir}/NotifyTask.java)
38
39 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia)
40 set(dht_kademlia_sources       ${srcdir}/Main.java  ${srcdir}/Answer.java  ${srcdir}/Bucket.java  ${srcdir}/Common.java
41                                ${srcdir}/Contact.java  ${srcdir}/FindNodeAnswerTask.java  ${srcdir}/FindNodeTask.java
42                                ${srcdir}/KademliaTask.java  ${srcdir}/Node.java  ${srcdir}/PingAnswerTask.java
43                                ${srcdir}/PingTask.java  ${srcdir}/RoutingTable.java)
44
45 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/trace/pingpong)
46 set(trace_pingpong_sources     ${srcdir}/Main.java  ${srcdir}/PingPongTask.java ${srcdir}/Receiver.java 
47                                ${srcdir}/Sender.java) 
48
49 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/energy/consumption)
50 set(energy_consumption_sources ${srcdir}/Main.java  ${srcdir}/EnergyConsumer.java)
51
52 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/energy/vm)
53 set(energy_vm_sources          ${srcdir}/Main.java  ${srcdir}/EnergyVMRunner.java)
54
55 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/io/file)
56 set(io_file_sources            ${srcdir}/Main.java  ${srcdir}/Node.java)
57
58 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/io/storage)
59 set(io_storage_sources         ${srcdir}/Main.java  ${srcdir}/Client.java)
60
61 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/kill)
62 set(process_kill_sources       ${srcdir}/Main.java  ${srcdir}/Killer.java  ${srcdir}/Victim.java)
63
64 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/migration)
65 set(process_migration_sources  ${srcdir}/Main.java  ${srcdir}/Emigrant.java  ${srcdir}/Policeman.java)
66
67 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime)
68 set(process_startkilltime_sources ${srcdir}/Main.java ${srcdir}/Sleeper.java)
69
70 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
71 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
72
73 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/task/priority)
74 set(task_priority_sources      ${srcdir}/Main.java  ${srcdir}/Test.java)
75
76 foreach (example app_bittorrent app_centralizedmutex app_masterworker app_pingpong app_tokenring async_waitall async_dsend
77          cloud_migration cloud_masterworker dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage 
78          process_kill process_migration process_startkilltime process_suspend task_priority trace_pingpong)
79   string (REPLACE "_" "/" example_dir ${example})
80   if(enable_java)
81     add_custom_command(
82       COMMENT "Building java_${example}..."
83       OUTPUT ${example_dir}/java_${example}_compiled
84       DEPENDS ${example_sources} simgrid-java_jar ${SIMGRID_JAR}
85       COMMAND ${CMAKE_COMMAND} -E make_directory ${example_dir}
86       COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR} ${${example}_sources}
87       COMMAND ${CMAKE_COMMAND} -E remove ${example_dir}/java_${example}_compiled
88       COMMAND ${CMAKE_COMMAND} -E touch ${example_dir}/java_${example}_compiled
89     )
90     add_custom_target(${example} ALL DEPENDS ${example_dir}/java_${example}_compiled)
91   endif()
92   set(examples_src  ${examples_src}  ${${example}_sources})
93   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh)
94 endforeach()
95
96 set(examples_src  ${examples_src}                                                                          PARENT_SCOPE)
97 set(tesh_files    ${tesh_files}                                                                            PARENT_SCOPE)
98 set(bin_files     ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/generate.py                  PARENT_SCOPE)
99 set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README
100                                    ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration/README                      PARENT_SCOPE)
101 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
102                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex/centralizedmutex.xml
103                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
104                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
105                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
106                                    ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml
107                                    ${CMAKE_CURRENT_SOURCE_DIR}/task/priority/priority.xml                  PARENT_SCOPE)
108
109 if(enable_java)
110   foreach (example app_bittorrent app_centralizedmutex app_masterworker app_pingpong app_tokenring async_waitall async_dsend
111            cloud_migration cloud_masterworker dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage 
112            process_kill process_migration process_startkilltime process_suspend task_priority trace_pingpong)
113     string (REPLACE "_" "/" example_dir ${example})
114     ADD_TESH(java-${example}  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
115   endforeach()
116 endif()