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 2)
22 set(NOMINATIM_VERSION_MINOR 5)
24 set(NOMINATIM_VERSION "${NOMINATIM_VERSION_MAJOR}.${NOMINATIM_VERSION_MINOR}")
26 add_definitions(-DNOMINATIM_VERSION="${NOMINATIM_VERSION}")
29 #-----------------------------------------------------------------------------
31 # Find external dependencies
33 #-----------------------------------------------------------------------------
35 set(BUILD_TESTS off CACHE BOOL "Build test suite" FORCE)
36 set(WITH_LUA off CACHE BOOL "Build with lua support" FORCE)
38 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/osm2pgsql/CMakeLists.txt")
39 message(FATAL_ERROR "The osm2pgsql directory is empty.\
40 Did you forget to check out Nominatim recursively?\
41 \nTry updating submodules with: git submodule update --init")
43 add_subdirectory(osm2pgsql)
45 find_package(Threads REQUIRED)
47 unset(PostgreSQL_TYPE_INCLUDE_DIR CACHE)
48 set(PostgreSQL_TYPE_INCLUDE_DIR "/usr/include/")
49 find_package(PostgreSQL REQUIRED)
50 include_directories(${PostgreSQL_INCLUDE_DIRS})
51 link_directories(${PostgreSQL_LIBRARY_DIRS})
53 find_program(OSMOSIS osmosis)
54 if (NOT EXISTS "${OSMOSIS}")
55 set(OSMOSIS_PATH "/nonexistent")
56 message(WARNING "Osmosis not found (required for updates)")
58 set(OSMOSIS_PATH "${OSMOSIS}")
59 message(STATUS "Using osmosis at ${OSMOSIS_PATH}")
63 find_program(PG_CONFIG pg_config)
64 execute_process(COMMAND ${PG_CONFIG} --pgxs
66 OUTPUT_STRIP_TRAILING_WHITESPACE)
68 if (NOT EXISTS "${PGXS}")
69 message(FATAL_ERROR "Postgresql server package not found.")
72 find_package(ZLIB REQUIRED)
74 find_package(BZip2 REQUIRED)
76 find_package(LibXml2 REQUIRED)
77 include_directories(${LIBXML2_INCLUDE_DIR})
79 #-----------------------------------------------------------------------------
81 # Setup settings and paths
83 #-----------------------------------------------------------------------------
86 settings/phrase_settings.php
96 utils/country_languages.php
98 utils/importWikipedia.php
100 utils/server_compare.php
102 utils/specialphrases.php
107 foreach (cfile ${CUSTOMFILES})
108 configure_file(${PROJECT_SOURCE_DIR}/${cfile} ${PROJECT_BINARY_DIR}/${cfile})
111 configure_file(${PROJECT_SOURCE_DIR}/settings/defaults.php ${PROJECT_BINARY_DIR}/settings/settings.php)
113 set(WEBPATHS css images js)
115 foreach (wp ${WEBPATHS})
117 COMMAND ln -sf ${PROJECT_SOURCE_DIR}/website/${wp} ${PROJECT_BINARY_DIR}/website/
122 #-----------------------------------------------------------------------------
126 #-----------------------------------------------------------------------------
130 set(TEST_BDD db osm2pgsql api)
132 foreach (test ${TEST_BDD})
133 add_test(NAME bdd_${test}
134 COMMAND lettuce features/${test}
135 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
136 set_tests_properties(bdd_${test}
137 PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
142 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
144 #-----------------------------------------------------------------------------
146 add_subdirectory(module)
147 add_subdirectory(nominatim)
148 add_subdirectory(docs)
150 #-----------------------------------------------------------------------------