Browse Source

Merge pull request #1052 from googlei18n/cmake_back_to_2.8

Add cmake Mac flag to enable Linux builds at lower cmake versions.
pull/1055/head
Keghani Kouzoujian 10 years ago
parent
commit
053e3c0ad0
4 changed files with 67 additions and 4 deletions
  1. +2
    -1
      cpp/CMakeLists.txt
  2. +62
    -2
      cpp/README
  3. +1
    -1
      debian/control
  4. +2
    -0
      java/pending_code_changes.txt

+ 2
- 1
cpp/CMakeLists.txt View File

@ -14,7 +14,7 @@
# Author: Philippe Liard # Author: Philippe Liard
cmake_minimum_required (VERSION 3.1)
cmake_minimum_required (VERSION 2.8)
project (libphonenumber) project (libphonenumber)
set (libphonenumber_VERSION_MAJOR 7) set (libphonenumber_VERSION_MAJOR 7)
@ -126,6 +126,7 @@ find_required_program (JAVA java
if (APPLE) if (APPLE)
FIND_LIBRARY (COREFOUNDATION_LIB CoreFoundation) FIND_LIBRARY (COREFOUNDATION_LIB CoreFoundation)
FIND_LIBRARY (FOUNDATION_LIB Foundation) FIND_LIBRARY (FOUNDATION_LIB Foundation)
set (CMAKE_MACOSX_RPATH "OFF")
set (CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS set (CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS
"${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
endif () endif ()


+ 62
- 2
cpp/README View File

@ -35,7 +35,8 @@ Quickstart:
- In recent Debian-based distributions, it should be sufficent to run: - In recent Debian-based distributions, it should be sufficent to run:
$ sudo apt-get install \ $ sudo apt-get install \
cmake cmake-curses-gui libprotobuf-dev libgtest-dev libre2-dev \ cmake cmake-curses-gui libprotobuf-dev libgtest-dev libre2-dev \
libicu-dev libboost-dev libboost-thread-dev libboost-system-dev
libicu-dev libboost-dev libboost-thread-dev libboost-system-dev \
protobuf-compiler
If any of these packages fails to install correctly, follow the instructions If any of these packages fails to install correctly, follow the instructions
in the appropriate section below. in the appropriate section below.
@ -56,7 +57,7 @@ Requirements:
recent Debian-based GNU/Linux distributions). recent Debian-based GNU/Linux distributions).
You can check which version is available: You can check which version is available:
$ apt-cache show libprotobuf-dev
$ apt-cache show libprotobuf-dev
Package: libprotobuf-dev Package: libprotobuf-dev
Source: protobuf Source: protobuf
Version: 2.5.0-9ubuntu1 <-- This must be >= 2.4.0 Version: 2.5.0-9ubuntu1 <-- This must be >= 2.4.0
@ -138,6 +139,63 @@ Building and testing the library
$ make $ make
$ ./libphonenumber_test $ ./libphonenumber_test
Manually installing the library on Mac
--------------------------------------
You can easily install dependencies on Mac using a package manager. In these
instructions we use Homebrew (http://brew.sh).
Install Homebrew package manager and use it to install dependencies:
$ /usr/bin/ruby -e "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install boost cmake icu4c pkg-config protobuf wget
See https://github.com/Homebrew/homebrew/issues/14099 - homebrew does not have
gtest. We don't need to install gtest, we only copy sources. For example:
$ mkdir ~/googletest_clone
$ cd ~/googletest_clone
$ git clone https://github.com/google/googletest.git
Get the libphonenumber source. For example:
$ mkdir ~/libphonenumber_clone
$ cd ~/libphonenumber_clone
$ git clone https://github.com/googlei18n/libphonenumber.git
Build and test the library:
$ cd libphonenumber/cpp
$ mkdir build
$ cd build
Replace XXX in the commands below with the appropriate version number:
$ cmake \
-DGTEST_SOURCE_DIR=~/googletest_clone/googletest/googletest/ \
-DGTEST_INCLUDE_DIR=~/googletest_clone/googletest/googletest/include/ \
-DICU_UC_INCLUDE_DIR=/usr/local/Cellar/icu4c/XXX/include/ \
-DICU_UC_LIB=/usr/local/Cellar/icu4c/XXX/lib/libicuuc.dylib \
-DICU_I18N_INCLUDE_DIR=/usr/local/Cellar/icu4c/XXX/include/ \
-DICU_I18N_LIB=/usr/local/Cellar/icu4c/XXX/lib/libicui18n.dylib \
-DUSE_STD_MAP=ON \
..
$ make
$ ./libphonenumber_test
Optional: Deleting & uninstalling everything again:
$ cd
$ rm -rf ~/libphonenumber_clone ~/googletest_clone
openssl is a dependency of wget and installed with it by Homebrew. If you had
openssl before installing wget don't uninstall here.
$ brew uninstall boost cmake icu4c openssl pkg-config protobuf wget
$ /usr/bin/ruby -e "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Homebrew will have changed permissions at installation. See output of previous
command for how to change them back, for example:
$ sudo chmod 0755 /usr/local
$ sudo chgrp wheel /usr/local
Troubleshooting CMake via ccmake Troubleshooting CMake via ccmake
-------------------------------- --------------------------------
Follow these instructions if the build steps above don't work for you. Follow these instructions if the build steps above don't work for you.
@ -202,6 +260,7 @@ Troubleshooting CMake via ccmake
$ cmake .. $ cmake ..
$ make $ make
Building the library on Windows (Visual Studio) Building the library on Windows (Visual Studio)
----------------------------------------------- -----------------------------------------------
The library was tested with Visual Studio 2010. The library was tested with Visual Studio 2010.
@ -264,6 +323,7 @@ C:/Program Files/libphonenumber/.
Note that this path can be set by overriding the CMAKE_INSTALL_PREFIX variable Note that this path can be set by overriding the CMAKE_INSTALL_PREFIX variable
with cmake-gui. with cmake-gui.
Supported build parameters Supported build parameters
-------------------------- --------------------------
Build parameters can be specified invoking CMake with '-DKEY=VALUE' or using a Build parameters can be specified invoking CMake with '-DKEY=VALUE' or using a


+ 1
- 1
debian/control View File

@ -3,7 +3,7 @@ Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org> Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: Daniel Pocock <daniel@pocock.pro>, Fredrik Roubert <roubert@google.com> Uploaders: Daniel Pocock <daniel@pocock.pro>, Fredrik Roubert <roubert@google.com>
Build-Depends: cdbs, Build-Depends: cdbs,
cmake (>= 3.1),
cmake (>= 2.8),
debhelper (>= 9), debhelper (>= 9),
default-jdk | java-sdk, default-jdk | java-sdk,
libboost-dev (>= 1.40), libboost-dev (>= 1.40),


+ 2
- 0
java/pending_code_changes.txt View File

@ -1,6 +1,8 @@
Code changes: Code changes:
- Added java/pending_code_changes.txt for contributors to track code changes - Added java/pending_code_changes.txt for contributors to track code changes
between releases. between releases.
- Reduced minimum required version of cmake to 2.8.
- Added cmake installation instructions for Mac.
- Added getExampleNumberForType that doesn't take in a region, and - Added getExampleNumberForType that doesn't take in a region, and
getInvalidExampleNumber getInvalidExampleNumber
- Improvements to javadoc for parse method - Improvements to javadoc for parse method

Loading…
Cancel
Save