]> git.openstreetmap.org Git - nominatim.git/blob - CMakeLists.txt
add travis-ci badge ("build passing") to README file
[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 link_directories(${PostgreSQL_LIBRARY_DIRS})
46
47 find_program(OSMOSIS osmosis)
48 if (NOT EXISTS "${OSMOSIS}")
49         set(OSMOSIS_PATH "/nonexistent")
50         message(WARNING "Osmosis not found (required for updates)")
51 else()
52         set(OSMOSIS_PATH "${OSMOSIS}")
53         message(STATUS "Using osmosis at ${OSMOSIS_PATH}")
54 endif()
55
56
57 find_program(PG_CONFIG pg_config)
58 execute_process(COMMAND ${PG_CONFIG} --pgxs
59                 OUTPUT_VARIABLE PGXS
60                 OUTPUT_STRIP_TRAILING_WHITESPACE)
61
62 if (NOT EXISTS "${PGXS}")
63     message(FATAL_ERROR "Postgresql server package not found.")
64 endif()
65
66 find_package(ZLIB REQUIRED)
67
68 find_package(BZip2 REQUIRED)
69
70 find_package(LibXml2 REQUIRED)
71 include_directories(${LIBXML2_INCLUDE_DIR})
72
73 #-----------------------------------------------------------------------------
74 #
75 # Setup settings and paths
76 #
77 #-----------------------------------------------------------------------------
78
79 set(CUSTOMFILES
80     settings/phrase_settings.php
81     website/deletable.php
82     website/details.php
83     website/hierarchy.php
84     website/lookup.php
85     website/polygons.php
86     website/reverse.php
87     website/search.php
88     website/status.php
89     utils/blocks.php
90     utils/country_languages.php
91     utils/imports.php
92     utils/importWikipedia.php
93     utils/query.php
94     utils/server_compare.php
95     utils/setup.php
96     utils/specialphrases.php
97     utils/update.php
98     utils/warm.php
99    )
100
101 foreach (cfile ${CUSTOMFILES})
102     configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile})
103 endforeach()
104
105 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php ${PROJECT_BINARY_DIR}/settings/settings.php)
106
107 set(WEBPATHS css images js)
108
109 foreach (wp ${WEBPATHS})
110     execute_process(
111         COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
112     )
113 endforeach()
114
115
116 #-----------------------------------------------------------------------------
117 #
118 # Tests
119 #
120 #-----------------------------------------------------------------------------
121
122 include(CTest)
123
124 set(TEST_BDD db osm2pgsql api)
125
126 foreach (test ${TEST_BDD})
127     add_test(NAME bdd_${test}
128              COMMAND lettuce features/${test}
129              WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
130     set_tests_properties(bdd_${test}
131         PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
132 endforeach()
133
134 add_test(NAME php
135          COMMAND phpunit ./
136          WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
137
138 #-----------------------------------------------------------------------------
139
140 add_subdirectory(module)
141 add_subdirectory(nominatim)
142 add_subdirectory(docs)
143
144 #-----------------------------------------------------------------------------