Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
redesign this test to match the C version
[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/masterworker)
7 set(app_masterworker_sources   ${srcdir}/Main.java  ${srcdir}/Master.java ${srcdir}/Worker.java) 
8
9 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord)
10 set(dht_chord_sources          ${srcdir}/Main.java  ${srcdir}/ChordTask.java  ${srcdir}/Common.java
11                                ${srcdir}/FindSuccessorAnswerTask.java  ${srcdir}/FindSuccessorTask.java
12                                ${srcdir}/GetPredecessorAnswerTask.java ${srcdir}/GetPredecessorTask.java
13                                ${srcdir}/Node.java  ${srcdir}/NotifyTask.java)
14
15 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia)
16 set(dht_kademlia_sources       ${srcdir}/Main.java  ${srcdir}/Answer.java  ${srcdir}/Bucket.java  ${srcdir}/Common.java
17                                ${srcdir}/Contact.java  ${srcdir}/FindNodeAnswerTask.java  ${srcdir}/FindNodeTask.java
18                                ${srcdir}/KademliaTask.java  ${srcdir}/Node.java  ${srcdir}/PingAnswerTask.java
19                                ${srcdir}/PingTask.java  ${srcdir}/RoutingTable.java)
20
21 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/energy/consumption)
22 set(energy_consumption_sources ${srcdir}/Main.java  ${srcdir}/EnergyConsumer.java)
23
24 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/io/file)
25 set(io_file_sources ${srcdir}/Main.java  ${srcdir}/Node.java)
26
27 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/io/storage)
28 set(io_storage_sources ${srcdir}/Main.java  ${srcdir}/Client.java)
29
30 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/kill)
31 set(process_kill_sources       ${srcdir}/Main.java  ${srcdir}/Killer.java  ${srcdir}/Victim.java)
32
33 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/migration)
34 set(process_migration_sources  ${srcdir}/Main.java  ${srcdir}/Emigrant.java  ${srcdir}/Policeman.java)
35
36 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime)
37 set(process_startkilltime_sources ${srcdir}/Main.java ${srcdir}/Sleeper.java)
38
39 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
40 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
41
42 foreach (example app_bittorrent app_masterworker dht_chord dht_kademlia energy_consumption io_file io_storage 
43          process_kill process_migration process_startkilltime process_suspend)
44   string (REPLACE "_" "/" example_dir ${example})
45   if(enable_java)
46     add_custom_command(
47       COMMENT "Building java_${example}..."
48       OUTPUT ${example_dir}/java_${example}_compiled
49       DEPENDS ${example_sources} simgrid-java_jar ${SIMGRID_JAR}
50       COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_SOURCE_DIR} ${${example}_sources}
51       COMMAND ${CMAKE_COMMAND} -E remove ${example_dir}/java_${example}_compiled
52       COMMAND ${CMAKE_COMMAND} -E touch ${example_dir}/java_${example}_compiled
53     )
54     add_custom_target(${example} ALL DEPENDS ${example_dir}/java_${example}_compiled)
55   endif()
56   set(examples_src  ${examples_src}  ${${example}_sources})
57   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh)
58 endforeach()
59
60 set(examples_src  ${examples_src}                                                          PARENT_SCOPE)
61 set(tesh_files    ${tesh_files}                                                            PARENT_SCOPE)
62 set(bin_files     ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/generate.py  PARENT_SCOPE)
63 set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README     PARENT_SCOPE)
64 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
65                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
66                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
67                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
68                                    ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml   PARENT_SCOPE)
69
70 if(enable_java)
71   foreach (example app_bittorrent app_masterworker dht_chord dht_kademlia energy_consumption io_file io_storage 
72            process_kill process_migration process_startkilltime process_suspend)
73     string (REPLACE "_" "/" example_dir ${example})
74     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)
75   endforeach()
76 endif()