CMakeLists.txt 3.56 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1
# list of source files
Matthieu Dorier's avatar
Matthieu Dorier committed
2 3 4 5 6
set(hepnos-src DataStore.cpp
	       DataSet.cpp
	       RunSet.cpp
	       Run.cpp
	       SubRun.cpp
7
	       Event.cpp
Matthieu Dorier's avatar
Matthieu Dorier committed
8
	       UUID.cpp
Matthieu Dorier's avatar
Matthieu Dorier committed
9
	       WriteBatch.cpp
10
	       Prefetcher.cpp
11 12
	       AsyncEngine.cpp
	       EventSet.cpp) 
Matthieu Dorier's avatar
Matthieu Dorier committed
13

14
set(hepnos-service-src service/HEPnOSService.cpp
Matthieu Dorier's avatar
Matthieu Dorier committed
15
		       service/ServiceConfig.cpp
Matthieu Dorier's avatar
Matthieu Dorier committed
16
		       UUID.cpp
Matthieu Dorier's avatar
Matthieu Dorier committed
17
		       service/ConnectionInfoGenerator.cpp)
18

Matthieu Dorier's avatar
Matthieu Dorier committed
19 20 21 22 23 24
# load package helper for generating cmake CONFIG packages
include (CMakePackageConfigHelpers)

#
# library version set here (e.g. for shared libs).
#
25
set (HEPNOS_VERSION_MAJOR 0)
26
set (HEPNOS_VERSION_MINOR 3)
Matthieu Dorier's avatar
Matthieu Dorier committed
27
set (HEPNOS_VERSION_PATCH 2)
Matthieu Dorier's avatar
Matthieu Dorier committed
28 29 30
set (hepnos-vers "${HEPNOS_VERSION_MAJOR}.${HEPNOS_VERSION_MINOR}")
set (HEPNOS_VERSION "${hepnos-vers}.${HEPNOS_VERSION_PATCH}")

31 32 33 34 35 36 37 38
# where to install files for "find_package"
set (hepnos-pkg "share/cmake/hepnos")

# some bits for the pkg-config file
set (DEST_DIR "${CMAKE_INSTALL_PREFIX}")
set (PRIVATE_LIBS "-lhepnos")
configure_file ("hepnos.pc.in" "hepnos.pc" @ONLY)

39
add_library(hepnos ${hepnos-src})
Matthieu Dorier's avatar
Matthieu Dorier committed
40
target_link_libraries (hepnos uuid thallium mercury margo yaml-cpp sdskv-client ch-placement)
41
target_include_directories (hepnos PUBLIC $<INSTALL_INTERFACE:include>)
Matthieu Dorier's avatar
Matthieu Dorier committed
42 43

# local include's BEFORE, in case old incompatable .h files in prefix/include
44 45 46
include_directories (hepnos ${CMAKE_CURRENT_SOURCE_DIR}/private)
target_include_directories (hepnos BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
Matthieu Dorier's avatar
Matthieu Dorier committed
47 48

# for shared libs, establish the lib version
49 50 51
set_target_properties (hepnos
    PROPERTIES VERSION ${HEPNOS_VERSION}
    SOVERSION ${HEPNOS_VERSION_MAJOR})
Matthieu Dorier's avatar
Matthieu Dorier committed
52

53
add_library(hepnos-service ${hepnos-service-src})
Matthieu Dorier's avatar
Matthieu Dorier committed
54
target_link_libraries (hepnos-service ${MPI_CXX_LIBRARIES} uuid thallium mercury margo yaml-cpp sdskv-client sdskv-server ch-placement)
55 56 57 58 59
target_include_directories (hepnos-service PUBLIC $<INSTALL_INTERFACE:include>)

# local include's BEFORE, in case old incompatable .h files in prefix/include
target_include_directories (hepnos-service BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
60 61
target_include_directories (hepnos-service BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/service>)
62 63 64 65 66

# for shared libs, establish the lib version
set_target_properties (hepnos-service
    PROPERTIES VERSION ${HEPNOS_VERSION}
    SOVERSION ${HEPNOS_VERSION_MAJOR})
Matthieu Dorier's avatar
Matthieu Dorier committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80
#
# installation stuff (packaging and install commands)
#
write_basic_package_version_file(
    "hepnos-config-version.cmake"
    VERSION ${HEPNOS_VERSION}
    COMPATIBILITY AnyNewerVersion)

# generate our config file for find_package()
configure_file (hepnos-config.cmake.in hepnos-config.cmake @ONLY)

#
# "make install" rules
#
81 82 83 84 85 86 87
install (TARGETS hepnos EXPORT hepnos-targets
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
install (TARGETS hepnos-service ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
install (EXPORT hepnos-targets
         DESTINATION ${hepnos-pkg}
         FILE "hepnos-targets.cmake")
Matthieu Dorier's avatar
Matthieu Dorier committed
88 89 90 91 92 93
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/hepnos-config.cmake"
               "${CMAKE_CURRENT_BINARY_DIR}/hepnos-config-version.cmake"
               "../cmake/xpkg-import.cmake"
         DESTINATION ${hepnos-pkg} )
install (DIRECTORY ../include/hepnos
         DESTINATION include
Matthieu Dorier's avatar
Matthieu Dorier committed
94
         FILES_MATCHING PATTERN "*.hpp")
95 96 97
install (DIRECTORY ../include/hepnos
         DESTINATION include
         FILES_MATCHING PATTERN "*.h")
Matthieu Dorier's avatar
Matthieu Dorier committed
98
install (FILES ../include/hepnos.hpp
99 100 101
		DESTINATION include)
install (FILES ../include/hepnos-service.h
		DESTINATION include)
102 103
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/hepnos.pc"
		DESTINATION "lib/pkgconfig/")