Merge pull request #296 from rolk/296_runpath

Embed original dependency paths in installed library
This commit is contained in:
Bård Skaflestad 2013-08-01 09:36:54 -07:00
commit 900a21adb3
4 changed files with 30 additions and 3 deletions

View File

@ -1,8 +1,24 @@
# - Default settings for the build # - Default settings for the build
include (UseCompVer) include (UseCompVer)
include(TestCXXAcceptsFlag)
macro (opm_defaults opm) macro (opm_defaults opm)
# if we are installing a development version (default when checking out of
# VCS), then remember which directories were used when configuring. package
# distribution should disable this option.
option (USE_RUNPATH "Embed original dependency paths in installed library" ON)
if (USE_RUNPATH)
if (CMAKE_COMPILER_IS_GNUCXX)
check_cxx_accepts_flag ("-Wl,--enable-new-dtags" HAVE_RUNPATH)
if (HAVE_RUNPATH)
list (APPEND ${opm}_LINKER_FLAGS "-Wl,--enable-new-dtags")
endif (HAVE_RUNPATH)
endif (CMAKE_COMPILER_IS_GNUCXX)
# set this to avoid CMake stripping it off again
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif (USE_RUNPATH)
# build release by default # build release by default
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release") set (CMAKE_BUILD_TYPE "Release")

View File

@ -19,6 +19,7 @@ Optional Features:
of the options shared and static may be built. of the options shared and static may be built.
--enable-debug build a non-optimized version of the library --enable-debug build a non-optimized version of the library
[default=no] [default=no]
--disable-runpath do not use RUNPATH in installed library [default=yes]
--enable-lto use whole program optimization [default=no] --enable-lto use whole program optimization [default=no]
--disable-tests do not compile and enable unit tests [default=yes] --disable-tests do not compile and enable unit tests [default=yes]
--disable-examples do not compile example programs [default=yes] --disable-examples do not compile example programs [default=yes]
@ -108,6 +109,8 @@ silent_rules=
debug_loc= debug_loc=
#use_lto=" -DWHOLE_PROG_OPTIM=OFF" #use_lto=" -DWHOLE_PROG_OPTIM=OFF"
use_lto= use_lto=
#use_runpath=" -DUSE_RUNPATH=OFF"
use_runpath=
#use_tests=" -DBUILD_TESTING=ON" #use_tests=" -DBUILD_TESTING=ON"
use_tests= use_tests=
#use_samples=" -DBUILD_EXAMPLES=ON" #use_samples=" -DBUILD_EXAMPLES=ON"
@ -235,6 +238,10 @@ for OPT in "$@"; do
pch_use=" -DPRECOMPILE_HEADERS:BOOL=OFF" pch_use=" -DPRECOMPILE_HEADERS:BOOL=OFF"
pkgname="" pkgname=""
;; ;;
runpath)
use_runpath=" -DUSE_RUNPATH=OFF"
pkgname=""
;;
silent-rules) silent-rules)
silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON" silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON"
pkgname="" pkgname=""
@ -313,6 +320,10 @@ for OPT in "$@"; do
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
shared="" shared=""
;; ;;
runpath)
use_runpath=" -DUSE_RUNPATH=ON"
shared=""
;;
lto) lto)
use_lto=" -DWHOLE_PROG_OPTIM=ON" use_lto=" -DWHOLE_PROG_OPTIM=ON"
shared="" shared=""
@ -373,7 +384,7 @@ for a in "${VARS[@]}"; do
done done
# pass everything on to CMake # pass everything on to CMake
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_tests}${use_samples} ${FEATURES}" CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples} ${FEATURES}"
echo --- calling CMake --- echo --- calling CMake ---
echo ${CMDLINE} echo ${CMDLINE}
eval exec ${CMDLINE} eval exec ${CMDLINE}

2
debian/rules vendored
View File

@ -19,7 +19,7 @@ override_dh_auto_build:
dh_auto_build --buildsystem=cmake dh_auto_build --buildsystem=cmake
override_dh_auto_configure: override_dh_auto_configure:
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 -DWHOLE_PROG_OPTIM=ON dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF
override_dh_auto_install: override_dh_auto_install:
dh_auto_install -- install-html dh_auto_install -- install-html

View File

@ -59,7 +59,7 @@ This package contains the applications for opm-core
%setup -q %setup -q
%build %build
cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DWHOLE_PROG_OPTIM=ON cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF
make make
%install %install