Disable shared libraries by default for mdrun-only
authorRoland Schulz <roland@utk.edu>
Thu, 6 Mar 2014 22:30:48 +0000 (17:30 -0500)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 31 Mar 2014 07:25:27 +0000 (09:25 +0200)
Shared libraries don't have any advantage for mdrun-only
build.

Also, add warning that someone re-using a normal build tree for a
subsequent mdrun-only build may want to manage this aspect explicitly.

Documented all this behaviour in the install guide.

Change-Id: I65fad0df8e54003599544903276a2be0ac61bbc2

admin/installguide/installguide.tex
cmake/gmxManageSharedLibraries.cmake

index 000ba61020861b2055ed674a41c5ac63cc16a390..cfee6c537cf6cd6a6219700f7f5dcdf7ee23362a 100644 (file)
@@ -666,7 +666,13 @@ now supported with the \cmake{} option
 \verb+-DGMX_BUILD_MDRUN_ONLY=ON+, which will build a cut-down version
 of \verb+libgromacs+ and/or the \verb+mdrun+ binary (according to
 whether shared or static). Naturally, now \verb+make install+ acts
-only those binaries.
+only those binaries. By default, a fresh build tree with this variable
+set will default to building statically, because this is generally a
+good idea for the targets for which an mdrun-only build is
+desirable. If you re-use a build tree and change to the mdrun-only
+build, then you will inherit the setting for \verb+BUILD_SHARED_LIBS+
+from the old build, and will be warned that you may wish to manage
+\verb+BUILD_SHARED_LIBS+ yourself.
 
 \subsection{Installing \gromacs{}}
 
index d4794d1378651e37f9df4ae207322ff6a06cbedf..cc73de31b447636ff325072a75fc7a9daabf4116 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-# Manage the Gromacs shared librar setup. 
+# Manage the Gromacs shared library setup.
 
 ########################################################################
 # Shared/static library settings
 ########################################################################
 # Determine the defaults (this block has no effect if the variables have
 # already been set)
-if(APPLE OR CYGWIN OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux|.*BSD")
+if((APPLE OR CYGWIN OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux|.*BSD") AND NOT GMX_BUILD_MDRUN_ONLY)
     # Maybe Solaris should be here? Patch this if you know!
     SET(SHARED_LIBS_DEFAULT ON)
 elseif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "BlueGene")
@@ -66,6 +66,10 @@ endif()
 
 # Declare the user-visible options
 option(BUILD_SHARED_LIBS "Enable shared libraries (can be problematic e.g. with MPI, or on some HPC systems)" ${SHARED_LIBS_DEFAULT})
+if(BUILD_SHARED_LIBS AND GMX_BUILD_MDRUN_ONLY)
+    message(WARNING "Both BUILD_SHARED_LIBS and GMX_BUILD_MDRUN_ONLY are set. Generally, an mdrun-only build should prefer to use static libraries, which is the default if you make a fresh build tree. You may be re-using an old build tree, and so may wish to set BUILD_SHARED_LIBS=off yourself.")
+endif()
+
 if (UNIX)
     set(GMX_PREFER_STATIC_LIBS_DESCRIPTION
         "When finding libraries prefer static archives (it will only work if static versions of external dependencies are available and found)")