-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
69 lines (54 loc) · 1.73 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
PROJECT(streetmangler)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
ENABLE_TESTING()
# options
OPTION(WITH_PYTHON "Enable python bindings" OFF)
OPTION(WITH_PERL "Enable perl bindings" OFF)
# depends
FIND_PACKAGE(EXPAT REQUIRED)
FIND_PACKAGE(ICU REQUIRED)
# common sources
SET(LOCALE_SRCS
lib/locales/ru.cc
lib/locales/en.cc
lib/locales/uk.cc
)
SET(LIBRARY_SRCS
${LOCALE_SRCS}
lib/database.cc
lib/locale.cc
lib/name.cc
lib/stringlistparser.cc
)
SET(PROCESS_NAMES_SRCS
utils/process_names.cc
utils/osm_name_extractor.cc
utils/name_aggregator.cc
)
# definitions
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib ${PROJECT_SOURCE_DIR}/contrib/tspell)
ADD_DEFINITIONS(-DDATADIR="${PROJECT_SOURCE_DIR}/data")
SET(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage")
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} --coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++11")
# library
INCLUDE_DIRECTORIES(${ICU_INCLUDE_DIR})
ADD_LIBRARY(streetmangler SHARED ${LIBRARY_SRCS})
TARGET_LINK_LIBRARIES(streetmangler ${ICU_LIBRARY})
# bindings
IF(WITH_PYTHON OR WITH_PERL)
ADD_SUBDIRECTORY(swig)
ENDIF(WITH_PYTHON OR WITH_PERL)
# utilities
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIRS})
ADD_EXECUTABLE(process_names ${PROCESS_NAMES_SRCS})
TARGET_LINK_LIBRARIES(process_names streetmangler ${EXPAT_LIBRARY})
# tests
SET(TESTS locale_test locale_internal_test tokenizer_test database_test canonical_test)
FOREACH(TEST ${TESTS})
ADD_EXECUTABLE(${TEST} tests/${TEST}.cc)
TARGET_LINK_LIBRARIES(${TEST} streetmangler)
ADD_TEST(${TEST} ${TEST})
ENDFOREACH(TEST ${TESTS})