Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 553 lines (420 sloc) 15.273 kb
43cc089 @aristidb build: add license headers
aristidb authored
1 # vim:ts=4:sw=4:expandtab:autoindent:
2 #
3 # Copyright (c) 2008, 2009 Aristid Breitkreuz, Ash Berlin, Ruediger Sonderfeld
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
14
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 # THE SOFTWARE.
22 #
23
ad2ae52 @aristidb build/encodings: fixed check for iconv, also check if iconv accepts char...
aristidb authored
24 project(Flusspferd)
fc351d2 @aristidb build: add PROJECT() line
aristidb authored
25
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
26 cmake_minimum_required(VERSION 2.6)
720d7ff @aristidb build: use FindBoost module of cmake 2.6
aristidb authored
27
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
28 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
29 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
3b76466 @aristidb build: at least improve the syntax a little bit
aristidb authored
30
1df5b0f @aristidb build: set the default build type to Debug
aristidb authored
31 if(NOT CMAKE_BUILD_TYPE)
32 set(
33 CMAKE_BUILD_TYPE
34 Debug
35 CACHE
36 STRING
37 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
38 FORCE)
39 endif()
40
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
41 message(STATUS "Source: ${CMAKE_SOURCE_DIR}")
42 message(STATUS "Binary: ${CMAKE_BINARY_DIR}")
43
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
44 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
45 message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files that cmake just created:\nrm -rf CMakeCache.txt CMakeFiles")
46 endif()
1155c22 @aristidb build: search for boost
aristidb authored
47
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
48 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
49 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
16119fc @aristidb build: set LIBRARY_ and EXECUTABLE_OUTPUT_PATH
aristidb authored
50
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
51 set(INSTALL_EXECUTABLES_PATH ${CMAKE_INSTALL_PREFIX}/bin)
52 set(INSTALL_LIBRARIES_PATH ${CMAKE_INSTALL_PREFIX}/lib)
53 set(INSTALL_LIBDATA_PATH ${CMAKE_INSTALL_PREFIX}/lib/flusspferd)
54 set(INSTALL_MODULES_PATH ${CMAKE_INSTALL_PREFIX}/lib/flusspferd/modules)
55 set(INSTALL_HEADERS_PATH ${CMAKE_INSTALL_PREFIX}/include)
56 set(INSTALL_ETC_PATH ${CMAKE_INSTALL_PREFIX}/etc)
80fc705 @aristidb build: improve installation procedure for libflusspferd and flusspferd-s...
aristidb authored
57
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
58 execute_process(
d4b27b6 @aristidb build: fix typo
aristidb authored
59 COMMAND "${Flusspferd_SOURCE_DIR}/flusspferd-version.sh"
60 WORKING_DIRECTORY "${Flusspferd_SOURCE_DIR}"
1c2a381 @aristidb build: cmake now recognizes flusspferd's version
aristidb authored
61 OUTPUT_VARIABLE FLUSSPFERD_VERSION
62 OUTPUT_STRIP_TRAILING_WHITESPACE)
63
489b1b3 Set default FLUSSPFERD_VERSION to 'unknown'
unknown authored
64 if(NOT FLUSSPFERD_VERSION)
65 set(FLUSSPFERD_VERSION unknown)
66 endif()
67
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
68 add_definitions("-DFLUSSPFERD_VERSION=\"${FLUSSPFERD_VERSION}\"")
69 add_definitions("-DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
2b6333a @aristidb build: compile libflusspferd
aristidb authored
70
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
71 message(STATUS "Flusspferd Version " ${FLUSSPFERD_VERSION})
1c2a381 @aristidb build: cmake now recognizes flusspferd's version
aristidb authored
72
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
73 set(CMAKE_SHARED_MODULE_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
74 add_definitions("-DFLUSSPFERD_MODULE_SUFFIX=\"${CMAKE_SHARED_MODULE_SUFFIX}\"")
6b4cbd8 @aristidb build/modules: explicitly set and use module suffix, consistently
aristidb authored
75
7686863 @aristidb build: -DDEBUG for debug builds
aristidb authored
76 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
77 add_definitions("-DDEBUG")
78 endif()
79
7541210 @aristidb build: longer divider comment lines
aristidb authored
80 #############################################################################
f2ba500 @aristidb build: check for POSIX
aristidb authored
81
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
82 include(CheckIncludeFile)
83 include(CheckCXXCompilerFlag)
84 include(CheckCXXSourceCompiles)
85 include(CheckCXXSourceRuns)
86 include(FindPkgConfig)
f2ba500 @aristidb build: check for POSIX
aristidb authored
87
3622957 @aristidb build: comment line was too short
aristidb authored
88 ## Compiler options #########################################################
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
89
4445d48 @aristidb Don't build tests on WIN32 by default
aristidb authored
90 if(WIN32)
91 set(_ENABLE_TESTS_DEFAULT OFF)
92 else()
93 set(_ENABLE_TESTS_DEFAULT ON)
94 endif()
95
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
96 option(
97 ENABLE_TESTS
98 "Compile the test suite"
99 ${_ENABLE_TESTS_DEFAULT})
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
100
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
101 if(CMAKE_COMPILER_IS_GNUCXX)
102 option(ENABLE_DEBUG_WARNINGS "Enable -Wpadded and -Weffc++" OFF)
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
103
877bf9c @aristidb build: no -Wstrict-no-sentinel
aristidb authored
104 add_definitions("-pedantic-errors -Wall -Wextra"
55c6fee @aristidb build: less warnings
aristidb authored
105 "-Winit-self -Woverloaded-virtual -Wnon-virtual-dtor -Wsign-promo"
106 "-Wstrict-aliasing=1")
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
107
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
108 if(ENABLE_DEBUG_WARNINGS)
109 add_definitions("-Wpadded -Weffc++")
110 endif()
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
111
91c94af @aristidb build: remove wrong-ish space in CMakeLists.txt
aristidb authored
112 add_definitions(-DBOOST_FILESYSTEM_NO_DEPRECATED)
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
113
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
114 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
115 set(CMAKE_CXX_FLAGS_DEBUG "-g")
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
116
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
117 add_definitions("-Wno-long-long -ansi")
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
118
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
119 set(CMAKE_REQUIRED_FLAGS "")
cb17e10 @aristidb build: check GCC version
aristidb authored
120
121 check_cxx_source_compiles(
c13a525 @ashb cmake: Reduce min GCC version to 4.0 (from 4.2)
ashb authored
122 "#if __GNUC__ < 4
cb17e10 @aristidb build: check GCC version
aristidb authored
123 #error \"GCC too old\"
124 #endif
125 int main() {}"
126 GCC_VERSION_OK)
127
128 if(NOT GCC_VERSION_OK)
129 message(FATAL_ERROR "GCC Version too old! Get a newer GCC.")
130 endif()
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
131 elseif(MSVC)
132 add_definitions("/W3 /wd4512 /wd4355 /wd4800 /wd4996 /wd4714 /EHa")
133 set(WINLIBS projects/windows/lib32)
134 set(WININCLUDES ${CMAKE_SOURCE_DIR}/${WINLIBS})
135 endif()
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
136
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
137 include_directories(${Flusspferd_SOURCE_DIR}/include)
6f5a0f4 @aristidb build: add section for compiler options
aristidb authored
138
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
139 ## Plugin options ###########################################################
140
141 option(
142 FORCE_PLUGINS
143 "Fail configuration if some enabled plugins could not be configured"
144 OFF)
145 option(PLUGIN_SQLITE3 "Build SQLite3 plugin" ON)
146 option(PLUGIN_CURL "Build cURL plugin" ON)
147 option(PLUGIN_GMP "Build GMP plugin" ON)
148 option(PLUGIN_XML "Build XML plugin" ON)
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
149 option(USE_READLINE "Build with GNU/readline instead of libedit" OFF)
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
150
a89feb7 @aristidb build: actually use POSIX check for some things
aristidb authored
151 ## POSIX ####################################################################
152
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
153 check_cxx_source_runs(
a89feb7 @aristidb build: actually use POSIX check for some things
aristidb authored
154 "#include <unistd.h>
155 #include <cstdlib>
156 int main()
157 {
e783ed3 @aristidb build: allow slightly older version of POSIX
aristidb authored
158 return _POSIX_VERSION >= 199506
a89feb7 @aristidb build: actually use POSIX check for some things
aristidb authored
159 ? EXIT_SUCCESS
160 : EXIT_FAILURE;
161 }"
162 FLUSSPFERD_HAVE_POSIX)
163
7541210 @aristidb build: longer divider comment lines
aristidb authored
164 ## libdl ####################################################################
467e215 @aristidb build: find libedit
aristidb authored
165
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
166 if(FLUSSPFERD_HAVE_POSIX)
167 find_package(DL REQUIRED)
168 include_directories(${DL_INCLUDE_DIR})
169 endif()
467e215 @aristidb build: find libedit
aristidb authored
170
fb7ba40 @ashb Find and link libiconv
ashb authored
171 ## iconv ####################################################################
172
2564c8e @aristidb build: as it happens, not all filesystems are case-insensitive
aristidb authored
173 find_package(Iconv REQUIRED)
fb7ba40 @ashb Find and link libiconv
ashb authored
174
ad2ae52 @aristidb build/encodings: fixed check for iconv, also check if iconv accepts char...
aristidb authored
175 if(ICONV_ACCEPTS_NONCONST_INPUT)
176 add_definitions(-DICONV_ACCEPTS_NONCONST_INPUT)
177 endif()
178
7541210 @aristidb build: longer divider comment lines
aristidb authored
179 ## Boost ####################################################################
f2ba500 @aristidb build: check for POSIX
aristidb authored
180
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
181 set(Boost_USE_MULTITHREADED ON)
720d7ff @aristidb build: use FindBoost module of cmake 2.6
aristidb authored
182
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
183 if(WIN32)
184 set(Boost_USE_STATIC_LIBS ON)
185 endif()
186
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
187 set(Boost_FIND_REQUIRED TRUE)
672dc53 @aristidb build: enable Boost_FIND_REQUIRED
aristidb authored
188
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
189 find_package(Boost 1.36.0 COMPONENTS
1155c22 @aristidb build: search for boost
aristidb authored
190 unit_test_framework
191 thread
192 filesystem
193 system)
194
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
195 if(Boost_INCLUDE_DIR)
196 include_directories(${Boost_INCLUDE_DIR})
197 else()
198 message(FATAL_ERROR "Boost headers not found. You will have to specify them in your build environment or you can use -DBOOST_ROOT or -DBOOST_INCLUDE_DIR to tell cmake where your boost installation is.")
199 endif()
35ab338 @aristidb build: check for Boost include directories and libraries, with fatal err...
aristidb authored
200
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
201 if(Boost_LIBRARY_DIRS)
202 link_directories(${Boost_LIBRARY_DIRS})
203 else()
204 message(FATAL_ERROR "Boost libraries not found. Please set -DBOOST_ROOT or -DBOOST_LIBRARY_DIR manually.")
205 endif()
f858932 @aristidb build: check Boost include directory
aristidb authored
206
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
207 if(NOT Boost_FOUND)
208 message(STATUS "Boost not found!")
209 endif()
f2ba500 @aristidb build: check for POSIX
aristidb authored
210
7541210 @aristidb build: longer divider comment lines
aristidb authored
211 ## Spidermonkey #############################################################
2b6333a @aristidb build: compile libflusspferd
aristidb authored
212
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
213 set(Spidermonkey_REQUIRED TRUE)
214 find_package(Spidermonkey)
b85e598 @aristidb build: add variable for spidermonkey include directory
aristidb authored
215
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
216 if(NOT SPIDERMONKEY_UTF8)
217 message(FATAL_ERROR "Spidermonkey UTF8 support required but not found")
218 endif()
72101ab @aristidb build: check spidermonkey for UTF8 support
aristidb authored
219
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
220 include_directories(${SPIDERMONKEY_INCLUDE_DIR})
221 add_definitions(${SPIDERMONKEY_DEFINITIONS})
cc021ac @aristidb build: check spidermonkey for JS_THREADSAFE
aristidb authored
222
7541210 @aristidb build: longer divider comment lines
aristidb authored
223 ## libedit ##################################################################
467e215 @aristidb build: find libedit
aristidb authored
224
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
225 if(NOT USE_READLINE)
226 find_package(Libedit)
467e215 @aristidb build: find libedit
aristidb authored
227
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
228 if(LIBEDIT_FOUND)
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
229 add_definitions(-DHAVE_EDITLINE)
230 include_directories(${LIBEDIT_INCLUDE_DIR})
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
231 endif()
232 endif()
233
234 ## GNU/readline #############################################################
235
236 if(USE_READLINE)
ef74838 @ruediger added warning message if GNU/Readline is linked and added GNU/Readline s...
ruediger authored
237 message("WARNING: GNU/readline is GPL licensed.")
238
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
239 find_package(Readline)
240
241 if(READLINE_FOUND)
242 add_definitions(-DHAVE_READLINE)
243 include_directories(${READLINE_INCLUDE_DIR})
244 endif()
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
245 endif()
467e215 @aristidb build: find libedit
aristidb authored
246
77ed9ea @aristidb build: add sqlite3 plugin
aristidb authored
247 ## libxml2 ##################################################################
4ea5d2a @aristidb build: search for libxml2
aristidb authored
248
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
249 if(PLUGIN_XML)
ba22078 @ashb build: libxml2 now found as a framework on osx
ashb authored
250 find_package(LibXml2)
4ea5d2a @aristidb build: search for libxml2
aristidb authored
251
14b582c @aristidb build: setting the property INCLUDE_DIRECTORIES does not work
aristidb authored
252 if(FORCE_PLUGINS AND NOT LIBXML2_FOUND)
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
253 message(SEND_ERROR "XML plugin required but libxml2 not found")
254 endif()
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
255 endif()
4ea5d2a @aristidb build: search for libxml2
aristidb authored
256
77ed9ea @aristidb build: add sqlite3 plugin
aristidb authored
257 ## sqlite3 ##################################################################
258
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
259 if(PLUGIN_SQLITE3)
260 pkg_check_modules(SQLITE3 sqlite3>=3.4.0)
261 include_directories(${SQLITE3_INCLUDE_DIRS})
262 link_directories(${SQLITE3_LIBRARY_DIRS})
263
264 if(FORCE_PLUGINS AND NOT SQLITE3_FOUND)
265 message(SEND_ERROR "SQLite3 plugin required but SQLite3 not found")
266 endif()
267 endif()
77ed9ea @aristidb build: add sqlite3 plugin
aristidb authored
268
f626e4d @aristidb build: add gmp plugin
aristidb authored
269 ## libcurl ##################################################################
c3cc279 @aristidb build: add curl plugin (but compiled with wrong name)
aristidb authored
270
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
271 if(PLUGIN_CURL)
272 find_package(CURL)
273
274 if(FORCE_PLUGINS AND NOT CURL_FOUND)
275 message(SEND_ERROR "CURL plugin required but cURL not found")
276 endif()
277 endif()
c3cc279 @aristidb build: add curl plugin (but compiled with wrong name)
aristidb authored
278
f626e4d @aristidb build: add gmp plugin
aristidb authored
279 ## GMP ######################################################################
280
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
281 if(PLUGIN_GMP)
282 find_package(GMP)
283 find_package(GMPXX)
284
285 if(FORCE_PLUGINS)
286 if(NOT GMP_FOUND OR NOT GMPXX_FOUND)
287 message(SEND_ERROR "GMP plugin required but GMP/GMPXX not found")
288 endif()
289 endif()
290 endif()
f626e4d @aristidb build: add gmp plugin
aristidb authored
291
7541210 @aristidb build: longer divider comment lines
aristidb authored
292 ## Library ##################################################################
2b6333a @aristidb build: compile libflusspferd
aristidb authored
293
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
294 file(
2b6333a @aristidb build: compile libflusspferd
aristidb authored
295 GLOB
296 flusspferd_library_sources
116677c @aristidb core: move many sources to src/core/ because they are not Spidermonkey-s...
aristidb authored
297 ${Flusspferd_SOURCE_DIR}/src/core/*.cpp
bf556b5 @aristidb io: make IO a core module
aristidb authored
298 ${Flusspferd_SOURCE_DIR}/src/spidermonkey/*.cpp
299 ${Flusspferd_SOURCE_DIR}/src/io/*.cpp)
2b6333a @aristidb build: compile libflusspferd
aristidb authored
300
3ee8c4d Build flusspferd as a static lib for Windows
unknown authored
301 if(WIN32)
302 set(FLUSSPFERD_LIBRARY_TYPE STATIC)
303 else()
304 set(FLUSSPFERD_LIBRARY_TYPE SHARED)
305 endif()
306
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
307 add_library(
2b6333a @aristidb build: compile libflusspferd
aristidb authored
308 flusspferd
3ee8c4d Build flusspferd as a static lib for Windows
unknown authored
309 ${FLUSSPFERD_LIBRARY_TYPE}
2b6333a @aristidb build: compile libflusspferd
aristidb authored
310 ${flusspferd_library_sources})
28a56c9 @aristidb build: add shell executable
aristidb authored
311
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
312 set(
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
313 flusspferd_LIBS
872fed4 @aristidb build: add FindDL.cmake
aristidb authored
314 ${DL_LIBRARIES}
fb7ba40 @ashb Find and link libiconv
ashb authored
315 ${ICONV_LIBRARIES}
4af245f @aristidb build: move Spidermonkey search into FindSpidermonkey.cmake module
aristidb authored
316 ${SPIDERMONKEY_LIBRARIES}
720d7ff @aristidb build: use FindBoost module of cmake 2.6
aristidb authored
317 ${Boost_THREAD_LIBRARY}
318 ${Boost_FILESYSTEM_LIBRARY}
319 ${Boost_SYSTEM_LIBRARY})
13c4451 @aristidb build: find and link spidermonkey
aristidb authored
320
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
321 target_link_libraries(flusspferd ${flusspferd_LIBS})
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
322
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
323 if(NOT WIN32)
324 install(TARGETS
325 flusspferd
326 LIBRARY DESTINATION ${INSTALL_LIBRARIES_PATH})
327 endif()
80fc705 @aristidb build: improve installation procedure for libflusspferd and flusspferd-s...
aristidb authored
328
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
329 ## Library - coverage variant ###############################################
330
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
331 if(ENABLE_TESTS)
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
332
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
333 # file(
1bdc8ea @aristidb build: compile tests
aristidb authored
334 # GLOB
335 # flusspferd_coverage_extra_sources
336 # ${Flusspferd_SOURCE_DIR}/src/io/*.cpp
337 # ${Flusspferd_SOURCE_DIR}/src/xml/*.cpp)
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
338
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
339 add_library(
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
340 flusspferd-coverage
341 SHARED
342 ${flusspferd_library_sources} ${flusspferd_coverage_extra_sources})
343
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
344 target_link_libraries(flusspferd-coverage ${flusspferd_LIBS})
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
345
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
346 set(COV_FLAGS "-fprofile-arcs -ftest-coverage")
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
347
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
348 set_property(
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
349 TARGET flusspferd-coverage
350 PROPERTY COMPILE_FLAGS
351 "${COV_FLAGS} -DFLUSSPFERD_COVERAGE")
352
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
353 set_property(
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
354 TARGET flusspferd-coverage
355 PROPERTY LINK_FLAGS
356 ${COV_FLAGS})
357
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
358 endif()
6e6c925 @aristidb build: build coverage-enabled flusspferd library for tests
aristidb authored
359
7541210 @aristidb build: longer divider comment lines
aristidb authored
360 ## Programs #################################################################
28a56c9 @aristidb build: add shell executable
aristidb authored
361
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
362 add_executable(
28a56c9 @aristidb build: add shell executable
aristidb authored
363 flusspferd-shell
364 src/programs/flusspferd.cpp)
365
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
366 set_property(
5135631 @aristidb build: rename flusspferd executable flusspferd, no longer flusspferd-she...
aristidb authored
367 TARGET flusspferd-shell
368 PROPERTY OUTPUT_NAME
369 flusspferd)
370
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
371 if(NOT USE_READLINE)
372 target_link_libraries(
28a56c9 @aristidb build: add shell executable
aristidb authored
373 flusspferd-shell
467e215 @aristidb build: find libedit
aristidb authored
374 flusspferd
375 ${LIBEDIT_LIBRARIES})
1a5a824 @ruediger shell: added GNU/readline support
ruediger authored
376 else()
377 target_link_libraries(
378 flusspferd-shell
379 flusspferd
380 ${READLINE_LIBRARIES})
381 endif()
7a357e1 @aristidb build: add flusspferd-io lib
aristidb authored
382
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
383 if(NOT WIN32)
384 install(TARGETS
385 flusspferd-shell
386 RUNTIME DESTINATION ${INSTALL_EXECUTABLES_PATH})
387 endif()
80fc705 @aristidb build: improve installation procedure for libflusspferd and flusspferd-s...
aristidb authored
388
1bdc8ea @aristidb build: compile tests
aristidb authored
389 ## Tests ###################################################################
390
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
391 if(ENABLE_TESTS)
1bdc8ea @aristidb build: compile tests
aristidb authored
392
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
393 file(GLOB
1bdc8ea @aristidb build: compile tests
aristidb authored
394 TESTS
395 test/test_*.cpp)
396
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
397 foreach(TEST_SOURCE ${TESTS})
398 string(REGEX MATCH "test_[a-zA-Z0-9_]*" TEST_OUTPUT ${TEST_SOURCE})
399 string(REGEX REPLACE "^test_" "" TEST_NAME TEST_OUTPUT)
400 add_executable(${TEST_OUTPUT} ${TEST_SOURCE})
401 set_property(
1bdc8ea @aristidb build: compile tests
aristidb authored
402 TARGET ${TEST_OUTPUT}
403 PROPERTY COMPILE_FLAGS
404 "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MODULE=${TEST_NAME}")
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
405 target_link_libraries(
1bdc8ea @aristidb build: compile tests
aristidb authored
406 ${TEST_OUTPUT}
407 ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
408 flusspferd-coverage)
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
409 endforeach()
1bdc8ea @aristidb build: compile tests
aristidb authored
410
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
411 endif()
1bdc8ea @aristidb build: compile tests
aristidb authored
412
23315c0 @aristidb build: build os plugin
aristidb authored
413 ## Plugins #################################################################
414
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
415 set(PLUGINS os environment)
a89feb7 @aristidb build: actually use POSIX check for some things
aristidb authored
416
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
417 if(FLUSSPFERD_HAVE_POSIX)
418 set(PLUGINS ${PLUGINS} posix)
419 endif()
77ed9ea @aristidb build: add sqlite3 plugin
aristidb authored
420
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
421 if(PLUGIN_SQLITE3 AND SQLITE3_FOUND)
4ec54ec @aristidb Lower-case module names
aristidb authored
422 set(PLUGINS ${PLUGINS} sqlite3)
423 set(sqlite3_DEFINITIONS ${SQLITE3_DEFINITIONS})
424 set(sqlite3_LIBRARIES ${SQLITE3_LIBRARIES})
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
425 endif()
c3cc279 @aristidb build: add curl plugin (but compiled with wrong name)
aristidb authored
426
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
427 if(PLUGIN_CURL AND CURL_FOUND)
4ec54ec @aristidb Lower-case module names
aristidb authored
428 set(PLUGINS ${PLUGINS} curl)
429 set(curl_LIBRARIES ${CURL_LIBRARIES})
14b582c @aristidb build: setting the property INCLUDE_DIRECTORIES does not work
aristidb authored
430 include_directories(${CURL_INCLUDE_DIR})
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
431 endif()
28b3d3c @aristidb build: build plugins with proper case
aristidb authored
432
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
433 if(PLUGIN_GMP AND GMP_FOUND AND GMPXX_FOUND)
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
434 set(PLUGINS ${PLUGINS} gmp)
435 set(gmp_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY})
14b582c @aristidb build: setting the property INCLUDE_DIRECTORIES does not work
aristidb authored
436 include_directories(${GMP_INCLUDE_DIR})
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
437 endif()
f626e4d @aristidb build: add gmp plugin
aristidb authored
438
cdf0626 @aristidb build: some plugins can now be enabled/disabled
aristidb authored
439 if(PLUGIN_XML AND LIBXML2_FOUND)
4ec54ec @aristidb Lower-case module names
aristidb authored
440 set(PLUGINS ${PLUGINS} xml)
441 set(xml_LIBRARIES ${LIBXML2_LIBRARIES})
14b582c @aristidb build: setting the property INCLUDE_DIRECTORIES does not work
aristidb authored
442 include_directories(${LIBXML2_INCLUDE_DIR})
480a018 @aristidb xml: => normal plugin now
aristidb authored
443 endif()
444
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
445 foreach(PLUGIN ${PLUGINS})
a0bdfd5 @aristidb build: more success messages (to avoid confusion if there are non-fatal ...
aristidb authored
446 message(STATUS "Plugin: ${PLUGIN} (will be built)")
23315c0 @aristidb build: build os plugin
aristidb authored
447
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
448 file(GLOB
856c1e5 @aristidb build: indentation
aristidb authored
449 ${PLUGIN}_sources
450 ${Flusspferd_SOURCE_DIR}/src/plugins/${PLUGIN}/*.cpp)
451
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
452 add_library(${PLUGIN}_PLUGIN MODULE ${${PLUGIN}_sources})
856c1e5 @aristidb build: indentation
aristidb authored
453
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
454 set_property(
856c1e5 @aristidb build: indentation
aristidb authored
455 TARGET ${PLUGIN}_PLUGIN
456 PROPERTY OUTPUT_NAME
457 ${PLUGIN})
458
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
459 set_property(
856c1e5 @aristidb build: indentation
aristidb authored
460 TARGET ${PLUGIN}_PLUGIN
461 PROPERTY LIBRARY_OUTPUT_DIRECTORY
462 ${Flusspferd_BINARY_DIR}/modules)
463
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
464 set_property(
856c1e5 @aristidb build: indentation
aristidb authored
465 TARGET ${PLUGIN}_PLUGIN
466 PROPERTY DEFINITIONS
467 ${${PLUGIN}_DEFINITIONS})
468
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
469 target_link_libraries(
856c1e5 @aristidb build: indentation
aristidb authored
470 ${PLUGIN}_PLUGIN
471 flusspferd
472 ${${PLUGIN}_LIBRARIES})
e7bb539 @aristidb build: build plugins with a loop and into the modules/ directory
aristidb authored
473
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
474 if(NOT WIN32)
475 install(TARGETS
476 ${PLUGIN}_PLUGIN
477 LIBRARY DESTINATION ${INSTALL_MODULES_PATH})
864fc1a @aristidb build: install IO, XML and plugins
aristidb authored
478
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
479 file(GLOB
480 ${PLUGIN}_JS_FILES
481 ${Flusspferd_SOURCE_DIR}/src/plugins/${PLUGIN}/${PLUGIN}.js)
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
482
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
483 if(${PLUGIN}_JS_FILES)
484 install(FILES
485 ${${PLUGIN}_JS_FILES}
486 DESTINATION ${INSTALL_MODULES_PATH})
487 endif()
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
488 endif()
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
489
4cf0661 @aristidb build: use lower-case cmake function names
aristidb authored
490 endforeach()
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
491
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
492 if(NOT WIN32)
493 set(JS_PLUGINS
33a5b2e @aristidb build: fix installation of renamed plugins (thank you, Michael Yates)
aristidb authored
494 util util/array util/function util/range testharness http/headers)
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
495
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
496 foreach(JS_PLUGIN ${JS_PLUGINS})
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
497
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
498 string(REGEX MATCH ".*/" ${JS_PLUGIN}_DIR ${JS_PLUGIN})
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
499
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
500 install(FILES
501 src/js/${JS_PLUGIN}.js
502 DESTINATION ${INSTALL_MODULES_PATH}/${${JS_PLUGIN}_DIR})
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
503
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
504 endforeach()
505 endif()
5c221d9 @aristidb build: install headers
aristidb authored
506
507 ## Headers ##################################################################
508
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
509 if(NOT WIN32)
510 install(
511 DIRECTORY include/
512 DESTINATION ${INSTALL_HEADERS_PATH}
513 FILES_MATCHING PATTERN "*.hpp")
514 endif()
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
515
516 ## Prelude ##################################################################
517
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
518 if(NOT WIN32)
519 install(
520 FILES src/js/prelude.js
521 DESTINATION ${INSTALL_LIBDATA_PATH})
522 endif()
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
523
0dbe02a @aristidb build: generate flusspferd.pc again
aristidb authored
524 ## Configured files##########################################################
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
525
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
526 if(NOT WIN32)
527 configure_file(
528 ${Flusspferd_SOURCE_DIR}/src/js/jsrepl.js.in
529 ${Flusspferd_BINARY_DIR}/js/jsrepl.js)
0312cd8 @aristidb build: install so much that the installed flusspferd binary works
aristidb authored
530
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
531 install(
532 FILES ${Flusspferd_BINARY_DIR}/js/jsrepl.js
533 DESTINATION ${INSTALL_ETC_PATH}/flusspferd)
0dbe02a @aristidb build: generate flusspferd.pc again
aristidb authored
534
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
535 set(FLUSSPFERD_EXTERNAL_CFLAGS
536 "-I${Boost_INCLUDE_DIR} -I${SPIDERMONKEY_INCLUDE_DIR}")
2b6a1b8 @aristidb fix flusspferd.pc
aristidb authored
537
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
538 foreach(_FLAG @SPIDERMONKEY_DEFINITIONS@)
539 set(FLUSSPFERD_EXTERNAL_CFLAGS "${FLUSSPFERD_EXTERNAL_CFLAGS} ${_FLAG}")
540 endforeach()
8996ed6 @aristidb build: add spidermonkey flags to flusspferd.pc
aristidb authored
541
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
542 configure_file(
543 ${Flusspferd_SOURCE_DIR}/flusspferd.pc.in
544 ${Flusspferd_BINARY_DIR}/flusspferd.pc
545 @ONLY)
0dbe02a @aristidb build: generate flusspferd.pc again
aristidb authored
546
0026e1f @aristidb win32/build: I can get cmake to configure now!
aristidb authored
547 install(
548 FILES ${Flusspferd_BINARY_DIR}/flusspferd.pc
549 DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
550 endif()
a0bdfd5 @aristidb build: more success messages (to avoid confusion if there are non-fatal ...
aristidb authored
551
552 message(STATUS "Configuration SUCCESSFUL. No fatal errors.")
Something went wrong with that request. Please try again.