]> git.openstreetmap.org Git - nominatim.git/blob - CMakeLists.txt
Merge remote-tracking branch 'upstream/master'
[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 add_subdirectory(osm2pgsql)
38
39 find_package(Threads REQUIRED)
40
41 unset(PostgreSQL_TYPE_INCLUDE_DIR CACHE)
42 set(PostgreSQL_TYPE_INCLUDE_DIR "/usr/include/")
43 find_package(PostgreSQL REQUIRED)
44 include_directories(${PostgreSQL_INCLUDE_DIRS})
45
46 find_program(PG_CONFIG pg_config)
47 execute_process(COMMAND ${PG_CONFIG} --pgxs
48                 OUTPUT_VARIABLE PGXS
49                 OUTPUT_STRIP_TRAILING_WHITESPACE)
50
51 if (NOT EXISTS "${PGXS}")
52     message(FATAL_ERROR "Postgresql server package not found.")
53 endif()
54
55 find_package(ZLIB REQUIRED)
56
57 find_package(BZip2 REQUIRED)
58
59 find_package(LibXml2 REQUIRED)
60 include_directories(${LIBXML2_INCLUDE_DIR})
61
62 #-----------------------------------------------------------------------------
63 #
64 # Setup settings and paths
65 #
66 #-----------------------------------------------------------------------------
67
68 set(CUSTOMFILES
69     settings/phrase_settings.php
70     website/deletable.php
71     website/details.php
72     website/hierarchy.php
73     website/lookup.php
74     website/polygons.php
75     website/reverse.php
76     website/search.php
77     website/status.php
78     website/403.html
79     website/509.html
80     website/crossdomain.xml
81     website/favicon.ico
82     website/last_update.php
83     website/nominatim.xml
84     website/robots.txt
85     website/taginfo.json
86     utils/blocks.php
87     utils/country_languages.php
88     utils/imports.php
89     utils/importWikipedia.php
90     utils/query.php
91     utils/server_compare.php
92     utils/setup.php
93     utils/specialphrases.php
94     utils/update.php
95     utils/warm.php
96    )
97
98 foreach (cfile ${CUSTOMFILES})
99     configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile})
100 endforeach()
101
102 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php ${PROJECT_BINARY_DIR}/settings/settings.php)
103
104 set(WEBPATHS css images js)
105
106 foreach (wp ${WEBPATHS})
107     execute_process(
108         COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
109     )
110 endforeach()
111
112
113 #-----------------------------------------------------------------------------
114 #
115 # Tests
116 #
117 #-----------------------------------------------------------------------------
118
119 include(CTest)
120
121 set(TEST_BDD db osm2pgsql api)
122
123 foreach (test ${TEST_BDD})
124     add_test(NAME bdd_${test}
125              COMMAND lettuce features/${test}
126              WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
127     set_tests_properties(bdd_${test}
128         PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
129 endforeach()
130
131 add_test(NAME php
132          COMMAND phpunit ./
133          WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
134
135 #-----------------------------------------------------------------------------
136
137 add_subdirectory(module)
138 add_subdirectory(nominatim)
139 add_subdirectory(docs)
140
141 #-----------------------------------------------------------------------------