CMakeLists.txt 4.64 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
35
36
  objectstore/CreationLog.hpp
  objectstore/GenericObject.hpp
  objectstore/ObjectOps.hpp
37
  objectstore/RetrieveRequest.hpp
38
39
  objectstore/RootEntry.hpp
  objectstore/SchedulerGlobalLock.hpp
40
  objectstore/TapeQueue.hpp
41
  objectstore/ArchiveQueue.hpp
42
43
  objectstore/UserIdentity.hpp
  objectstore/ValueCountMap.hpp)
44
45
46
47
48

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

49
include_directories (${PROTOBUF3_INCLUDE_DIRS})
Eric Cano's avatar
Eric Cano committed
50
add_library (ctaobjectstore SHARED
51
  ${CTAProtoSources}
52
53
  RootEntry.cpp
  Agent.cpp
54
  AgentHeartbeatThread.cpp
55
  AgentReference.cpp
56
  AgentRegister.cpp
57
  AgentWatchdog.cpp
58
59
  ArchiveQueue.cpp
  RetrieveQueue.cpp
Daniele Kruse's avatar
Daniele Kruse committed
60
  ArchiveRequest.cpp
61
  RetrieveRequest.cpp
Eric Cano's avatar
Eric Cano committed
62
  DriveRegister.cpp
63
  BackendVFS.cpp
64
  BackendRados.cpp
65
  BackendPopulator.cpp
66
  BackendFactory.cpp
67
  ProtocolBuffersAlgorithms.cpp
68
  GenericObject.cpp
69
  GarbageCollector.cpp
70
  SchedulerGlobalLock.cpp
71
72
  ValueCountMap.cpp
  Helpers.cpp)
Eric Cano's avatar
Eric Cano committed
73
target_link_libraries(ctaobjectstore rados json-c ctautils)
74
set_source_files_properties(BackendRados.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
Eric Cano's avatar
Eric Cano committed
75
install (TARGETS ctaobjectstore DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
76

77
set(ObjectStoreUnitTests
78
79
  BackendTest.cpp
  RootEntryTest.cpp
80
  RetrieveQueueTest.cpp
81
  GarbageCollectorTest.cpp
82
)
83

Eric Cano's avatar
Eric Cano committed
84
85
add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests})
target_link_libraries(ctaobjectstoreunittests
86
  ${PROTOBUF3_LIBRARIES} rados ctacommon gtest ctaobjectstore)
87
install(TARGETS ctaobjectstoreunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
88

89
add_executable(cta-objectstore-initialize cta-objectstore-initialize.cpp)
90
set_target_properties(cta-objectstore-initialize PROPERTIES INSTALL_RPATH ${PROTOBUF3_RPATH})
91
target_link_libraries(cta-objectstore-initialize
92
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon ctautils)
93

94
add_executable(cta-objectstore-list cta-objectstore-list.cpp)
95
set_target_properties(cta-objectstore-list PROPERTIES INSTALL_RPATH ${PROTOBUF3_RPATH})
96
target_link_libraries(cta-objectstore-list
97
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
Eric Cano's avatar
Eric Cano committed
98

99
add_executable(cta-objectstore-dump-object cta-objectstore-dump-object.cpp)
100
set_target_properties(cta-objectstore-dump-object PROPERTIES INSTALL_RPATH ${PROTOBUF3_RPATH})
101
target_link_libraries(cta-objectstore-dump-object
102
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
103

104
add_executable(cta-objectstore-unfollow-agent cta-objectstore-unfollow-agent.cpp)
105
set_target_properties(cta-objectstore-unfollow-agent PROPERTIES INSTALL_RPATH ${PROTOBUF3_RPATH})
106
target_link_libraries(cta-objectstore-unfollow-agent
107
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)
108

109
110
111
112
113
add_executable(cta-objectstore-dereference-removed-queues cta-objectstore-dereference-removed-queues.cpp)
set_target_properties(cta-objectstore-dereference-removed-queues PROPERTIES INSTALL_RPATH ${PROTOBUF3_RPATH})
target_link_libraries(cta-objectstore-dereference-removed-queues
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

114
115
116
117
118
add_executable(cta-objectstore-collect-orphaned-object cta-objectstore-collect-orphaned-object.cpp)
set_target_properties(cta-objectstore-collect-orphaned-object PROPERTIES INSTALL_RPATH ${PROTOBUF3_RPATH})
target_link_libraries(cta-objectstore-collect-orphaned-object
  ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon)

119
install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object cta-objectstore-unfollow-agent 
120
  cta-objectstore-dereference-removed-queues cta-objectstore-collect-orphaned-object
121
  DESTINATION usr/bin)