CMakeLists.txt 6.06 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
  BackendVFS.cpp
95
  BackendRados.cpp
96
  BackendPopulator.cpp
97
  BackendFactory.cpp
98
  ProtocolBuffersAlgorithms.cpp
99
  GenericObject.cpp
100
  GarbageCollector.cpp
101
  SchedulerGlobalLock.cpp
102
  ValueCountMap.cpp
103
104
  Helpers.cpp
  RetrieveActivityCountMap.cpp)
Michael Davis's avatar
Michael Davis committed
105
106
107
set_property(TARGET ctaobjectstore PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstore PROPERTY   VERSION "${CTA_LIBVERSION}")

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

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

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

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

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

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

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

144
add_executable(cta-objectstore-dereference-removed-queues cta-objectstore-dereference-removed-queues.cpp)
145
set_property(TARGET cta-objectstore-dereference-removed-queues APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
146
147
148
target_link_libraries(cta-objectstore-dereference-removed-queues
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

149
add_executable(cta-objectstore-collect-orphaned-object cta-objectstore-collect-orphaned-object.cpp)
150
set_property(TARGET cta-objectstore-collect-orphaned-object APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
151
target_link_libraries(cta-objectstore-collect-orphaned-object
152
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon ctacatalogue)
153

154
155
156
157
158
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)

159
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object 
160
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object cta-objectstore-create-missing-repack-index
161
  DESTINATION usr/bin)