#include $(LDAS_DIRECTORY_MAKE_INCLUDE)/compilerflags.mk
#
#NAMESPACE=ldastoolsal
#PKG_SWIGFLAGS=$(LDASTOOLSAL_SWIGFLAGS)
#
##------------------------------------------------------------------------
## form: <(c)urrent>:<(r)elease>:<(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.
##------------------------------------------------------------------------
## 1:0:0 -- 2014.06.10
##    Library name change general -> ldastoolsal
## 1:1:0 -- 2014.09.19
##    Modifications resulting in the 2.0.3 release of ldas-tools
## 2:0:0 -- 2015.05.08
##    Added elements to class CommandLineOptions
##    Added parameters to MemChecker.Append( )
##    Added method MemChecker.Info( )
##    Added method ThreadPool.Active( )
##    Added mehtod mutex_lock::baton_type::bool( )
##    Added member to mutex_lock::baton_type
## 3:0:0 - 2015.07.06
##    Added SignalHandler class
## 4:0:0 - 2016.03.03
##    Modified Directory class
## 4:1:0 - 2016.09.09
##    Added leap second for 2017.01.01
##    Addressed valgrind issue by using new instead of strdup
## 4:2:0 - 2016.09.15
##    Added functions Timeout and Interval
## 4:3:0 - 2016.09.26
##    Added optional Thread debugging
## 4:4:0 - 2016.10.10
##    Corrections to how threads handle signals.
##    Optimized registration of signal handler.
## 4:5:0 - 2016.11.14
##    Correction to internal allocation of directory buffer
## 5:0:1 - 2017.10.25 (ldas-tools-al-2.5.7)
##    Added routines needed for diskcache
## 6:0:0 - 2018.05.11 ( ldas-tools-al-2.6.0 )
##    Removed hand rolled smart pointers in favor of boost smart pointers
## 7:0:0 - ????.??.?? ( ldas-tools-al-2.6.1 )
##    Removed LDASUnexpected class
## 7:1:0 - 2019.08.14 ( ldas-tools-al-2.6.3 )
##    Minor patching
## 7:2:0 - 2021.03.09 ( ldas-tools-al-2.6.5 )
##------------------------------------------------------------------------

set( libldastoolsal_la_CURRENT 7 )
set( libldastoolsal_la_REVISION 2 )
set( libldastoolsal_la_AGE 0 )

#lib_LTLIBRARIES = libldastoolsal.la
#
#noinst_LTLIBRARIES = libldastoolspreload.la
#
#libldastoolspreload_la_SOURCES = \
#	Unlocked.cc
#
set( libldastoolsal_la_SOURCES 
	AtExit.cc
	CommandLineOptions.cc
	ConditionalVariable.cc
	Config.cc
	DeadLockDetector.cc
	Directory.cc
	Exec.cc
	IOLock.cc
	Log.cc
	MemChecker.cc
	MkDir.cc
	mutexlock.cc
	PSInfo.cc
	ReadWriteLock.cc
	SignalHandler.cc
	Timeout.cc
	TimerThread.cc
	base64.cc
	errors.cc
	errorinfo.cc
	ErrorLog.cc
	FileType.cc
	Fork.cc
	fstream.cc
	gpstime.cc
	Pool.cc
	regex.cc
	regexmatch.cc
	Sed.cc
	Singleton.cc
	SOLoader.cc
	streamexception.cc
	System.cc
	SystemCall.cc
	SystemCallTask.cc
	Task.cc
	TaskTimer.cc
	TaskThread.cc
	Thread.cc
	ThreadPool.cc
	UserInfoCache.cc
	util.cc
	toss.cc
	ldasexception.cc
)
#
#libldastoolsal_la_LDFLAGS = $(LDASTOOLSAL_LIBTOOL_VERSION_FLAG) $(LDFLAGS) $(BOOST_LDFLAGS)
#libldastoolsal_la_LIBADD = -ldl
#

set( HDR_DIR ldastoolsal )
set( ldastoolsalhhdir "${CMAKE_INSTALL_INCLUDEDIR}/${HDR_DIR}" )

set( ldastoolsalhh_HEADERS
 	AtExit.hh
 	BackgroundTaskCounter.hh
 	CommandLineOptions.hh
 	ConditionalVariable.hh
 	Config.hh
 	DeadLockDetector.hh
 	Deprecated.hh
 	Directory.hh
 	Exec.hh
 	InfixIterator.hh
 	IOLock.hh
 	Log.hh
 	MemChecker.hh
 	MkDir.hh
 	PtrHash.hh
 	PSInfo.hh
 	ReadWriteLock.hh
 	ReadWriteSingleton.hh
 	Sed.hh
 	SignalHandler.hh
 	Singleton.hh
 	SingletonMacro.hh
 	Timeout.hh
 	TimerThread.hh
 	base64.hh
 	bit_vector.hh
 	compiler.h
 	errors.hh
 	errorinfo.hh
 	ErrorLog.hh
 	FileType.hh
 	Fork.hh
 	formatexception.hh
 	fstream.hh
 	gpstime.hh
 	ldasexception.hh
 	mutexlock.hh
 	objectregistry.hh
 	objectregistry.icc
 	Pool.hh
 	port.hh
 	Profile.hh
 	regex.hh
 	regexmatch.hh
 	SOLoader.hh
 	streamexception.hh
 	System.hh
 	SystemCall.hh
 	SystemCallTask.hh
 	Task.hh
 	TaskTimer.hh
 	TaskThread.hh
 	Thread.hh
 	ThreadPool.hh
 	TriStatePool.hh
 	unittest.h
 	UnitTestTS.h
 	util.hh
 	unimplemented_error.hh
 	toss.hh
 	UserInfoCache.hh
)

set( nodist_ldastoolsalhh_HEADERS
	ldas_types.h
	reverse.hh
	types.hh
	unordered_map.hh
  )

foreach( filename ${nodist_ldastoolsalhh_HEADERS} )
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.in
    ${CMAKE_CURRENT_BINARY_DIR}/${filename}
    @ONLY
    )
endforeach( )

cx_link_headers( ${HDR_DIR} ${ldastoolsalhh_HEADERS} )
cx_link_headers( BUILT_HEADERS ${HDR_DIR} ${nodist_ldastoolsalhh_HEADERS} )

set( libldastoolsal_la_LIBADD
  ${Boost_LIBRARIES} ${CMAKE_DL_LIBS}
  )

cx_target_library(
  TARGET ldastoolsal
  CURRENT ${libldastoolsal_la_CURRENT}
  REVISION ${libldastoolsal_la_REVISION}
  AGE ${libldastoolsal_la_AGE}
  STATIC
  SOURCES ${libldastoolsal_la_SOURCES}
  DEFINES
  HAVE_CONFIG_H=1
  LIBRARIES ${libldastoolsal_la_LIBADD}
  INCLUDE_DIRECTORIES BEFORE PRIVATE
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_BINARY_DIR}/include
  ${CMAKE_BINARY_DIR}
  ${Boost_INCLUDE_DIRS}
  ABI_MESSAGE "LDAS Tools Abstraction Library"
  ABI_HEADER_DIR ${HDR_DIR}
  ABI_LOCAL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include/${HDR_DIR}
  ABI_HEADERS ${ldastoolsalhh_HEADERS}
  )
target_link_libraries( ldastoolsal Threads::Threads )

foreach(filename ${nodist_ldastoolsalhh_HEADERS})
  list(APPEND nodist_full_ldastoolsalhh_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/${filename}" )
endforeach( )
install(
  FILES ${ldastoolsalhh_HEADERS} ${nodist_full_ldastoolsalhh_HEADERS}
  DESTINATION ${ldastoolsalhhdir}
  )

cx_target_pkgconfig( ldastoolsal )
