Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cmake: new option to build a jarfile with no external dependencies
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 3 Apr 2019 11:07:18 +0000 (13:07 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 3 Apr 2019 11:07:18 +0000 (13:07 +0200)
CMakeLists.txt
tools/cmake/Option.cmake

index ad1dd5b..0fd26a8 100644 (file)
@@ -254,26 +254,30 @@ endif()
 set(_Boost_STACKTRACE_HEADERS           "boost/stacktrace.hpp")
 set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp")
 
-find_package(Boost 1.59 COMPONENTS context stacktrace_backtrace)
-set(Boost_FOUND 1) # These components are optionals
-message(STATUS "Mandatory components found. SimGrid is compilable.")
-message(STATUS "Looking for optional Boost components:")
-
-if (Boost_STACKTRACE_BACKTRACE_FOUND)
-  message (STATUS "  stacktrace: found. Activating human-readable stack traces.")
-  set(HAVE_BOOST_STACKTRACE 1)
-  set(SIMGRID_DEP "${SIMGRID_DEP} -lboost_stacktrace_backtrace")
+if(minimal_java) # When we want a minimal jarfile, don't even search for boost optional components
+  message(STATUS "Don't even look for boost optional components, as we build a minimal jar file")
 else()
-  message (STATUS "  stacktrace: MISSING. Install libboost-stacktrace-dev to display the stacktraces.")
-  set(HAVE_BOOST_STACKTRACE 0)
-endif()
+  find_package(Boost 1.59 COMPONENTS context stacktrace_backtrace)
+  set(Boost_FOUND 1) # These components are optionals
+  message(STATUS "Mandatory components found. SimGrid is compilable.")
+  message(STATUS "Looking for optional Boost components:")
+
+  if (Boost_STACKTRACE_BACKTRACE_FOUND)
+    message (STATUS "  stacktrace: found. Activating human-readable stack traces.")
+    set(HAVE_BOOST_STACKTRACE 1)
+    set(SIMGRID_DEP "${SIMGRID_DEP} -lboost_stacktrace_backtrace")
+  else()
+    message (STATUS "  stacktrace: MISSING. Install libboost-stacktrace-dev to display the stacktraces.")
+    set(HAVE_BOOST_STACKTRACE 0)
+  endif()
 
-if(Boost_CONTEXT_FOUND)
-  message (STATUS "  context: found. Activating Boost contexts.")
-  set(HAVE_BOOST_CONTEXTS 1)
-else()
-  message (STATUS "  context: MISSING. Install libboost-context-dev for this optional feature.")
-  set(HAVE_BOOST_CONTEXTS 0)
+  if(Boost_CONTEXT_FOUND)
+    message (STATUS "  context: found. Activating Boost contexts.")
+    set(HAVE_BOOST_CONTEXTS 1)
+  else()
+    message (STATUS "  context: MISSING. Install libboost-context-dev for this optional feature.")
+    set(HAVE_BOOST_CONTEXTS 0)
+  endif()
 endif()
 
 
@@ -352,12 +356,16 @@ else()
   SET(SIMGRID_HAVE_MALLOCATOR 0)
 endif()
 
-include(FindLibunwind)
-if(HAVE_LIBUNWIND)
-  SET(SIMGRID_DEP "${SIMGRID_DEP} ${LIBUNWIND_LIBRARIES}")
+if (minimal_java)
+  message(STATUS "Don't look for libunwind as we build a minimal jar file.")
 else()
-  if(enable_model-checking)
-    message(FATAL_ERROR "Please install libunwind-dev libdw-dev libelf-dev libevent-dev if you want to compile the SimGrid model checker.")
+  include(FindLibunwind)
+  if(HAVE_LIBUNWIND)
+    SET(SIMGRID_DEP "${SIMGRID_DEP} ${LIBUNWIND_LIBRARIES}")
+  else()
+    if(enable_model-checking)
+      message(FATAL_ERROR "Please install libunwind-dev libdw-dev libelf-dev libevent-dev if you want to compile the SimGrid model checker.")
+    endif()
   endif()
 endif()
 
index 32a5b24..d4956fa 100644 (file)
@@ -27,6 +27,12 @@ option(enable_documentation "Whether to produce documentation" on)
 option(enable_ns3            "Whether ns3 model is activated." off)
 option(enable_java           "Whether the Java bindings are activated." off)
 option(enable_lib_in_jar     "Whether the native libraries are bundled in a Java jar file" on)
+option(minimal_java          "Whether to compile the jarfile with the minimal dependency set" off)
+mark_as_advanced(minimal_java)
+if(minimal_java)
+  set(enable_java on)
+  set(enable_lib_in_jar on)
+endif()
 
 option(enable_lua            "Whether the Lua bindings are activated." off)