From e0fbd001bebcbd8d78a59473fd8e777749551d08 Mon Sep 17 00:00:00 2001 From: Roland Schulz Date: Thu, 6 Mar 2014 17:30:48 -0500 Subject: [PATCH] Disable shared libraries by default for mdrun-only 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 | 8 +++++++- cmake/gmxManageSharedLibraries.cmake | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/admin/installguide/installguide.tex b/admin/installguide/installguide.tex index 000ba61020..cfee6c537c 100644 --- a/admin/installguide/installguide.tex +++ b/admin/installguide/installguide.tex @@ -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{}} diff --git a/cmake/gmxManageSharedLibraries.cmake b/cmake/gmxManageSharedLibraries.cmake index d4794d1378..cc73de31b4 100644 --- a/cmake/gmxManageSharedLibraries.cmake +++ b/cmake/gmxManageSharedLibraries.cmake @@ -32,14 +32,14 @@ # 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)") -- 2.22.0