~aleteoryx/muditaos

ref: 9a7982f8efa4974f7f1396232fa2c09db0f6908e muditaos/module-utils/third-party/libphonenumber.cmake -rw-r--r-- 2.4 KiB
9a7982f8 — Marcin Smoczyński changelog: update changelog for v0.48.1 (#1104) (#1106) 5 years ago
                                                                                
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
include (thirdparty)

# add sources
set (LIBPHONENUMBER_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/libphonenumber/cpp/src)
set (LIBPHONENUMBER ${LIBPHONENUMBER_SRCDIR}/phonenumbers)
set (LIBPHONENUMBER_SOURCES
        ${LIBPHONENUMBER}/asyoutypeformatter.cc
        ${LIBPHONENUMBER}/base/strings/string_piece.cc
        ${LIBPHONENUMBER}/default_logger.cc
        ${LIBPHONENUMBER}/logger.cc
        ${LIBPHONENUMBER}/metadata.cc
        ${LIBPHONENUMBER}/phonemetadata.pb.cc
        ${LIBPHONENUMBER}/phonenumber.cc
        ${LIBPHONENUMBER}/phonenumber.pb.cc
        ${LIBPHONENUMBER}/phonenumberutil.cc
        ${LIBPHONENUMBER}/regex_based_matcher.cc
        ${LIBPHONENUMBER}/regexp_adapter_re2.cc
        ${LIBPHONENUMBER}/regexp_cache.cc
        ${LIBPHONENUMBER}/shortnumberinfo.cc
        ${LIBPHONENUMBER}/stringutil.cc
        ${LIBPHONENUMBER}/unicodestring.cc
        ${LIBPHONENUMBER}/utf/rune.c
        ${LIBPHONENUMBER}/utf/unicodetext.cc
        ${LIBPHONENUMBER}/utf/unilib.cc
)

# create static library for the third party
set (LIBPHONENUMBER_TARGET phonenumber)
add_library (${LIBPHONENUMBER_TARGET} STATIC ${LIBPHONENUMBER_SOURCES})

# setup flags for the third party
third_party_target_setup (${LIBPHONENUMBER_TARGET})

# set compile definitions
target_compile_definitions (${LIBPHONENUMBER_TARGET}
        PRIVATE
                I18N_PHONENUMBERS_ASCII_DECIMALS_ONLY
        PUBLIC
                I18N_PHONENUMBERS_USE_RTOS_WRAPPER
                I18N_PHONENUMBERS_ASCII_DECIMALS_ONLY
                I18N_PHONENUMBERS_USE_RE2
)

# suppress warning for libphonenumber
set_source_files_properties (${LIBPHONENUMBER}/asyoutypeformatter.cc
        PROPERTIES COMPILE_FLAGS
        -Wno-implicit-fallthrough
)

# add include directory path
target_include_directories (${LIBPHONENUMBER_TARGET} PUBLIC ${LIBPHONENUMBER_SRCDIR})

# module-os dependency (locking support)
target_link_libraries (${LIBPHONENUMBER_TARGET} PUBLIC module-os)

# RE2 dependency
if (NOT RE2_TARGET)
        message (FATAL_ERROR "RE2 is required for libphonenumber")
endif ()
target_link_libraries (${LIBPHONENUMBER_TARGET} PUBLIC ${RE2_TARGET})

# protobuf dependency
if (NOT PROTOBUF_TARGET)
        message (FATAL_ERROR "Protobuf is required for libphonenumber")
endif()
target_link_libraries (${LIBPHONENUMBER_TARGET} PUBLIC ${PROTOBUF_TARGET})

# turn on optimization in debug
third_party_source_optimization (${LIBPHONENUMBER_SOURCES})