Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add an option to control whether native libraries are bundled into jar file.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 21 Feb 2014 14:44:49 +0000 (15:44 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 21 Feb 2014 16:05:55 +0000 (17:05 +0100)
May be usefull for e.g. Debian packages.

ChangeLog
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/Distrib.cmake
buildtools/Cmake/MakeJava.cmake
buildtools/Cmake/Option.cmake
buildtools/Cmake/PrintArgs.cmake

index b5682ba..4df2e78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,8 +13,6 @@ SimGrid (3.11) NOT RELEASED; urgency=low
    - Use git to generate the dist archive.  Either use git-archive to
      generate the tarball, or keep using cmake -E tar, but use git-ls-files
      to get the list of files to pack.
-   - For Java, add an option to enable/disable the inclusion of the native
-     libraries in the jar file, and avoid to duplicate these files.
 
  Tools:
  * Normalizing pointers addresses tool for better diff between logs
@@ -60,6 +58,12 @@ SimGrid (3.11) NOT RELEASED; urgency=low
  * Collective communication algorithms should not crash if used with
    improper number of nodes and report the error.
 
+ Java:
+ * New cmake option, enable_lib_in_jar, to control whether native libraries are
+   copied into simgrid.jar or not (ON by default).  Use this option if you want
+   to reduce the size of the installed simgrid.jar, *and* the native libraries
+   are kept installed elsewhere.
+
  Build System:
  * Supernovae build mode is definitively removed. It was used to improve
    inlining and inter-module optimizations. It is nowadays superseded by
index 4f36521..9d5814c 100644 (file)
@@ -561,9 +561,9 @@ if(NOT enable_memcheck)
   # Java examples
   if(enable_java)
     if(WIN32)
-      set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/\;${SIMGRID_JAR}")
+      set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/\;${SIMGRID_FULL_JAR}")
     else()
-      set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${SIMGRID_JAR}")
+      set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${SIMGRID_FULL_JAR}")
     endif()
     ADD_TEST(java-async                         ${TESH_COMMAND} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/async/async.tesh)
     ADD_TEST(java-bittorrent                    ${TESH_COMMAND} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/bittorrent/bittorrent.tesh)
@@ -589,9 +589,9 @@ if(NOT enable_memcheck)
   # Scala examples
   if(enable_scala)
     if(WIN32)
-    set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/scala/\;${SIMGRID_JAR}\;${SCALA_JARS}")
+      set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/scala/\;${SIMGRID_FULL_JAR}\;${SCALA_JARS}")
     else()
-    set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/scala/:${SIMGRID_JAR}:${SCALA_JARS}")
+      set(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/scala/:${SIMGRID_FULL_JAR}:${SCALA_JARS}")
     endif()
 
     ADD_TEST(scala-bypass                       ${TESH_COMMAND} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/scala --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/scala ${CMAKE_HOME_DIRECTORY}/examples/scala/master_slave_bypass/bypass.tesh)
index 780b085..74b539b 100644 (file)
@@ -78,10 +78,16 @@ if(enable_lib_static AND NOT WIN32)
 endif()
 
 if(enable_java)
+  if(enable_lib_in_jar)
+    set(SIMGRID_JAR_TO_INSTALL "${SIMGRID_FULL_JAR}")
+  else()
+    set(SIMGRID_JAR_TO_INSTALL "${SIMGRID_JAR}")
+  endif()
   install(TARGETS simgrid-java
       DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
-  install(FILES ${SIMGRID_JAR}
-      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/)
+  install(FILES ${SIMGRID_JAR_TO_INSTALL}
+      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/
+      RENAME simgrid.jar)
 endif()
 
 # include files
index 9f957f2..f1c43de 100644 (file)
@@ -56,6 +56,7 @@ endif()
 ## Files to include in simgrid.jar
 ##
 set(SIMGRID_JAR "${CMAKE_BINARY_DIR}/simgrid.jar")
+set(SIMGRID_FULL_JAR "${CMAKE_BINARY_DIR}/simgrid_full.jar")
 set(MANIFEST_IN_FILE "${CMAKE_HOME_DIRECTORY}/src/bindings/java/MANIFEST.MF.in")
 set(MANIFEST_FILE "${CMAKE_BINARY_DIR}/src/bindings/java/MANIFEST.MF")
 
@@ -103,7 +104,9 @@ add_custom_command(
   COMMAND ${CMAKE_COMMAND} -E copy ${MANIFEST_IN_FILE} ${MANIFEST_FILE}
   COMMAND ${CMAKE_COMMAND} -E echo "Specification-Version: \\\"${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}\\\"" >> ${MANIFEST_FILE}
   COMMAND ${CMAKE_COMMAND} -E echo "Implementation-Version: \\\"${GIT_VERSION}\\\"" >> ${MANIFEST_FILE}
-  COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR} "NATIVE"
+  COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR}
+  COMMAND ${CMAKE_COMMAND} -E copy ${SIMGRID_JAR} ${SIMGRID_FULL_JAR}
+  COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} "NATIVE"
   COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized
   COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
   )
index 5842fe2..1c56b6e 100644 (file)
@@ -34,6 +34,7 @@ option(enable_print_message "Enable print message during config." off)
 mark_as_advanced(enable_print_message)
 option(enable_model-checking "Turn this on to experiment with our prototype of model-checker (hinders the simulation's performance even if turned of at runtime)" off)
 option(enable_lib_static "" off)
+option(enable_lib_in_jar "Whether the native libraries are bundled into the Java jar file" on)
 option(enable_jedule "Jedule output of SimDAG." off)
 option(enable_debug "Turn this off to remove all debug messages at compile time (faster, but no debug activable)" on)
 option(enable_msg_deprecated "This option enable the use of msg deprecated functions" off)
index 4e62dc6..09c6b3d 100644 (file)
@@ -115,6 +115,9 @@ message("        Compile MPI testsuite: ${enable_smpi_MPICH3_testsuite}")
 message("        Compile Smpi f77 ....: ${SMPI_F2C}")
 message("        Compile Smpi f90 ....: ${SMPI_F90}")
 message("        Compile Static ......: ${enable_lib_static}")
+if(enable_java)
+  message("        Native lib in jar ...: ${enable_lib_in_jar}")
+endif()
 message("")
 message("        Maintainer mode .....: ${enable_maintainer_mode}")
 message("        Model checking ......: ${HAVE_MC}")