Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix distcheck (dumb me)
[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}/cloud/masterworker)
14 set(cloud_masterworker_sources ${srcdir}/Main.java  ${srcdir}/Master.java ${srcdir}/Worker.java)
15
16 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration)
17 set(cloud_migration_sources    ${srcdir}/Main.java  ${srcdir}/Daemon.java ${srcdir}/Test.java
18                                ${srcdir}/TestHostOnOff.java ${srcdir}/XVM.java)
19
20 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord)
21 set(dht_chord_sources          ${srcdir}/Main.java  ${srcdir}/ChordTask.java  ${srcdir}/Common.java
22                                ${srcdir}/FindSuccessorAnswerTask.java  ${srcdir}/FindSuccessorTask.java
23                                ${srcdir}/GetPredecessorAnswerTask.java ${srcdir}/GetPredecessorTask.java
24                                ${srcdir}/Node.java  ${srcdir}/NotifyTask.java)
25
26 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia)
27 set(dht_kademlia_sources       ${srcdir}/Main.java  ${srcdir}/Answer.java  ${srcdir}/Bucket.java  ${srcdir}/Common.java
28                                ${srcdir}/Contact.java  ${srcdir}/FindNodeAnswerTask.java  ${srcdir}/FindNodeTask.java
29                                ${srcdir}/KademliaTask.java  ${srcdir}/Node.java  ${srcdir}/PingAnswerTask.java
30                                ${srcdir}/PingTask.java  ${srcdir}/RoutingTable.java)
31
32 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/energy/consumption)
33 set(energy_consumption_sources ${srcdir}/Main.java  ${srcdir}/EnergyConsumer.java)
34
35 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/energy/vm)
36 set(energy_vm_sources          ${srcdir}/Main.java  ${srcdir}/EnergyVMRunner.java)
37
38 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/io/file)
39 set(io_file_sources            ${srcdir}/Main.java  ${srcdir}/Node.java)
40
41 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/io/storage)
42 set(io_storage_sources         ${srcdir}/Main.java  ${srcdir}/Client.java)
43
44 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/kill)
45 set(process_kill_sources       ${srcdir}/Main.java  ${srcdir}/Killer.java  ${srcdir}/Victim.java)
46
47 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/migration)
48 set(process_migration_sources  ${srcdir}/Main.java  ${srcdir}/Emigrant.java  ${srcdir}/Policeman.java)
49
50 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime)
51 set(process_startkilltime_sources ${srcdir}/Main.java ${srcdir}/Sleeper.java)
52
53 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
54 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
55
56 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/task/priority)
57 set(task_priority_sources      ${srcdir}/Main.java  ${srcdir}/Test.java)
58
59 foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
60          dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
61          process_startkilltime process_suspend task_priority)
62   string (REPLACE "_" "/" example_dir ${example})
63   if(enable_java)
64     add_custom_command(
65       COMMENT "Building java_${example}..."
66       OUTPUT ${example_dir}/java_${example}_compiled
67       DEPENDS ${example_sources} simgrid-java_jar ${SIMGRID_JAR}
68       COMMAND ${CMAKE_COMMAND} -E make_directory ${example_dir}
69       COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR} ${${example}_sources}
70       COMMAND ${CMAKE_COMMAND} -E remove ${example_dir}/java_${example}_compiled
71       COMMAND ${CMAKE_COMMAND} -E touch ${example_dir}/java_${example}_compiled
72     )
73     add_custom_target(${example} ALL DEPENDS ${example_dir}/java_${example}_compiled)
74   endif()
75   set(examples_src  ${examples_src}  ${${example}_sources})
76   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh)
77 endforeach()
78
79 set(examples_src  ${examples_src}                                                          PARENT_SCOPE)
80 set(tesh_files    ${tesh_files}                                                            PARENT_SCOPE)
81 set(bin_files     ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/generate.py  PARENT_SCOPE)
82 set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README
83                                    ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration/README                      PARENT_SCOPE)
84 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
85                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex/centralizedmutex.xml
86                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
87                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
88                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
89                                    ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml
90                                    ${CMAKE_CURRENT_SOURCE_DIR}/task/priority/priority.xml                  PARENT_SCOPE)
91
92 if(enable_java)
93   foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
94            dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
95            process_startkilltime process_suspend task_priority)
96     string (REPLACE "_" "/" example_dir ${example})
97     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)
98   endforeach()
99 endif()