diff --git a/.github/resources/witness-generator/linux.Makefile b/.github/resources/witness-generator/linux.Makefile new file mode 100644 index 0000000..3c01dcc --- /dev/null +++ b/.github/resources/witness-generator/linux.Makefile @@ -0,0 +1,18 @@ +CC=g++ +CFLAGS=-std=c++11 -O3 -I. +LDFLAGS = -lgmp -static + +DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp +DEPS_O = main.o calcwit.o fr.o pol.o + +all: pol + +%.o: %.cpp $(DEPS_HPP) + $(CC) -Wno-address-of-packed-member -c $< $(CFLAGS) -o $@ + +pol: $(DEPS_O) + $(CC) -o pol $(DEPS_O) $(LDFLAGS) + +clean: + rm -f *.o pol + diff --git a/.github/resources/witness-generator/macos.Makefile b/.github/resources/witness-generator/macos.Makefile index 6bca6a3..926a92d 100644 --- a/.github/resources/witness-generator/macos.Makefile +++ b/.github/resources/witness-generator/macos.Makefile @@ -1,6 +1,7 @@ CC = g++ -CFLAGS = -std=c++11 -O3 -I. -I/opt/homebrew/include -include gmp_patch.hpp -LDFLAGS = -L/opt/homebrew/lib -lgmp +CFLAGS = -std=c++11 -O3 -I. -I/opt/homebrew/include -include gmp_patch.hpp -Wno-address-of-packed-member +LDFLAGS = -Wl,-search_paths_first -Wl,-dead_strip -L/opt/homebrew/lib +LDLIBS = /opt/homebrew/lib/libgmp.a DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp DEPS_O = main.o calcwit.o fr.o pol.o @@ -8,10 +9,11 @@ DEPS_O = main.o calcwit.o fr.o pol.o all: pol %.o: %.cpp $(DEPS_HPP) - $(CC) -Wno-address-of-packed-member -c $< $(CFLAGS) -o $@ + $(CC) $(CFLAGS) -c $< -o $@ pol: $(DEPS_O) - $(CC) -o pol $(DEPS_O) $(LDFLAGS) + $(CC) -o $@ $(DEPS_O) $(LDFLAGS) $(LDLIBS) clean: rm -f *.o pol + diff --git a/.github/resources/witness-generator/windows.Makefile b/.github/resources/witness-generator/windows.Makefile index 0aceb95..2f0c7e7 100644 --- a/.github/resources/witness-generator/windows.Makefile +++ b/.github/resources/witness-generator/windows.Makefile @@ -1,6 +1,6 @@ CC = g++ CFLAGS = -std=c++11 -O3 -I. -I/include -Duint="unsigned int" -LDFLAGS = -L/lib -lgmp -lmman +LDFLAGS = -L/lib -lgmp -lmman -static DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp DEPS_O = main.o calcwit.o fr.o pol.o diff --git a/.github/workflows/build-circuits.yml b/.github/workflows/build-circuits.yml index 1e3b50b..d99bf1a 100644 --- a/.github/workflows/build-circuits.yml +++ b/.github/workflows/build-circuits.yml @@ -94,6 +94,10 @@ jobs: working-directory: repo/circom_circuits/Mantle run: circom --c --r1cs --no_asm --O2 pol.circom + - name: Replace Witness Generator Makefile # TODO: Make a fork generate the appropriate Linux Makefile + working-directory: repo + run: cp .github/resources/witness-generator/${{ env.OS }}.Makefile circom_circuits/Mantle/pol_cpp/Makefile + - name: Compile Witness Generator working-directory: repo/circom_circuits/Mantle/pol_cpp run: make pol