]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[pzstd] Remove gtest dependency from make all
authorNick Terrell <terrelln@fb.com>
Mon, 14 Nov 2016 19:02:03 +0000 (11:02 -0800)
committerNick Terrell <terrelln@fb.com>
Mon, 14 Nov 2016 19:56:28 +0000 (11:56 -0800)
.travis.yml
appveyor.yml
contrib/pzstd/Makefile
contrib/pzstd/README.md

index 8462b97128dd66ba536d871b39fe602fef2714e3..73ff048630320d24d3d90ac98764936170aaaba2 100644 (file)
@@ -23,7 +23,7 @@ matrix:
           packages:
             - gcc-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
       sudo: false
       env: PLATFORM="Ubuntu 12.04 container" CMD="make usan"
index fbdc30c40b5156479ee3a2c0392ccf60eb5377b8..bce87a3aba59bc6efb7129798a9bc143ac0452d3 100644 (file)
@@ -51,7 +51,8 @@ build_script:
       ECHO *** Building pzstd for %PLATFORM% &&
       ECHO *** &&
       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 clean
     )
index ad0e556739cd619a58fe9fcce18ca3d63fb1d395..99d955e948eb229a6b9ef1d08aa9d4d7be325619 100644 (file)
@@ -34,7 +34,7 @@ LDFLAGS  ?=
 PZSTD_INC  = -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(PROGDIR) -I.
 GTEST_INC  = -isystem googletest/googletest/include
 
-PZSTD_CPPFLAGS  = $(PZSTD_INC) $(GTEST_INC)
+PZSTD_CPPFLAGS  = $(PZSTD_INC)
 PZSTD_CCXXFLAGS =
 PZSTD_CFLAGS    = $(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_LIB  = -L googletest/build/googlemock/gtest
-LIBS       = $(GTEST_LIB) -lpthread
+LIBS       =
 
 # 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 $@
 CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $<  -o $@
 
@@ -109,7 +109,7 @@ uninstall:
 # Targets for many different builds
 .PHONY: all
 all: PZSTD_CPPFLAGS += -DNDEBUG
-all: pzstd$(EXT) tests roundtrip
+all: pzstd$(EXT)
 
 .PHONY: debug
 debug: EXTRA_FLAGS += -g
@@ -130,7 +130,7 @@ ubsan: debug
 
 .PHONY: all32
 all32: EXTRA_FLAGS += -m32
-all32: all
+all32: all tests roundtrip
 
 .PHONY: debug32
 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
        $(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  \
                   SkippableFrame.o $(ZSTDDIR)/libzstd.a
        $(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
        $(LD_COMMAND)
 
@@ -233,10 +235,12 @@ $(PROGDIR)/%.o: $(PROGDIR)/%.c
        $(CXX_COMMAND)
        $(POSTCOMPILE)
 
+test/%.o: PZSTD_CPPFLAGS += $(GTEST_INC)
 test/%.o: test/%.cpp
        $(CXX_COMMAND)
        $(POSTCOMPILE)
 
+utils/test/%.o: PZSTD_CPPFLAGS += $(GTEST_INC)
 utils/test/%.o: utils/test/%.cpp
        $(CXX_COMMAND)
        $(POSTCOMPILE)
index 3fe7b0b9df48fede674096f54604beb53290747c..84d945815838f7357ec71c717823becad0db9a51 100644 (file)
@@ -51,5 +51,6 @@ Pigz cannot do parallel decompression, it simply does each of reading, decompres
 ## Tests
 
 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.
-Then run `make test` in the `contrib/pzstd` directory.
+Set `GTEST_INC` and `GTEST_LIB` in `Makefile` to specify the location of the gtest headers and libraries.
+Alternatively, run `make googletest`, which will clone googletest and build it.
+Run `make tests && make check` to run tests.