root/sandbox/sigis/christian.gonzalez/trunk/CMakeLists.txt

Revision 203, 3.8 KB (checked in by anton, 2 years ago)

cmake files fixed

Line 
1CMAKE_MINIMUM_REQUIRED(VERSION 2.3)
2PROJECT(PGROUTING)
3
4#-----------------------------------------------------------------------------
5# PGROUTING version number.
6SET(PGROUTING_VERSION_MAJOR "1")
7SET(PGROUTING_VERSION_MINOR "0")
8SET(PGROUTING_VERSION_PATCH "1")
9
10SET(PGROUTING_VERSION_STRING "${PGROUTING_VERSION_MAJOR}.${PGROUTING_VERSION_MINOR}.${PGROUTING_VERSION_PATCH}")
11
12add_subdirectory(cmake)
13SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
14
15include (MacroLibrary)
16
17macro_optional_find_package(PostgreSQL)
18IF(NOT POSTGRESQL_FOUND)
19  MESSAGE(FATAL ERROR " Please check your Boost installation.")
20ENDIF(NOT POSTGRESQL_FOUND)
21
22FIND_PACKAGE(Boost)
23IF(Boost_INCLUDE_DIRS)
24  MESSAGE("Boost headers were found here: ${Boost_INCLUDE_DIR}")
25ELSE(Boost_INCLUDE_DIRS)
26  MESSAGE(FATAL ERROR " Please check your Boost installation ")
27ENDIF(Boost_INCLUDE_DIRS)
28
29EXEC_PROGRAM(pg_config
30 ARGS --pkglibdir
31 OUTPUT_VARIABLE LIB_DIR)
32
33IF(LIB_DIR)
34  MESSAGE("Output directory for libraries is set to ${LIB_DIR}")
35ELSE(LIB_DIR)
36  SET(LIB_DIR ${PGROUTING_BINARY_DIR}/lib)
37  MESSAGE("pg_config not found, output directory for libraries is set to ${PGROUTING_BINARY_DIR}/lib")
38ENDIF(LIB_DIR)
39
40if(PGROUTING_CORE_INCLUDE_DIR)
41   set(PGROUTING_CORE_FOUND TRUE)
42
43else(PGROUTING_CORE_INCLUDE_DIR)
44 FIND_PATH(PGROUTING_CORE_INCLUDE_DIR dijkstra.h
45      PATHS
46      ${CMAKE_CURRENT_SOURCE_DIR}/core/src
47      )
48
49  if(PGROUTING_CORE_INCLUDE_DIR)
50    set(PGROUTING_CORE_FOUND TRUE)
51    message(STATUS "Found PGROUTING_CORE core: ${PGROUTING_CORE_INCLUDE_DIR}")
52    INCLUDE_DIRECTORIES(${PGROUTING_CORE_INCLUDE_DIR})
53  else(PGROUTING_CORE_INCLUDE_DIR)
54    set(PGROUTING_CORE_FOUND FALSE)
55    message(STATUS "PGROUTING_CORE core not found.")
56  endif(PGROUTING_CORE_INCLUDE_DIR)
57
58  mark_as_advanced(PGROUTING_CORE_INCLUDE_DIR)
59
60endif(PGROUTING_CORE_INCLUDE_DIR)
61
62OPTION(WITH_TSP "Build TSP library" OFF)
63OPTION(WITH_DD "Build Driving distance library" OFF)
64
65IF(UNIX)
66  SET(LIBRARY_INSTALL_PATH ${LIB_DIR})
67  SET(SQL_INSTALL_PATH /usr/share/postlbs)
68  MESSAGE("Installation directory for libraries is set to ${LIBRARY_INSTALL_PATH} and for SQL files is set to ${SQL_INSTALL_PATH}")
69ELSE(UNIX)
70  SET(LIBRARY_INSTALL_PATH ${PGROUTING_BINARY_DIR}/lib)
71  SET(SQL_INSTALL_PATH ${PGROUTING_BINARY_DIR}/lib)
72ENDIF(UNIX)
73
74SET(PGROUTING_INCLUDE_DIRECTORIES ${PGROUTING_SOURCE_DIR}/core ${PGROUTING_SOURCE_DIR}/core/src ${PGROUTING_SOURCE_DIR}/extra ${PGROUTING_SOURCE_DIR}/extra/tsp ${PGROUTING_SOURCE_DIR}/extra/tsp/src ${PGROUTING_SOURCE_DIR}/extra/driving_distance ${PGROUTING_SOURCE_DIR}/extra/driving_distance/src
75)
76
77INCLUDE_DIRECTORIES(. ${PGROUTING_INCLUDE_DIRECTORIES} ${POSTGRESQL_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
78IF(WIN32)
79  INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${POSTGRESQL_INCLUDE_DIR}/port/win32)
80ENDIF(WIN32)
81
82# we need link libpostgres.a on win32 env
83IF(WIN32)
84  LINK_DIRECTORIES(${LIB_DIR})
85  LINK_LIBRARIES(postgres)
86ENDIF(WIN32)
87
88SET(CMAKE_C_FLAGS "-O2 -g")
89SET(CMAKE_CXX_FLAGS "-O2 -g")
90
91# Recurse into the subdirectories.  This does not actually
92# cause another cmake executable to run.  The same process will walk through
93# the project's entire directory structure.
94SUBDIRS(core)
95
96IF(WITH_TSP)
97  macro_optional_find_package(GAUL)
98  IF(NOT GAUL_FOUND)
99    message(FATAL ERROR " Please check your gaul installation, or set correct path to GAUL_INCLUDE_DIR and GAUL_LIBRARIES.")
100  ENDIF(NOT GAUL_FOUND)
101  INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${GAUL_INCLUDE_DIR})
102  ADD_SUBDIRECTORY(extra/tsp)
103ENDIF(WITH_TSP)
104
105IF(WITH_DD)
106  macro_optional_find_package(CGAL)
107  IF(NOT CGAL_FOUND)
108    message(FATAL ERROR " Please check your CGAL installation, or set correct path to CGAL_INCLUDE_DIR and CGAL_LIBRARIES.")
109  ENDIF(NOT CGAL_FOUND)
110  INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${CGAL_INCLUDE_DIR})
111  ADD_SUBDIRECTORY(extra/driving_distance)
112ENDIF(WITH_DD)
113
114
115
116
Note: See TracBrowser for help on using the browser.