CMakeLists.txt 5.79 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
40
  objectstore/RepackIndex.hpp
  objectstore/RepackRequest.hpp
Eric Cano's avatar
Eric Cano committed
41
  objectstore/RepackQueue.hpp
42
  objectstore/RetrieveRequest.hpp
43
44
  objectstore/RootEntry.hpp
  objectstore/SchedulerGlobalLock.hpp
45
  objectstore/TapeQueue.hpp
46
  objectstore/ArchiveQueue.hpp
47
48
  objectstore/UserIdentity.hpp
  objectstore/ValueCountMap.hpp)
49
50
51
52
53

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

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

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

106
set(ObjectStoreUnitTests
107
108
  BackendTest.cpp
  RootEntryTest.cpp
109
  RetrieveQueueTest.cpp
110
  GarbageCollectorTest.cpp
111
  AlgorithmsTest.cpp
112
  SorterTest.cpp
113
)
114

Eric Cano's avatar
Eric Cano committed
115
add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests})
Michael Davis's avatar
Michael Davis committed
116
117
118
set_property(TARGET ctaobjectstoreunittests PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstoreunittests PROPERTY   VERSION "${CTA_LIBVERSION}")

Eric Cano's avatar
Eric Cano committed
119
target_link_libraries(ctaobjectstoreunittests
120
  ${PROTOBUF3_LIBRARIES} rados ctacommon gtest ctaobjectstore)
121
install(TARGETS ctaobjectstoreunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
122

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

128
add_executable(cta-objectstore-list cta-objectstore-list.cpp)
129
set_property(TARGET cta-objectstore-list APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
130
target_link_libraries(cta-objectstore-list
131
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
Eric Cano's avatar
Eric Cano committed
132

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

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

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

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

153
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object cta-objectstore-unfollow-agent 
154
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object
155
  DESTINATION usr/bin)