Skip to content
Snippets Groups Projects
Commit c349e5a6 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

use pkg_config to find doocs

parent d86b703f
No related branches found
No related tags found
No related merge requests found
...@@ -32,84 +32,63 @@ ...@@ -32,84 +32,63 @@
SET(DOOCS_FOUND 0) SET(DOOCS_FOUND 0)
list(APPEND DOOCS_FIND_COMPONENTS doocsapi)
FIND_PATH(DOOCS_DIR libDOOCSapi.so
${CMAKE_CURRENT_LIST_DIR}
/export/doocs/lib
)
if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";zmq;") if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";zmq;")
FIND_PATH(DOOCS_DIR_zmq libDOOCSdzmq.so list(APPEND DOOCS_FIND_COMPONENTS doocsdzmq)
${DOOCS_DIR} list(REMOVE_ITEM DOOCS_FIND_COMPONENTS zmq)
)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DOOCSdzmq)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_zmq)
endif() endif()
if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";dapi;") if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";dapi;")
FIND_PATH(DOOCS_DIR_dapi libDOOCSdapi.so list(APPEND DOOCS_FIND_COMPONENTS doocsdapi)
${DOOCS_DIR} list(REMOVE_ITEM DOOCS_FIND_COMPONENTS dapi)
)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DOOCSdapi)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_dapi)
endif() endif()
if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";server;") if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";server;")
FIND_PATH(DOOCS_DIR_server libEqServer.so list(APPEND DOOCS_FIND_COMPONENTS serverlib)
${DOOCS_DIR} list(REMOVE_ITEM DOOCS_FIND_COMPONENTS server)
)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} EqServer)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_server)
endif() endif()
set(DOOCS_FIND_COMPONENTS_DDAQ false)
if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";ddaq;") if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";ddaq;")
FIND_PATH(DOOCS_DIR_ddaq libDOOCSddaq.so # This library seems not yet to come with a pkg-config module
${DOOCS_DIR} list(REMOVE_ITEM DOOCS_FIND_COMPONENTS ddaq)
) set(DOOCS_FIND_COMPONENTS_DDAQ true)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DOOCSddaq timinginfo daqevstat DAQFSM TTF2XML xerces-c BM TTF2evutl)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_ddaq)
endif() endif()
if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";daqreader;") if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";daqreader;")
FIND_PATH(DOOCS_DIR_daqreader libDAQReader.so list(APPEND DOOCS_FIND_COMPONENTS daqreaderlib)
${DOOCS_DIR} list(REMOVE_ITEM DOOCS_FIND_COMPONENTS daqreader)
)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DAQReader)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_daqreader)
endif()
if (";${DOOCS_FIND_COMPONENTS};" MATCHES ";eqdaqdatalib;")
FIND_PATH(DOOCS_DIR_eqdaqdatalib libDAQsvrutil.so
${DOOCS_DIR}
)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DAQsvrutil)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_eqdaqdatalib)
endif() endif()
#This is for the transition only. The logic is not bullet proof, but in almost all cases # For newer cmake versions, the following foreach() can be replaced by this:
#if there is libgul14.so, it means DOOCS brought it and needs it. # list(TRANSFORM DOOCS_FIND_COMPONENTS PREPEND "doocs-")
FIND_LIBRARY(LIB_GULOLD libgul.so ${DOOCS_DIR}) foreach(component ${DOOCS_FIND_COMPONENTS})
FIND_LIBRARY(LIB_GUL14 libgul14.so ${DOOCS_DIR}) list(APPEND DOOCS_FIND_COMPONENTS_TRANSFORMED "doocs-${component}")
if ("${LIB_GUL14}" MATCHES "LIB_GUL14-NOTFOUND") endforeach()
set(LIB_GUL "gul") set(DOOCS_FIND_COMPONENTS ${DOOCS_FIND_COMPONENTS_TRANSFORMED})
else()
set(LIB_GUL "gul14")
endif()
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DOOCSapi nsl dl pthread m rt ldap ${LIB_GUL}) include(FindPkgConfig)
message("DOOCS_LIBRARIES ${DOOCS_LIBRARIES}") pkg_check_modules(DOOCS REQUIRED ${DOOCS_FIND_COMPONENTS})
# now set the required variables based on the determined DOOCS_DIR string(REPLACE ";" " " DOOCS_CFLAGS "${DOOCS_CFLAGS}")
set(DOOCS_INCLUDE_DIRS ${DOOCS_DIR}/include) string(REPLACE ";" " " DOOCS_LDFLAGS "${DOOCS_LDFLAGS}")
set(DOOCS_LIBRARY_DIRS ${DOOCS_DIR}/)
set(DOOCS_CXX_FLAGS "-Wall -fPIC -D_REENTRANT -DLINUX -D__LINUX__ -DDMSG -DTINE_EXPORT=' '") set(DOOCS_DIR "${DOOCS_doocs-doocsapi_LIBDIR}")
set(DOOCS_LINKER_FLAGS "-Wl,--no-as-needed") set(DOOCS_VERSION "${DOOCS_doocs-doocsapi_VERSION}")
set(DOOCS_LINK_FLAGS "${DOOCS_LINKER_FLAGS}") set(DOOCS_CXX_FLAGS ${DOOCS_CFLAGS})
set(DOOCS_LINKER_FLAGS ${DOOCS_LDFLAGS})
set(DOOCS_LINK_FLAGS ${DOOCS_LINKER_FLAGS})
# extract DOOCS version from librar so symlink. Note: This is platform dependent and only works set(COMPONENT_DIRS "")
# if DOOCS was installed from the Debian pagackes. Find a better version detection scheme! if(DOOCS_FIND_COMPONENTS_DDAQ)
execute_process(COMMAND bash -c "env LANG=C readelf -d ${DOOCS_DIR}/libDOOCSapi.so | grep SONAME | sed -e 's/^.*Library soname: \\[libDOOCSapi\\.so\\.//' -e 's/\\]$//'" message("Searching for libDOOCSddaq.so")
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE DOOCS_VERSION) FIND_PATH(DOOCS_DIR_ddaq libDOOCSddaq.so
${DOOCS_DIR}
)
set(DOOCS_LIBRARIES ${DOOCS_LIBRARIES} DOOCSddaq timinginfo daqevstat DAQFSM TTF2XML xerces-c BM TTF2evutl)
set(COMPONENT_DIRS ${COMPONENT_DIRS} DOOCS_DIR_ddaq)
endif()
# use a macro provided by CMake to check if all the listed arguments are valid and set DOOCS_FOUND accordingly # use a macro provided by CMake to check if all the listed arguments are valid and set DOOCS_FOUND accordingly
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment