Git Product home page Git Product logo

gtest_build's Introduction

Building GTest & GMock from source

Compiling GTest from source is actually not that difficult. Here's what you should do:

1. Install all the prerequisite libraries (including Bazel)

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python openjdk-8-jdk bazel

2. Build from the package source with CMake.

Keep in mind that GTest installations are easy using cmake to fit your system:

git clone https://github.com/lmenale/gtest_build.git
cd gtest_build/googletest
mkdir build
cd build
cmake ..
make
cmake .. -DBUILD_SHARED_LIBS=ON
make
sudo cp lib/libgtest* /usr/lib/
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a
sudo ln -s /usr/lib/libgtest.so /usr/local/lib/googletest/libgtest.so
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a
sudo ln -s /usr/lib/libgtest_main.so /usr/local/lib/googletest/libgtest_main.so
sudo cp lib/libgmock* /usr/lib/
sudo ln -s /usr/lib/libgmock.a /usr/local/lib/googletest/libgmock.a
sudo ln -s /usr/lib/libgmock.so /usr/local/lib/googletest/libgmock.so
sudo ln -s /usr/lib/libgmock_main.a /usr/local/lib/googletest/libgmock_main.a
sudo ln -s /usr/lib/libgmock_main.so /usr/local/lib/googletest/libgmock_main.so
cd ..
sudo rm -rf build

3. Build from the package source with Bazel.

Keep in mind that GTest build with Bazel is very easy step:

git clone https://github.com/lmenale/gtest_build.git
cd gtest_build/googletest
bazel build //...
sudo cp bazel-bin/libgtest.a /usr/lib/
sudo cp bazel-bin/libgtest.so /usr/lib/
sudo cp bazel-bin/libgtest_main.a /usr/lib/
sudo cp bazel-bin/libgtest_main.so /usr/lib/
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a
sudo ln -s /usr/lib/libgtest.so /usr/local/lib/googletest/libgtest.so
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a
sudo ln -s /usr/lib/libgtest_main.so /usr/local/lib/googletest/libgtest_main.so
cd ..

4. Install from the package is more easy.

Keep in mind that GTest installations are easy with the package libgtest-dev to fit your system:

sudo apt-get install libgtest-dev
cd /usr/src/googletest
sudo mkdir build
cd build
sudo cmake ..
sudo cmake .. -DBUILD_SHARED_LIBS=ON
sudo make
sudo cp googlemock/gtest/libgtest* /usr/lib/
sudo cp googlemock/libgmock* /usr/lib/
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a
cd ..
sudo rm -rf build

gtest_build's People

Watchers

Luigi Menale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.