Build fix lalsuite from src
Updates the cmake build instructions such that they use pkg-config
to search for e.g. LAL libraries. Provided PKG_CONFIG_PATH
is correctly set (usually achieved via source lalsuiterc
), users should now be able to build BayesWave against local installations of LALSuite
built from source and installed to e.g. /home/user/opt/lscsoft/lalsuite
etc, which is potentially useful for development against bleeding-edge waveforms etc.
Does not affect users' installations using system-installed packages.
I've also added an additional Dockerfile which can be used (manually for now) to test this process.
Merge request reports
Activity
assigned to @james-clark
I think this has the general idea @duncanmmacleod
This looks fine to me, an alternative to that is to use
find_library
to resolve the absolute path of the relevant library before using that intarget_link_libraries
:diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2b31e2..521d37c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,15 +11,31 @@ set(BAYESWAVE_VERSION_PATCH 3) set(BAYESWAVE_VERSION_STRING ${BAYESWAVE_VERSION_MAJOR}.${BAYESWAVE_VERSION_MINOR}.${BAYESWAVE_VERSION_PATCH}) -# find headers +# find libraries pkg_check_modules(GSL REQUIRED "gsl") -pkg_check_modules(FFTW REQUIRED "fftw3") -pkg_check_modules(fftw3f REQUIRED "fftw3f") +find_library(LIBGSL "gsl" PATHS ${GSL_LIBRARY_DIRS}) +message(STATUS " Found libgsl in ${LIBGSL}") +pkg_check_modules(FFTW3 REQUIRED "fftw3") +find_library(LIBFFTW3 "fftw3" PATHS ${FFTW3_LIBRARY_DIRS}) +message(STATUS " Found libfftw3 in ${LIBFFTW3}") +pkg_check_modules(FFTW3F REQUIRED "fftw3f") +find_library(LIBFFTW3F "fftw3f" PATHS ${FFTW3F_LIBRARY_DIRS}) +message(STATUS " Found libfftw3d in ${LIBFFTW3F}") pkg_check_modules(LAL REQUIRED "lal") +find_library(LIBLAL "lal" PATHS ${LAL_LIBRARY_DIRS}) +message(STATUS " Found liblal in ${LIBLAL}") pkg_check_modules(LALSUPPORT REQUIRED "lalsupport") +find_library(LIBLALSUPPORT "lalsupport" PATHS ${LALSUPPORT_LIBRARY_DIRS}) +message(STATUS " Found liblalsupport in ${LIBLALSUPPORT}") pkg_check_modules(LALFRAME REQUIRED "lalframe") +find_library(LIBLALFRAME "lalframe" PATHS ${LALFRAME_LIBRARY_DIRS}) +message(STATUS " Found liblalframe in ${LIBLALFRAME}") pkg_check_modules(LALINFERENCE REQUIRED "lalinference") +find_library(LIBLALSIMULATION "lalsimulation" PATHS ${LALSIMULATION_LIBRARY_DIRS}) +message(STATUS " Found liblalsimulation in ${LIBLALSIMULATION}") pkg_check_modules(LALSIMULATION REQUIRED "lalsimulation") +find_library(LIBLALINFERENCE "lalinference" PATHS ${LALINFERENCE_LIBRARY_DIRS}) +message(STATUS " Found liblalinference in ${LIBLALINFERENCE}") # -- VCS info -------- @@ -92,10 +108,9 @@ message(STATUS "LAL_LIBDIR is ${LAL_LIBDIR}") message(STATUS "LAL_CFLAGS is ${LAL_CFLAGS}") message(STATUS "LAL_LDFLAGS is ${LAL_LDFLAGS}") -#target_include_directories(libbayeswave PRIVATE target_include_directories(libbayeswave PUBLIC ${GSL_INCLUDE_DIRS} - ${FFTW_INCLUDE_DIRS} + ${FFTW3_INCLUDE_DIRS} ${FFTW3F_INCLUDE_DIRS} ${LAL_INCLUDE_DIRS} ${LALSUPPORT_INCLUDE_DIRS} @@ -106,14 +121,14 @@ target_include_directories(libbayeswave PUBLIC target_link_libraries(libbayeswave m - gsl - fftw3 - fftw3f - ${LAL_LDFLAGS} - ${LALSUPPORT_LDFLAGS} - ${LALFRAME_LDFLAGS} - ${LALINFERENCE_LDFLAGS} - ${LALSIMULATION_LDFLAGS} + ${LIBGSL} + ${LIBFFTW3} + ${LIBFFTW3F} + ${LIBLAL} + ${LIBLALSUPPORT} + ${LIBLALFRAME} + ${LIBLALINFERENCE} + ${LIBLALSIMULATION} ) set_target_properties( libbayeswave PROPERTIES
added 14 commits
-
82109b1f...929cbe50 - 4 commits from branch
lscsoft:master
- 448b293a - Use pkg-config derived LDFLAGS instead of library names for lalsuite libs
- 72c16a18 - remove pkg_search (experimenting)
- 0c81abef - Setting up example dockerfiles for different build procedures
- 82e54122 - Adding explicit bayeswave build commands to dockerfile
- ff720bb4 - Revert "Use pkg-config derived LDFLAGS instead of library names for lalsuite libs"
- 0c7033b4 - Revert "remove pkg_search (experimenting)"
- 941fefbd - Revert "Revert "remove pkg_search (experimenting)""
- 3f02ae1b - Build now locates libraries using pkg-config to support linking against custom...
- dffd2f48 - reorganised the dev dockerfile a bit
- 14f6e467 - Merge branch 'build-fix-lalsuite-from-src' of...
Toggle commit list-
82109b1f...929cbe50 - 4 commits from branch
mentioned in commit 47b95372