]> git.openstreetmap.org Git - nominatim.git/blob - CMakeLists.txt
add extensive debug messages for placex
[nominatim.git] / CMakeLists.txt
1 #-----------------------------------------------------------------------------
2 #
3 #  CMake Config
4 #
5 #  Nominatim
6 #
7 #-----------------------------------------------------------------------------
8
9 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
10 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
11
12
13 #-----------------------------------------------------------------------------
14 #
15 #  Project version
16 #
17 #-----------------------------------------------------------------------------
18
19 project(nominatim)
20
21 set(NOMINATIM_VERSION_MAJOR 2)
22 set(NOMINATIM_VERSION_MINOR 5)
23
24 set(NOMINATIM_VERSION "${NOMINATIM_VERSION_MAJOR}.${NOMINATIM_VERSION_MINOR}")
25
26 add_definitions(-DNOMINATIM_VERSION="${NOMINATIM_VERSION}")
27
28
29 #-----------------------------------------------------------------------------
30 #
31 #  Find external dependencies
32 #
33 #-----------------------------------------------------------------------------
34
35 set(BUILD_TESTS off CACHE BOOL "Build test suite" FORCE)
36 set(WITH_LUA off CACHE BOOL "Build with lua support" FORCE)
37
38 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/osm2pgsql/CMakeLists.txt")
39     message(FATAL_ERROR "The osm2pgsql directory is empty.\
40     Did you forget to check out Nominatim recursively?\
41     \nTry updating submodules with: git submodule update --init")
42 endif()
43 add_subdirectory(osm2pgsql)
44
45 find_package(Threads REQUIRED)
46
47 unset(PostgreSQL_TYPE_INCLUDE_DIR CACHE)
48 set(PostgreSQL_TYPE_INCLUDE_DIR "/usr/include/")
49 find_package(PostgreSQL REQUIRED)
50 include_directories(${PostgreSQL_INCLUDE_DIRS})
51 link_directories(${PostgreSQL_LIBRARY_DIRS})
52
53 find_program(PYOSMIUM pyosmium-get-changes)
54 if (NOT EXISTS "${PYOSMIUM}")
55     set(PYOSMIUM_PATH "/nonexistent")
56         message(WARNING "pyosmium-get-changes not found (required for updates)")
57 else()
58     set(PYOSMIUM_PATH "${PYOSMIUM}")
59     message(STATUS "Using pyosmium-get-changes at ${PYOSMIUM_PATH}")
60 endif()
61
62
63 find_program(PG_CONFIG pg_config)
64 execute_process(COMMAND ${PG_CONFIG} --pgxs
65                 OUTPUT_VARIABLE PGXS
66                 OUTPUT_STRIP_TRAILING_WHITESPACE)
67
68 if (NOT EXISTS "${PGXS}")
69     message(FATAL_ERROR "Postgresql server package not found.")
70 endif()
71
72 find_package(ZLIB REQUIRED)
73
74 find_package(BZip2 REQUIRED)
75
76 find_package(LibXml2 REQUIRED)
77 include_directories(${LIBXML2_INCLUDE_DIR})
78
79 #-----------------------------------------------------------------------------
80 #
81 # Setup settings and paths
82 #
83 #-----------------------------------------------------------------------------
84
85 set(CUSTOMFILES
86     settings/phrase_settings.php
87     website/deletable.php
88     website/details.php
89     website/hierarchy.php
90     website/lookup.php
91     website/polygons.php
92     website/reverse.php
93     website/search.php
94     website/status.php
95     utils/blocks.php
96     utils/country_languages.php
97     utils/imports.php
98     utils/importWikipedia.php
99     utils/query.php
100     utils/server_compare.php
101     utils/setup.php
102     utils/specialphrases.php
103     utils/update.php
104     utils/warm.php
105    )
106
107 foreach (cfile ${CUSTOMFILES})
108     configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile})
109 endforeach()
110
111 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php ${PROJECT_BINARY_DIR}/settings/settings.php)
112
113 set(WEBPATHS css images js)
114
115 foreach (wp ${WEBPATHS})
116     execute_process(
117         COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
118     )
119 endforeach()
120
121
122 #-----------------------------------------------------------------------------
123 #
124 # Tests
125 #
126 #-----------------------------------------------------------------------------
127
128 include(CTest)
129
130 set(TEST_BDD db osm2pgsql api)
131
132 foreach (test ${TEST_BDD})
133     add_test(NAME bdd_${test}
134              COMMAND lettuce features/${test}
135              WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
136     set_tests_properties(bdd_${test}
137         PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
138 endforeach()
139
140 add_test(NAME php
141          COMMAND phpunit ./
142          WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
143
144 #-----------------------------------------------------------------------------
145
146 add_subdirectory(module)
147 add_subdirectory(nominatim)
148 add_subdirectory(docs)
149
150 #-----------------------------------------------------------------------------