From 8563ef44bb428e669fbe7dc20a0ea0ce421b4b91 Mon Sep 17 00:00:00 2001 From: Andreas Neiser Date: Wed, 26 Jun 2013 17:56:51 +0200 Subject: [PATCH] Hadaq binaries and libhadaq are built, and somewhat tested --- allParam/CMakeLists.txt | 11 +++--- hadaq/CMakeLists.txt | 74 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 hadaq/CMakeLists.txt diff --git a/allParam/CMakeLists.txt b/allParam/CMakeLists.txt index f4611ad..a766312 100644 --- a/allParam/CMakeLists.txt +++ b/allParam/CMakeLists.txt @@ -4,18 +4,21 @@ find_package(TCL QUIET) if(NOT TCL_FOUND) message(FATAL_ERROR "TCL is required, forgot to install the -dev package?") endif() + include_directories(${TCL_INCLUDE_PATH}) -add_library(tclParam STATIC "tcl/tclParam.c") -#target_link_libraries(tclParam ${TCL_LIBRARY}) +add_library(tclParam STATIC + tcl/tclParam.c) +target_link_libraries(tclParam ${TCL_LIBRARY}) # don't know if the threads enabled lib # is needed at all... but it's easy with cmake ^-^ set(CMAKE_THREAD_PREFER_PTHREAD "ON") find_package(Threads QUIET) if(Threads_FOUND) - add_library(tclParam_p STATIC "tcl/tclParam.c") + add_library(tclParam_p STATIC + tcl/tclParam.c) set_target_properties(tclParam_p PROPERTIES COMPILE_DEFINITIONS PTHREADS) - #target_link_libraries(tclParam_p ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(tclParam_p ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) endif() diff --git a/hadaq/CMakeLists.txt b/hadaq/CMakeLists.txt new file mode 100644 index 0000000..3ae587d --- /dev/null +++ b/hadaq/CMakeLists.txt @@ -0,0 +1,74 @@ +# the sources list is copied from the old Makefile.am autotools stuff + + +# handle some common dependencies +include_directories(../allParam/include ${CMAKE_CURRENT_BINARY_DIR}) +find_library(RT_LIBRARY rt) +if(NOT RT_LIBRARY) + message(FATAL_ERROR "rt library not found") +endif() + +# and some generated stuff from rpcgen +# it needs some generated files and it's a mess to generate them :( +find_program(RPCGEN_EXE rpcgen) +if(NOT RPCGEN_EXE) + message(FATAL_ERROR "rpcgen executable not found in PATH") +endif() + +function(generate_rpc_helper INFILE OUTFILE OPTIONS EXTRA_DEPENDS) + add_custom_command(OUTPUT ${OUTFILE} + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${OUTFILE} + COMMAND ${RPCGEN_EXE} ${OPTIONS} -o ${CMAKE_CURRENT_BINARY_DIR}/${OUTFILE} ${INFILE} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + DEPENDS ${INFILE} ${EXTRA_DEPENDS}) +endfunction() + +macro(generate_rpc TAG SVCOPT) + generate_rpc_helper("${TAG}.x" "${TAG}_svc.c" "${SVCOPT}" "${TAG}.h") + generate_rpc_helper("${TAG}.x" "${TAG}_clnt.c" "-l" "${TAG}.h") + generate_rpc_helper("${TAG}.x" "${TAG}_xdr.c" "-c" "${TAG}.h") + generate_rpc_helper("${TAG}.x" "${TAG}.h" "-h" "") +endmacro() +generate_rpc(agent "-s;tcp") +generate_rpc(online "-m") + +# the libhadaq.a +add_library(hadaq STATIC + readout.c worker.c evt.c subevt.c shmtrans.c hadtuqueue.c psxshm.c hadtu.c) + +# daq_agent +add_executable(daq_agent + agent.c agent_svc.c agent_xdr.c worker.c psxshm.c) +target_link_libraries(daq_agent ${RT_LIBRARY}) + +# daq_memnet +add_executable(daq_memnet + memnet.c worker.c shmtrans.c hadtuqueue.c psxshm.c nettrans.c hadtu.c) +target_link_libraries(daq_memnet ${RT_LIBRARY} tclParam) + +# daq_netmem +add_executable(daq_netmem + netmem.c worker.c shmtrans.c hadtuqueue.c psxshm.c nettrans.c hadtu.c) +target_link_libraries(daq_netmem ${RT_LIBRARY} tclParam) + +# daq_evtbuild +add_executable(daq_evtbuild + evtbuild.c genid32.c worker.c shmtrans.c hadtuqueue.c psxshm.c + online.c online_svc.c online_xdr.c evt.c subevt.c hadtu.c + ansiTape.c ansiTapeLabel.c ansiTapeChar.c + debug.c logger.c resdata.c args.c stats.c) +target_link_libraries(daq_evtbuild ${RT_LIBRARY} tclParam) + +# daq_ctrlctu +add_executable(daq_ctrlctu + ctrlctu.c worker.c psxshm.c) +target_link_libraries(daq_ctrlctu ${RT_LIBRARY}) + +# daq_sniff +add_executable(daq_sniff + sniff.c online_clnt.c online_xdr.c) + +# daq_anal +add_executable(daq_anal + showevt.c hldread.c evt.c subevt.c hadtu.c) \ No newline at end of file -- 2.43.0