~aleteoryx/muditaos

82b585947465662c6e8bef23fcea815bd2a707a9 — Mateusz Grzegorzek 4 years ago 3c2ca02
[BH-363] Move libphonenumber to a separate directory

Move libphonenumber to a separate directory
M .gitmodules => .gitmodules +3 -3
@@ 16,8 16,8 @@
	url = ../protobuf.git
	branch = rt1051
	shallow = true
[submodule "module-utils/libphonenumber"]
	path = module-utils/libphonenumber
[submodule "third-party/libphonenumber"]
	path = third-party/libphonenumber/src
	url = ../libphonenumber.git
	branch = rt1051
	shallow = true


@@ 28,7 28,7 @@
[submodule "test/Catch2"]
	path = test/Catch2
	url = https://github.com/catchorg/Catch2
[submodule "module-utils/date"]
[submodule "third-party/date"]
	path = third-party/date
	url = ../date.git
[submodule "module-utils/taglib"]

M cmake/modules/PureCoverage.cmake => cmake/modules/PureCoverage.cmake +0 -1
@@ 30,7 30,6 @@ if(COVERAGE_ENABLE)
        module-os/.*
        module-utils/gsl/.*
        module-utils/json/.*
        module-utils/libphonenumber/.*
        module-utils/segger/.*
        source/main.cpp
        test/.*

M doc/Doxyfile.in => doc/Doxyfile.in +0 -1
@@ 889,7 889,6 @@ EXCLUDE                = @PROJECT_SOURCE_DIR@/module-bluetooth/lib \
                         @PROJECT_SOURCE_DIR@/module-utils/tinyfsm \
                         @PROJECT_SOURCE_DIR@/module-utils/segger \
                         @PROJECT_SOURCE_DIR@/module-utils/sbini \
                         @PROJECT_SOURCE_DIR@/module-utils/libphonenumber \
                         @PROJECT_SOURCE_DIR@/module-utils/test \
                         @PROJECT_SOURCE_DIR@/module-db/tests \
                         @PROJECT_SOURCE_DIR@/module-db/Database/sqlite3.c \

M module-apps/CMakeLists.txt => module-apps/CMakeLists.txt +1 -0
@@ 74,6 74,7 @@ target_link_libraries(${PROJECT_NAME}
        date::date
        eventstore
        i18n
        libphonenumber::libphonenumber
        Microsoft.GSL::GSL
        service-antenna
        service-appmgr

M module-utils/CMakeLists.txt => module-utils/CMakeLists.txt +2 -5
@@ 21,20 21,17 @@ add_library(${PROJECT_NAME} STATIC ${SOURCES})

include(segger/rtt/CMakeLists.txt)

# add third party libs
include(third-party/libphonenumber.cmake)

target_link_libraries(${PROJECT_NAME}
PUBLIC 
    board
    libphonenumber::libphonenumber
    log
    magic_enum
    module-os 
    module-vfs
    ${LIBPHONENUMBER_TARGET}
PRIVATE
    json::json
    crc32
    json::json
    time
)


D module-utils/libphonenumber => module-utils/libphonenumber +0 -1
@@ 1,1 0,0 @@
Subproject commit 1bab216bee1ff366f92552e7dca6f01a327be12b

D module-utils/third-party/libphonenumber.cmake => module-utils/third-party/libphonenumber.cmake +0 -69
@@ 1,69 0,0 @@
include (thirdparty)

# choose metadata to use
option (LIBPHONENUMBER_USE_MINIMAL_METADATA "Use minimal metadata for libphonenumber" OFF)

# add sources
set (LIBPHONENUMBER_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/libphonenumber/cpp/src)
set (LIBPHONENUMBER ${LIBPHONENUMBER_SRCDIR}/phonenumbers)
if (LIBPHONENUMBER_USE_MINIMAL_METADATA)
        set (LIBPHONENUMBER_METADATA ${LIBPHONENUMBER}/metadata-minimal.cc)
else ()
        set (LIBPHONENUMBER_METADATA ${LIBPHONENUMBER}/metadata.cc)
endif ()
set (LIBPHONENUMBER_SOURCES
        ${LIBPHONENUMBER}/asyoutypeformatter.cc
        ${LIBPHONENUMBER}/base/strings/string_piece.cc
        ${LIBPHONENUMBER}/default_logger.cc
        ${LIBPHONENUMBER}/logger.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
        ${LIBPHONENUMBER_METADATA}
)

# 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})

target_link_libraries (${LIBPHONENUMBER_TARGET} 
        PRIVATE 
                re2::re2
        PUBLIC 
                protobuf::libprotobuf-lite
)

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

M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +0 -1
@@ 40,7 40,6 @@
#include <ApplicationLauncher.hpp>
#include <log/log.hpp>
#include <log/Logger.hpp>
#include <phonenumbers/phonenumberutil.h>
#include <source/version.hpp>
#include <SystemManager/SystemManager.hpp>
#include <SystemWatchdog/SystemWatchdog.hpp>

M products/PurePhone/PurePhoneMain.cpp => products/PurePhone/PurePhoneMain.cpp +0 -1
@@ 48,7 48,6 @@
#include <ApplicationLauncher.hpp>
#include <log.hpp>
#include <Logger.hpp>
#include <phonenumbers/phonenumberutil.h>
#include <source/version.hpp>
#include <SystemManager/SystemManager.hpp>
#include <SystemWatchdog/SystemWatchdog.hpp>

M third-party/CMakeLists.txt => third-party/CMakeLists.txt +1 -0
@@ 14,6 14,7 @@ add_subdirectory(json)
add_subdirectory(gsl)
add_subdirectory(re2)
add_subdirectory(utz)
add_subdirectory(libphonenumber)
if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
    add_subdirectory(CrashDebug)
endif()

A third-party/libphonenumber/CMakeLists.txt => third-party/libphonenumber/CMakeLists.txt +50 -0
@@ 0,0 1,50 @@
add_library(libphonenumber STATIC)
add_library(libphonenumber::libphonenumber ALIAS libphonenumber)

# choose metadata to use
option (LIBPHONENUMBER_USE_MINIMAL_METADATA "Use minimal metadata for libphonenumber" OFF)

target_sources(libphonenumber
    PRIVATE
        src/cpp/src/phonenumbers/asyoutypeformatter.cc
        src/cpp/src/phonenumbers/base/strings/string_piece.cc
        src/cpp/src/phonenumbers/default_logger.cc
        src/cpp/src/phonenumbers/logger.cc
        src/cpp/src/phonenumbers/phonemetadata.pb.cc
        src/cpp/src/phonenumbers/phonenumber.cc
        src/cpp/src/phonenumbers/phonenumber.pb.cc
        src/cpp/src/phonenumbers/phonenumberutil.cc
        src/cpp/src/phonenumbers/regex_based_matcher.cc
        src/cpp/src/phonenumbers/regexp_adapter_re2.cc
        src/cpp/src/phonenumbers/regexp_cache.cc
        src/cpp/src/phonenumbers/shortnumberinfo.cc
        src/cpp/src/phonenumbers/stringutil.cc
        src/cpp/src/phonenumbers/unicodestring.cc
        src/cpp/src/phonenumbers/utf/rune.c
        src/cpp/src/phonenumbers/utf/unicodetext.cc
        src/cpp/src/phonenumbers/utf/unilib.cc
        $<IF:$<BOOL:${LIBPHONENUMBER_USE_MINIMAL_METADATA}>,src/cpp/src/phonenumbers/metadata-minimal.cc,src/cpp/src/phonenumbers/metadata.cc>
)

target_include_directories(libphonenumber PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/src)

target_compile_definitions (libphonenumber
    PRIVATE
        I18N_PHONENUMBERS_ASCII_DECIMALS_ONLY
    PUBLIC
        I18N_PHONENUMBERS_USE_RTOS_WRAPPER
        I18N_PHONENUMBERS_USE_RE2
)

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

target_link_libraries (libphonenumber 
    PRIVATE 
        re2::re2
    PUBLIC 
        protobuf::libprotobuf-lite
)

A third-party/libphonenumber/src => third-party/libphonenumber/src +1 -0
@@ 0,0 1,1 @@
Subproject commit 1bab216bee1ff366f92552e7dca6f01a327be12b