mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
step one project reorganization
This commit is contained in:
parent
8d6ee6ff46
commit
1b28cc88ff
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
#project(slsDetectorPackage LANGUAGES CXX)
|
||||
# cmake_minimum_required(VERSION 3.5)
|
||||
project(slsDetectorPackage)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
set (CALIBRATE OFF)
|
||||
@ -38,6 +38,14 @@ find_package(Qwt 6)
|
||||
find_package(CBF)
|
||||
find_package(Doxygen)
|
||||
|
||||
if (USE_TESTS)
|
||||
enable_testing()
|
||||
endif(USE_TESTS)
|
||||
|
||||
# Support library containing functionallity common to
|
||||
# detector and receiver
|
||||
add_subdirectory(slsSupportLib)
|
||||
|
||||
if (USE_HDF5)
|
||||
find_package(HDF5 1.10 COMPONENTS CXX)
|
||||
endif (USE_HDF5)
|
||||
@ -69,9 +77,9 @@ if (USE_GUI)
|
||||
endif()
|
||||
endif (USE_GUI)
|
||||
|
||||
if (USE_SUPPORT_LIB)
|
||||
add_subdirectory(slsSupportLib)
|
||||
endif(USE_SUPPORT_LIB)
|
||||
|
||||
|
||||
|
||||
|
||||
if (CALIBRATE)
|
||||
if (DEFINED ENV{ROOTSYS})
|
||||
@ -82,9 +90,6 @@ if (CALIBRATE)
|
||||
endif()
|
||||
endif(CALIBRATE)
|
||||
|
||||
if (USE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif(USE_TESTS)
|
||||
|
||||
install(FILES ${ZMQ_STATIC_ARCHIVE}
|
||||
DESTINATION lib)
|
||||
|
10
examples/remove_shm.sh
Executable file
10
examples/remove_shm.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/csh -f
|
||||
#set l = `ipcs -m | grep "$USER"| cut -c12-19`
|
||||
set l = `ipcs -m | cut -c0-10`
|
||||
foreach s ( $l )
|
||||
echo $s
|
||||
ipcrm -M $s
|
||||
end
|
||||
#if ($#l != 0 )
|
||||
echo $#l shared memory\(s\) for $user removed
|
||||
|
@ -4,17 +4,12 @@ set(SOURCES
|
||||
slsDetector/slsDetectorUsers.cpp
|
||||
slsDetector/slsDetectorCommand.cpp
|
||||
slsDetector/slsDetector.cpp
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/src/ClientInterface.cpp
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/src/utilities.cpp
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/src/string_utils.cpp
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/src/CmdLineParser.cpp
|
||||
)
|
||||
|
||||
set(HEADERS
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include
|
||||
multiSlsDetector
|
||||
sharedMemory
|
||||
slsDetector
|
||||
@ -26,25 +21,16 @@ add_library(slsDetectorShared SHARED
|
||||
)
|
||||
|
||||
target_link_libraries(slsDetectorShared
|
||||
slsSupportLib
|
||||
zmq
|
||||
)
|
||||
|
||||
|
||||
set(PUBLICHEADERS
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/sls_detector_defs.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/sls_detector_funcs.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/error_defs.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/versionAPI.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/sls_detector_exceptions.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/utilities.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/container_utils.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/string_utils.h
|
||||
sharedMemory/SharedMemory.h
|
||||
slsDetector/slsDetector.h
|
||||
slsDetector/slsDetectorUsers.h
|
||||
slsDetector/detectorData.h
|
||||
multiSlsDetector/multiSlsDetector.h
|
||||
${PROJECT_SOURCE_DIR}/slsSupportLib/include/ClientInterface.h
|
||||
)
|
||||
set_target_properties(slsDetectorShared PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME SlsDetector
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "utilities.h"
|
||||
#include "file_utils.h"
|
||||
|
||||
#include "string_utils.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "gitInfoLib.h"
|
||||
#include "versionAPI.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "utilities.h"
|
||||
#include "file_utils.h"
|
||||
#include "string_utils.h"
|
||||
#include "MySocketTCP.h"
|
||||
|
||||
|
@ -10,7 +10,6 @@ set(SOURCES
|
||||
src/DataProcessor.cpp
|
||||
src/DataStreamer.cpp
|
||||
src/Fifo.cpp
|
||||
../slsSupportLib/src/ClientInterface.cpp
|
||||
)
|
||||
|
||||
|
||||
@ -30,30 +29,22 @@ if (USE_HDF5)
|
||||
endif (USE_HDF5)
|
||||
|
||||
|
||||
#add_definitions(
|
||||
# -DVERBOSE
|
||||
#)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
../slsSupportLib/include
|
||||
)
|
||||
|
||||
# include_directories(
|
||||
# ${SLS_SUPPORT_LIB_INCLUDE_DIRS}
|
||||
# )
|
||||
|
||||
add_library(slsReceiverShared SHARED
|
||||
${SOURCES}
|
||||
${HEADERS}
|
||||
)
|
||||
|
||||
set(PUBLICHEADERS
|
||||
../slsSupportLib/include/sls_detector_defs.h
|
||||
../slsSupportLib/include/ansi.h
|
||||
../slsSupportLib/include/sls_detector_funcs.h
|
||||
../slsSupportLib/include/MySocketTCP.h
|
||||
../slsSupportLib/include/genericSocket.h
|
||||
../slsSupportLib/include/logger.h
|
||||
../slsSupportLib/include/sls_detector_exceptions.h
|
||||
)
|
||||
target_link_libraries(slsReceiverShared slsSupportLib)
|
||||
target_include_directories(slsReceiverShared PUBLIC include)
|
||||
|
||||
#What is included in slsReceiverLib?
|
||||
# set(PUBLICHEADERS
|
||||
|
||||
# )
|
||||
|
||||
|
||||
set_target_properties(slsReceiverShared PROPERTIES
|
||||
@ -70,6 +61,7 @@ set_target_properties(slsReceiver PROPERTIES
|
||||
)
|
||||
|
||||
target_link_libraries(slsReceiver
|
||||
slsSupportLib
|
||||
slsReceiverShared
|
||||
pthread
|
||||
zmq
|
||||
|
@ -6,7 +6,7 @@
|
||||
/**
|
||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
||||
*/
|
||||
#include "sls_detector_defs.h"
|
||||
// #include "sls_detector_defs.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "logger.h"
|
||||
#include "container_utils.h"
|
||||
@ -15,6 +15,7 @@ class Listener;
|
||||
class DataProcessor;
|
||||
class DataStreamer;
|
||||
class Fifo;
|
||||
class slsDetectorDefs;
|
||||
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
|
49
slsSupportLib/CMakeLists.txt
Normal file
49
slsSupportLib/CMakeLists.txt
Normal file
@ -0,0 +1,49 @@
|
||||
set(SOURCES
|
||||
src/ClientInterface.cpp
|
||||
src/CmdLineParser.cpp
|
||||
src/string_utils.cpp
|
||||
src/file_utils.cpp
|
||||
)
|
||||
|
||||
|
||||
set(HEADERS
|
||||
)
|
||||
|
||||
set(PUBLICHEADERS
|
||||
include/ansi.h
|
||||
include/sls_detector_defs.h
|
||||
include/sls_detector_funcs.h
|
||||
include/error_defs.h
|
||||
include/versionAPI.h
|
||||
include/sls_detector_exceptions.h
|
||||
include/file_utils.h
|
||||
include/container_utils.h
|
||||
include/string_utils.h
|
||||
include/ClientInterface.h
|
||||
include/MySocketTCP.h
|
||||
include/genericSocket.h
|
||||
include/logger.h
|
||||
)
|
||||
|
||||
add_library(slsSupportLib SHARED
|
||||
${SOURCES}
|
||||
${HEADERS}
|
||||
)
|
||||
|
||||
target_include_directories(slsSupportLib PUBLIC include)
|
||||
|
||||
set_target_properties(slsSupportLib PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME SlsSupport
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
PUBLIC_HEADER "${PUBLICHEADERS}"
|
||||
)
|
||||
|
||||
if (USE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif(USE_TESTS)
|
||||
|
||||
install(TARGETS slsSupportLib
|
||||
LIBRARY DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
#include "utilities.h"
|
||||
#include "file_utils.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <iostream>
|
26
slsSupportLib/tests/CMakeLists.txt
Normal file
26
slsSupportLib/tests/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/catch
|
||||
../include
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
test.cpp
|
||||
test-CmdLineParser.cpp
|
||||
test-container_utils.cpp
|
||||
test-string_utils.cpp
|
||||
test-Timer.cpp
|
||||
)
|
||||
|
||||
add_executable(testSlsSupportLib ${SOURCES})
|
||||
target_link_libraries(testSlsSupportLib
|
||||
slsSupportLib
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
set_target_properties(testSlsSupportLib PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
#TODO! Move to automatic test discovery
|
||||
add_test(test-slsSupportLib ${CMAKE_BINARY_DIR}/bin/testSlsSupportLib)
|
23
slsSupportLib/tests/test-Timer.cpp
Normal file
23
slsSupportLib/tests/test-Timer.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "Timer.h"
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
TEST_CASE("Time 1s restart then time 2s") {
|
||||
auto sleep_duration = std::chrono::seconds(1);
|
||||
auto t = sls::Timer();
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
REQUIRE(t.elapsed_s() == Approx(1).epsilon(0.01));
|
||||
|
||||
t.restart();
|
||||
std::this_thread::sleep_for(sleep_duration * 2);
|
||||
REQUIRE(t.elapsed_s() == Approx(2).epsilon(0.01));
|
||||
}
|
||||
|
||||
TEST_CASE("Return ms") {
|
||||
auto sleep_duration = std::chrono::milliseconds(1300);
|
||||
auto t = sls::Timer();
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
REQUIRE(t.elapsed_ms() == Approx(1300).epsilon(0.5));
|
||||
}
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "string_utils.h"
|
||||
|
||||
#define VERBOSE
|
||||
|
||||
TEST_CASE("copy a string") {
|
||||
|
3
slsSupportLib/tests/test.cpp
Normal file
3
slsSupportLib/tests/test.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
// tests-main.cpp
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
Loading…
x
Reference in New Issue
Block a user