set(PACKAGE data_converters-ngpipes-hdf5)

message(STATUS ${PACKAGE})

enable_nls()

include(FindProtobuf)
find_package(Protobuf REQUIRED)
find_package(gRPC REQUIRED)
find_package(HDF5)
find_package(OpenSSL REQUIRED)
find_package(vaisala-wr-common-dto REQUIRED)
find_package(spdlog REQUIRED)

set(PIPE_NAMES pb2odimhdf5 odimhdf52pb hdf52iris)
set(SCRIPTS raw2odimhdf5 odimhdf52raw)
set(CONF_FILES hdf52iris.conf pb2odimhdf5.conf odimhdf52pb.conf)
set(SOURCE_FILES
        simplehdf5.cpp
        hdf5schema.cpp
        hdf5rxtx.cpp
        hdf5rangemask.cpp
        hdf5sweep.cpp
        hdf5io.cpp)

include_directories(
                ${HDF5_INCLUDE_DIR}
                ${CMAKE_SOURCE_DIR}/ngpipes)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

link_libraries(rscan-iris sws-iris wrdata siglog hdf5 dl tirpc boost_program_options boost_system boost_filesystem 
        boost_regex boost_date_time m hdf5 hdf5_cpp user-iris dsp-iris config-iris antenna-iris exthdr-iris himath-iris misc-iris spdlog::spdlog OpenSSL::Crypto)

add_executable(h5read_test h5read.cpp simplehdf5.cpp)
add_executable(iris2hdf5 iris2hdf5.cpp ${SOURCE_FILES})
add_executable(hdf52iris hdf52iris.cpp ${SOURCE_FILES})

add_executable(pb2odimhdf5 pb2odimhdf5.cpp  ${SOURCE_FILES})
target_link_libraries(pb2odimhdf5 vaisala-wr-common-dto::common-dto protoc ${Boost_LIBRARIES} m z lz4 ${PROTOBUF_LIBRARIES})

add_executable(odimhdf52pb odimhdf52pb.cpp  ${SOURCE_FILES})
target_link_libraries(odimhdf52pb vaisala-wr-common-dto::common-dto protoc ${Boost_LIBRARIES} m z lz4 ${PROTOBUF_LIBRARIES})

install(TARGETS ${PIPE_NAMES} DESTINATION ${IRIS_PIPES} COMPONENT hdf5)
install(PROGRAMS ${SCRIPTS} DESTINATION ${IRIS_PIPES} COMPONENT hdf5)
install(FILES ${CONF_FILES} DESTINATION ${IRIS_CONFIG_TMPL} COMPONENT hdf5)

