set(PACKAGE base-dsp_lib)

message(STATUS ${PACKAGE})

set(INST_INCLUDES dsp_lib.h)
set(LIB_NAME dsp)
set(LIBI_NAME dspi)

set(SOURCE_FILES_DSP
    dsp_def.h
    dsp_lib.h
    customops.c
    dsp_info.c
    dsp_lib_nls_init.c
    dsp_open.c
    dsp_open_for_io.c
    dsp_read.c
    dsp_set_prf.c
    dsp_start.c
    dsp_strings.c
    dsp_write.c
    dspi_mask.c
    dspr_subs.c
    DspResetFifo.c
    dspw_subs.c
    fradar_constant.c
    intelhex.c
    ireadtrigload.c
    OpenSocket.c
    trig_wform_gen.c)

set(SOURCE_FILES_DSPI
    dsp_def.h
    dsp_lib.h
    dsp_info.c
    dsp_lib_nls_init.c
    dsp_open.c
    dsp_strings.c
    dspi_mask.c
    fradar_constant.c
    intelhex.c
    OpenSocket.c
    trig_wform_gen.c)

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/../antenna_lib
  ${CMAKE_CURRENT_SOURCE_DIR}/../config_lib
  ${CMAKE_CURRENT_SOURCE_DIR}/../include
  ${CMAKE_CURRENT_SOURCE_DIR}/../user_lib)

add_library(${LIB_NAME} SHARED ${SOURCE_FILES_DSP})
add_library(${LIBI_NAME} SHARED ${SOURCE_FILES_DSPI})

set(LIB_MAJOR_VER 10) # Set Library major version, this is also used for SO file versioning
set(LIB_MINOR_VER 0) # Set Library minor version
set(LIB_PATCH_VER 0) # Set Library patch version
set(LIB_VERSION "${LIB_MAJOR_VER}.${LIB_MINOR_VER}.${LIB_PATCH_VER}")
set_target_properties(${LIB_NAME} PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VER})

set(LIBI_MAJOR_VER 10) # Set Library major version, this is also used for SO file versioning
set(LIBI_MINOR_VER 0) # Set Library minor version
set(LIBI_PATCH_VER 0) # Set Library patch version
set(LIBI_VERSION "${LIBI_MAJOR_VER}.${LIBI_MINOR_VER}.${LIBI_PATCH_VER}")
set_target_properties(${LIBI_NAME} PROPERTIES VERSION ${LIBI_VERSION} SOVERSION ${LIBI_MAJOR_VER})

add_subdirectory(po)

install(
  TARGETS ${LIB_NAME}
  DESTINATION ${IRIS_LIB}
  LIBRARY COMPONENT base NAMELINK_COMPONENT devel)

install(
  TARGETS ${LIBI_NAME}
  DESTINATION ${IRIS_LIB}
  LIBRARY COMPONENT base NAMELINK_COMPONENT devel)

install(
  FILES ${INST_INCLUDES}
  DESTINATION ${IRIS_INCLUDE}
  COMPONENT devel)
