Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git://scm.gforge.inria.fr/simgrid/simgrid-java
[simgrid.git] / CMakeLists.txt
index 8f032ed..8d9e3bf 100644 (file)
@@ -96,6 +96,11 @@ set(JMSG_C_SRC
        src/jmsg_task.h
 )
 
+set(JTRACE_C_SRC
+       src/jtrace.c
+       src/jtrace.h
+)      
+
 set(JMSG_JAVA_SRC
        org/simgrid/msg/Host.java
        org/simgrid/msg/HostFailureException.java       
@@ -116,6 +121,9 @@ set(JMSG_JAVA_SRC
        org/simgrid/msg/Comm.java
        org/simgrid/msg/RngStream.java
 )
+set(JTRACE_JAVA_SRC
+       org/simgrid/trace/Trace.java
+)
 
 set(JAVA_EXAMPLES
        examples/async/AsyncTest.java
@@ -173,9 +181,13 @@ set(JAVA_EXAMPLES
        examples/startKillTime/Master.java
        examples/startKillTime/Slave.java
        examples/startKillTime/StartKillTime.java
+       examples/tracing/PingPongTask.java
        examples/suspend/DreamMaster.java
        examples/suspend/LazyGuy.java
        examples/suspend/Suspend.java
+       examples/tracing/Sender.java
+       examples/tracing/Receiver.java
+       examples/tracing/TracingTest.java
 )
 
 set(CMAKE_SRC
@@ -188,6 +200,7 @@ ${CMAKE_HOME_DIRECTORY}/FindSimGrid.cmake
 set(XML_FILES
     examples/platform.xml
     examples/async/asyncDeployment.xml
+    examples/tracing/tracingPingPongDeployment.xml
     examples/bittorrent/bittorrent.xml
     examples/commTime/commTimeDeployment.xml
     examples/masterslave/masterslaveDeployment.xml
@@ -202,14 +215,19 @@ set(XML_FILES
 set(source_to_pack
 ${CMAKE_SRC}
 ${JMSG_C_SRC}
+${JTRACE_C_SRC}
 ${JMSG_JAVA_SRC}
+${JTRACE_JAVA_SRC}
 ${JAVA_EXAMPLES}
 ${XML_FILES}
 )
 
-string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/org/" JAVA_FILES "${JMSG_JAVA_SRC}") 
+string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/org/" JAVA_FILES_MSG "${JMSG_JAVA_SRC}") 
+string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/org/" JAVA_FILES_TRACE "${JTRACE_JAVA_SRC}") 
 string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/classes/org/" JMSG_JAVA_SRC_CLASS "${JMSG_JAVA_SRC}")
+string(REPLACE "org/" "${CMAKE_HOME_DIRECTORY}/classes/org/" JTRACE_JAVA_SRC_CLASS "${JTRACE_JAVA_SRC}")
 string(REPLACE ".java" ".class" JMSG_JAVA_SRC_CLASS "${JMSG_JAVA_SRC_CLASS}")
+string(REPLACE ".java" ".class" JTRACE_JAVA_SRC_CLASS "${JTRACE_JAVA_SRC_CLASS}")
 string(REPLACE "examples/" "${CMAKE_HOME_DIRECTORY}/examples/" JAVA_EXAMPLES_CLASS "${JAVA_EXAMPLES}") 
 string(REPLACE ".java" ".class" JAVA_EXAMPLES_CLASS "${JAVA_EXAMPLES_CLASS}")
 
@@ -243,17 +261,43 @@ else(WIN32)
     set_target_properties(SG_java PROPERTIES LINK_FLAGS "-L${SIMGRID_LIB_PATH}")
 endif(WIN32)
 
+# SG_java_tracing
+add_library(SG_java_tracing SHARED ${JTRACE_C_SRC})
+if(WIN32)
+    set_target_properties(SG_java_tracing PROPERTIES LINK_FLAGS "-Wl,--subsystem,windows,--kill-at ${SIMGRID_LIB}" PREFIX "")
+    find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
+    message(STATUS "pexports: ${PEXPORTS_PATH}")
+    if(PEXPORTS_PATH)
+    add_custom_command(TARGET SG_java_tracing POST_BUILD
+    COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/SG_java_tracing.dll > ${CMAKE_BINARY_DIR}/SG_java_tracing.def)
+    endif(PEXPORTS_PATH)
+else(WIN32)
+    target_link_libraries(SG_java_tracing pcre pthread simgrid)
+    set_target_properties(SG_java_tracing PROPERTIES LINK_FLAGS "-L${SIMGRID_LIB_PATH}")
+endif(WIN32)
+
+
 # java_classes
 add_custom_command(
-       OUTPUT  ${JMSG_JAVA_SRC_CLASS}
+       OUTPUT  ${JMSG_JAVA_SRC_CLASS}
        DEPENDS ${JMSG_JAVA_SRC}
        COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_HOME_DIRECTORY}/classes/"
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/classes/
-                                       -cp ${CMAKE_HOME_DIRECTORY}/classes/ ${JAVA_FILES}
-       COMMENT "Compiling java sources of core library..."                                     
+       -cp ${CMAKE_HOME_DIRECTORY}/classes/ ${JAVA_FILES_MSG}
+       COMMENT "Compiling java sources of core libraries..."                                   
 )
+
+add_custom_command(
+       OUTPUT  ${JTRACE_JAVA_SRC_CLASS}
+       DEPENDS ${JTRACE_JAVA_SRC}
+       COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_HOME_DIRECTORY}/classes/"
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/classes/
+       -cp ${CMAKE_HOME_DIRECTORY}/classes/ ${JAVA_FILES_TRACE}
+       COMMENT "Compiling java sources of core libraries..."                                   
+)
+
 add_custom_target(java_classes ALL
-  DEPENDS ${JMSG_JAVA_SRC_CLASS}
+                 DEPENDS ${JMSG_JAVA_SRC_CLASS} ${JTRACE_JAVA_SRC_CLASS}
 )
 
 # simgrid_jar
@@ -281,6 +325,8 @@ add_custom_command(
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/pingPong/*.java
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/priority/*.java    
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/startKillTime/*.java
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/tracing/*.java
+       COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/bittorrent/*.java
        COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/suspend/*.java
 
 )
@@ -293,7 +339,7 @@ add_custom_target(simgrid_java_examples ALL
 # Declare dependencies #
 ########################
 add_dependencies(simgrid_jar java_classes)
-add_dependencies(simgrid_java_examples simgrid_jar SG_java)
+add_dependencies(simgrid_java_examples simgrid_jar SG_java SG_java_tracing)
 
 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
 ${CMAKE_HOME_DIRECTORY}/simgrid.jar
@@ -318,8 +364,10 @@ ADD_TEST(pingPong        ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE
 ADD_TEST(priority        ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/priority/priority.tesh)
 ADD_TEST(startKillTime   ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/startKillTime/startKillTime.tesh)
 ADD_TEST(suspend         ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/suspend/suspend.tesh)
+ADD_TEST(tracing         ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/tracing/tracingPingPong.tesh)
+#Don't forget to put new test in this list!!!
 #Don't forget to put new test in this list!!!
-set(test_list async bittorrent bypass chord commTime kill masterslave migration mutualExclusion pingPong priority startKillTime)
+set(test_list async bittorrent bypass chord commTime kill masterslave migration mutualExclusion pingPong priority startKillTime tracing)
 
 ##########################################
 # Set the  DYLD_LIBRARY_PATH for mac     #
@@ -350,7 +398,7 @@ endif(APPLE)
 ###########
 # Install #
 ###########
-install(TARGETS SG_java
+install(TARGETS SG_java SG_java_tracing
        DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)
 install(FILES ${CMAKE_HOME_DIRECTORY}/simgrid.jar
        DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)