Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[java/cmake] try to add boost_context to the jar when we have it
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 4 Dec 2015 21:31:40 +0000 (22:31 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 4 Dec 2015 21:31:46 +0000 (22:31 +0100)
This fix #38 (hopefully)

src/bindings/java/org/simgrid/NativeLib.java
tools/cmake/Java.cmake

index 6bd5dae..e2931c5 100644 (file)
@@ -23,6 +23,9 @@ public final class NativeLib {
                if (System.getProperty("os.name").toLowerCase().startsWith("win"))
                        NativeLib.nativeInit("winpthread-1");
 
+               try {
+                       NativeLib.nativeInit("boost_context");
+               } catch (Exception e) {/* Dont care */}
                NativeLib.nativeInit("simgrid");
                NativeLib.nativeInit("surf-java");
                NativeLib.nativeInit("simgrid-java");      
index 275f1b3..c3ef8f7 100644 (file)
@@ -148,11 +148,20 @@ if(enable_lib_in_jar)
     #COMMAND ${STRIP_COMMAND} ${JAVA_NATIVE_PATH}/${LIBSURF_JAVA_SO}    || true
 
     COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_JAR}  NATIVE
-    COMMAND ${CMAKE_COMMAND} -E remove_directory NATIVE
     
     COMMAND ${CMAKE_COMMAND} -E echo "-- Cmake put the native code in ${JAVA_NATIVE_PATH}"
     COMMAND "${Java_JAVA_EXECUTABLE}" -classpath "${SIMGRID_JAR}" org.simgrid.NativeLib
     )
+    
+  if (HAVE_BOOST_CONTEXT)
+    add_custom_command(
+      TARGET simgrid-java_jar POST_BUILD
+      COMMENT "Add the boost_context lib into simgrid.jar..."
+      COMMAND ${CMAKE_COMMAND} -E copy ${Boost_CONTEXT_LIBRARY_RELEASE}  ${JAVA_NATIVE_PATH}
+      COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_JAR}  NATIVE
+    )
+  endif()
+  
   if(MINGW)
     find_library(WINPTHREAD_DLL
       NAME winpthread winpthread-1