-
Notifications
You must be signed in to change notification settings - Fork 125
/
CMakeLists.txt
176 lines (148 loc) · 5.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# Copyright (C) 2009 Doug Judd (Zvents, Inc.)
#
# 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 2
# of the License, or 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
project(HYPERTABLE)
# Hypertable version components
set(VERSION_MAJOR "0")
set(VERSION_MINOR "9")
set(VERSION_MICRO "2")
set(VERSION_PATCH "7")
# cmake behavior compatibility
cmake_minimum_required(VERSION 2.6.0)
mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
# saner control structure syntax
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if (COMMAND cmake_policy)
# we prefer the more strict behavior, to find out more:
# cmake --help-policy CMP0003
cmake_policy(SET CMP0003 NEW)
endif ()
# Something nice for GUI like ccmake
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Options: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
# install directory prefix
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/opt/hypertable"
CACHE PATH "installation directory prefix" FORCE)
endif ()
# Enable testing
enable_testing()
# A simple test helper
set(TEST_DIFF ${HYPERTABLE_SOURCE_DIR}/bin/src-utils/testdiff)
# gcc warning settings
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wall -pedantic -Wno-long-long)
endif ()
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT)
# Uncomment the following to build dynamic libraries
# set (BUILD_SHARED_LIBS ON)
# Locate required packages
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(CommonUtil)
# A more informative hypertable version string
include(VersionHelper)
# Verison install directory
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${VERSION})
set(INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
find_package(Threads REQUIRED)
message(STATUS "Use thread library: ${CMAKE_THREAD_LIBS_INIT}")
find_package(Boost REQUIRED)
find_package(BerkeleyDB REQUIRED)
find_package(EXPAT REQUIRED)
find_package(Log4cpp REQUIRED)
find_package(Readline REQUIRED)
find_package(SIGAR REQUIRED)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Doxygen)
find_package(Tcmalloc)
find_package(Kfs)
find_package(Ceph)
find_package(Ant)
find_package(JNI)
find_package(PythonLibs)
find_package(LibEvent)
find_package(Thrift)
find_package(RubyThrift)
find_package(PHP5Thrift)
find_package(PerlThrift)
find_package(PythonThrift)
# set malloc library except in Debug mode
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(MALLOC_LIBRARY ${Tcmalloc_LIBRARIES})
endif ()
# include directories
include_directories(src/cc ${HYPERTABLE_BINARY_DIR}/src/cc
${ZLIB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${Log4cpp_INCLUDE_DIR}
${EXPAT_INCLUDE_DIRS} ${BDB_INCLUDE_DIR} ${READLINE_INCLUDE_DIR}
${SIGAR_INCLUDE_DIR})
if (Thrift_FOUND)
include_directories(${LibEvent_INCLUDE_DIR} ${Thrift_INCLUDE_DIR})
add_definitions(-DHT_WITH_THRIFT)
set(ThriftBroker_IDL_DIR ${HYPERTABLE_SOURCE_DIR}/src/cc/ThriftBroker)
endif ()
if (BOOST_VERSION MATCHES "1_34")
message(STATUS "Got boost 1.34.x, prepend fix directory")
include_directories(BEFORE src/cc/boost-1_34-fix)
endif ()
if (GCC_VERSION MATCHES "^([4-9]|[1-9][0-9]+)\\.")
add_definitions(-Wno-variadic-macros)
# turn off deprecated feature warnings for gcc 4.3+
if (GCC_VERSION MATCHES "^([4-9]|[1-9][0-9]+)\\.([3-9]|[1-9][0-9]+)")
add_definitions(-Wno-deprecated)
endif ()
elseif (GCC_VERSION MATCHES "^([4-9]|[1-9][0-9]+)\\.")
message(STATUS "Ancient gcc detected, hope it finishes despite warnings...")
endif ()
include(HadoopHelper)
include(TestHelper)
include(DocHelper)
# sub-project directories
add_subdirectory(src)
add_subdirectory(examples)
add_subdirectory(contrib)
add_subdirectory(tests/integration)
# Java stuff
if (NOT SKIP_JAVA_BUILD)
include(JavaHelper)
endif ()
configure_file(bin/ht.in ht @ONLY)
configure_file(bin/postinst.in postinst @ONLY)
configure_file(bin/prerm.in prerm @ONLY)
file(GLOB CONFS conf/[^.]*)
install(FILES ${CONFS} DESTINATION conf)
install(PROGRAMS ${HYPERTABLE_BINARY_DIR}/ht DESTINATION bin)
if (NOT HT_COMPONENT_INSTALL)
file(GLOB JARS lib/*.jar lib/*.txt)
install(FILES ${JARS} DESTINATION lib/java)
install(FILES ${HYPERTABLE_BINARY_DIR}/java/hypertable-${VERSION}.jar
DESTINATION lib/java OPTIONAL)
file(GLOB SCRIPTS bin/jrun bin/*.sh)
install(PROGRAMS ${SCRIPTS} DESTINATION bin)
install(DIRECTORY examples/apache_log DESTINATION examples
USE_SOURCE_PERMISSIONS)
install(DIRECTORY examples/hql_tutorial DESTINATION examples
USE_SOURCE_PERMISSIONS)
install(DIRECTORY examples/freebase DESTINATION examples
USE_SOURCE_PERMISSIONS)
include(PackageHelper)
else ()
install(PROGRAMS bin/ht-env.sh bin/fhsize.sh bin/prerm.sh DESTINATION bin)
endif ()