Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Factor common definition, and avoid empty component in LD_LIBRARY_PATH.
[simgrid.git] / examples / deprecated / 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 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  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 set(hostload_files              Main  LoadRunner)
27
28 if(enable_java)
29   add_custom_target(java-all COMMENT "Building all Java examples...")
30   add_dependencies(tests java-all)
31 endif()
32
33 foreach (example app-bittorrent app-centralizedmutex app-masterworker app-pingpong app-tokenring async-yield async-waitall async-dsend
34          cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm hostload io-file io-storage
35          process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong)
36   string (REPLACE "-" "/" example_dir ${example})
37   set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir})
38   foreach (filename ${${example}_files} )
39     set( ${example}_sources "${${example}_sources}" "${srcdir}/${filename}.java")
40   endforeach()
41
42   if(enable_java)
43     add_custom_command(
44       COMMENT "Building java-${example}..."
45       OUTPUT ${example_dir}/java-${example}_compiled
46       DEPENDS ${example_sources} simgrid-java_jar ${SIMGRID_JAR}
47       COMMAND ${CMAKE_COMMAND} -E make_directory ${example_dir}
48       COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR} ${${example}_sources}
49       COMMAND ${CMAKE_COMMAND} -E remove ${example_dir}/java-${example}_compiled
50       COMMAND ${CMAKE_COMMAND} -E touch ${example_dir}/java-${example}_compiled
51     )
52     add_custom_target(java-${example} ALL DEPENDS ${example_dir}/java-${example}_compiled)
53     add_dependencies(java-all java-${example})
54   endif()
55   set(examples_src  ${examples_src}  ${${example}_sources})
56   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh)
57 endforeach()
58
59 set(examples_src  ${examples_src}                                                                          PARENT_SCOPE)
60 set(tesh_files    ${tesh_files}                                                                            PARENT_SCOPE)
61 set(bin_files     ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/generate.py                  PARENT_SCOPE)
62 set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README
63                                    ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration/README                      PARENT_SCOPE)
64 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
65                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex/centralizedmutex.xml
66                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
67                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
68                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
69                                    ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml
70                                    ${CMAKE_CURRENT_SOURCE_DIR}/task/priority/priority.xml                  PARENT_SCOPE)
71
72 if(enable_java)
73   foreach (example app-bittorrent app-centralizedmutex app-masterworker app-pingpong app-tokenring async-yield async-waitall async-dsend
74            cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm hostload io-file io-storage
75            process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong)
76     string (REPLACE "-" "/" example_dir ${example})
77     ADD_TESH(java-${example}  --setenv javacmd=${Java_JAVA_EXECUTABLE} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/java --setenv LD_LIBRARY_PATH=${TESH_LIBRARY_PATH} --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/deprecated/java/${example_dir} ${CMAKE_HOME_DIRECTORY}/examples/deprecated/java/${example_dir}/${example}.tesh)
78   endforeach()
79 endif()