forked from pgRouting/pgrouting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
617 lines (484 loc) · 21.1 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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
#
# Format convention
# - command (lower case)
# - VARIABLE (upper case)
# (http://www.cmake.org/cmake/help/v2.8.12/cmake.html)
#
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
if(POLICY CMP0046)
cmake_policy(SET CMP0046 OLD)
endif()
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
message(FATAL_ERROR "In-source builds not allowed.
Please make a new directory (called a build directory) and run CMake from there.
You may need to remove CMakeCache.txt." )
endif()
#---------------------------------------------
# Setting kind of build
#---------------------------------------------
#
# for developing
# cmake -DMAKE_BUILD_TYPE=Develop
#----------------------
message(STATUS "CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}")
if (CMAKE_BUILD_TYPE MATCHES Develop)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo
MinSizeRel."
FORCE)
set(WITH_INTERNAL_TESTS)
endif()
message(STATUS "CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}")
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
project(PGROUTING)
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
if(POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif()
if(MSVC)
cmake_policy(SET CMP0046 OLD)
endif()
#=============================================
# Set the working directories
#=============================================
#---------------------------------------------
# PgRouting_SOURCE_NAMES
#---------------------------------------------
#
# Name of the directories that have C/C++ code
# - <directory>/src/CMakelists.txt must exist
# - <directory>/sql/CMakeLists.txt must exist
#----------------------
configure_file("configuration.conf" "configuration.conf")
file(STRINGS configuration.conf PgRouting_CONFIGURATION_FILE)
set(PgRouting_SOURCE_NAMES "")
set(PgRouting_SQL_DIRECTORIES "")
set(PgRouting_DOC_DIRECTORIES "")
foreach(line ${PgRouting_CONFIGURATION_FILE})
string(REGEX REPLACE "^(#).*" "\\1" comment ${line})
if("${comment}" MATCHES "#")
continue()
endif()
string(REGEX REPLACE "^(.*)\\|(.*)\\|(.*)\\|(.*)" "\\1" directory ${line})
string(REGEX REPLACE "^(.*)\\|(.*)\\|(.*)\\|(.*)" "\\2" has_code ${line})
string(REGEX REPLACE "^(.*)\\|(.*)\\|(.*)\\|(.*)" "\\3" has_sql ${line})
string(REGEX REPLACE "^(.*)\\|(.*)\\|(.*)\\|(.*)" "\\4" has_doc ${line})
string(STRIP ${directory} directory)
string(STRIP ${has_code} has_code)
string(STRIP ${has_sql} has_sql)
string(STRIP ${has_doc} has_doc)
if( ${has_code} MATCHES "Y")
list(APPEND PgRouting_SOURCE_NAMES "${directory}")
endif()
if( ${has_sql} MATCHES "Y")
list(APPEND PgRouting_SQL_DIRECTORIES "${directory}")
endif()
if( ${has_doc} MATCHES "Y")
list(APPEND PgRouting_DOC_DIRECTORIES "${directory}")
endif()
endforeach()
if (PGROUTING_DEBUG)
message(STATUS "${PgRouting_SOURCE_NAMES}")
message(STATUS "${PgRouting_SQL_DIRECTORIES}")
message(STATUS "${PgRouting_DOC_DIRECTORIES}")
endif()
#---------------------------------------------
# minimum versions
#---------------------------------------------
set(DOXYGEN_MINIMUM_VERSION "1.7")
set(SPHINX_MINIMUM_VERSION "1.1")
set(POSTGRESQL_MINIMUM_VERSION "9.2.0")
set(BOOST_MINIMUM_VERSION "1.46")
set(CGAL_CXX_MINIMUM_VERSION "4.4")
set(POSTGIS_MINIMUM_VERSION "2.0.0")
set(GNU_CXX_MINIMUM_VERSION "4.6")
set(MSVC_CXX_MINIMUM_VERSION "18.0")
message(STATUS "DOXYGEN_MINIMUM_VERSION=${DOXYGEN_MINIMUM_VERSION}")
message(STATUS "SPHINX_MINIMUM_VERSION=${SPHINX_MINIMUM_VERSION}")
message(STATUS "POSTGRESQL_MINIMUM_VERSION=${POSTGRESQL_MINIMUM_VERSION}")
message(STATUS "POSTGIS_MINIMUM_VERSION=${POSTGIS_MINIMUM_VERSION}")
message(STATUS "GNU_CXX_MINIMUM_VERSION=${GNU_CXX_MINIMUM_VERSION}")
message(STATUS "CLANG_CXX_MINIMUM_VERSION=${CLANG_CXX_MINIMUM_VERSION}")
message(STATUS "MSVC_CXX_MINIMUM_VERSION=${MSVC_CXX_MINIMUM_VERSION}")
#---------------------------------------------
# adding cmake modules
#---------------------------------------------
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
foreach(dir ${CMAKE_MODULE_PATH})
message(STATUS "dir='${dir}'")
endforeach()
include(MacroLibrary)
include(TargetDistclean)
#---------------------------------------------
# C++ Compiler requirements
#---------------------------------------------
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNU_CXX_MINIMUM_VERSION)
message(FATAL_ERROR "GCC version must be at least ${GNU_CXX_MINIMUM_VERSION}!
Found version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_CXX_MINIMUM_VERSION)
message(FATAL_ERROR "MSVC version must be at least ${MSVC_CXX_MINIMUM_VERSION}!")
endif()
else()
message(STATUS "Unknown compiler minimum version for ${CMAKE_CXX_COMPILER_ID}")
endif()
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
message(STATUS "Using -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
message(STATUS "Using -std=c++0x.")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++0x or C++11 flags support.")
endif()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# PGROUTING version variables
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
set(PGROUTING_VERSION_MAJOR "2")
set(PGROUTING_VERSION_MINOR "5")
set(PGROUTING_VERSION_PATCH "0")
set(PGROUTING_VERSION_DEV "-rc")
set(PGROUTING_SHORT_VERSION "${PGROUTING_VERSION_MAJOR}.${PGROUTING_VERSION_MINOR}")
set(PGROUTING_VERSION "${PGROUTING_VERSION_MAJOR}.${PGROUTING_VERSION_MINOR}.${PGROUTING_VERSION_PATCH}")
set(PGROUTING_FULL_VERSION "v${PGROUTING_VERSION}${PGROUTING_VERSION_DEV}")
#---------------------------------------------
# Variables used in pgr_version()
#---------------------------------------------
file(STRINGS "${PGROUTING_SOURCE_DIR}/VERSION" PGROUTING_BUILD_STRING)
set(PGROUTING_GIT_HASH "")
string(REGEX REPLACE "^([0-9]+)-([0-9a-f]+) (.*)$" "\\2" PGROUTING_GIT_HASH ${PGROUTING_BUILD_STRING})
string(REGEX REPLACE "^([0-9]+)-([0-9a-f]+) (.*)$" "\\3" PGROUTING_GIT_BRANCH ${PGROUTING_BUILD_STRING})
if ( NOT "${PGROUTING_GIT_BRANCH}" STREQUAL "master")
set (PGROUTING_GIT_HASH "")
set (PGROUTING_GIT_BRANCH "")
endif()
if (PGROUTING_DEBUG)
message(STATUS "PGROUTING_VERSION: ${PGROUTING_FULL_VERSION}")
message(STATUS "PGROUTING_SHORT_VERSION: ${PGROUTING_FULL_VERSION}")
message(STATUS "PGROUTING_FULL_VERSION: ${PGROUTING_FULL_VERSION}")
message(STATUS "VERSION file contents: ${PGROUTING_BUILD_STRING}")
message(STATUS "PGROUTING_GIT_HASH: ${PGROUTING_GIT_HASH}")
message(STATUS "PGROUTING_GIT_BRANCH: ${PGROUTING_GIT_BRANCH}")
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
message(STATUS "PGROUTING_SOURCE_DIR: ${PGROUTING_SOURCE_DIR}")
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
endif()
#----------------------
# PGROUTING library name used in the pgr_functions
# '$libdir/${PGROUTING_LIBRARY_NAME}'
#----------------------
set(PGROUTING_LIBRARY_NAME "libpgrouting-${PGROUTING_SHORT_VERSION}")
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Windows compiler flags
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
if(WIN32 AND NOT MSVC)
set(OS_BUILD $ENV{OS_BUILD})
if(NOT OS_BUILD)
set(OS_BUILD "64")
endif(NOT OS_BUILD)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:/c/ming${OS_BUILD}/projects/pgx${OS_BUILD}/pg92)
if (NOT BOOST_ROOT)
set(BOOST_ROOT c:/ming${OS_BUILD}/msys/local)
endif(NOT BOOST_ROOT)
if (NOT CGAL_ROOT)
set(CGAL_ROOT c:/ming${OS_BUILD}/msys/local)
endif(NOT CGAL_ROOT)
if (NOT GMP_ROOT)
set(GMP_ROOT c:/ming${OS_BUILD}/mingw${OS_BUILD})
endif(NOT GMP_ROOT)
if (PGROUTING_DEBUG)
message(STATUS "OS_BUILD=${OS_BUILD}")
message(STATUS "CGAL_ROOT=${CGAL_ROOT}")
message(STATUS "GMP_ROOT=${GMP_ROOT}")
message(STATUS "BOOST_ROOT=${BOOST_ROOT}")
message(STATUS "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
endif()
endif(WIN32 AND NOT MSVC)
if(WIN32 AND MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_SCL_SECURE_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_NONSTDC_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -EHsc")
endif()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Finding prerequisites
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#---------------------------------------------
#---------------------------------------------
# Perl
#---------------------------------------------
#---------------------------------------------
include(FindPerl)
if(NOT PERL_EXECUTABLE)
message(FATAL_ERROR " Please check your Perl installation.")
endif(NOT PERL_EXECUTABLE)
#---------------------------------------------
#---------------------------------------------
# PostgreSQL
#---------------------------------------------
#---------------------------------------------
find_package(PostgreSQL)
if(NOT POSTGRESQL_FOUND)
message(FATAL_ERROR " Please check your PostgreSQL installation.")
endif(NOT POSTGRESQL_FOUND)
if(NOT POSTGRESQL_VERSION_STRING)
message(FATAL_ERROR "pg_config was not found. Please check your PostgreSQL installation!")
endif()
string(SUBSTRING "${POSTGRESQL_VERSION_STRING}" 11 -1 POSTGRESQL_VERSION)
# for XbetaY XalphaY XrcY -> X.Y
string(REGEX REPLACE "^([0-9]+)[beta|alpha|rc].*" "\\1.0" POSTGRESQL_VERSION ${POSTGRESQL_VERSION})
#for X.Y.Z -> XY Y<10
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "\\1\\2" PGSQL_VERSION ${POSTGRESQL_VERSION})
if("${POSTGRESQL_VERSION}" VERSION_LESS "${POSTGRESQL_MINIMUM_VERSION}")
message(FATAL_ERROR " PostgreSQL ${POSTGRESQL_MINIMUM_VERSION} or greater is required.")
endif("${POSTGRESQL_VERSION}" VERSION_LESS "${POSTGRESQL_MINIMUM_VERSION}")
#-------
include_directories(${POSTGRESQL_INCLUDE_DIR})
if(WIN32)
include_directories(${POSTGRESQL_INCLUDE_DIR}/port/win32)
if(MSVC)
include_directories(${POSTGRESQL_INCLUDE_DIR}/port/win32_msvc/)
endif(MSVC)
endif(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPGSQL_VERSION=${PGSQL_VERSION}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPGSQL_VERSION=${PGSQL_VERSION}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DPGSQL_VERSION=${PGSQL_VERSION}")
#---------------------------------------------
#---------------------------------------------
# Boost
#---------------------------------------------
#---------------------------------------------
find_package(Boost ${BOOST_MINIMUM_VERSION})
if(Boost_INCLUDE_DIRS)
message(STATUS "Boost headers were found here: ${Boost_INCLUDE_DIRS}")
else(Boost_INCLUDE_DIRS)
message(FATAL_ERROR " Please check your Boost installation ")
endif(Boost_INCLUDE_DIRS)
include_directories(${Boost_INCLUDE_DIRS})
#---------------------------------------------
#---------------------------------------------
# CGAL
#---------------------------------------------
#---------------------------------------------
find_package(CGAL ${CGAL_MINIMUM_VERSION})
if(NOT CGAL_FOUND)
message(FATAL_ERROR " Please check your CGAL installation, or set correct path to CGAL_INCLUDE_DIR and CGAL_LIBRARIES.")
endif(NOT CGAL_FOUND)
#-------
include_directories(${CGAL_INCLUDE_DIR})
#---------------------------------------------
#---------------------------------------------
# PgRouting includes
#---------------------------------------------
#---------------------------------------------
set(PGROUTING_INCLUDE_DIRECTORIES
${PGROUTING_SOURCE_DIR}/src/common/src
${PGROUTING_SOURCE_DIR}/src/dijkstra/src
${PGROUTING_SOURCE_DIR}/include
)
#-------
include_directories(${PGROUTING_INCLUDE_DIRECTORIES})
#---------------------------------------------
if (PGROUTING_DEBUG)
message(STATUS "PERL_VERSION_STRING = ${PERL_VERSION_STRING}")
message(STATUS "POSTGRESQL_VERSION is ${PGSQL_VERSION}")
message(STATUS "PGSQL_VERSION is ${PGSQL_VERSION}")
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "CGAL_INCLUDE_DIR: ${CGAL_INCLUDE_DIR}")
message(STATUS "PGROUTING_INCLUDE_DIRECTORIES = ${PGROUTING_INCLUDE_DIRECTORIES}")
message(STATUS "POSTGRESQL_INCLUDE_DIR = ${POSTGRESQL_INCLUDE_DIR}")
message(STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS}")
endif()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Posgres installation directories
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#---------------------------------------------
# library directory
#---------------------------------------------
execute_process(
COMMAND ${POSTGRESQL_PG_CONFIG} --pkglibdir
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE LIB_DIR)
if(NOT LIB_DIR)
message(FATAL_ERROR "pg_config --pkglibdir failed to return a value. Please check your PostgreSQL installation!")
endif()
#-------
set(LIBRARY_INSTALL_PATH ${LIB_DIR})
#---------------------------------------------
# extension directory
#---------------------------------------------
execute_process(
COMMAND ${POSTGRESQL_PG_CONFIG} --sharedir
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE SHARE_DIR)
#-------
if(SHARE_DIR)
set(SHARE_DIR "${SHARE_DIR}/extension")
else(SHARE_DIR)
message(FATAL_ERROR "pg_config --sharedir failed to return a value. Please check your PostgreSQL installation!")
endif(SHARE_DIR)
#---------------------------------------------
if (PGROUTING_DEBUG)
message(STATUS "Install directory for libraries is set to ${LIB_DIR}")
message(STATUS "Extension directory for SQL files is set to ${SHARE_DIR}")
endif()
#---------------------------------------------
# Special cases for windows
#---------------------------------------------
if(WIN32)
message(STATUS "LINK_DIRECTORIES = ${POSTGRESQL_LIBRARIES}")
link_directories(${POSTGRESQL_LIBRARIES} ${LIB_DIR})
link_libraries(postgres)
endif()
#-----------------------------------------------------------------------------
if (PGROUTING_DEBUG)
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "dir='${dir}'")
endforeach()
endif()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#compiler directives
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# for UNIX & JENKINS
if(UNIX OR (WIN32 AND NOT MSVC))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()
if(NOT WIN32)
CHECK_C_COMPILER_FLAG("-fPIC" C_COMPILER_SUPPORTS_FPIC)
CHECK_CXX_COMPILER_FLAG("-fPIC" CXX_COMPILER_SUPPORTS_FPIC)
if(C_COMPILER_SUPPORTS_FPIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC ")
endif()
if(CXX_COMPILER_SUPPORTS_FPIC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ")
endif()
endif()
if(WIN32 AND MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
endif()
CHECK_C_COMPILER_FLAG("-frounding-math" C_COMPILER_SUPPORTS_ROUNDING_MATH)
CHECK_CXX_COMPILER_FLAG("-frounding-math" CXX_COMPILER_SUPPORTS_ROUNDING_MATH)
if(C_COMPILER_SUPPORTS_ROUNDING_MATH)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -frounding-math ")
endif()
if(CXX_COMPILER_SUPPORTS_ROUNDING_MATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frounding-math ")
endif()
# TODO use -Werror when TRSP gets rewritten
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wconversion -pedantic -Wmissing-prototypes -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -fno-implicit-inline-templates -Wconversion -pedantic -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (PGROUTING_DEBUG)
message(STATUS "CMAKE_CXX_FLAGS_DEBUG= ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE= ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_FLAGS= ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_C_FLAGS_DEBUG= ${CMAKE_C_FLAGS_DEBUG}")
message(STATUS "CMAKE_C_FLAGS_RELEASE= ${CMAKE_C_FLAGS_RELEASE}")
message(STATUS "CMAKE_C_FLAGS= ${CMAKE_C_FLAGS}")
message(STATUS "UNIX=${UNIX}")
message(STATUS "WIN32=${WIN32}")
message(STATUS "MSVC=${MSVC}")
endif()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#====================================================================
# Include the working directories
#====================================================================
if(WITH_INTERNAL_TESTS)
message("Including InternalQueryTests")
set(PgRouting_SOURCE_NAMES ${PgRouting_SOURCE_NAMES} "internalQueryTests")
endif()
#-------------------
# add the subdirectories that have the C/C++ code
#-------------------
foreach (subdir ${PgRouting_SOURCE_NAMES})
add_subdirectory("${PGROUTING_SOURCE_DIR}/src/${subdir}/src")
endforeach()
#====================================================================
# assemble the object files from the src functions into
# a single library librouting.so
set(LIBRARY_OUTPUT_PATH lib)
if(APPLE)
set(LIBRARY_MODE_TARGET "MODULE")
else(APPLE)
set(LIBRARY_MODE_TARGET "SHARED")
endif(APPLE)
LINK_LIBRARIES(${CGAL_LIBRARIES} ${GMP_LIBRARIES} ${BOOST_THREAD_LIBRARIES})
#-------------------
# pgRouting objects to be linked
#-------------------
foreach (subdir ${PgRouting_SOURCE_NAMES} )
set(PGROUTING_OBJECTS ${PGROUTING_OBJECTS} "$<TARGET_OBJECTS:${subdir}>")
endforeach()
#-----------------------------------------------------------------------------
# PGROUTING Library names
#-----------------------------------------------------------------------------
message("Building the library names")
#----------------------
# PGROUTING installation files names have the following name
#----------------------
set(PGROUTING_LIB_NAME "pgrouting-${PGROUTING_SHORT_VERSION}")
add_library(${PGROUTING_LIB_NAME}
${LIBRARY_MODE_TARGET}
${PGROUTING_OBJECTS})
if(APPLE)
set_target_properties(${PGROUTING_LIB_NAME}
PROPERTIES
LINK_FLAGS "-bundle_loader ${POSTGRESQL_EXECUTABLE} -bundle")
endif(APPLE)
if(WIN32 AND MSVC)
set_target_properties(${PGROUTING_LIB_NAME} PROPERTIES PREFIX "lib")
endif(WIN32 AND MSVC)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# sql subdirectory creates the files:
# pgrouting--(version).sql
# pgrouting--(oldVersion)--(version).sql
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
add_subdirectory(sql)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# INSTALLATION
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
install(TARGETS ${PGROUTING_LIB_NAME} DESTINATION ${LIBRARY_INSTALL_PATH})
install(FILES
${PgRouting_SQL_FILES_TO_INSTALL}
DESTINATION "${SHARE_DIR}"
)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# DOCUMENTATION
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
add_subdirectory(doxygen)
add_subdirectory(doc)
if (PGROUTING_DEBUG)
foreach (f ${PgRouting_SQL_FILES})
message(STATUS ${f})
endforeach()
endif()