Skip to content

Commit be669a9

Browse files
authored
Merge pull request #24 from dlecocq/dan/gtest
Vendor in google test
2 parents d28a77b + a6031bc commit be669a9

5 files changed

Lines changed: 15 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Binaries and build artifacts
22
*.o
3+
*.a
34
bench
45
test-all
56

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[submodule "deps/url-cpp"]
22
path = deps/url-cpp
33
url = https://github.com/seomoz/url-cpp
4+
[submodule "deps/googletest"]
5+
path = deps/googletest
6+
url = https://github.com/google/googletest/
7+
ignore = untracked

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
GTEST_DIR ?= deps/googletest/googletest
2+
13
CXX ?= g++
2-
CXXOPTS ?= -Wall -Werror -std=c++11 -Iinclude/ -Ideps/url-cpp/include
4+
CXXOPTS ?= -Wall -Werror -std=c++11 -Iinclude/ -Ideps/url-cpp/include -I$(GTEST_DIR)/include
35
DEBUG_OPTS ?= -g -fprofile-arcs -ftest-coverage -O0 -fPIC
46
RELEASE_OPTS ?= -O3
5-
BINARIES =
7+
BINARIES =
68

79
all: test release/librep.o $(BINARIES)
810

11+
$(GTEST_DIR)/libgtest.a:
12+
g++ -isystem $(GTEST_DIR)/include -I$(GTEST_DIR) -pthread -c $(GTEST_DIR)/src/gtest-all.cc -o $(GTEST_DIR)/libgtest.a
13+
914
# Release libraries
1015
release:
1116
mkdir -p release
@@ -42,8 +47,8 @@ test/%.o: test/%.cpp
4247
$(CXX) $(CXXOPTS) $(DEBUG_OPTS) -o $@ -c $<
4348

4449
# Tests
45-
test-all: test/test-all.o test/test-agent.o test/test-directive.o test/test-robots.o debug/librep.o
46-
$(CXX) $(CXXOPTS) $(DEBUG_OPTS) -o $@ $^ -lgtest -lpthread
50+
test-all: test/test-all.o test/test-agent.o test/test-directive.o test/test-robots.o debug/librep.o $(GTEST_DIR)/libgtest.a
51+
$(CXX) $(CXXOPTS) -L$(GTEST_DIR) $(DEBUG_OPTS) -o $@ $^ -lpthread
4752

4853
# Bench
4954
bench: bench.cpp release/librep.o

deps/googletest

Submodule googletest added at ca102b1

scripts/travis/before_install.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,3 @@ set -e
55
sudo apt-get install -y g++ libgtest-dev cmake python-pip
66

77
sudo pip install gcovr==3.2
8-
9-
pushd /tmp
10-
mkdir -p gtest-build
11-
pushd gtest-build
12-
cmake -DCMAKE_BUILD_TYPE=RELEASE /usr/src/gtest/
13-
make
14-
find . -name 'libg*.a' | xargs sudo cp -f --target-directory=/usr/lib/
15-
popd
16-
popd

0 commit comments

Comments
 (0)