CMakeLists.txt 6.39 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
33
set (CTAProtoDependants 
  objectstore/Agent.hpp
Daniele Kruse's avatar
Daniele Kruse committed
34
  objectstore/ArchiveRequest.hpp
35
  objectstore/CreationLog.hpp
36
37
  objectstore/DriveRegister.hpp
  objectstore/DriveState.hpp
38
39
  objectstore/GenericObject.hpp
  objectstore/ObjectOps.hpp
40
41
  objectstore/RepackIndex.hpp
  objectstore/RepackRequest.hpp
Eric Cano's avatar
Eric Cano committed
42
  objectstore/RepackQueue.hpp
43
  objectstore/RetrieveActivityCountMap.hpp
44
  objectstore/RetrieveRequest.hpp
45
46
  objectstore/RootEntry.hpp
  objectstore/SchedulerGlobalLock.hpp
47
  objectstore/TapeQueue.hpp
48
  objectstore/ArchiveQueue.hpp
49
50
  objectstore/UserIdentity.hpp
  objectstore/ValueCountMap.hpp)
51
52
53
54
55

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

56
include_directories (${PROTOBUF3_INCLUDE_DIRS})
Eric Cano's avatar
Eric Cano committed
57
add_library (ctaobjectstore SHARED
58
  ${CTAProtoSources}
59
  ObjectOps.cpp
60
61
  RootEntry.cpp
  Agent.cpp
62
  AgentHeartbeatThread.cpp
63
  AgentReference.cpp
64
65
  AgentReferenceInterface.cpp
  AgentWrapper.cpp
66
  AgentRegister.cpp
67
  AgentWatchdog.cpp
68
  ArchiveQueue.cpp
69
  ArchiveQueueShard.cpp
70
  ArchiveQueueToTransferAlgorithms.cpp
71
  ArchiveQueueToReportAlgorithms.cpp
72
  ArchiveQueueFailedAlgorithms.cpp
73
  ArchiveQueueToReportToRepackForSuccessAlgorithms.cpp
74
  ArchiveQueueToReportToRepackForFailureAlgorithms.cpp
75
  ArchiveQueueToTransferForRepackAlgorithms.cpp
76
  RetrieveQueue.cpp
77
  RetrieveQueueShard.cpp
78
  RetrieveQueueToTransferAlgorithms.cpp
79
80
  RetrieveQueueToReportAlgorithms.cpp
  RetrieveQueueFailedAlgorithms.cpp
81
  RetrieveQueueToReportToRepackForSuccessAlgorithms.cpp
82
  RetrieveQueueToReportToRepackForFailureAlgorithms.cpp
83
  JobQueueType.cpp
84
  Sorter.cpp
Daniele Kruse's avatar
Daniele Kruse committed
85
  ArchiveRequest.cpp
86
  RetrieveRequest.cpp
Eric Cano's avatar
Eric Cano committed
87
  DriveRegister.cpp
88
  DriveState.cpp
89
90
  RepackIndex.cpp
  RepackRequest.cpp
Eric Cano's avatar
Eric Cano committed
91
  RepackQueue.cpp
92
93
  RepackQueuePendingAlgorithms.cpp
  RepackQueueToExpandAlgorithms.cpp
94
  RepackQueueType.cpp
95
  BackendVFS.cpp
96
  BackendRados.cpp
97
  BackendPopulator.cpp
98
  BackendFactory.cpp
99
  ProtocolBuffersAlgorithms.cpp
100
  GenericObject.cpp
101
  GarbageCollector.cpp
102
  SchedulerGlobalLock.cpp
103
  ValueCountMap.cpp
104
105
  Helpers.cpp
  RetrieveActivityCountMap.cpp)
Michael Davis's avatar
Michael Davis committed
106
107
108
set_property(TARGET ctaobjectstore PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstore PROPERTY   VERSION "${CTA_LIBVERSION}")

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

113
set(ObjectStoreUnitTests
114
115
  BackendTest.cpp
  RootEntryTest.cpp
116
  RetrieveQueueTest.cpp
117
  GarbageCollectorTest.cpp
118
  AlgorithmsTest.cpp
119
  SorterTest.cpp
120
)
121

Eric Cano's avatar
Eric Cano committed
122
add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests})
Michael Davis's avatar
Michael Davis committed
123
124
125
set_property(TARGET ctaobjectstoreunittests PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstoreunittests PROPERTY   VERSION "${CTA_LIBVERSION}")

Eric Cano's avatar
Eric Cano committed
126
target_link_libraries(ctaobjectstoreunittests
127
  ${PROTOBUF3_LIBRARIES} rados ctacommon gtest ctaobjectstore)
128
install(TARGETS ctaobjectstoreunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
129

130
add_executable(cta-objectstore-initialize cta-objectstore-initialize.cpp)
131
set_property(TARGET cta-objectstore-initialize APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
132
target_link_libraries(cta-objectstore-initialize
133
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
134

135
add_executable(cta-objectstore-list cta-objectstore-list.cpp)
136
set_property(TARGET cta-objectstore-list APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
137
target_link_libraries(cta-objectstore-list
138
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
Eric Cano's avatar
Eric Cano committed
139

140
add_executable(cta-objectstore-dump-object cta-objectstore-dump-object.cpp)
141
set_property(TARGET cta-objectstore-dump-object APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
142
target_link_libraries(cta-objectstore-dump-object
143
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
144

145
add_executable(cta-objectstore-unfollow-agent cta-objectstore-unfollow-agent.cpp)
146
set_property(TARGET cta-objectstore-unfollow-agent APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
147
target_link_libraries(cta-objectstore-unfollow-agent
148
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
149

150
add_executable(cta-objectstore-dereference-removed-queues cta-objectstore-dereference-removed-queues.cpp)
151
set_property(TARGET cta-objectstore-dereference-removed-queues APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
152
153
154
target_link_libraries(cta-objectstore-dereference-removed-queues
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

155
add_executable(cta-objectstore-collect-orphaned-object cta-objectstore-collect-orphaned-object.cpp)
156
set_property(TARGET cta-objectstore-collect-orphaned-object APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
157
target_link_libraries(cta-objectstore-collect-orphaned-object
158
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon ctacatalogue)
159

160
161
162
163
164
add_executable(cta-objectstore-create-missing-repack-index cta-objectstore-create-missing-repack-index.cpp)
set_property(TARGET cta-objectstore-create-missing-repack-index APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
target_link_libraries(cta-objectstore-create-missing-repack-index
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

165
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object cta-objectstore-unfollow-agent 
166
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object cta-objectstore-create-missing-repack-index
167
  DESTINATION usr/bin)