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