Commit f1caaba1 authored by Yuelong Yu's avatar Yuelong Yu
Browse files

added pkg-config file

parent 3f604e76
......@@ -19,7 +19,7 @@ message(STATUS "library output path is:${LIBRARY_OUTPUT_PATH}")
#install path
set(CMAKE_INSTALL_LIB_PATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_INC_PATH "${CMAKE_INSTALL_PREFIX}/include/fsdetector/lambda")
set(CMAKE_INSTALL_INC_PATH "${CMAKE_INSTALL_PREFIX}/include/fsdetector/agipdrecv")
message(STATUS "install path is:${CMAKE_INSTALL_PREFIX}")
#add module
......@@ -81,6 +81,8 @@ set(SHARED_LINKER_FLAGS
h5cpp
hdf5_serial)
set(PKG_LIBS "-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -lboost_system -lboost_filesystem -lboost_regex -lboost_date_time -lpnicore -lpniio -lh5cpp -lhdf5_serial -lhdf5_hl -lboost_thread -lpthread -lz")
#src
#add_subdirectory("include")
add_subdirectory("src")
......
prefix = @CMAKE_INSTALL_PREFIX@
includedir = ${prefix}/include
libdir = ${prefix}/lib
Name: @PROJECT_NAME@
Description:
URL:
Version: @LIBRARY_VERSION@
Requires: fsdetcore
Libs: -L${libdir} -l@PROJECT_NAME@ @PKG_LIBS@
Cflags: -I${includedir}
set(SOURCES main.cpp
set(SOURCES #main.cpp
DataReceiver.cpp
FileSavingTask.cpp
ReceiverTask.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${SHARED_LINKER_FLAGS})
#set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${LIBRARY_VERSION}"
# SOVERSION "${SO_VERSION}")
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${LIBRARY_VERSION}"
SOVERSION "${SO_VERSION}")
#install target
#install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIB_PATH})
......@@ -23,12 +23,32 @@ configure_file(${CMAKE_MODULE_PATH}/Version.h.cmake
${PROJECT_SOURCE_DIR}/src/Version.h @ONLY)
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "include dir='${dir}'")
endforeach()
# get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
# foreach(dir ${dirs})
# message(STATUS "include dir='${dir}'")
# endforeach()
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LINK_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "library dir='${dir}'")
endforeach()
# get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LINK_DIRECTORIES)
# foreach(dir ${dirs})
# message(STATUS "library dir='${dir}'")
# endforeach()
#install target
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIB_PATH})
#create and install pkg-config file
configure_file(${CMAKE_MODULE_PATH}/pkgconfig.pc.cmake
${EXECUTABLE_OUTPUT_PATH}/${PROJECT_NAME}.pc @ONLY)
install(FILES ${EXECUTABLE_OUTPUT_PATH}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIB_PATH}/pkgconfig)
set(HEADERS
AGIPDRecvGlobals.h
DataReceiver.h
Version.h)
#install header files
install(FILES ${HEADERS} DESTINATION "${CMAKE_INSTALL_INC_PATH}")
......@@ -9,6 +9,8 @@ namespace FSDataRecvNS
unique_ptr<DataReceiver> DataReceiver::Instance()
{
LOG_TRACE(__FUNCTION__);
// if it is empty create new instance
if(!m_data_receiver)
m_data_receiver = unique_ptr<DataReceiver>(new DataReceiver());
......@@ -17,9 +19,13 @@ namespace FSDataRecvNS
DataReceiver::~DataReceiver()
{
LOG_TRACE(__FUNCTION__);
if(m_status != ON)
Stop();
m_receiver_task->Exit();
m_filesaving_task->Exit();
m_threadpool.reset();
}
......@@ -29,13 +35,19 @@ namespace FSDataRecvNS
int16 pixel_depth,
string udp_ip,
int32 port,
int32 buffer_length)
int32 buffer_length,
Enum_log_level level)
{
LOG_TRACE(__FUNCTION__);
InitLogLevel(level);
m_x = x;
m_y =y;
m_img_size = m_x * m_y;
m_pixel_depth = pixel_depth;
m_buffer_length = buffer_length;
m_max_frame_numbers = m_buffer_length;
m_live_image = shared_ptr<int32>(new int32[m_img_size]);
......@@ -76,6 +88,7 @@ namespace FSDataRecvNS
void DataReceiver::SetFrameNumbers(int32 frame_number)
{
LOG_TRACE(__FUNCTION__);
m_requested_frames = frame_number;
m_receiver_task->SetRequestFrames(m_requested_frames);
m_filesaving_task->SetRequestFrames(m_requested_frames);
......@@ -83,39 +96,52 @@ namespace FSDataRecvNS
int32 DataReceiver::GetReceivedImages()
{
LOG_TRACE(__FUNCTION__);
return m_receiver_task->GetReceivedImages();
}
int32 DataReceiver::GetSavedImages()
{
LOG_TRACE(__FUNCTION__);
if(m_save_file)
return m_filesaving_task->GetSavedImages();
else
return m_receiver_task->GetReceivedImages();
return 0;
}
int32 DataReceiver::GetMaxFrameNumbers()
{
LOG_TRACE(__FUNCTION__);
return m_max_frame_numbers;
}
void DataReceiver::SetFileSaving(bool save_data)
{
LOG_TRACE(__FUNCTION__);
m_save_file = save_data;
}
void DataReceiver::SetFileName(string file_name)
{
LOG_TRACE(__FUNCTION__);
m_file_name = file_name;
}
void DataReceiver::SetFramesPerFile(int32 frames_per_file)
{
LOG_TRACE(__FUNCTION__);
m_frames_per_file = frames_per_file;
}
void DataReceiver::SetFileStructureWithXML(string file_structure)
{
LOG_TRACE(__FUNCTION__);
if(m_save_file)
m_filesaving_task->SetFileStructureWithXML(file_structure);
}
Enum_detector_state DataReceiver::GetStatus()
{
LOG_TRACE(__FUNCTION__);
int32 received_images = m_receiver_task->GetReceivedImages();
int32 saved_images = m_filesaving_task->GetSavedImages();
......@@ -148,6 +174,8 @@ namespace FSDataRecvNS
void DataReceiver::Start()
{
LOG_TRACE(__FUNCTION__);
std::fill(m_live_image.get(),m_live_image.get()+m_img_size,0);
m_status = BUSY;
......@@ -165,6 +193,8 @@ namespace FSDataRecvNS
void DataReceiver::Stop()
{
LOG_TRACE(__FUNCTION__);
m_status = ON;
m_receiver_task->Stop();
......@@ -176,6 +206,8 @@ namespace FSDataRecvNS
int32& frame_number,
int16& error_code)
{
LOG_TRACE(__FUNCTION__);
m_receiver_task->GetLiveImageData(m_live_image,frame_number,error_code);
img_data = m_live_image;
}
......@@ -188,5 +220,6 @@ namespace FSDataRecvNS
m_start_acq(false),m_stop_acq(false),m_save_file(false),
m_status(DISABLE),m_file_name("test")
{
LOG_TRACE(__FUNCTION__);
}
}
......@@ -46,14 +46,15 @@ namespace FSDataRecvNS
* @param pixel_depth image pixel depth
* @param udp_ip ip of data link
* @param port port of data linke
* @param buffer_length tells how much memory is reserved for images. default is 10
* @param buffer_length tells how much memory is reserved for images
*/
void InitDataReceiver(int32 x,
int32 y,
int16 pixel_depth,
string udp_ip,
int32 port,
int32 buffer_length = 10);
int32 buffer_length,
Enum_log_level level=ERROR);
/**
* @brief set requested frame numbers
......@@ -66,6 +67,12 @@ namespace FSDataRecvNS
* @return received images
*/
int32 GetReceivedImages();
/**
* @brief get saved images when file saving is enabled
* @return saved images
*/
int32 GetSavedImages();
/**
* @brief get maximum possible frames
......@@ -73,6 +80,12 @@ namespace FSDataRecvNS
*/
int32 GetMaxFrameNumbers();
/**
* @brief get total loss frames during acquisition
* @return loss frames
*/
int32 GetTotalLossFrames();
/**
* @brief enable file saving or not
* @param save_data true: data will be saved.
......@@ -123,7 +136,7 @@ namespace FSDataRecvNS
void GetLiveImageData(shared_ptr<int32>& img_data,
int32& frame_number,
int16& error_code);
protected:
/**
* @brief contructor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment