From: Arnaud Giersch Date: Fri, 21 Feb 2014 14:44:49 +0000 (+0100) Subject: Add an option to control whether native libraries are bundled into jar file. X-Git-Tag: v3_11~260 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8b1eca707cb735a63d73576f298133979eef2f0c Add an option to control whether native libraries are bundled into jar file. May be usefull for e.g. Debian packages. --- diff --git a/ChangeLog b/ChangeLog index b5682bac78..4df2e784a3 100644 --- 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 diff --git a/buildtools/Cmake/AddTests.cmake b/buildtools/Cmake/AddTests.cmake index 4f36521a59..9d5814c4e3 100644 --- a/buildtools/Cmake/AddTests.cmake +++ b/buildtools/Cmake/AddTests.cmake @@ -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) diff --git a/buildtools/Cmake/Distrib.cmake b/buildtools/Cmake/Distrib.cmake index 780b08545c..74b539b171 100644 --- a/buildtools/Cmake/Distrib.cmake +++ b/buildtools/Cmake/Distrib.cmake @@ -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 diff --git a/buildtools/Cmake/MakeJava.cmake b/buildtools/Cmake/MakeJava.cmake index 9f957f250e..f1c43dedbf 100644 --- a/buildtools/Cmake/MakeJava.cmake +++ b/buildtools/Cmake/MakeJava.cmake @@ -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 ) diff --git a/buildtools/Cmake/Option.cmake b/buildtools/Cmake/Option.cmake index 5842fe2da0..1c56b6eba5 100644 --- a/buildtools/Cmake/Option.cmake +++ b/buildtools/Cmake/Option.cmake @@ -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) diff --git a/buildtools/Cmake/PrintArgs.cmake b/buildtools/Cmake/PrintArgs.cmake index 4e62dc6b98..09c6b3df0a 100644 --- a/buildtools/Cmake/PrintArgs.cmake +++ b/buildtools/Cmake/PrintArgs.cmake @@ -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}")