CMakeLists.txt 6.07 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
79
  RetrieveQueueToTransferForUserAlgorithms.cpp
  RetrieveQueueToTransferForRepackAlgorithms.cpp
80
81
  RetrieveQueueToReportAlgorithms.cpp
  RetrieveQueueFailedAlgorithms.cpp
82
  RetrieveQueueToReportToRepackForSuccessAlgorithms.cpp
83
  RetrieveQueueToReportToRepackForFailureAlgorithms.cpp
84
  JobQueueType.cpp
85
  Sorter.cpp
Daniele Kruse's avatar
Daniele Kruse committed
86
  ArchiveRequest.cpp
87
  RetrieveRequest.cpp
Eric Cano's avatar
Eric Cano committed
88
  DriveRegister.cpp
89
  DriveState.cpp
90
91
  RepackIndex.cpp
  RepackRequest.cpp
Eric Cano's avatar
Eric Cano committed
92
  RepackQueue.cpp
93
94
  RepackQueuePendingAlgorithms.cpp
  RepackQueueToExpandAlgorithms.cpp
95
  RepackQueueType.cpp
96
  BackendVFS.cpp
97
  BackendRados.cpp
98
  BackendPopulator.cpp
99
  BackendFactory.cpp
100
  ProtocolBuffersAlgorithms.cpp
101
  GenericObject.cpp
102
  GarbageCollector.cpp
103
  SchedulerGlobalLock.cpp
104
  ValueCountMap.cpp
105
106
  Helpers.cpp
  RetrieveActivityCountMap.cpp)
Michael Davis's avatar
Michael Davis committed
107
108
109
set_property(TARGET ctaobjectstore PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstore PROPERTY   VERSION "${CTA_LIBVERSION}")

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

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

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

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

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

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

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

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

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

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

161
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object cta-objectstore-unfollow-agent 
162
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object
163
  DESTINATION usr/bin)