CMakeLists.txt 5.49 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
41
  objectstore/RetrieveRequest.hpp
42
43
  objectstore/RootEntry.hpp
  objectstore/SchedulerGlobalLock.hpp
44
  objectstore/TapeQueue.hpp
45
  objectstore/ArchiveQueue.hpp
46
47
  objectstore/UserIdentity.hpp
  objectstore/ValueCountMap.hpp)
48
49
50
51
52

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

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

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

98
set(ObjectStoreUnitTests
99
100
  BackendTest.cpp
  RootEntryTest.cpp
101
  RetrieveQueueTest.cpp
102
  GarbageCollectorTest.cpp
103
  AlgorithmsTest.cpp
104
)
105

Eric Cano's avatar
Eric Cano committed
106
add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests})
Michael Davis's avatar
Michael Davis committed
107
108
109
set_property(TARGET ctaobjectstoreunittests PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctaobjectstoreunittests PROPERTY   VERSION "${CTA_LIBVERSION}")

Eric Cano's avatar
Eric Cano committed
110
target_link_libraries(ctaobjectstoreunittests
111
  ${PROTOBUF3_LIBRARIES} rados ctacommon gtest ctaobjectstore)
112
install(TARGETS ctaobjectstoreunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
113

114
add_executable(cta-objectstore-initialize cta-objectstore-initialize.cpp)
115
set_property(TARGET cta-objectstore-initialize APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
116
target_link_libraries(cta-objectstore-initialize
117
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
118

119
add_executable(cta-objectstore-list cta-objectstore-list.cpp)
120
set_property(TARGET cta-objectstore-list APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
121
target_link_libraries(cta-objectstore-list
122
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
Eric Cano's avatar
Eric Cano committed
123

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

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

134
add_executable(cta-objectstore-dereference-removed-queues cta-objectstore-dereference-removed-queues.cpp)
135
set_property(TARGET cta-objectstore-dereference-removed-queues APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
136
137
138
target_link_libraries(cta-objectstore-dereference-removed-queues
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

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

144
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object cta-objectstore-unfollow-agent 
145
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object
146
  DESTINATION usr/bin)