]> Git Repo - VerusCoin.git/commitdiff
Don't compile libgtest.a when building libsnark.
authorsyd <[email protected]>
Sat, 25 Nov 2017 15:58:37 +0000 (10:58 -0500)
committersyd <[email protected]>
Sat, 25 Nov 2017 15:58:37 +0000 (10:58 -0500)
Previously libsnark would try to build libgtest if /usr/src/gtest
exists on the build machine. This caused issues because the
version of libgtest in /usr/src isn't necessarily the same as
the one that the rest of zcash's gtests were built with.

src/Makefile.am
src/snark/Makefile

index ea745a1f7d46e4dbb731e8cca361bb1ef19654a8..48b60911a99453c62518ee2855d63d780620eae9 100644 (file)
@@ -46,7 +46,7 @@ $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
 collate-libsnark: $(LIBSNARK)
 
 LIBSNARK_CXXFLAGS = -fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1
-LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1
+LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 NO_COMPILE_LIBGTEST=1
 
 $(LIBSNARK): $(wildcard snark/src/*)
        $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ install PREFIX=$(srcdir)/build DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
index cceffb989667c3d89dacd7dff478a7afe14b0338..32b8609f202fcbf1e3e9e45df4e8ea1de3a94a33 100644 (file)
@@ -27,13 +27,13 @@ INSTALL_LIBS = $(LIB_FILE)
 # Sentinel file to check existence of this directory (since directories don't work as a Make dependency):
 DEPINST_EXISTS = $(DEPINST)/.exists
 
-
-COMPILE_GTEST :=
 ifneq ($(NO_GTEST),1)
-       GTESTDIR=/usr/src/gtest
-# Compile GTest from sourcecode if we can (e.g., Ubuntu). Otherwise use precompiled one (e.g., Fedora).
-# See https://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog .
-       COMPILE_GTEST :=$(shell test -d $(GTESTDIR) && echo -n 1)
+       # Compile GTest from sourcecode if we can (e.g., Ubuntu). Otherwise use precompiled one (e.g., Fedora).
+       # See https://github.com/google/googletest/blob/master/googletest/docs/FAQ.md#why-is-it-not-recommended-to-install-a-pre-compiled-copy-of-google-test-for-example-into-usrlocal
+       ifneq ($(NO_COMPILE_LIBGTEST),1)
+               GTESTDIR=/usr/src/gtest
+               COMPILE_LIBGTEST = $(shell test -d $(GTESTDIR) && echo -n 1)
+       endif
        GTEST_LDLIBS += -lgtest -lpthread
 endif
 
@@ -221,13 +221,13 @@ src/gadgetlib2/tests/gadgetlib2_test: \
 $(EXECUTABLES): %: %.o $(LIBSNARK_A) $(DEPINST_EXISTS)
        $(CXX) -o $@   [email protected] $(LIBSNARK_A) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS)
 
-$(EXECUTABLES_WITH_GTEST): %: %.o $(LIBSNARK_A) $(if $(COMPILE_GTEST),$(LIBGTEST_A)) $(DEPINST_EXISTS)
+$(EXECUTABLES_WITH_GTEST): %: %.o $(LIBSNARK_A) $(if $(COMPILE_LIBGTEST),$(LIBGTEST_A)) $(DEPINST_EXISTS)
        $(CXX) -o $@   [email protected] $(LIBSNARK_A) $(CXXFLAGS) $(LDFLAGS) $(GTEST_LDLIBS) $(LDLIBS)
 
 $(EXECUTABLES_WITH_SUPERCOP): %: %.o $(LIBSNARK_A) $(DEPINST_EXISTS)
        $(CXX) -o $@   [email protected] $(LIBSNARK_A) $(CXXFLAGS) $(LDFLAGS) $(SUPERCOP_LDLIBS) $(LDLIBS)
 
-$(GTEST_TESTS): %: $(GTEST_OBJS) $(LIBSNARK_A) $(if $(COMPILE_GTEST),$(LIBGTEST_A)) $(DEPINST_EXISTS)
+$(GTEST_TESTS): %: $(GTEST_OBJS) $(LIBSNARK_A) $(if $(COMPILE_LIBGTEST),$(LIBGTEST_A)) $(DEPINST_EXISTS)
        $(CXX) -o $@   $(GTEST_OBJS) $(LIBSNARK_A) $(CXXFLAGS) $(LDFLAGS) $(GTEST_LDLIBS) $(LDLIBS)
 
 
This page took 0.03114 seconds and 4 git commands to generate.