Skip to content

Commit 6b48f73

Browse files
committed
Separate assigner and transpiler runs into functions in CMakeLists
1 parent b0ee716 commit 6b48f73

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

examples/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
set(INPUTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inputs)
22

3+
function(assign_ir target binary_name input)
4+
add_custom_target(${target}_assign
5+
COMMAND $<TARGET_FILE:assigner> -b ${binary_name} -i ${INPUTS_DIR}/${input} -c circuit_${target}.crct -t assignment_${target}.tbl -e pallas --check
6+
DEPENDS ${target} ${INPUTS_DIR}/${input} $<TARGET_FILE:assigner>
7+
COMMAND_EXPAND_LISTS
8+
VERBATIM)
9+
endfunction()
10+
11+
function(gen_proof target input)
12+
add_custom_target(${target}_prove
13+
COMMAND $<TARGET_FILE:transpiler> -m gen-test-proof -i ${INPUTS_DIR}/${input} -c circuit_${target}.crct -t assignment_${target}.tbl -o .
14+
DEPENDS ${target} ${INPUTS_DIR}/${input} $<TARGET_FILE:transpiler>
15+
COMMAND_EXPAND_LISTS
16+
VERBATIM)
17+
endfunction()
18+
319
add_subdirectory(cpp)

examples/cpp/CMakeLists.txt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,10 @@ function(add_example example_target)
5050
set(binary_name ${example_target}.bc)
5151
endif()
5252

53-
add_custom_target(${example_target}_assign
54-
COMMAND $<TARGET_FILE:assigner> -b ${binary_name} -i ${INPUTS_DIR}/${ARG_INPUT} -c circuit_${example_target}.crct -t assignment_${example_target}.tbl -e pallas --check
55-
DEPENDS ${example_target} ${ARG_INPUT} $<TARGET_FILE:assigner>
56-
COMMAND_EXPAND_LISTS
57-
VERBATIM)
53+
assign_ir(${example_target} ${binary_name} ${ARG_INPUT})
5854
add_dependencies(assign_cpp_examples ${example_target}_assign)
5955

60-
add_custom_target(${example_target}_prove
61-
COMMAND $<TARGET_FILE:transpiler> -m gen-test-proof -i ${INPUTS_DIR}/${ARG_INPUT} -c circuit_${example_target}.crct -t assignment_${example_target}.tbl -o .
62-
DEPENDS ${example_target} ${ARG_INPUT} $<TARGET_FILE:transpiler>
63-
COMMAND_EXPAND_LISTS
64-
VERBATIM)
56+
gen_proof(${example_target} ${ARG_INPUT})
6557
add_dependencies(prove_cpp_examples ${example_target}_prove)
6658
endfunction()
6759

0 commit comments

Comments
 (0)