Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case s4u::Mailbox
[simgrid.git] / examples / java / CMakeLists.txt
1 set(app-bittorrent_files        Main  Common  Connection MessageTask Peer  Tracker TrackerTask)
2 set(app-centralizedmutex_files  Main  Coordinator  GrantTask Node ReleaseTask  RequestTask)
3 set(app-masterworker_files      Main  Master Worker)
4 set(app-pingpong_files          Main  PingPongTask Receiver Sender)
5 set(app-tokenring_files         Main  RelayRunner)
6 set(async-waitall_files         Main  Receiver Sender)
7 set(async-yield_files           Main  Yielder)
8 set(async-dsend_files           Main  Receiver Sender)
9 set(cloud-masterworker_files    Main  Master Worker)
10 set(cloud-migration_files       Main  Daemon Test TestHostOnOff XVM)
11 set(dht-chord_files             Main  ChordTask  Common FindSuccessorAnswerTask  FindSuccessorTask
12                                       GetPredecessorAnswerTask GetPredecessorTask Node  NotifyTask)
13 set(dht-kademlia_files          Main  Answer  Bucket  Common Contact FindNodeAnswerTask  FindNodeTask
14                                       KademliaTask  Node  PingAnswerTask PingTask  RoutingTable)
15 set(trace-pingpong_files        Main  PingPongTask Receiver Sender)
16 set(energy-consumption_files    Main  EnergyConsumer)
17 set(energy-pstate_files         Main  PstateRunner)
18 set(energy-vm_files             Main  EnergyVMRunner)
19 set(io-file_files               Main  Node)
20 set(io-storage_files            Main  Client)
21 set(process-kill_files          Main  Killer  Victim)
22 set(process-migration_files     Main  Emigrant  Policeman)
23 set(process-startkilltime_files Main  Sleeper)
24 set(process-suspend_files       Main  DreamMaster  LazyGuy)
25 set(task-priority_files         Main  Test)
26
27
28 foreach (example app-bittorrent app-centralizedmutex app-masterworker app-pingpong app-tokenring async-yield async-waitall async-dsend
29          cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm io-file io-storage
30          process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong)
31   string (REPLACE "-" "/" example_dir ${example})
32   set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir})
33   foreach (filename ${${example}_files} )
34     set( ${example}_sources "${${example}_sources}" "${srcdir}/${filename}.java")
35   endforeach()
36
37   if(enable_java)
38     add_custom_command(
39       COMMENT "Building java-${example}..."
40       OUTPUT ${example_dir}/java-${example}_compiled
41       DEPENDS ${example_sources} simgrid-java_jar ${SIMGRID_JAR}
42       COMMAND ${CMAKE_COMMAND} -E make_directory ${example_dir}
43       COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR} ${${example}_sources}
44       COMMAND ${CMAKE_COMMAND} -E remove ${example_dir}/java-${example}_compiled
45       COMMAND ${CMAKE_COMMAND} -E touch ${example_dir}/java-${example}_compiled
46     )
47     add_custom_target(java-${example} ALL DEPENDS ${example_dir}/java-${example}_compiled)
48   endif()
49   set(examples_src  ${examples_src}  ${${example}_sources})
50   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh)
51 endforeach()
52
53 set(examples_src  ${examples_src}                                                                          PARENT_SCOPE)
54 set(tesh_files    ${tesh_files}                                                                            PARENT_SCOPE)
55 set(bin_files     ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/generate.py                  PARENT_SCOPE)
56 set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README
57                                    ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration/README                      PARENT_SCOPE)
58 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
59                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex/centralizedmutex.xml
60                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
61                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
62                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
63                                    ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml
64                                    ${CMAKE_CURRENT_SOURCE_DIR}/task/priority/priority.xml                  PARENT_SCOPE)
65
66 if(enable_java)
67   foreach (example app-bittorrent app-centralizedmutex app-masterworker app-pingpong app-tokenring async-yield async-waitall async-dsend
68            cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm io-file io-storage
69            process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong)
70     string (REPLACE "-" "/" example_dir ${example})
71     ADD_TESH(java-${example}  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java/${example_dir} ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
72   endforeach()
73 endif()