Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix dependencies for Java and its examples.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 1 Feb 2013 01:18:36 +0000 (02:18 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 1 Feb 2013 09:31:36 +0000 (10:31 +0100)
Try to avoid to rebuild targets when not needed.

19 files changed:
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/MakeLib.cmake
examples/java/async/CMakeLists.txt
examples/java/bittorrent/CMakeLists.txt
examples/java/chord/CMakeLists.txt
examples/java/cloud/CMakeLists.txt
examples/java/commTime/CMakeLists.txt
examples/java/io/CMakeLists.txt
examples/java/kademlia/CMakeLists.txt
examples/java/master_slave_bypass/CMakeLists.txt
examples/java/master_slave_kill/CMakeLists.txt
examples/java/masterslave/CMakeLists.txt
examples/java/migration/CMakeLists.txt
examples/java/mutualExclusion/CMakeLists.txt
examples/java/pingPong/CMakeLists.txt
examples/java/priority/CMakeLists.txt
examples/java/startKillTime/CMakeLists.txt
examples/java/suspend/CMakeLists.txt
examples/java/tracing/CMakeLists.txt

index adcac33..728ea6a 100644 (file)
@@ -317,7 +317,7 @@ if(NOT enable_memcheck)
   ENDIF()
 
   # Java examples
   ENDIF()
 
   # Java examples
-  set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${CMAKE_BINARY_DIR}/simgrid.jar")
+  set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${SIMGRID_JAR}")
   if(enable_java)
     ADD_TEST(java-async                         ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_HOME_DIRECTORY}/examples/java async/async.tesh)
     ADD_TEST(java-bittorrent                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_HOME_DIRECTORY}/examples/java bittorrent/bittorrent.tesh)
   if(enable_java)
     ADD_TEST(java-async                         ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_HOME_DIRECTORY}/examples/java async/async.tesh)
     ADD_TEST(java-bittorrent                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_HOME_DIRECTORY}/examples/java bittorrent/bittorrent.tesh)
index f2960f0..1707c38 100644 (file)
@@ -49,12 +49,8 @@ if(enable_java)
   set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
   add_jar(SG_java_jar ${JMSG_JAVA_SRC})
 
   set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
   add_jar(SG_java_jar ${JMSG_JAVA_SRC})
 
+  set(SIMGRID_JAR "${CMAKE_BINARY_DIR}/simgrid.jar")
   set(MANIFEST_FILE "${CMAKE_HOME_DIRECTORY}/src/bindings/java/MANIFEST.MF")
   set(MANIFEST_FILE "${CMAKE_HOME_DIRECTORY}/src/bindings/java/MANIFEST.MF")
-  add_custom_command(TARGET simgrid.jar POST_BUILD
-    COMMENT "Update file MANIFEST.MF in simgrid.jar..."
-    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
-    COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} simgrid.jar
-    )
 
   if(CMAKE_SYSTEM_PROCESSOR MATCHES ".86")
     if(${ARCH_32_BITS})
 
   if(CMAKE_SYSTEM_PROCESSOR MATCHES ".86")
     if(${ARCH_32_BITS})
@@ -67,9 +63,13 @@ if(enable_java)
   endif()
   message("Native libraries bundeled into: ${JSG_BUNDLE}")
 
   endif()
   message("Native libraries bundeled into: ${JSG_BUNDLE}")
 
-  add_custom_command(TARGET simgrid.jar POST_BUILD
-    COMMENT "Combine native libraries in simgrid.jar..."
-    DEPENDS simgrid SG_java
+  add_custom_command(
+    COMMENT "Finalize simgrid.jar..."
+    OUTPUT ${SIMGRID_JAR}_finalized
+    DEPENDS simgrid SG_java ${SIMGRID_JAR} ${MANIFEST_FILE}
+            ${CMAKE_HOME_DIRECTORY}/COPYING
+            ${CMAKE_HOME_DIRECTORY}/ChangeLog
+            ${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java
     WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
     COMMAND ${CMAKE_COMMAND} -E remove_directory "NATIVE"
     COMMAND ${CMAKE_COMMAND} -E make_directory "${JSG_BUNDLE}"
     WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
     COMMAND ${CMAKE_COMMAND} -E remove_directory "NATIVE"
     COMMAND ${CMAKE_COMMAND} -E make_directory "${JSG_BUNDLE}"
@@ -80,8 +80,11 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/COPYING" "${JSG_BUNDLE}"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog" "${JSG_BUNDLE}"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java" "${JSG_BUNDLE}"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/COPYING" "${JSG_BUNDLE}"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog" "${JSG_BUNDLE}"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java" "${JSG_BUNDLE}"
-    COMMAND ${JAVA_ARCHIVE} -uvf simgrid.jar "NATIVE"
+    COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR} "NATIVE"
+    COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
     )
     )
+  add_custom_target(SG_java_jar_finalize DEPENDS ${SIMGRID_JAR}_finalized)
+  add_dependencies(SG_java_jar SG_java_jar_finalize)
 endif()
 
 add_dependencies(simgrid maintainer_files)
 endif()
 
 add_dependencies(simgrid maintainer_files)
index 98044f6..41082fe 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_async)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/AsyncTest.java
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/AsyncTest.java
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
@@ -9,11 +10,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_async ALL
-    COMMENT "Building java_async..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_async SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index c2f2803..a8a46f2 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_bittorrent)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Bittorrent.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Common.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Bittorrent.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Common.java
@@ -11,11 +12,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_bittorrent ALL
-    COMMENT "Building java_bittorrent..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_bittorrent SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 8235967..50c534f 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_chord)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Chord.java
   ${CMAKE_CURRENT_SOURCE_DIR}/ChordTask.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Chord.java
   ${CMAKE_CURRENT_SOURCE_DIR}/ChordTask.java
@@ -13,11 +14,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_chord ALL
-    COMMENT "Building java_chord..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_chord SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index b06f6f9..d3ef5f6 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_cloud)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Cloud.java
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Cloud.java
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
@@ -8,11 +9,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_cloud ALL
-    COMMENT "Building java_cloud..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_cloud SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 0545440..2404c0f 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_commTime)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/CommTimeTest.java
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/CommTimeTest.java
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
@@ -8,11 +9,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_commTime ALL
-    COMMENT "Building java_commTime..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_commTime SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 0165381..1d1e5ab 100644 (file)
@@ -1,16 +1,21 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_io)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/IO.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Node.java
   )
 
 if(enable_java)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/IO.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Node.java
   )
 
 if(enable_java)
-  add_custom_target(java_io ALL
-    COMMENT "Building java_io..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_io SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 18f6222..b6cdc1a 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_kademlia)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Answer.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Bucket.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Answer.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Bucket.java
@@ -16,11 +17,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_kademlia ALL
-    COMMENT "Building java_kademlia..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_kademlia SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 8b5003f..ae5fea7 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_master_slave_bypass)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Master.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Master.java
@@ -8,11 +9,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_master_slave_bypass ALL
-    COMMENT "Building java_master_slave_bypass..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_master_slave_bypass SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index fd8d8e6..c4ff8be 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_master_slave_kill)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Master.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Master.java
@@ -8,11 +9,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_master_slave_kill ALL
-    COMMENT "Building java_master_slave_kill..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_master_slave_kill SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 30ecd76..e0173a3 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_masterslave)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Forwarder.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/FinalizeTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Forwarder.java
@@ -9,11 +10,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_masterslave ALL
-    COMMENT "Building java_masterslave..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_masterslave SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 1802795..383a02d 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_migration)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Emigrant.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Migration.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Emigrant.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Migration.java
@@ -7,11 +8,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_migration ALL
-    COMMENT "Building java_migration..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_migration SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 24a17fb..9e5b45a 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_mutualExclusion)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Coordinator.java
   ${CMAKE_CURRENT_SOURCE_DIR}/GrantTask.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Coordinator.java
   ${CMAKE_CURRENT_SOURCE_DIR}/GrantTask.java
@@ -10,11 +11,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_mutualExclusion ALL
-    COMMENT "Building java_mutualExclusion..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_mutualExclusion SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 9de1cd6..95b1361 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_pingPong)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTest.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTest.java
@@ -8,11 +9,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_pingPong ALL
-    COMMENT "Building java_pingPong..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_pingPong SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index d961e0f..6d838dd 100644 (file)
@@ -1,16 +1,21 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_priority)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Priority.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Test.java
   )
 
 if(enable_java)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Priority.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Test.java
   )
 
 if(enable_java)
-  add_custom_target(java_priority ALL
-    COMMENT "Building java_priority..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_priority SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index fecb6c9..46ea114 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_startKillTime)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Master.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Slave.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/Master.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Slave.java
@@ -7,11 +8,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_startKillTime ALL
-    COMMENT "Building java_startKillTime..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_startKillTime SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index 38bf557..8c0e73c 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_suspend)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/DreamMaster.java
   ${CMAKE_CURRENT_SOURCE_DIR}/LazyGuy.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/DreamMaster.java
   ${CMAKE_CURRENT_SOURCE_DIR}/LazyGuy.java
@@ -7,11 +8,15 @@ set(sources
   )
 
 if(enable_java)
   )
 
 if(enable_java)
-  add_custom_target(java_suspend ALL
-    COMMENT "Building java_suspend..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_suspend SG_java_jar)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files
index bc34cec..1ae946b 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.6)
 
 cmake_minimum_required(VERSION 2.6)
 
+set(example java_tracing)
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Receiver.java
 set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTask.java
   ${CMAKE_CURRENT_SOURCE_DIR}/Receiver.java
@@ -7,12 +8,16 @@ set(sources
   ${CMAKE_CURRENT_SOURCE_DIR}/TracingTest.java
   )
 
   ${CMAKE_CURRENT_SOURCE_DIR}/TracingTest.java
   )
 
-if(enable_java AND HAVE_TRACING)
-  add_custom_target(java_tracing ALL
-    COMMENT "Building java_tracing..."
-    COMMAND ${JAVA_COMPILE} -cp ${CMAKE_BINARY_DIR}/simgrid.jar
-                            -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources})
-  add_dependencies(java_tracing SG_java_jar)
+if(enable_java)
+  add_custom_command(
+    COMMENT "Building ${example}..."
+    OUTPUT ${example}_compiled
+    DEPENDS ${sources} ${SIMGRID_JAR}
+    COMMAND ${JAVA_COMPILE} -cp ${SIMGRID_JAR}
+                             -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+  )
+  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
 endif()
 
 set(tesh_files
 endif()
 
 set(tesh_files