cmake_minimum_required(VERSION 3.22)

project(Phoenix)

find_package(PhoenixCMake REQUIRED)

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

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

pull_extra_module("PhoenixCore" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/system/PhoenixCore.git")
pull_extra_module("PhoenixCheckStream" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/serialize-io/PhoenixCheckStream.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("PhoenixFileParser" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/config/PhoenixFileParser.git")
pull_extra_module("PhoenixYml" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/config/PhoenixYml.git")

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

phoenix_create_find_full(PhoenixProtocolBuffer
	"phoenix_protocol_buffer.h"
	"phoenix_protocol_buffer"
	"phoenix_protocol_buffer_print"
	""
	PhoenixCore PhoenixDataStream PhoenixOptionParser PhoenixFileParser PhoenixYml
)

set(STREAM_DATA_CUT ${CMAKE_CURRENT_SOURCE_DIR}/TESTS/cut_messages.pzmq)
set(SWAT_STREAM_DATA_CUT ${CMAKE_CURRENT_SOURCE_DIR}/TESTS/swat_cut_messages.pzmq)
add_definitions(-DSTREAM_DATA_CUT="${STREAM_DATA_CUT}")
add_definitions(-DSWAT_STREAM_DATA_CUT="${SWAT_STREAM_DATA_CUT}")

set(LID_LIB_DEPENDENCIES phoenix_yml phoenix_file_parser phoenix_core phoenix_data_stream phoenix_check_stream)

set(PHOENIXPROTOCOLBUFFER_TEST_DEPENDENCIES
	phoenix_protocol_buffer
	${LID_LIB_DEPENDENCIES}
)

phoenix_add_subdirectory(src)
add_subdirectory(program)

phoenix_tests()
