Skip to content

Commit

Permalink
Cmake changes to almost get the feedback analyzer working.
Browse files Browse the repository at this point in the history
Added a modeule to find the EPICS libraries on the adaq cluster,
and a CMakeList to compile the Feedback library if both EPICS and ET have
been found.
I wasn't able to get the QwFeedback library and the feedback executable
to both be compiled and linked though.
Maybe @wdconinc can look at it...
  • Loading branch information
paulmking committed Jan 23, 2019
1 parent 810442d commit ad878dc
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ foreach(file ${exefiles})
)
endforeach()

#----------------------------------------------------------------------------
# Build feedback library and executable
add_subdirectory(Feedback)
#add_executable(feedback ${CMAKE_CURRENT_SOURCE_DIR}/Feedback/main/QwFeedback.cc)
#target_link_libraries(feedback Qwfeedback)




#----------------------------------------------------------------------------
# uninstall
Expand Down
77 changes: 77 additions & 0 deletions Feedback/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
cmake_minimum_required(VERSION 3.5)

#----------------------------------------------------------------------------
# ROOT
#
set(minimum_root_version 6.0)
find_package(ROOT ${minimum_root_version} REQUIRED)
config_add_dependency(ROOT ${minimum_root_version})

#----------------------------------------------------------------------------
# CODA ET
#
find_package(ET)

#----------------------------------------------------------------------------
# EPICS
find_package(EPICS)

message(STATUS "*********** In Feedback Cmake")
set_compiler_flags("${ROOT_CXX_FLAGS}")
#set_diagnostic_flags(WALL WEXTRA)
set_diagnostic_flags(WALL)
report_build_info()

#----------------------------------------------------------------------------
# Feedback needs both ET and EPICS
IF(ET_FOUND)
IF(EPICS_FOUND)
include_directories(${ROOT_INCLUDE_DIR})
include_directories(${ET_INCLUDE_DIR})
include_directories(${EPICS_INCLUDE_DIR}
${EPICS_INCLUDE_DIR}/os/Linux
${EPICS_INCLUDE_DIR}/compiler/gcc)
include_directories(${PROJECT_SOURCE_DIR}/Analysis/include
${PROJECT_SOURCE_DIR}/Parity/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

set(feedback_sources
${CMAKE_CURRENT_SOURCE_DIR}/src/GreenMonster.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/QwEPICSControl.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/QwHelicityCorrelatedFeedback.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/cfSockCli.cc
)
add_library(QwFeedback SHARED ${feedback_sources})
target_include_directories(QwFeedback PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
target_compile_options(QwFeedback
PUBLIC
${${PROJECT_NAME_UC}_CXX_FLAGS_LIST}
PRIVATE
${${PROJECT_NAME_UC}_DIAG_FLAGS_LIST}
)
target_link_libraries(QwFeedback
PUBLIC
EVIO::ET
ROOT::Libraries
${EPICS_CA_LIBRARY} ${EPICS_CAS_LIBRARY} ${EPICS_COM_LIBRARY} ${EPICS_GDD_LIBRARY}
)

install(TARGETS QwFeedback
EXPORT ${MAIN_PROJECT_NAME_LC}-exports
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

install(FILES ${my_feedback_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

endif(EPICS_FOUND)
endif(ET_FOUND)



9 changes: 1 addition & 8 deletions Feedback/main/QwFeedback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "QwFakeHelicity.h"
#include "QwBeamLine.h"
#include "QwMainCerenkovDetector.h"
#include "QwScanner.h"
#include "QwLumi.h"
#include "QwBeamMod.h"
#include "QwVQWK_Channel.h"
Expand Down Expand Up @@ -224,12 +223,6 @@ Int_t main(Int_t argc, Char_t* argv[])
failed_events_counts++;
}

// Burst mode
if (eventbuffer.IsEndOfBurst()) {
helicitypattern.AccumulateRunningBurstSum();
helicitypattern.CalculateBurstAverage();
helicitypattern.ClearBurstSum();
}



Expand All @@ -246,7 +239,7 @@ Int_t main(Int_t argc, Char_t* argv[])


// Print the event cut error summery for each subsystem
detectors.GetEventcutErrorCounters();
// detectors.GetEventcutErrorCounters();


// Read from the datebase
Expand Down
6 changes: 6 additions & 0 deletions Feedback/src/cfSockCli.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extern "C" {
#include "cfSockCli.c"
} /* End extern "C" */



34 changes: 34 additions & 0 deletions cmake/modules/FindEPICS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### The path for EPICS is restricted to a single copy on the Hall A cluster
### which has been compiled for 64-bit architecture.
### In principle this could be generalized, but would need to have guards
### to verify the library has been compiled with the correct flag.


find_library(EPICS_CA_LIBRARY ca
PATHS /adaqfs/apps/epics/lib/linux-x86_64
DOC "EPICS CA library"
)
find_library(EPICS_CAS_LIBRARY cas
PATHS /adaqfs/apps/epics/lib/linux-x86_64
DOC "EPICS CAS library"
)
find_library(EPICS_COM_LIBRARY Com
PATHS /adaqfs/apps/epics/lib/linux-x86_64
DOC "EPICS COM library"
)
find_library(EPICS_GDD_LIBRARY gdd
PATHS /adaqfs/apps/epics/lib/linux-x86_64
DOC "EPICS GDD library"
)
# Needs to build this line: -L/adaqfs/apps/epics/lib/linux-x86_64 -lca -lcas -lCom -lgdd

find_path(EPICS_INCLUDE_DIR
NAMES cadef.h
PATHS /adaqfs/apps/epics/include
# $ENV{CODA}/common/include
DOC "EPICS header include base directory"
)
# Needs to get all three: -I /adaqfs/apps/epics/include -I /adaqfs/apps/epics/include/os/Linux -I /adaqfs/apps/epics/include/compiler/gcc

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EPICS "The EPICS libraries were not found; feedback analysis will be disabled." EPICS_CA_LIBRARY EPICS_CAS_LIBRARY EPICS_COM_LIBRARY EPICS_GDD_LIBRARY EPICS_INCLUDE_DIR)

2 comments on commit ad878dc

@wdconinc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the issue is that the following fails?

cd Feedback
mkdir build && pushd build
cmake .. && make -j $(nproc)
popd

@wdconinc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_add_dependency is provided by cmake/modules/CMakeEnv.cmake this is not expected to build from inside Feedback, right

Please sign in to comment.