Skip to content
Snippets Groups Projects
Commit 48cad22c authored by James Alexander Clark PhD's avatar James Alexander Clark PhD
Browse files

Merge branch 'build-with-cmake' into 'master'

Build with cmake

See merge request lscsoft/bayeswave!118
parents 0e3f279f 874e0f9b
No related branches found
Tags v1.0.3
No related merge requests found
...@@ -16,6 +16,8 @@ BayesWave ...@@ -16,6 +16,8 @@ BayesWave
BayesWaveCleanFrame BayesWaveCleanFrame
BayesWavePost BayesWavePost
BayesWaveToLALPSD BayesWaveToLALPSD
src/version.h
src/bayeswave.pc
# autotools stuff # autotools stuff
.libs/ .libs/
...@@ -31,7 +33,9 @@ configure ...@@ -31,7 +33,9 @@ configure
libtool libtool
Makefile Makefile
Makefile.in Makefile.in
bayeswave.spec
# docs stuff # docs stuff
doc/_build doc/_build
doc/index.rst doc/index.rst
...@@ -4,7 +4,7 @@ variables: ...@@ -4,7 +4,7 @@ variables:
NIGHTLY: $CI_REGISTRY_IMAGE:nightly NIGHTLY: $CI_REGISTRY_IMAGE:nightly
TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
BUILD_DIR: test-install BUILD_DIR: test-install
BUILD_TARGET: ${CI_PROJECT_DIR}/${BUILD_DIR} BUILD_TARGET: $CI_PROJECT_DIR/$BUILD_DIR
TEST_OUTPUT: test-output TEST_OUTPUT: test-output
stages: stages:
...@@ -16,59 +16,61 @@ stages: ...@@ -16,59 +16,61 @@ stages:
build-env: build-env:
stage: build stage: build
script: script:
- mkdir -p ${BUILD_TARGET} - mkdir -p $BUILD_TARGET
- sed "s|INSTALL_DIR|${BUILD_DIR}|g" ${CI_PROJECT_DIR}/etc/bayeswave-user-env.sh > ${BUILD_TARGET}/bayeswave-user-env.sh - sed "s|INSTALL_DIR|$BUILD_DIR|g" $CI_PROJECT_DIR/etc/bayeswave-user-env.sh > $BUILD_TARGET/bayeswave-user-env.sh
artifacts: artifacts:
paths: paths:
- ${BUILD_DIR} - $BUILD_DIR
build-bayeswave: build-bayeswave:
stage: build stage: build
image: ligo/software:stretch image: ligo/software:el7
script: script:
- pushd ${CI_PROJECT_DIR}/src - pushd $CI_PROJECT_DIR
- autoreconf --verbose --force --install --make - mkdir -p build
- ./configure --prefix ${BUILD_TARGET} CFLAGS="-Wno-format-truncation -g -O3" - cmake3 . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=true -DCMAKE_INSTALL_PREFIX=$BUILD_DIR
- make - cmake3 --build . -- VERBOSE=1
- make install - cmake3 --build . --target install
- popd - popd
artifacts: artifacts:
paths: paths:
- ${BUILD_DIR} - $BUILD_DIR
build-BayesWaveUtils: build-BayesWaveUtils:
stage: build stage: build
image: ligo/software:stretch image: ligo/software:el7
script: script:
- pushd BayesWaveUtils - pushd BayesWaveUtils
- python setup.py install --prefix ${BUILD_TARGET} - python setup.py install --prefix $BUILD_TARGET
- popd - popd
artifacts: artifacts:
paths: paths:
- ${BUILD_DIR} - $BUILD_DIR
# FIXME: including the full commandline here is illustrative. We have a test # FIXME: including the full commandline here is illustrative. We have a test
# script in the repository that does the same thing. # script in the repository that does the same thing.
test:BayesWave: test:BayesWave:
stage: test stage: test
image: ligo/software:stretch image: ligo/software:el7
script: script:
- source ${BUILD_DIR}/bayeswave-user-env.sh - source $BUILD_DIR/bayeswave-user-env.sh
- cat $BUILD_DIR/bayeswave-user-env.sh
- ls -R $BUILD_DIR
- BayesWave --help - BayesWave --help
- "BayesWave --ifo H1 --H1-flow 32 \ - "BayesWave --ifo H1 --H1-flow 32 \
--H1-cache LALSimAdLIGO --H1-channel LALSimAdLIGO \ --H1-cache LALSimAdLIGO --H1-channel LALSimAdLIGO \
--trigtime 900000000.00 --srate 512 --seglen 4 --PSDstart 900000000 \ --trigtime 900000000.00 --srate 512 --seglen 4 --PSDstart 900000000 \
--PSDlength 1024 --NCmin 2 --NCmax 2 --dataseed 1234 \ --PSDlength 1024 --NCmin 2 --NCmax 2 --dataseed 1234 \
--Niter 500 --outputDir ${TEST_OUTPUT}" --Niter 500 --outputDir $TEST_OUTPUT"
dependencies: dependencies:
- build-env - build-env
- build-bayeswave - build-bayeswave
test:BayesWavePost: test:BayesWavePost:
stage: test stage: test
image: ligo/software:stretch image: ligo/software:el7
script: script:
- source ${BUILD_DIR}/bayeswave-user-env.sh - source $BUILD_DIR/bayeswave-user-env.sh
- BayesWavePost --help - BayesWavePost --help
dependencies: dependencies:
- build-env - build-env
...@@ -76,15 +78,24 @@ test:BayesWavePost: ...@@ -76,15 +78,24 @@ test:BayesWavePost:
test:bayeswave_pipe: test:bayeswave_pipe:
stage: test stage: test
image: ligo/software:stretch image: ligo/software:el7
script: script:
- ls ${BUILD_DIR} - ls $BUILD_DIR
- source ${BUILD_DIR}/bayeswave-user-env.sh - source $BUILD_DIR/bayeswave-user-env.sh
- bayeswave_pipe --help - bayeswave_pipe --help
dependencies: dependencies:
- build-env - build-env
- build-BayesWaveUtils - build-BayesWaveUtils
test:docker:
stage: test
image: docker:latest
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- docker build --pull -t $CI_REGISTRY_IMAGE:latest --file Dockerfile .
- docker run $CI_REGISTRY_IMAGE:latest /test-bayeswave.sh
# FIXME: Add a proper test stage for the docker images # FIXME: Add a proper test stage for the docker images
docker:latest: docker:latest:
...@@ -97,7 +108,6 @@ docker:latest: ...@@ -97,7 +108,6 @@ docker:latest:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script: script:
- docker build --pull -t $CI_REGISTRY_IMAGE:latest --file Dockerfile . - docker build --pull -t $CI_REGISTRY_IMAGE:latest --file Dockerfile .
- docker run -u $(id -u):$(id -g) $CI_REGISTRY_IMAGE:latest "/opt/lscsoft/bayeswave/test/test-bayeswave.sh"
- docker push $CI_REGISTRY_IMAGE:latest - docker push $CI_REGISTRY_IMAGE:latest
...@@ -111,7 +121,6 @@ docker:tags: ...@@ -111,7 +121,6 @@ docker:tags:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script: script:
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --file Dockerfile . - docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --file Dockerfile .
- docker run -u $(id -u):$(id -g) $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG "/opt/lscsoft/bayeswave/test/test-bayeswave.sh"
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
docs: docs:
...@@ -124,7 +133,7 @@ docs: ...@@ -124,7 +133,7 @@ docs:
- apt-get -yqq update - apt-get -yqq update
- apt-get -yqq install curl - apt-get -yqq install curl
- curl --location --output pandoc.deb https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb - curl --location --output pandoc.deb https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb
- dpkg --install pandoc.deb || { apt-get -y -f install; dpkg --install pandoc.deb; } - dpkg --install pandoc.deb || apt-get -y -f install; dpkg --install pandoc.deb;
# install python dependencies # install python dependencies
- python3 -m pip install -r doc/requirements.txt - python3 -m pip install -r doc/requirements.txt
script: script:
......
#
# CMake packaging for BayesWave
# Copyright 2019 James Alexander Clark <james.clark@ligo.org>
# Based on CMake packaging for libframe & Frv by Duncan MacLeod <duncan.macleod@ligo.org>
#
# -- package info -----------
cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
project(
bayeswave
LANGUAGES C
VERSION 1.0.3
DESCRIPTION "LIGO/VIRGO burst analysis algorithm"
HOMEPAGE_URL "https://git.ligo.org/lscsoft/bayeswave"
)
include(GNUInstallDirs)
include(CheckFunctionExists)
find_package(PkgConfig)
find_package(Git)
# -- build components -------
# C library | enable/disable with -DENABLE_C={yes,no} (default yes)
add_subdirectory(src)
#add_subdirectory(doc)
# -- packaging components ---
set(SPEC_IN "${CMAKE_CURRENT_SOURCE_DIR}/bayeswave.spec.in")
set(SPEC "${CMAKE_CURRENT_SOURCE_DIR}/bayeswave.spec")
configure_file(${SPEC_IN} ${SPEC} @ONLY)
# -- build tarball ----------
#
# to build a source tarball:
#
# mkdir dist
# pushd dist
# cmake ..
# cmake --build . --target package_source
#
set(CPACK_PACKAGE_MAJOR ${${PROJECT_NAME}_MAJOR_VERSION})
set(CPACK_PACKAGE_MINOR ${${PROJECT_NAME}_MINOR_VERSION})
set(CPACK_PACKAGE_PATCH ${${PROJECT_NAME}_PATCH_VERSION})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_MAJOR}.${CPACK_PACKAGE_MINOR}.${CPACK_PACKAGE_PATCH}")
set(CPACK_SOURCE_GENERATOR TXZ)
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${${PROJECT_NAME}_VERSION})
set(CPACK_SOURCE_IGNORE_FILES
"/.*~$/"
".*~$"
"\\\\.svn/"
"\\\\.git"
"build/"
"CMakeFiles/"
"CMakeCache.txt"
"_CPack_Packages/"
"\\\\.cmake"
"Makefile"
"\\\\.deps/"
"autom4te.cache/"
"\\\\.tar\\\\.xz"
)
include(CPack)
FROM containers.ligo.org/lscsoft/lalsuite/lalsuite-v6.53:stretch FROM containers.ligo.org/lscsoft/lalsuite/lalsuite-v6.53:el7
ARG version ARG version
RUN echo "Building bayeswave" RUN echo "Building bayeswave"
MAINTAINER James Alexander Clark <james.clark@ligo.org> MAINTAINER James Alexander Clark <james.clark@ligo.org>
# Dependencies RUN yum upgrade -y && \
RUN apt-get update && apt-get install --assume-yes \ yum install -y gcc \
build-essential \ cmake3 \
pkg-config \ gcc-c++ \
python-pip \ help2man \
rpm-build \
which \
git \ git \
python-ligo-lw python-ligo-lw && \
yum clean all && \
rm -rf /var/cache/yum
RUN python -m pip install --upgrade setuptools # RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
# python get-pip.py && \
# rm get-pip.py
# Copy and build BayesWave # Copy and build BayesWave
WORKDIR / WORKDIR /tmp
# This seems very hacky but will get us git verion info in the configure.ac: RUN mkdir /tmp/bayeswave
COPY .git / COPY bayeswave.spec.in /tmp/bayeswave
COPY install.sh / COPY .git /tmp/bayeswave
COPY src /src COPY CMakeLists.txt /tmp/bayeswave
copy etc/bayeswave-user-env.sh /etc/bayeswave-user-env.sh COPY src /tmp/bayeswave/src
COPY BayesWaveUtils /BayesWaveUtils COPY etc/bayeswave-user-env.sh /tmp/bayeswave/etc/bayeswave-user-env.sh
RUN sh install.sh /opt/lscsoft/bayeswave COPY README.md /tmp
COPY test /opt/lscsoft/bayeswave/test COPY BayesWaveUtils /tmp/bayeswave/BayesWaveUtils
RUN rm -rf .git install.sh /src /BayesWaveUtils /etc/bayeswave-user-env.sh ADD test/test-bayeswave.sh /
RUN mkdir -p /cvmfs /hdfs /hadoop /etc/condor
# Python Utils
# BayesWave env RUN cd /tmp/bayeswave/BayesWaveUtils && \
ENV PATH /opt/lscsoft/bayeswave/bin:${PATH} python /tmp/bayeswave/BayesWaveUtils/setup.py install
ENV LD_LIBRARY_PATH /opt/lscsoft/bayeswave/lib:${LD_LIBRARY_PATH}
ENV PYTHONPATH /opt/lscsoft/bayeswave/lib/python2.7/site-packages:${PYTHONPATH} RUN mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
RUN echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
RUN mkdir dist && \
pushd dist && \
cmake3 /tmp/bayeswave && \
cmake3 --build . --target package_source && \
mv bayeswave-*.tar.xz /root/rpmbuild/SOURCES/ && \
popd
RUN rpmbuild -ba /tmp/bayeswave/bayeswave.spec
RUN rpm -ivh /root/rpmbuild/RPMS/x86_64/bayeswave-1.0.3-1.el7.x86_64.rpm
RUN rm -rf .git install.sh /src /BayesWaveUtils /etc/bayeswave-user-env.sh /build.sh /CMakeLists.txt /build
RUN mkdir -p /cvmfs /hdfs /hadoop /etc/condor /test
# Clean up
RUN rm -rf /tmp/* ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
WORKDIR /
ENTRYPOINT ["/bin/bash"] ENTRYPOINT ["/bin/bash"]
......
Name: @PROJECT_NAME@
Version: @PROJECT_VERSION@
Release: 1%{?dist}
Summary: @PROJECT_DESCRIPTION@
License: GPLv2
Source: http://software.ligo.org/lscsoft/source/%{name}-%{version}.tar.xz
URL: https://git.ligo.org/lscsoft/bayeswave
Packager: Duncan Macleod <duncan.macleod@ligo.org>
Prefix: %{_prefix}
# -- build requires ---------
BuildRequires: gcc, gcc-c++, glibc
BuildRequires: cmake3 >= 3.12.0
BuildRequires: make
BuildRequires: help2man
BuildRequires: gsl-devel
BuildRequires: fftw-devel
BuildRequires: libframe-devel
BuildRequires: libmetaio-devel
BuildRequires: lal-devel
BuildRequires: lalframe-devel
BuildRequires: lalmetaio-devel
BuildRequires: lalsimulation-devel
BuildRequires: lalinspiral-devel
BuildRequires: lalinference-devel
# -- package definitions ----
%description
A Bayesian algorithm designed to robustly distinguish gravitational wave
signals from noise and instrumental glitches without relying on any prior
assumptions of waveform morphology.
BayesWave produces posterior probability distributions directly on
gravitational wave signals and instrumental glitches, allowing robust,
morphology-independent waveform reconstruction.
%package devel
Summary: Files and documentation needed for compiling bayeswave programs
Requires: %{name} = %{version}
%description devel
A Bayesian algorithm designed to robustly distinguish gravitational wave
signals from noise and instrumental glitches without relying on any prior
assumptions of waveform morphology.
This package contains the files needed for building libframe programs
# -- build stages -----------
%prep
%setup -c -T -D -a 0 -n %{name}-%{version}
%build
%cmake3 \
-DCMAKE_BUILD_TYPE=Release \
%{name}-%{version}
%make_build
%install
%make_install
# man pages
mkdir -vp %{buildroot}%{_mandir}/man1
export LD_LIBRARY_PATH="%{buildroot}%{_libdir}:${LD_LIBRARY_PATH}"
help2man --source %{name} --version-string %{version} \
--section 1 --no-info --no-discard-stderr \
--output %{buildroot}%{_mandir}/man1/BayesWave.1 %{buildroot}%{_bindir}/BayesWave
help2man --source %{name} --version-string %{version} \
--section 1 --no-info --no-discard-stderr \
--output %{buildroot}%{_mandir}/man1/BayesWaveCleanFrame.1 %{buildroot}%{_bindir}/BayesWaveCleanFrame
help2man --source %{name} --version-string %{version} \
--section 1 --no-info --no-discard-stderr \
--output %{buildroot}%{_mandir}/man1/BayesWavePost.1 %{buildroot}%{_bindir}/BayesWavePost
help2man --source %{name} --version-string %{version} \
--section 1 --no-info --no-discard-stderr \
--output %{buildroot}%{_mandir}/man1/BayesWaveToLALPSD.1 %{buildroot}%{_bindir}/BayesWaveToLALPSD
%check
export LD_LIBRARY_PATH="%{buildroot}%{_libdir}:${LD_LIBRARY_PATH}"
export PKG_CONFIG_PATH="%{buildroot}%{_libdir}/pkgconfig:${PKG_CONFIG_PATH}"
# run each executable with no args (equivalent of --help)
%{buildroot}%{_bindir}/BayesWave
%{buildroot}%{_bindir}/BayesWaveCleanFrame
%{buildroot}%{_bindir}/BayesWavePost
%{buildroot}%{_bindir}/BayesWaveToLALPSD
# run pkg-config to check metadata
pkg-config --modversion @PROJECT_NAME@
%clean
rm -rf %{buildroot}
# -- files ------------------
%files
%{_bindir}/*
%{_libdir}/*.so.*
%{_mandir}/man1/*
%files devel
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%{_includedir}/*
# -- changelog --------------
# dates should be formatted using: 'date +"%a %b %d %Y"'
%changelog
* Thu Jun 6 2019 Duncan Macleod <duncan.macleod@ligo.org> 1.3.0-1
- Rework packaging for cmake
build.sh 0 → 100755
#!/bin/bash
set -e
INSTALL_PREFIX=$1
rm -rf build
mkdir -p build
pushd build
cmake3 .. \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=true
cmake3 --build . -- VERBOSE=1
cmake3 --build . --target install
popd
...@@ -14,5 +14,6 @@ pyminor=$(python -c 'import sys; print(sys.version_info[1])') ...@@ -14,5 +14,6 @@ pyminor=$(python -c 'import sys; print(sys.version_info[1])')
# BayesWave # BayesWave
export PATH=${BAYESWAVE_PREFIX}/bin:${PATH} export PATH=${BAYESWAVE_PREFIX}/bin:${PATH}
export LD_LIBRARY_PATH=${BAYESWAVE_PREFIX}/lib:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=${BAYESWAVE_PREFIX}/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=${BAYESWAVE_PREFIX}/lib64:${LD_LIBRARY_PATH}
export PYTHONPATH=${BAYESWAVE_PREFIX}/lib/python${pymajor}.${pyminor}/site-packages:${PYTHONPATH} export PYTHONPATH=${BAYESWAVE_PREFIX}/lib/python${pymajor}.${pyminor}/site-packages:${PYTHONPATH}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
set -e set -e
install_dir=${1} install_dir=${1}
# Remove trailing slash if present # Remove trailing slash if present
...@@ -31,19 +32,20 @@ echo "Installing to ${install_dir}" ...@@ -31,19 +32,20 @@ echo "Installing to ${install_dir}"
# #
# Configure and make main executables # Configure and make main executables
# #
START=${PWD} # START=${PWD}
cd src # cd src
autoreconf --verbose --force --install --make # autoreconf --verbose --force --install --make
./configure --prefix ${install_dir} CFLAGS="-Wno-format-truncation -g -O3" # ./configure --prefix ${install_dir} CFLAGS="-Wno-format-truncation -g -O3"
make install # make install
cd ${START} # cd ${START}
./build.sh ${install_dir}
# #
# Install python codes # Install python codes
# #
cd BayesWaveUtils pushd BayesWaveUtils
python setup.py install --prefix ${install_dir} python setup.py install --prefix ${install_dir}
cd ${START} popd
# #
# Environment script # Environment script
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <fftw3.h> #include <fftw3.h>
#include "version.h"
#include "BayesLine.h" #include "BayesLine.h"
#include "BayesWave.h" #include "BayesWave.h"
#include "BayesWaveIO.h" #include "BayesWaveIO.h"
...@@ -817,7 +818,7 @@ void print_version(FILE *fptr) ...@@ -817,7 +818,7 @@ void print_version(FILE *fptr)
fprintf(fptr, " Git version: %s\n", GIT_VER); fprintf(fptr, " Git version: %s\n", GIT_VER);
fprintf(fptr, " Git commit: %s\n", GIT_HASH); fprintf(fptr, " Git commit: %s\n", GIT_HASH);
fprintf(fptr, " Git commit author: %s\n",GIT_AUTHOR); fprintf(fptr, " Git commit author: %s\n",GIT_AUTHOR);
fprintf(fptr, " Git commit date: %s\n",GIT_DATE); fprintf(fptr, " Git commit date: %s\n", GIT_DATE);
} }
void print_run_flags(FILE *fptr, struct Data *data, struct Prior *prior) void print_run_flags(FILE *fptr, struct Data *data, struct Prior *prior)
{ {
......
# -- C library --------------
# library version | the rules for shared library version are complicated,
# the only very important thing is that if the ABI
# changes in a backwards-incompatible way, you should
# increment the MAJOR version number (and probably reset
# the others)
set(BAYESWAVE_VERSION_MAJOR 1)
set(BAYESWAVE_VERSION_MINOR 0)
set(BAYESWAVE_VERSION_PATCH 3)
set(BAYESWAVE_VERSION_STRING
${BAYESWAVE_VERSION_MAJOR}.${BAYESWAVE_VERSION_MINOR}.${BAYESWAVE_VERSION_PATCH})
# find headers
pkg_check_modules(GSL REQUIRED "gsl")
pkg_check_modules(FFTW REQUIRED "fftw3")
pkg_check_modules(fftw3f REQUIRED "fftw3f")
pkg_check_modules(LIBFRAME REQUIRED "libframe")
pkg_check_modules(LIBMETAIO REQUIRED "libmetaio")
pkg_check_modules(LAL REQUIRED "lal")
pkg_check_modules(LALSUPPORT REQUIRED "lalsupport")
pkg_check_modules(LALFRAME REQUIRED "lalframe")
pkg_check_modules(LALINFERENCE REQUIRED "lalinference")
pkg_check_modules(LALINSPIRAL REQUIRED "lalinspiral") # REALLY?
pkg_check_modules(LALMETAIO REQUIRED "lalmetaio")
pkg_check_modules(LALSIMULATION REQUIRED "lalsimulation")
# -- VCS info --------
execute_process(COMMAND
"${GIT_EXECUTABLE}" config --get remote.origin.url
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_URL
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "GIT_URL is ${GIT_URL}")
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe --dirty --always --tags
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_VER
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "GIT_VER is ${GIT_VER}")
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%H
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "GIT_HASH is ${GIT_HASH}")
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ae
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_AUTHOR
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "GIT_AUTHOR is ${GIT_AUTHOR}")
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ad
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "GIT_DATE is ${GIT_DATE}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
${CMAKE_CURRENT_SOURCE_DIR}/version.h @ONLY)
# define library
set(
BAYESWAVE_HEADERS
version.h
BayesLine.h
BayesWave.h
BayesWaveEvidence.h
BayesWaveIO.h
BayesWaveLikelihood.h
BayesWaveMCMC.h
BayesWaveMath.h
BayesWaveModel.h
BayesWavePrior.h
BayesWaveProposal.h
BayesWaveWavelet.h
)
add_library(
libbayeswave SHARED
BayesLine.c
BayesWaveIO.c
BayesWaveMath.c
BayesWaveModel.c
BayesWaveWavelet.c
BayesWavePrior.c
BayesWaveLikelihood.c
BayesWaveProposal.c
BayesWaveEvidence.c
BayesWaveMCMC.c
)
target_include_directories(libbayeswave PRIVATE
${GSL_INCLUDE_DIRS}
${FFTW_INCLUDE_DIRS}
${FFTW3F_INCLUDE_DIRS}
${LIBFRAME_INCLUDE_DIRS}
${LIBMETAIO_INCLUDE_DIRS}
${LAL_INCLUDE_DIRS}
${LALSUPPORT_INCLUDE_DIRS}
${LALFRAME_INCLUDE_DIRS}
${LALINFERENCE_INCLUDE_DIRS}
${LALINSPIRAL_INCLUDE_DIRS}
${LALMETAIO_INCLUDE_DIRS}
${LALSIMULATION_INCLUDE_DIRS}
)
target_link_libraries(libbayeswave
m
gsl
fftw3
fftw3f
Frame
lal
lalsupport
lalframe
lalinference
lalinspiral
lalmetaio
lalsimulation
)
set_target_properties(
libbayeswave PROPERTIES
OUTPUT_NAME bayeswave
VERSION ${BAYESWAVE_VERSION_STRING}
SOVERSION ${BAYESWAVE_VERSION_MAJOR}
PUBLIC_HEADER "${BAYESWAVE_HEADERS}"
)
set_property(TARGET libbayeswave PROPERTY C_STANDARD 11)
# install
install(
TARGETS libbayeswave
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# -- executables --------
add_executable(BayesWave BayesWave.c)
target_link_libraries(BayesWave libbayeswave)
set_property(TARGET BayesWave PROPERTY C_STANDARD 11)
add_executable(BayesWavePost BayesWavePost.c)
target_link_libraries(BayesWavePost libbayeswave)
set_property(TARGET BayesWavePost PROPERTY C_STANDARD 11)
add_executable(BayesWaveCleanFrame BayesWaveCleanFrame.c)
target_link_libraries(BayesWaveCleanFrame libbayeswave)
set_property(TARGET BayesWaveCleanFrame PROPERTY C_STANDARD 11)
add_executable(BayesWaveToLALPSD BayesWaveToLALPSD.c)
target_link_libraries(BayesWaveToLALPSD libbayeswave)
set_property(TARGET BayesWaveToLALPSD PROPERTY C_STANDARD 11)
install(
TARGETS
BayesWave
BayesWavePost
BayesWaveCleanFrame
BayesWaveToLALPSD
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# -- pkgconfig --------------
# install pkgconfig file
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Libs: -L${libdir} -llibbayeswave
Libs.private: -L${libdir} -lgsl -lfftw3 -lfftwf -lFrame -llal -llalsupport -llalframe -llalinference -llalinspiral -llalmetaio -llalsimulation
Cflags: -I${includedir}
/* Git VCS info
* Define macros for substitution by cmake. Macros used in BayesWaveIO.c.
* Copyright (C) 2019 James A. Clark <james.clark@ligo.org>
*/
#define GIT_URL "@GIT_URL@"
#define GIT_VER "@GIT_VER@"
#define GIT_HASH "@GIT_HASH@"
#define GIT_AUTHOR "@GIT_AUTHOR@"
#define GIT_DATE "@GIT_DATE@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment