-
Notifications
You must be signed in to change notification settings - Fork 13
/
LucenePlusPlusCMakeLists.txt.appveyor
218 lines (183 loc) · 5.16 KB
/
LucenePlusPlusCMakeLists.txt.appveyor
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
project(lucene++)
cmake_minimum_required(VERSION 2.8.6)
set(lucene++_VERSION_MAJOR 3)
set(lucene++_VERSION_MINOR 0)
set(lucene++_VERSION_PATCH 7)
set(lucene++_SOVERSION "0")
set(lucene++_VERSION
"${lucene++_VERSION_MAJOR}.${lucene++_VERSION_MINOR}.${lucene++_VERSION_PATCH}"
)
# include specific modules
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
####################################
# pre-compiled headers support
####################################
include(cotire)
# if setup using the Toolchain-llvm.cmake file, then use llvm...
if(ENABLE_LLVM)
include(Toolchain-llvm)
endif()
####################################
# user specified build options
####################################
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
option(ENABLE_PACKAGING
"Create build scripts for creating lucene++ packages"
OFF
)
option(LUCENE_USE_STATIC_BOOST_LIBS
"Use static boost libraries"
OFF
)
option(ENABLE_BOOST_INTEGER
"Enable boost integer types"
OFF
)
option(ENABLE_CYCLIC_CHECK
"Enable cyclic checking"
OFF
)
option(ENABLE_TEST
"Enable the tests"
ON
)
option(ENABLE_DEMO
"Enable building demo applications"
ON
)
####################################
# bootstrap
####################################
find_package(Threads REQUIRED)
find_package(Boost COMPONENTS
date_time
filesystem
regex
system
thread
REQUIRED
)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ${LUCENE_USE_STATIC_BOOST_LIBS})
set(lucene_boost_libs
${Boost_LIBRARIES}
${Boost_FILESYSTEM_LIBRARIES}
"C:\\Libraries\\boost_1_59_0\\stage\\lib\\libboost_iostreams-vc120-mt-1_59.lib"
${Boost_REGEX_LIBRARIES}
${Boost_SYSTEM_LIBRARIES}
${Boost_THREAD_LIBRARIES}
"C:\\Libraries\\boost_1_59_0\\stage\\lib\\libboost_zlib-vc120-mt-1_59.lib"
)
include(Lucene++Docs)
include(TestCXXAcceptsFlag)
include(GNUInstallDirs)
set(LIB_DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}" CACHE STRING "Define lib output directory name"
)
if(ENABLE_BOOST_INTEGER)
set(DEFINE_USE_BOOST_INTEGER "define")
else()
set(DEFINE_USE_BOOST_INTEGER "undef")
endif()
if(ENABLE_CYCLIC_CHECK)
set(DEFINE_USE_CYCLIC_CHECK "define")
else()
set(DEFINE_USE_CYCLIC_CHECK "undef")
endif()
####################################
# platform specific options
####################################
if(WIN32 OR WIN64)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
if(MSVC)
# Disable automatic boost linking on Windows as libraries are added to the linker explicitly
add_definitions(-DBOOST_ALL_NO_LIB)
# enable exceptions, see http://msdn.microsoft.com/en-us/library/1deeycx5.aspx
add_definitions(-EHsc)
endif()
if(NOT WIN32 AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
add_definitions(-fPIC)
endif()
if(CYGWIN)
add_definitions(-D__LARGE64_FILES)
endif()
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
endif()
#################################
# generate Config.h
#################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/Config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/include/Config.h" @ONLY
)
include_directories(
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
add_subdirectory(src/core)
add_subdirectory(src/contrib)
if(ENABLE_DEMO)
add_subdirectory(src/demo)
endif()
if(ENABLE_TEST)
enable_testing()
add_subdirectory(src/test)
endif()
#################################
# install pkg-config file
#################################
if(NOT WIN32)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/liblucene++.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++.pc" @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/liblucene++-contrib.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++-contrib.pc" @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++.pc"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++-contrib.pc"
DESTINATION "${LIB_DESTINATION}/pkgconfig")
endif()
#################################
# install Config.h
#################################
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/include/Config.h"
DESTINATION include/lucene++)
####################################
# custom targets
####################################
configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(
uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
VERBATIM
)
if(ENABLE_PACKAGING)
include(CreateLucene++Packages)
endif()
message("** Build Summary **")
message(" Version: ${lucene++_VERSION}")
message(" Prefix: ${CMAKE_INSTALL_PREFIX}")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(" System: ${CMAKE_SYSTEM_NAME}")
message(" Boost Include: ${Boost_INCLUDE_DIRS}")
message(" Boost Library: ${Boost_LIBRARY_DIRS}")