Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix cmake for swig
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 20 Mar 2014 09:28:18 +0000 (10:28 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 20 Mar 2014 10:23:13 +0000 (11:23 +0100)
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/Distrib.cmake
buildtools/Cmake/MakeJava.cmake
examples/java/surfPlugin/CMakeLists.txt

index 2b7de55..a414011 100644 (file)
@@ -484,22 +484,32 @@ set(JMSG_JAVA_SRC
   src/bindings/java/org/simgrid/msg/TimeoutException.java
   src/bindings/java/org/simgrid/msg/TransferFailureException.java
   src/bindings/java/org/simgrid/msg/VM.java
   src/bindings/java/org/simgrid/msg/TimeoutException.java
   src/bindings/java/org/simgrid/msg/TransferFailureException.java
   src/bindings/java/org/simgrid/msg/VM.java
+)
 
 
-  src/bindings/java/org/simgrid/surf/Surf.java
-  src/bindings/java/org/simgrid/surf/SurfJNI.java
-  src/bindings/java/org/simgrid/surf/Plugin.java
-  src/bindings/java/org/simgrid/surf/Model.java
-  src/bindings/java/org/simgrid/surf/Resource.java
-  src/bindings/java/org/simgrid/surf/Action.java  
-  src/bindings/java/org/simgrid/surf/Cpu.java
-  src/bindings/java/org/simgrid/surf/CpuAction.java  
-  src/bindings/java/org/simgrid/surf/NetworkLink.java  
-  src/bindings/java/org/simgrid/surf/NetworkAction.java  
-
-  src/bindings/java/org/simgrid/surf/LmmConstraint.java  
-  src/bindings/java/org/simgrid/surf/XbtDict.java    
+set(JSURF_SWIG_SRC
+  src/bindings/java/surf.i
+)
+set(JSURF_JAVA_C_SRC
+  src/bindings/java/surf_swig.cpp
+  src/bindings/java/surf_swig.hpp
 )
 
 )
 
+set(JSURF_JAVA_GENERATED_SRC
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/Surf.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/SurfJNI.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/Plugin.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/Model.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/Resource.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/Action.java  
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/Cpu.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/CpuAction.java  
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkLink.java  
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkAction.java  
+
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/LmmConstraint.java  
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/XbtDict.java
+) 
+
 set(JTRACE_C_SRC
   src/bindings/java/jtrace.c
   src/bindings/java/jtrace.h
 set(JTRACE_C_SRC
   src/bindings/java/jtrace.c
   src/bindings/java/jtrace.h
index 74b539b..2bb482a 100644 (file)
@@ -189,6 +189,8 @@ set(source_to_pack
   ${JEDULE_SRC}
   ${JMSG_C_SRC}
   ${JMSG_JAVA_SRC}
   ${JEDULE_SRC}
   ${JMSG_C_SRC}
   ${JMSG_JAVA_SRC}
+  ${JSURF_SWIG_SRC}
+  ${JSURF_JAVA_C_SRC}
   ${LUA_SRC}
   ${MC_SRC}
   ${MSG_SRC}
   ${LUA_SRC}
   ${MC_SRC}
   ${MSG_SRC}
index 63e6420..8091c98 100644 (file)
@@ -64,7 +64,7 @@ set(LIBSIMGRID_SO
 set(LIBSIMGRID_JAVA_SO
   ${CMAKE_SHARED_LIBRARY_PREFIX}simgrid-java${CMAKE_SHARED_LIBRARY_SUFFIX})
 set(LIBSURF_JAVA_SO
 set(LIBSIMGRID_JAVA_SO
   ${CMAKE_SHARED_LIBRARY_PREFIX}simgrid-java${CMAKE_SHARED_LIBRARY_SUFFIX})
 set(LIBSURF_JAVA_SO
-  ${CMAKE_SHARED_LIBRARY_PREFIX}surf-java.so)
+  ${CMAKE_SHARED_LIBRARY_PREFIX}surf-java${CMAKE_SHARED_LIBRARY_SUFFIX})
 
 ## Don't strip libraries if not in release mode
 ##
 
 ## Don't strip libraries if not in release mode
 ##
@@ -78,9 +78,9 @@ endif()
 ##
 if(CMAKE_VERSION VERSION_LESS "2.8.12")
   set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
 ##
 if(CMAKE_VERSION VERSION_LESS "2.8.12")
   set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
-  add_jar(simgrid-java_pre_jar ${JMSG_JAVA_SRC})
+  add_jar(simgrid-java_pre_jar ${JMSG_JAVA_SRC} ${JSURF_JAVA_GENERATED_SRC})
 else()
 else()
-  add_jar(simgrid-java_pre_jar ${JMSG_JAVA_SRC} OUTPUT_NAME simgrid)
+  add_jar(simgrid-java_pre_jar ${JMSG_JAVA_SRC} ${JSURF_JAVA_GENERATED_SRC} OUTPUT_NAME simgrid)
 endif()
 
 set(JAVA_BUNDLE "${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Scripts/java_bundle.sh")
 endif()
 
 set(JAVA_BUNDLE "${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Scripts/java_bundle.sh")
@@ -115,12 +115,12 @@ add_custom_target(simgrid-java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
 
 set(CMAKE_SWIG_FLAGS "-package" "org.simgrid.surf")
 set(CMAKE_SWIG_OUTDIR "${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/surf")
 
 set(CMAKE_SWIG_FLAGS "-package" "org.simgrid.surf")
 set(CMAKE_SWIG_OUTDIR "${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/surf")
+set(CMAKE_SWIG_OUTDIR "${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf")
 
 
-set(SURF_SWIG_FILE "${CMAKE_HOME_DIRECTORY}/src/bindings/java/surf.i")
-set_source_files_properties(${SURF_SWIG_FILE} PROPERTIES CPLUSPLUS 1)
+set_source_files_properties(${JSURF_SWIG_SRC} PROPERTIES CPLUSPLUS 1)
 #set_source_files_properties(${SURF_SWIG_FILE} PROPERTIES SWIG_FLAGS "-includeall")
 include_directories(${JNI_INCLUDE_DIRS})
 #set_source_files_properties(${SURF_SWIG_FILE} PROPERTIES SWIG_FLAGS "-includeall")
 include_directories(${JNI_INCLUDE_DIRS})
-swig_add_module(surf-java java ${SURF_SWIG_FILE} "${CMAKE_HOME_DIRECTORY}/src/surf/surf_interface.hpp" "${CMAKE_HOME_DIRECTORY}/src/bindings/java/surf_swig.hpp" "${CMAKE_HOME_DIRECTORY}/src/bindings/java/surf_swig.cpp")
+swig_add_module(surf-java java ${JSURF_SWIG_SRC} ${JSURF_JAVA_C_SRC})
 swig_link_libraries(surf-java simgrid)
 
 add_dependencies(simgrid-java surf-java)
 swig_link_libraries(surf-java simgrid)
 
 add_dependencies(simgrid-java surf-java)
index 8204fca..005c6f4 100644 (file)
@@ -28,6 +28,7 @@ set(tesh_files
   )
 set(xml_files
   ${xml_files}
   )
 set(xml_files
   ${xml_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/surfPluginPlatform.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/surfPluginDeployment.xml  
   PARENT_SCOPE
   )
   ${CMAKE_CURRENT_SOURCE_DIR}/surfPluginDeployment.xml  
   PARENT_SCOPE
   )