|
|
@ -12,6 +12,9 @@ |
|
|
# See the License for the specific language governing permissions and |
|
|
# See the License for the specific language governing permissions and |
|
|
# limitations under the License. |
|
|
# limitations under the License. |
|
|
|
|
|
|
|
|
|
|
|
# Author: Philippe Liard |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmake_minimum_required (VERSION 2.8) |
|
|
cmake_minimum_required (VERSION 2.8) |
|
|
|
|
|
|
|
|
project (libphonenumber) |
|
|
project (libphonenumber) |
|
|
@ -61,6 +64,25 @@ if (PROTOC STREQUAL "PROTOC-NOTFOUND") |
|
|
"Please read README.") |
|
|
"Please read README.") |
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find ICU |
|
|
|
|
|
find_path (ICU_INCLUDE_DIR unicode/unistr.h unicode/normlzr.h) |
|
|
|
|
|
|
|
|
|
|
|
if (ICU_INCLUDE_DIR STREQUAL "ICU_INCLUDE_DIR-NOTFOUND") |
|
|
|
|
|
message (FATAL_ERROR |
|
|
|
|
|
"Can't find ICU headers. Please read README.") |
|
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
include_directories (${ICU_INCLUDE_DIR}) |
|
|
|
|
|
|
|
|
|
|
|
find_library (ICU_LIB icui18n) |
|
|
|
|
|
|
|
|
|
|
|
if (ICU_LIB STREQUAL "ICU_LIB-NOTFOUND") |
|
|
|
|
|
message (FATAL_ERROR |
|
|
|
|
|
"Can't find ICU library. Please read README.") |
|
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add protoc (Protocol Buffers compiler) target |
|
|
# Add protoc (Protocol Buffers compiler) target |
|
|
set ( |
|
|
set ( |
|
|
PROTOBUF_SOURCES "${CMAKE_SOURCE_DIR}/src/phonemetadata.proto" |
|
|
PROTOBUF_SOURCES "${CMAKE_SOURCE_DIR}/src/phonemetadata.proto" |
|
|
@ -95,12 +117,20 @@ set ( |
|
|
SOURCES |
|
|
SOURCES |
|
|
"src/base/at_exit.cc" |
|
|
"src/base/at_exit.cc" |
|
|
"src/base/lazy_instance.cc" |
|
|
"src/base/lazy_instance.cc" |
|
|
|
|
|
"src/base/string_piece.cc" |
|
|
"src/base/synchronization/lock.cc" |
|
|
"src/base/synchronization/lock.cc" |
|
|
"src/base/threading/thread_restrictions.cc" |
|
|
"src/base/threading/thread_restrictions.cc" |
|
|
|
|
|
"src/default_logger.cc" |
|
|
|
|
|
"src/logger_adapter.cc" |
|
|
|
|
|
"src/metadata.cc" # Generated by src/embed_binary_data.sh |
|
|
|
|
|
"src/phonemetadata.pb.cc" # Generated by Protocol Buffers |
|
|
|
|
|
"src/phonenumber.pb.cc" # Generated by Protocol Buffers |
|
|
"src/phonenumberutil.cc" |
|
|
"src/phonenumberutil.cc" |
|
|
"src/re2_cache.cc" |
|
|
"src/re2_cache.cc" |
|
|
"src/stringutil.cc" |
|
|
"src/stringutil.cc" |
|
|
"src/utf/rune.c" |
|
|
"src/utf/rune.c" |
|
|
|
|
|
"src/utf/unicodetext.cc" |
|
|
|
|
|
"src/utf/unilib.cc" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
if (UNIX) |
|
|
if (UNIX) |
|
|
@ -141,11 +171,12 @@ endif () |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include_directories ("src") |
|
|
include_directories ("src") |
|
|
|
|
|
include_directories (".") |
|
|
|
|
|
|
|
|
add_library (phonenumber STATIC ${SOURCES}) |
|
|
add_library (phonenumber STATIC ${SOURCES}) |
|
|
add_dependencies (phonenumber generate-sources) |
|
|
add_dependencies (phonenumber generate-sources) |
|
|
|
|
|
|
|
|
target_link_libraries (phonenumber re2) |
|
|
|
|
|
|
|
|
target_link_libraries (phonenumber re2 protobuf icui18n) |
|
|
|
|
|
|
|
|
# Tests |
|
|
# Tests |
|
|
|
|
|
|
|
|
@ -154,6 +185,7 @@ set (TEST_SOURCES |
|
|
"src/re2_cache_test.cc" |
|
|
"src/re2_cache_test.cc" |
|
|
"src/run_tests.cc" |
|
|
"src/run_tests.cc" |
|
|
"src/stringutil_test.cc" |
|
|
"src/stringutil_test.cc" |
|
|
|
|
|
"src/test_metadata.cc" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
add_executable (libphonenumber_test ${TEST_SOURCES}) |
|
|
add_executable (libphonenumber_test ${TEST_SOURCES}) |
|
|
|