diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fcb1f5..0e4e8bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,4 +32,5 @@ add_subdirectory("core-buffer") add_subdirectory("sf-buffer") add_subdirectory("sf-stream") add_subdirectory("sf-writer") -add_subdirectory("jf-live-writer") \ No newline at end of file +add_subdirectory("jf-live-writer") +add_subdirectory("jf-live-daq") \ No newline at end of file diff --git a/jf-live-daq/CMakeLists.txt b/jf-live-daq/CMakeLists.txt new file mode 100644 index 0000000..f2763dc --- /dev/null +++ b/jf-live-daq/CMakeLists.txt @@ -0,0 +1,26 @@ + +find_package(MPI REQUIRED) +# Because of openmpi. +add_definitions(-DOMPI_SKIP_MPICXX) + +file(GLOB SOURCES + src/*.cpp) + +add_library(jf-live-daq-lib STATIC ${SOURCES}) +target_include_directories(jf-live-daq-lib + PUBLIC include/ + SYSTEM ${MPI_INCLUDE_PATH}) + +target_link_libraries(jf-live-daq-lib + external + core-buffer-lib + ${MPI_LIBRARIES}) + +add_executable(jf-live-daq src/main.cpp) +set_target_properties(jf-live-daq PROPERTIES OUTPUT_NAME jf_live_daq) +target_link_libraries(jf-live-daq + jf-live-daq-lib + ) + +enable_testing() +add_subdirectory(test/) \ No newline at end of file diff --git a/jf-live-daq/src/main.cpp b/jf-live-daq/src/main.cpp new file mode 100644 index 0000000..7f6fc3e --- /dev/null +++ b/jf-live-daq/src/main.cpp @@ -0,0 +1,27 @@ +#include +#include + +int main(int argc, char** argv) { + // Initialize the MPI environment + MPI_Init(NULL, NULL); + + // Get the number of processes + int world_size; + MPI_Comm_size(MPI_COMM_WORLD, &world_size); + + // Get the rank of the process + int world_rank; + MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); + + // Get the name of the processor + char processor_name[MPI_MAX_PROCESSOR_NAME]; + int name_len; + MPI_Get_processor_name(processor_name, &name_len); + + // Print off a hello world message + printf("Hello world from processor %s, rank %d out of %d processors\n", + processor_name, world_rank, world_size); + + // Finalize the MPI environment. + MPI_Finalize(); +} diff --git a/jf-live-daq/test/CMakeLists.txt b/jf-live-daq/test/CMakeLists.txt new file mode 100644 index 0000000..7dc93bb --- /dev/null +++ b/jf-live-daq/test/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(jf-live-daq-tests main.cpp) + +target_link_libraries(jf-live-daq-tests + jf-live-daq-lib + hdf5 + hdf5_hl + hdf5_cpp + zmq + gtest + ) diff --git a/jf-live-daq/test/main.cpp b/jf-live-daq/test/main.cpp new file mode 100644 index 0000000..1ea4d8a --- /dev/null +++ b/jf-live-daq/test/main.cpp @@ -0,0 +1,9 @@ +#include "gtest/gtest.h" + + +using namespace std; + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}