1 #-----------------------------------------------------------------------------
7 #-----------------------------------------------------------------------------
9 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
10 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
13 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
21 set(NOMINATIM_VERSION_MAJOR 3)
22 set(NOMINATIM_VERSION_MINOR 2)
23 set(NOMINATIM_VERSION_PATCH 0)
25 set(NOMINATIM_VERSION "${NOMINATIM_VERSION_MAJOR}.${NOMINATIM_VERSION_MINOR}.${NOMINATIM_VERSION_PATCH}")
27 add_definitions(-DNOMINATIM_VERSION="${NOMINATIM_VERSION}")
30 #-----------------------------------------------------------------------------
32 # Find external dependencies
34 #-----------------------------------------------------------------------------
36 set(BUILD_TESTS off CACHE BOOL "Build test suite" FORCE)
37 set(WITH_LUA off CACHE BOOL "Build with lua support" FORCE)
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")
44 add_subdirectory(osm2pgsql)
46 find_package(Threads REQUIRED)
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})
54 find_program(PYOSMIUM pyosmium-get-changes)
55 if (NOT EXISTS "${PYOSMIUM}")
57 message(WARNING "pyosmium-get-changes not found (required for updates)")
59 set(PYOSMIUM_PATH "${PYOSMIUM}")
60 message(STATUS "Using pyosmium-get-changes at ${PYOSMIUM_PATH}")
64 find_program(PG_CONFIG pg_config)
65 execute_process(COMMAND ${PG_CONFIG} --pgxs
67 OUTPUT_STRIP_TRAILING_WHITESPACE)
69 if (NOT EXISTS "${PGXS}")
70 message(FATAL_ERROR "Postgresql server package not found.")
73 find_package(ZLIB REQUIRED)
75 find_package(BZip2 REQUIRED)
77 find_package(LibXml2 REQUIRED)
78 include_directories(${LIBXML2_INCLUDE_DIR})
80 # Setting PHP binary variable as to command line (prevailing) or auto detect
82 find_program (PHP_BIN php)
84 # sanity check if PHP binary exists
85 if (NOT EXISTS ${PHP_BIN})
86 message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
88 message (STATUS "Using PHP binary " ${PHP_BIN})
90 #-----------------------------------------------------------------------------
92 # Setup settings and paths
94 #-----------------------------------------------------------------------------
97 settings/phrase_settings.php
100 website/hierarchy.php
108 website/crossdomain.xml
110 website/last_update.php
111 website/nominatim.xml
115 utils/country_languages.php
116 utils/importWikipedia.php
119 utils/server_compare.php
121 utils/specialphrases.php
126 foreach (cfile ${CUSTOMFILES})
127 configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile})
130 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php ${PROJECT_BINARY_DIR}/settings/settings.php)
132 set(WEBPATHS css images js)
134 foreach (wp ${WEBPATHS})
136 COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
141 #-----------------------------------------------------------------------------
145 #-----------------------------------------------------------------------------
149 set(TEST_BDD db osm2pgsql api)
151 foreach (test ${TEST_BDD})
152 add_test(NAME bdd_${test}
153 COMMAND lettuce features/${test}
154 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
155 set_tests_properties(bdd_${test}
156 PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
161 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
163 #-----------------------------------------------------------------------------
165 add_subdirectory(module)
166 add_subdirectory(nominatim)
167 add_subdirectory(docs)
169 #-----------------------------------------------------------------------------