diff --git a/.github/actions/compile-witness-generator/action.yml b/.github/actions/compile-witness-generator/action.yml index 0d8f5b0..12ef161 100644 --- a/.github/actions/compile-witness-generator/action.yml +++ b/.github/actions/compile-witness-generator/action.yml @@ -74,9 +74,12 @@ runs: env: SOURCES_ROOT: ${{ github.workspace }}/src CIRCUIT_CPP_PATH: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + CIRCUIT_FILESTEM: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }} run: | - cp "${SOURCES_ROOT}/ffi.cpp" "${CIRCUIT_CPP_PATH}/ffi.cpp" - cp "${SOURCES_ROOT}/ffi.hpp" "${CIRCUIT_CPP_PATH}/ffi.hpp" + cp -r "${SOURCES_ROOT}/${CIRCUIT_FILESTEM}" "${CIRCUIT_CPP_PATH}/${CIRCUIT_FILESTEM}" + cp "${SOURCES_ROOT}/circom_adapter.cpp" "${CIRCUIT_CPP_PATH}/circom_adapter.cpp" + cp "${SOURCES_ROOT}/circom_adapter.hpp" "${CIRCUIT_CPP_PATH}/circom_adapter.hpp" + cp "${SOURCES_ROOT}/circom_fwd.hpp" "${CIRCUIT_CPP_PATH}/circom_fwd.hpp" cp "${SOURCES_ROOT}/types.hpp" "${CIRCUIT_CPP_PATH}/types.hpp" # TODO: Instead of replace, make a fork that generates the appropriate Makefile @@ -119,12 +122,13 @@ runs: shell: bash env: CIRCUIT_CPP_PATH: ${{ steps.parse-circuit-path.outputs.CIRCUIT_CPP_PATH }} + CIRCUIT_FILESTEM: ${{ steps.parse-circuit-path.outputs.CIRCUIT_FILESTEM }} run: | mkdir -p "${CIRCUIT_CPP_PATH}/include" mv "${CIRCUIT_CPP_PATH}/calcwit.hpp" "${CIRCUIT_CPP_PATH}/include/" mv "${CIRCUIT_CPP_PATH}/circom.hpp" "${CIRCUIT_CPP_PATH}/include/" mv "${CIRCUIT_CPP_PATH}/fr.hpp" "${CIRCUIT_CPP_PATH}/include/" - mv "${CIRCUIT_CPP_PATH}/ffi.hpp" "${CIRCUIT_CPP_PATH}/include/" + mv "${CIRCUIT_CPP_PATH}/${CIRCUIT_FILESTEM}/ffi.hpp" "${CIRCUIT_CPP_PATH}/include/" mv "${CIRCUIT_CPP_PATH}/types.hpp" "${CIRCUIT_CPP_PATH}/include/" - name: Upload ${{ inputs.circuit-name-display }} diff --git a/.github/resources/witness-generator/Makefile b/.github/resources/witness-generator/Makefile index 93dedfe..7cf4f12 100644 --- a/.github/resources/witness-generator/Makefile +++ b/.github/resources/witness-generator/Makefile @@ -7,14 +7,14 @@ endif # ---- Common ---- CXX := g++ -CXXFLAGS_COMMON := -std=c++11 -O3 -I. -Wno-address-of-packed-member -Dmain=circom_main -DCIRCUIT_NAME=$(PROJECT) +CXXFLAGS_COMMON := -std=c++11 -O3 -I. -Wno-address-of-packed-member -Dmain=circom_main COMMON_SRCS := main.cpp calcwit.cpp fr.cpp $(PROJECT).cpp COMMON_OBJS := $(COMMON_SRCS:.cpp=.o) -LIB_ONLY_SRCS := ffi.cpp +LIB_ONLY_SRCS := $(PROJECT)/ffi.cpp circom_adapter.cpp LIB_ONLY_OBJS := $(LIB_ONLY_SRCS:.cpp=.o) LIB_SRCS := $(COMMON_SRCS) $(LIB_ONLY_SRCS) -LIB_OBJS := $(LIB_SRCS:.cpp=.o) -DEPS_HPP := circom.hpp calcwit.hpp fr.hpp types.hpp ffi.hpp +LIB_OBJS := $(COMMON_OBJS) $(LIB_ONLY_OBJS) +DEPS_HPP := circom.hpp calcwit.hpp fr.hpp types.hpp $(PROJECT)/ffi.hpp BIN := $(PROJECT) ifeq ($(OS),windows) LIB_EXT := .lib