]> git.openstreetmap.org Git - nominatim.git/blob - CMakeLists.txt
Merge pull request #381 from lonvia/cmake-port
[nominatim.git] / CMakeLists.txt
1 #-----------------------------------------------------------------------------
2 #
3 #  CMake Config
4 #
5 #  Nominatim
6 #
7 #-----------------------------------------------------------------------------
8
9 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
10 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
11
12
13 #-----------------------------------------------------------------------------
14 #
15 #  Project version
16 #
17 #-----------------------------------------------------------------------------
18
19 project(nominatim)
20
21 set(NOMINATIM_VERSION_MAJOR 2)
22 set(NOMINATIM_VERSION_MINOR 5)
23
24 set(NOMINATIM_VERSION "${NOMINATIM_VERSION_MAJOR}.${NOMINATIM_VERSION_MINOR}")
25
26 add_definitions(-DNOMINATIM_VERSION="${NOMINATIM_VERSION}")
27
28
29 #-----------------------------------------------------------------------------
30 #
31 #  Find external dependencies
32 #
33 #-----------------------------------------------------------------------------
34
35 set(BUILD_TESTS on)
36 add_subdirectory(osm2pgsql)
37
38 find_package(Threads REQUIRED)
39
40 unset(PostgreSQL_TYPE_INCLUDE_DIR CACHE)
41 set(PostgreSQL_TYPE_INCLUDE_DIR "/usr/include/")
42 find_package(PostgreSQL REQUIRED)
43 include_directories(${PostgreSQL_INCLUDE_DIRS})
44
45 find_program(PG_CONFIG pg_config)
46 execute_process(COMMAND ${PG_CONFIG} --pgxs
47                 OUTPUT_VARIABLE PGXS
48                 OUTPUT_STRIP_TRAILING_WHITESPACE)
49
50 find_package(ZLIB REQUIRED)
51
52 find_package(BZip2 REQUIRED)
53
54 find_package(LibXml2 REQUIRED)
55 include_directories(${LIBXML2_INCLUDE_DIR})
56
57 #-----------------------------------------------------------------------------
58 #
59 # Setup settings and paths
60 #
61 #-----------------------------------------------------------------------------
62
63 configure_file(
64     ${PROJECT_SOURCE_DIR}/settings/settings.php
65     ${PROJECT_BINARY_DIR}/settings/settings.php
66 )
67
68 configure_file(
69     ${PROJECT_SOURCE_DIR}/settings/phrase_settings.php
70     ${PROJECT_BINARY_DIR}/settings/phrase_settings.php
71 )
72
73 execute_process(
74     COMMAND ln -s -t ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/utils
75 )
76
77 #-----------------------------------------------------------------------------
78 #
79 # Tests
80 #
81 #-----------------------------------------------------------------------------
82
83 include(CTest)
84
85 set(TEST_BDD db osm2pgsql api)
86
87 foreach (test ${TEST_BDD})
88     add_test(NAME bdd_${test}
89              COMMAND lettuce features/${test}
90              WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
91     set_tests_properties(bdd_${test}
92         PROPERTIES ENVIRONMENT "NOMINATIM_DIR=${PROJECT_BINARY_DIR}")
93 endforeach()
94
95 add_test(NAME php
96          COMMAND phpunit ./
97          WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests-php)
98
99 #-----------------------------------------------------------------------------
100
101 add_subdirectory(module)
102 add_subdirectory(nominatim)
103
104 #-----------------------------------------------------------------------------