cmake_minimum_required(VERSION 3.22)

project(Phoenix)

find_package(PhoenixCMake REQUIRED)

set(PROJECT_VERSION "1.0.1") # this line is updated by semantic release using regex

phoenix_base_project("PhoenixProtoBuffStreamToHdf5" "${PROJECT_VERSION}"
		"Set of tools to decode offset from protocol buffer"
		"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/network/PhoenixProtoBuffStreamToHdf5")

pull_extra_module("PhoenixCore" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/system/PhoenixCore.git")
pull_extra_module("PhoenixDataStream" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/serialize-io/PhoenixDataStream.git")
pull_extra_module("PhoenixOptionParser" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/config/PhoenixOptionParser.git")
pull_extra_module("PhoenixProtocolBuffer" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/network/PhoenixProtocolBuffer.git")

find_package(HDF5 COMPONENTS CXX)

phoenix_include_directories(
	${CMAKE_CURRENT_SOURCE_DIR}
	${CMAKE_CURRENT_BINARY_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}/src
)

phoenix_create_find_full(PhoenixProtoBuffStreamToHdf5
	"phoenix_protobuff_stream_to_hdf5.h"
	"phoenix_protobuff_stream_to_hdf5"
	"phoenix_protocol_buffer_stream_to_hdf5"
	""
	PhoenixCore PhoenixDataStream PhoenixOptionParser PhoenixProtocolBuffer
)

set(PROTOBUFF_DUMPER_LIBRARIES phoenix_protocol_buffer phoenix_data_stream phoenix_core)

if(SELF_TESTS_MODE)
	set(STREAM_DATA_CUT ${CMAKE_CURRENT_SOURCE_DIR}/TESTS/swat_100_messages.pzmq)
	add_definitions(-DSTREAM_DATA_CUT="${STREAM_DATA_CUT}")
endif()

phoenix_add_subdirectory(src)

phoenix_tests()

if(NOT DOC_ONLY)
	add_subdirectory(program)
endif()
