大隻雞慢啼

大隻雞慢啼

我們是小國小民,但是我們是好國好民。 - 鄭南榕

10 Jan 2019

Build S2 Geometry

Prerequisite

  • You need to install Xcode from App Store
  • Clone googletest from GitHub and install openssl via brew see below:
git clone https://github.com/google/googletest

# Note that there are `googlemock` and `googletest` under the root `googletest` dir, 
# please use the more specific `googletest/googletest` as the `GTEST_ROOT`.
GTEST_ROOT=`realpath googletest/googletest`

# Because we need OpenSSL header files
brew install openssl
OPENSSL_ROOT=`brew --prefix openssl`

Build s2geometry

git clone https://github.com/google/s2geometry.git
cd s2geometry
mkdir build
cd build
cmake -DOPENSSL_INCLUDE_DIR=${OPENSSL_ROOT}/include -DGTEST_ROOT=${GTEST_ROOT} ..
make
make test
sudo make install

Run s2geometry tests in CLion

  • Please go to Preferences... -> Build, Execution, Deployment -> CMake
  • Select the Debug Profile, then add -DOPENSSL_INCLUDE_DIR=${path_to_openssl_include} and -DGTEST_ROOT=${path_to_gtest_root} to CMake options.
  • Reload project in CLion then you should be able to run all unit tests.