-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
171 lines (148 loc) · 6.21 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
#
# $Id: CMakeLists.txt 385 2010-05-27 15:58:30Z sriramsrao $
#
# Created 2006/10/20
# Author: Sriram Rao (Kosmix Corp)
#
# Copyright 2006 Kosmix Corp.
#
# This file is part of Kosmos File System (KFS).
#
# Licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
#
project (KFS)
cmake_minimum_required(VERSION 2.4.6)
# Locate Boost
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS regex REQUIRED)
message(STATUS "Boost-includes = ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost-libs = ${Boost_LIBRARIES}")
# Locate the path to jni.h
find_package(JNI)
# Use the IntelIPP package
set (CMAKE_IPPBASE "/opt/intel/ipp/current/em64t")
if (EXISTS ${CMAKE_IPPBASE} AND CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT KFS_NO_IPP)
message (STATUS "Using IntelIPP = ${CMAKE_IPPBASE}")
set (CMAKE_KFS_USE_INTEL_IPP ON)
set (CMAKE_IPP_INCLUDE_DIR ${CMAKE_IPPBASE}/include)
set (CMAKE_IPP_LIB_DIR ${CMAKE_IPPBASE}/lib)
set (CMAKE_IPP_LIBS
${CMAKE_IPP_LIB_DIR}/libippdcemergedem64t.a
${CMAKE_IPP_LIB_DIR}/libippdcmergedem64t.a
${CMAKE_IPP_LIB_DIR}/libippsemergedem64t.a
${CMAKE_IPP_LIB_DIR}/libippsmergedem64t.a
${CMAKE_IPP_LIB_DIR}/libippcoreem64t.a
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_INTEL_IPP")
endif (EXISTS ${CMAKE_IPPBASE} AND CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT KFS_NO_IPP)
# Change this to where the install directory is located
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "." CACHE PATH "installation directory prefix" FORCE)
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Build with statically linked libraries; the value for this variable has to be defined here
# overwriting whatever is in the cache.
# When set to ON, we build with statically linked libraries; when off we
# link with dynamically linked libs
IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
IF (BUILD_CPU_MODE STREQUAL "32")
message (STATUS "Building 32-bit mode on Solaris")
# If we are asked to build 32 bit mode
add_definitions (-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES)
ELSE (BUILD_CPU_MODE STREQUAL "32")
# On solaris, use 64-bit mode
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
ENDIF (BUILD_CPU_MODE STREQUAL "32")
# Statically linked binaries don't work on solaris
set (USE_STATIC_LIB_LINKAGE OFF CACHE BOOL "Build binaries with statically linked libraries" FORCE)
# Cmake does whacky relink on solaris and messes things up; avoid this
set (CMAKE_SKIP_RPATH ON)
ELSE (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set (USE_STATIC_LIB_LINKAGE ON CACHE BOOL "Build binaries with statically linked libraries" FORCE)
IF (CMAKE_SIZEOF_VOID_P MATCHES "4")
message (STATUS "Enabling largefile source flags")
add_definitions (-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_LARGE_FILES)
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "4")
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
IF (ENABLE_PROFILING)
message (STATUS "Enabling profiling with gprof")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set(CMAKE_SHAREDBoost_USE_MULTITHREADED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
set(CMAKE_EXE_FLAGS "${CMAKE_EXE_FLAGS} -pg")
ENDIF (ENABLE_PROFILING)
# Darwin compilers need to be told about ports
IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/opt/local/include -L/opt/local/lib")
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Change the line to Release to build release binaries
# For servers, build with debugging info; for tools, build Release
#
IF (NOT CMAKE_BUILD_TYPE)
message (STATUS "Setting build type to Debug")
set (CMAKE_BUILD_TYPE "Debug")
ENDIF (NOT CMAKE_BUILD_TYPE)
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
message(STATUS "Enabling -D NDEBUG flag")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D NDEBUG -g3")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -DBOOST_SP_USE_QUICK_ALLOCATOR")
string(TOUPPER KFS_OS_NAME_${CMAKE_SYSTEM_NAME} KFS_OS_NAME)
add_definitions (-D${KFS_OS_NAME})
#
# Find the path to libfuse.so
#
# IF (EXISTS "/lib64/libfuse.so")
# SET(Fuse_LIBRARY_DIR "/lib64")
# ELSE (EXISTS "/lib64/libfuse.so")
# SET(Fuse_LIBRARY_DIR "")
# ENDIF (EXISTS "/lib64/libfuse.so")
# Fill in the path to fuse library
SET(Fuse_LIBRARY_DIR "")
SET(Fuse_INCLUDE_DIR "")
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
# include dirs
include_directories( ${Boost_INCLUDE_DIRS} src/cc)
if (CMAKE_KFS_USE_INTEL_IPP)
include_directories( ${CMAKE_IPP_INCLUDE_DIR} )
endif (CMAKE_KFS_USE_INTEL_IPP)
# get the subdirs we want
add_subdirectory (src/cc/common)
add_subdirectory (src/cc/rebalancer)
add_subdirectory (src/cc/meta)
add_subdirectory (src/cc/chunk)
add_subdirectory (src/cc/libkfsClient)
add_subdirectory (src/cc/libkfsIO)
add_subdirectory (src/cc/tools)
add_subdirectory (src/cc/tests)
add_subdirectory (src/cc/emulator)
add_subdirectory (src/cc/telemetry)
#add_subdirectory (src/test-scripts)
add_subdirectory (src/cc/qcdio)
IF (NOT ${JAVA_INCLUDE_PATH} STREQUAL "")
message(STATUS "Found JNI...building kfs_access")
include_directories ( ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} )
add_subdirectory (src/cc/access)
ENDIF (NOT ${JAVA_INCLUDE_PATH} STREQUAL "")
IF (NOT ${Fuse_LIBRARY_DIR} STREQUAL "")
message(STATUS "Found fuse")
include_directories ( ${Fuse_INCLUDE_DIR} )
add_subdirectory (src/cc/fuse)
ENDIF (NOT ${Fuse_LIBRARY_DIR} STREQUAL "")