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")
44 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/osm2pgsql/CMakeLists.txt")
45 message(FATAL_ERROR "The osm2pgsql directory is empty.\
46 Did you forget to check out Nominatim recursively?\
47 \nTry updating submodules with: git submodule update --init")
49 add_subdirectory(osm2pgsql)
51 find_program(PYOSMIUM pyosmium-get-changes)
52 if (NOT EXISTS "${PYOSMIUM}")
54 message(WARNING "pyosmium-get-changes not found (required for updates)")
56 set(PYOSMIUM_PATH "${PYOSMIUM}")
57 message(STATUS "Using pyosmium-get-changes at ${PYOSMIUM_PATH}")
61 # Setting PHP binary variable as to command line (prevailing) or auto detect
63 find_program (PHP_BIN php)
65 # sanity check if PHP binary exists
66 if (NOT EXISTS ${PHP_BIN})
67 message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
69 message (STATUS "Using PHP binary " ${PHP_BIN})
72 #-----------------------------------------------------------------------------
74 # Setup settings and paths
76 #-----------------------------------------------------------------------------
91 utils/country_languages.php
92 utils/importWikipedia.php
96 utils/specialphrases.php
101 foreach (script_source ${CUSTOMSCRIPTS})
102 configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl
103 ${PROJECT_BINARY_DIR}/${script_source})
106 foreach (script_source ${WEBSITESCRIPTS})
107 configure_file(${PROJECT_SOURCE_DIR}/cmake/website.tmpl
108 ${PROJECT_BINARY_DIR}/${script_source})
111 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php
112 ${PROJECT_BINARY_DIR}/settings/settings.php)
114 set(WEBPATHS css images js)
116 foreach (wp ${WEBPATHS})
118 COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
123 #-----------------------------------------------------------------------------
127 #-----------------------------------------------------------------------------
132 set(TEST_BDD db osm2pgsql api)
134 foreach (test ${TEST_BDD})
135 add_test(NAME bdd_${test}
136 COMMAND lettuce features/${test}
137 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
138 set_tests_properties(bdd_${test}
139 PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
144 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
147 #-----------------------------------------------------------------------------
150 add_subdirectory(module)
153 add_subdirectory(nominatim)
156 add_subdirectory(docs)
159 #-----------------------------------------------------------------------------