#
# LDASTools filtes - A library implementing filtering algorithms
#
# Copyright (C) 2018 California Institute of Technology
#
# LDASTools filtes 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 filtes 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
#
#include $(LDAS_DIRECTORY_MAKE_INCLUDE)/compilerflags.mk
#
#noinst_DATA =
#
#AM_CPPFLAGS= -I$(srcdir)/../src -I$(top_builddir)/include $(LDASTOOLSAL_INCLUDES)
include_directories(
  BEFORE
    ${CMAKE_CURRENT_SOURCE_DIR}
    "${CMAKE_BINARY_DIR}/include"
    ${CMAKE_BINARY_DIR}
    "${CMAKE_SOURCE_DIR}/src"
    ${LDASTOOLS_INCLUDE_DIRS}
  )
set( LDADD ${LDASTOOLS_LIBRARIES_FULL_PATH} )
#
#
#EXTRA_DIST = \
#	tWindowIn.dat \
#	tWindowOutHW.dat \
#	tWindowOutKW.dat \
#	tWindowOutRW.dat \
#	tFIRLPH2.dat \
#	tFIRLPH.dat \p
#	tFIRLPR.dat \
#	tKFIRLP1.dat \
#	tKFIRLP2.dat \
#	tLinFiltAP16384.dat \
#	tLinFiltFIR16384.dat \
#	tLinFiltIIR16384.dat \
#	tLinFiltIn16384.dat \
#	tResample100.dat
#
#EXTRA_PROGRAMS = $(TESTS) \
#	tFiltPerf \
#	tResPerf
#
#TESTS_ENVIRONMENT=env DATADIR=$(srcdir)
set( TESTS_ENVIRONMENT
  "DATADIR=${CMAKE_CURRENT_SOURCE_DIR}"
  "TEST_DIR=${CMAKE_SOURCE_DIR}/src/Utilities"
  )

set( tBasic_array_SOURCES tBasic_array.cc )
set( tFiltPerf_SOURCES tFiltPerf.cc )
set( tFIRLP_SOURCES tFIRLP.cc )
set( tGCD_SOURCES tGCD.cc )
set( tInterpolate_SOURCES tInterpolate.cc )
set( tKFIRLP_SOURCES  tKFIRLP.cc )
set( tLinFilt_SOURCES tLinFilt.cc )
set( tResample_SOURCES tResample.cc )
set( tResPerf_SOURCES tResPerf.cc )
set( tSinc_SOURCES tSinc.cc )
set( tWindow_SOURCES tWindow.cc )

set ( TESTS
	tBasic_array
	tFIRLP
	tGCD
	tInterpolate
	tKFIRLP
	tLinFilt
	tResample
	tSinc
	tWindow
)

cx_target_executable(
  tBasic_array
  NOINST
  SOURCES ${tBasic_array_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tFIRLP
  NOINST
  SOURCES ${tFIRLP_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tGCD
  NOINST
  SOURCES ${tGCD_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tInterpolate
  NOINST
  SOURCES ${tInterpolate_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tKFIRLP
  NOINST
  SOURCES ${tKFIRLP_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tLinFilt
  NOINST
  SOURCES ${tLinFilt_SOURCES}
  LDADD filters ${LDADD} dl
  )

cx_target_executable(
  tResample
  NOINST
  SOURCES ${tResample_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tSinc
  NOINST
  SOURCES ${tSinc_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tWindow
  NOINST
  SOURCES ${tWindow_SOURCES}
  LDADD filters ${LDADD}
  )

cx_target_executable(
  tFiltPerf
  NOINST
  SOURCES ${tFiltPerf_SOURCES}
  LDADD filters ${LDADD}
  )

add_test( NAME tBasic_array COMMAND tBasic_array )
add_test( NAME tFIRLP COMMAND tFIRLP )
add_test(	NAME tGCD COMMAND tGCD )
add_test( NAME tInterpolate COMMAND tInterpolate )
add_test( NAME tKFIRLP COMMAND tKFIRLP )
add_test( NAME tLinFilt COMMAND tLinFilt )
add_test( NAME tResample COMMAND tResample )
add_test( NAME tSinc COMMAND tSinc )
add_test( NAME tWindow COMMAND tWindow )

set_tests_properties( ${TESTS} PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" )

#------------------------------------------------------------------------

cx_scheme_sanitizer_set_environment( )

##========================================================================
## Valgrind support
##========================================================================
#include $(LDAS_DIRECTORY_MAKE_INCLUDE)/recursive.mk
#
#clean-local:
#	rm -f $(TESTS)
#
