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 4)
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(ONLY_DOCS off CACHE BOOL "Build documentation only")
41 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/osm2pgsql/CMakeLists.txt")
42 message(FATAL_ERROR "The osm2pgsql directory is empty.\
43 Did you forget to check out Nominatim recursively?\
44 \nTry updating submodules with: git submodule update --init")
46 add_subdirectory(osm2pgsql)
48 find_package(Threads REQUIRED)
50 unset(PostgreSQL_TYPE_INCLUDE_DIR CACHE)
51 set(PostgreSQL_TYPE_INCLUDE_DIR "/usr/include/")
52 find_package(PostgreSQL REQUIRED)
53 include_directories(${PostgreSQL_INCLUDE_DIRS})
54 link_directories(${PostgreSQL_LIBRARY_DIRS})
56 find_program(PYOSMIUM pyosmium-get-changes)
57 if (NOT EXISTS "${PYOSMIUM}")
59 message(WARNING "pyosmium-get-changes not found (required for updates)")
61 set(PYOSMIUM_PATH "${PYOSMIUM}")
62 message(STATUS "Using pyosmium-get-changes at ${PYOSMIUM_PATH}")
66 find_program(PG_CONFIG pg_config)
67 execute_process(COMMAND ${PG_CONFIG} --pgxs
69 OUTPUT_STRIP_TRAILING_WHITESPACE)
71 if (NOT EXISTS "${PGXS}")
72 message(FATAL_ERROR "Postgresql server package not found.")
75 find_package(ZLIB REQUIRED)
77 find_package(BZip2 REQUIRED)
79 find_package(LibXml2 REQUIRED)
80 include_directories(${LIBXML2_INCLUDE_DIR})
82 # Setting PHP binary variable as to command line (prevailing) or auto detect
84 find_program (PHP_BIN php)
86 # sanity check if PHP binary exists
87 if (NOT EXISTS ${PHP_BIN})
88 message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
90 message (STATUS "Using PHP binary " ${PHP_BIN})
93 #-----------------------------------------------------------------------------
95 # Setup settings and paths
97 #-----------------------------------------------------------------------------
100 website/deletable.php
102 website/hierarchy.php
111 utils/country_languages.php
115 utils/specialphrases.php
120 foreach (script_source ${CUSTOMSCRIPTS})
121 configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl
122 ${PROJECT_BINARY_DIR}/${script_source})
125 foreach (script_source ${WEBSITESCRIPTS})
126 configure_file(${PROJECT_SOURCE_DIR}/cmake/website.tmpl
127 ${PROJECT_BINARY_DIR}/${script_source})
130 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php
131 ${PROJECT_BINARY_DIR}/settings/settings.php)
133 set(WEBPATHS css images js)
135 foreach (wp ${WEBPATHS})
137 COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
142 #-----------------------------------------------------------------------------
146 #-----------------------------------------------------------------------------
151 set(TEST_BDD db osm2pgsql api)
153 foreach (test ${TEST_BDD})
154 add_test(NAME bdd_${test}
155 COMMAND lettuce features/${test}
156 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
157 set_tests_properties(bdd_${test}
158 PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
163 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
166 #-----------------------------------------------------------------------------
169 add_subdirectory(module)
170 add_subdirectory(nominatim)
172 add_subdirectory(docs)
174 #-----------------------------------------------------------------------------