CMakeLists.txt 5.28 KB
Newer Older
Steven Murray's avatar
Steven Murray committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# The CERN Tape Archive(CTA) project
# Copyright(C) 2015  CERN
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

17
18
cmake_minimum_required (VERSION 2.6)

19
20
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../middletier)
21

22

Steven Murray's avatar
Steven Murray committed
23
find_package(json-c REQUIRED)
Steven Murray's avatar
Steven Murray committed
24
find_package(librados2 REQUIRED)
25
find_package(Protobuf3 REQUIRED)
26
27
28
29

set (CTAProtoFiles
  cta.proto)

30
PROTOBUF3_GENERATE_CPP(CTAProtoSources CTAProtoHeaders ${CTAProtoFiles})
31

32
set (CTAProtoDependants objectstore/Agent.hpp
Daniele Kruse's avatar
Daniele Kruse committed
33
  objectstore/ArchiveRequest.hpp
34
  objectstore/CreationLog.hpp
35
36
  objectstore/DriveRegister.hpp
  objectstore/DriveState.hpp
37
38
  objectstore/GenericObject.hpp
  objectstore/ObjectOps.hpp
39
  objectstore/RetrieveRequest.hpp
40
41
  objectstore/RootEntry.hpp
  objectstore/SchedulerGlobalLock.hpp
42
  objectstore/TapeQueue.hpp
43
  objectstore/ArchiveQueue.hpp
44
45
  objectstore/UserIdentity.hpp
  objectstore/ValueCountMap.hpp)
46
47
48
49
50

SET_SOURCE_FILES_PROPERTIES(${CTAProtoHeaders} PROPERTIES HEADER_FILE_ONLY TRUE)
SET_SOURCE_FILES_PROPERTIES(${CTAProtoDependants} 
  PROPERTIES OBJECT_DEPENDS ${CTAProtoHeaders})

51
include_directories (${PROTOBUF3_INCLUDE_DIRS})
Eric Cano's avatar
Eric Cano committed
52
add_library (ctaobjectstore SHARED
53
  ${CTAProtoSources}
54
  ObjectOps.cpp
55
56
  RootEntry.cpp
  Agent.cpp
57
  AgentHeartbeatThread.cpp
58
  AgentReference.cpp
59
  AgentRegister.cpp
60
  AgentWatchdog.cpp
61
  ArchiveQueue.cpp
62
  ArchiveQueueShard.cpp
63
  ArchiveQueueToTransferAlgorithms.cpp
64
  ArchiveQueueToReportAlgorithms.cpp
65
  ArchiveQueueFailedAlgorithms.cpp
66
  RetrieveQueue.cpp
67
  RetrieveQueueShard.cpp
68
  RetrieveQueueAlgorithms.cpp
69
  QueueType.cpp
Daniele Kruse's avatar
Daniele Kruse committed
70
  ArchiveRequest.cpp
71
  RetrieveRequest.cpp
Eric Cano's avatar
Eric Cano committed
72
  DriveRegister.cpp
73
  DriveState.cpp
74
  BackendVFS.cpp
75
  BackendRados.cpp
76
  BackendPopulator.cpp
77
  BackendFactory.cpp
78
  ProtocolBuffersAlgorithms.cpp
79
  GenericObject.cpp
80
  GarbageCollector.cpp
81
  SchedulerGlobalLock.cpp
82
83
  ValueCountMap.cpp
  Helpers.cpp)
Michael Davis's avatar
Michael Davis committed
84
85
86
set_property(TARGET ctaobjectstore PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstore PROPERTY   VERSION "${CTA_LIBVERSION}")

87
target_link_libraries(ctaobjectstore rados json-c cryptopp)
88
set_source_files_properties(BackendRados.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
Eric Cano's avatar
Eric Cano committed
89
install (TARGETS ctaobjectstore DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
90

91
set(ObjectStoreUnitTests
92
93
  BackendTest.cpp
  RootEntryTest.cpp
94
  RetrieveQueueTest.cpp
95
  GarbageCollectorTest.cpp
96
  AlgorithmsTest.cpp
97
)
98

Eric Cano's avatar
Eric Cano committed
99
add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests})
Michael Davis's avatar
Michael Davis committed
100
101
102
set_property(TARGET ctaobjectstoreunittests PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstoreunittests PROPERTY   VERSION "${CTA_LIBVERSION}")

Eric Cano's avatar
Eric Cano committed
103
target_link_libraries(ctaobjectstoreunittests
104
  ${PROTOBUF3_LIBRARIES} rados ctacommon gtest ctaobjectstore)
105
install(TARGETS ctaobjectstoreunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
106

107
add_executable(cta-objectstore-initialize cta-objectstore-initialize.cpp)
108
set_property(TARGET cta-objectstore-initialize APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
109
target_link_libraries(cta-objectstore-initialize
110
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
111

112
add_executable(cta-objectstore-list cta-objectstore-list.cpp)
113
set_property(TARGET cta-objectstore-list APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
114
target_link_libraries(cta-objectstore-list
115
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
Eric Cano's avatar
Eric Cano committed
116

117
add_executable(cta-objectstore-dump-object cta-objectstore-dump-object.cpp)
118
set_property(TARGET cta-objectstore-dump-object APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
119
target_link_libraries(cta-objectstore-dump-object
120
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
121

122
add_executable(cta-objectstore-unfollow-agent cta-objectstore-unfollow-agent.cpp)
123
set_property(TARGET cta-objectstore-unfollow-agent APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
124
target_link_libraries(cta-objectstore-unfollow-agent
125
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
126

127
add_executable(cta-objectstore-dereference-removed-queues cta-objectstore-dereference-removed-queues.cpp)
128
set_property(TARGET cta-objectstore-dereference-removed-queues APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
129
130
131
target_link_libraries(cta-objectstore-dereference-removed-queues
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

132
add_executable(cta-objectstore-collect-orphaned-object cta-objectstore-collect-orphaned-object.cpp)
133
set_property(TARGET cta-objectstore-collect-orphaned-object APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
134
target_link_libraries(cta-objectstore-collect-orphaned-object
135
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon ctacatalogue)
136

137
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object cta-objectstore-unfollow-agent 
138
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object
139
  DESTINATION usr/bin)