1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-05 19:15:58 +03:00

[pzstd] Remove gtest dependency from make all

This commit is contained in:
Nick Terrell
2016-11-14 11:02:03 -08:00
parent 1f0b09dc4c
commit 324c8ab000
4 changed files with 17 additions and 11 deletions

View File

@@ -23,7 +23,7 @@ matrix:
packages: packages:
- gcc-4.8 - gcc-4.8
- g++-4.8 - g++-4.8
env: PLATFORM="Ubuntu 12.04 container" CMD="make zlibwrapper && make clean && make -C tests test-zstd-nolegacy && make clean && make clean && make cmaketest && make clean && make -C contrib/pzstd googletest && make -C contrib/pzstd all && make -C contrib/pzstd check && make -C contrib/pzstd clean" env: PLATFORM="Ubuntu 12.04 container" CMD="make zlibwrapper && make clean && make -C tests test-zstd-nolegacy && make clean && make clean && make cmaketest && make clean && make -C contrib/pzstd googletest pzstd tests check && make -C contrib/pzstd clean"
- os: linux - os: linux
sudo: false sudo: false
env: PLATFORM="Ubuntu 12.04 container" CMD="make usan" env: PLATFORM="Ubuntu 12.04 container" CMD="make usan"

View File

@@ -51,7 +51,8 @@ build_script:
ECHO *** Building pzstd for %PLATFORM% && ECHO *** Building pzstd for %PLATFORM% &&
ECHO *** && ECHO *** &&
make -C contrib\pzstd googletest-mingw64 && make -C contrib\pzstd googletest-mingw64 &&
make -C contrib\pzstd all && make -C contrib\pzstd pzstd.exe &&
make -C contrib\pzstd tests &&
make -C contrib\pzstd check && make -C contrib\pzstd check &&
make -C contrib\pzstd clean make -C contrib\pzstd clean
) )

View File

@@ -34,7 +34,7 @@ LDFLAGS ?=
PZSTD_INC = -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(PROGDIR) -I. PZSTD_INC = -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(PROGDIR) -I.
GTEST_INC = -isystem googletest/googletest/include GTEST_INC = -isystem googletest/googletest/include
PZSTD_CPPFLAGS = $(PZSTD_INC) $(GTEST_INC) PZSTD_CPPFLAGS = $(PZSTD_INC)
PZSTD_CCXXFLAGS = PZSTD_CCXXFLAGS =
PZSTD_CFLAGS = $(PZSTD_CCXXFLAGS) PZSTD_CFLAGS = $(PZSTD_CCXXFLAGS)
PZSTD_CXXFLAGS = $(PZSTD_CCXXFLAGS) PZSTD_CXXFLAGS = $(PZSTD_CCXXFLAGS)
@@ -47,10 +47,10 @@ ALL_LDFLAGS = $(EXTRA_FLAGS) $(LDFLAGS) $(PZSTD_LDFLAGS)
# gtest libraries need to go before "-lpthread" because they depend on it. # gtest libraries need to go before "-lpthread" because they depend on it.
GTEST_LIB = -L googletest/build/googlemock/gtest GTEST_LIB = -L googletest/build/googlemock/gtest
LIBS = $(GTEST_LIB) -lpthread LIBS =
# Compilation commands # Compilation commands
LD_COMMAND = $(CXX) $^ $(ALL_LDFLAGS) $(LIBS) -o $@ LD_COMMAND = $(CXX) $^ $(ALL_LDFLAGS) $(LIBS) -lpthread -o $@
CC_COMMAND = $(CC) $(DEPFLAGS) $(ALL_CFLAGS) -c $< -o $@ CC_COMMAND = $(CC) $(DEPFLAGS) $(ALL_CFLAGS) -c $< -o $@
CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@ CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
@@ -109,7 +109,7 @@ uninstall:
# Targets for many different builds # Targets for many different builds
.PHONY: all .PHONY: all
all: PZSTD_CPPFLAGS += -DNDEBUG all: PZSTD_CPPFLAGS += -DNDEBUG
all: pzstd$(EXT) tests roundtrip all: pzstd$(EXT)
.PHONY: debug .PHONY: debug
debug: EXTRA_FLAGS += -g debug: EXTRA_FLAGS += -g
@@ -130,7 +130,7 @@ ubsan: debug
.PHONY: all32 .PHONY: all32
all32: EXTRA_FLAGS += -m32 all32: EXTRA_FLAGS += -m32
all32: all all32: all tests roundtrip
.PHONY: debug32 .PHONY: debug32
debug32: EXTRA_FLAGS += -m32 debug32: EXTRA_FLAGS += -m32
@@ -177,12 +177,14 @@ test/RoundTripTest$(EXT): test/RoundTripTest.o $(PROGDIR)/datagen.o Options.o \
Pzstd.o SkippableFrame.o $(ZSTDDIR)/libzstd.a Pzstd.o SkippableFrame.o $(ZSTDDIR)/libzstd.a
$(LD_COMMAND) $(LD_COMMAND)
test/%Test$(EXT): GTEST_LIB += -lgtest -lgtest_main test/%Test$(EXT): PZSTD_LDFLAGS += $(GTEST_LIB)
test/%Test$(EXT): LIBS += -lgtest -lgtest_main
test/%Test$(EXT): test/%Test.o $(PROGDIR)/datagen.o Options.o Pzstd.o \ test/%Test$(EXT): test/%Test.o $(PROGDIR)/datagen.o Options.o Pzstd.o \
SkippableFrame.o $(ZSTDDIR)/libzstd.a SkippableFrame.o $(ZSTDDIR)/libzstd.a
$(LD_COMMAND) $(LD_COMMAND)
utils/test/%Test$(EXT): GTEST_LIB += -lgtest -lgtest_main utils/test/%Test$(EXT): PZSTD_LDFLAGS += $(GTEST_LIB)
utils/test/%Test$(EXT): LIBS += -lgtest -lgtest_main
utils/test/%Test$(EXT): utils/test/%Test.o utils/test/%Test$(EXT): utils/test/%Test.o
$(LD_COMMAND) $(LD_COMMAND)
@@ -233,10 +235,12 @@ $(PROGDIR)/%.o: $(PROGDIR)/%.c
$(CXX_COMMAND) $(CXX_COMMAND)
$(POSTCOMPILE) $(POSTCOMPILE)
test/%.o: PZSTD_CPPFLAGS += $(GTEST_INC)
test/%.o: test/%.cpp test/%.o: test/%.cpp
$(CXX_COMMAND) $(CXX_COMMAND)
$(POSTCOMPILE) $(POSTCOMPILE)
utils/test/%.o: PZSTD_CPPFLAGS += $(GTEST_INC)
utils/test/%.o: utils/test/%.cpp utils/test/%.o: utils/test/%.cpp
$(CXX_COMMAND) $(CXX_COMMAND)
$(POSTCOMPILE) $(POSTCOMPILE)

View File

@@ -51,5 +51,6 @@ Pigz cannot do parallel decompression, it simply does each of reading, decompres
## Tests ## Tests
Tests require that you have [gtest](https://github.com/google/googletest) installed. Tests require that you have [gtest](https://github.com/google/googletest) installed.
Modify `GTEST_INC` and `GTEST_LIB` in `test/Makefile` and `utils/test/Makefile` to work for your install of gtest. Set `GTEST_INC` and `GTEST_LIB` in `Makefile` to specify the location of the gtest headers and libraries.
Then run `make test` in the `contrib/pzstd` directory. Alternatively, run `make googletest`, which will clone googletest and build it.
Run `make tests && make check` to run tests.