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 3)
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)
38 set(BUILD_DOCS on CACHE BOOL "Build documentation")
39 set(BUILD_SERVER on CACHE BOOL "Build API server")
40 set(BUILD_MODULE on CACHE BOOL "Build PostgreSQL module")
41 set(BUILD_NOMINATIM on CACHE BOOL "Build Nominatim executable")
42 set(BUILD_OSM2PGSQL on CACHE BOOL "Build osm2pgsql")
46 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/osm2pgsql/CMakeLists.txt")
47 message(FATAL_ERROR "The osm2pgsql directory is empty.\
48 Did you forget to check out Nominatim recursively?\
49 \nTry updating submodules with: git submodule update --init")
51 add_subdirectory(osm2pgsql)
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 # Setting PHP binary variable as to command line (prevailing) or auto detect
66 find_program (PHP_BIN php)
68 # sanity check if PHP binary exists
69 if (NOT EXISTS ${PHP_BIN})
70 message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
72 message (STATUS "Using PHP binary " ${PHP_BIN})
75 #-----------------------------------------------------------------------------
77 # Setup settings and paths
79 #-----------------------------------------------------------------------------
94 utils/country_languages.php
95 utils/importWikipedia.php
99 utils/specialphrases.php
104 foreach (script_source ${CUSTOMSCRIPTS})
105 configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl
106 ${PROJECT_BINARY_DIR}/${script_source})
109 foreach (script_source ${WEBSITESCRIPTS})
110 configure_file(${PROJECT_SOURCE_DIR}/cmake/website.tmpl
111 ${PROJECT_BINARY_DIR}/${script_source})
114 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php
115 ${PROJECT_BINARY_DIR}/settings/settings.php)
117 set(WEBPATHS css images js)
119 foreach (wp ${WEBPATHS})
121 COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
126 #-----------------------------------------------------------------------------
130 #-----------------------------------------------------------------------------
135 set(TEST_BDD db osm2pgsql api)
137 foreach (test ${TEST_BDD})
138 add_test(NAME bdd_${test}
139 COMMAND lettuce features/${test}
140 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
141 set_tests_properties(bdd_${test}
142 PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
147 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
150 #-----------------------------------------------------------------------------
153 add_subdirectory(module)
156 add_subdirectory(nominatim)
159 add_subdirectory(docs)
162 #-----------------------------------------------------------------------------