#
# LDASTools Frame Utilities - A library to extend manipulation of LIGO/Virgo Frame
# Files
#
# Copyright (C) 2018 California Institute of Technology
#
# LDASTools Frame Utilities is free software; you may redistribute it and/or
# modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 (GPLv2) of the
# License or at your discretion, any later version.
#
# LDASTools Frame Utilities is distributed in the hope that it will be useful, but
# without any warranty or even the implied warranty of merchantability
# or fitness for a particular purpose. See the GNU General Public
# License (GPLv2) for more details.
#
# Neither the names of the California Institute of Technology (Caltech),
# The Massachusetts Institute of Technology (M.I.T), The Laser
# Interferometer Gravitational-Wave Observatory (LIGO), nor the names
# of its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# You should have received a copy of the licensing terms for this
# software included in the file LICENSE located in the top-level
# directory of this package. If you did not, you can view a copy at
# http://dcc.ligo.org/M1500244/LICENSE
#
# -*-mode: makefile;-*-
#------------------------------------------------------------------------

#------------------------------------------------------------------------
#  5:0:0 - 2015.05.08
#    Small changes to resampling code
#  6:0:0 - 2016.09.09
#    Reduced code distinction between reduced and resampled frames.
#    Added Padding option
#  7:0:0 - ldas-tools-frameAPI-2.6.0
#    Removed hand rolled smart pointers in favor of boost smart pointers
# 7:1:0 - ldas-tools-frameAPI-2.6.4
#    Minor code cleanup
# 8:0:0 - ldas-tools-frameAPI-3.0.0
#    * Added structure to allow for channel name renaming for createRDS methods
#    * Heavily modified rdsreduce code to handle analysis ready reduction
# 8:1:0 - ldas-tools-frameAPI-3.0.1
#    * Restored reading of channel names from a file.
# 9:0:1 - ldas-tools-frameAPI-3.0.2
#    * Made it so reading of channels from a file could be called from
#      exteral libraries
# 9:1:1 - ldas-tools-frameAPI-3.0.3
#    * Remove white spaces when reading channels from a file.
# 9:2:1 - ldas-tools-frameAPI-3.0.5
#------------------------------------------------------------------------
# form: <(c)urrent>:<(r)evision>:<(a)ge
#
# 1. Update the version information only immediately before a public
#    release of your software. More frequent updates are unnecessary,
#    and only guarantee that the current interface number gets larger
#    faster.
# 2. If the library source code has changed at all since the last
#    update, then increment revision (c:r:a becomes c:r+1:a).
# 3. If any interfaces [exported functions or data] have been added,
#    removed, or changed since the last update, increment current,
#    and set revision to 0.
# 4. If any interfaces have been added since the last public
#    release, then increment age.
# 5. If any interfaces have been removed since the last public
#    release, then set age to 0.
#------------------------------------------------------------------------

set( libldasframe_la_CURRENT 9 )
set( libldasframe_la_REVISION 3 )
set( libldasframe_la_AGE 1 )

set(HH_DIR frameAPI)
set( ldasframehhdir ${CMAKE_INSTALL_INCLUDEDIR}/${HH_DIR} )

set( ldasframehh_HEADERS
  CalibrationVector.hh
  createRDS.hh
	filereader.hh
	Frame.hh
	Catalog.hh
	Channel.hh
  Intervals.hh
	rdsframe.hh
	rdsreduce.hh
	rdsresample.hh
	util.hh )

set( libldasframe_la_SOURCES
	Catalog.cc
	Channel.cc
	createRDS.cc
	DeviceIOConfiguration.cc
	filereader.cc
	Frame.cc
	FrameH.cc
	FrAdcData.cc
	FrProcData.cc
	FrRawData.cc
	FrVect.cc
	MountMgr.cc
	ResampleCmd.cc
	rdsframe.cc
	rdsreduce.cc
	rdsresample.cc
	RDSStreamFile.cc
	RDSStreamMemory.cc
	rdsutil.cc
	SAMFSLoader.cc
	Stage.cc
	util.cc )

set( libldasframe_la_LIBADD
  ${LDASTOOLS_LIBRARIES_FULL_PATH}
  ${Boost_LIBRARIES}
  )

cx_link_headers( ${HH_DIR} ${ldasframehh_HEADERS} )

# Build static library only if BUILD_STATIC_LIBS is ON
cx_static_libs_arg(_static_arg)

cx_target_library(
  TARGET ldasframe
  CURRENT ${libldasframe_la_CURRENT}
  REVISION ${libldasframe_la_REVISION}
  AGE ${libldasframe_la_AGE}
  ${_static_arg}
  SOURCES ${libldasframe_la_SOURCES}
  LIBRARIES ${libldasframe_la_LIBADD}
  INCLUDE_DIRECTORIES BEFORE PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/include
    ${CMAKE_BINARY_DIR}
    ${LDASTOOLS_INCLUDE_DIRS}
  ABI_MESSAGE "LDAS Frame Library"
  ABI_HEADER_DIR ${HH_DIR}
  ABI_LOCAL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include/${HH_DIR}
  ABI_HEADERS ${ldasframehh_HEADERS}
  )

install(
  FILES ${ldasframehh_HEADERS}
  DESTINATION "${ldasframehhdir}" )

cx_target_executable(
  ldas_analysis_ready
  SOURCES ldas_analysis_ready.cc
  LDADD ldasframe Boost::regex Threads::Threads
  INCLUDE_DIRECTORIES BEFORE PRIVATE
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_BINARY_DIR}/include
  ${CMAKE_BINARY_DIR}
  ${LDASTOOLS_INCLUDE_DIRS}
  )

cx_target_pkgconfig( ldastools-ldasframe )
