|
1 | | -add_custom_target(circuit_examples) |
2 | | -add_custom_target(assign_examples) |
3 | | -add_custom_target(prove_examples) |
| 1 | +set(INPUTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inputs) |
4 | 2 |
|
5 | | -function(add_example example_target) |
6 | | - set(prefix ARG) |
7 | | - set(noValues "") |
8 | | - set(singleValues INPUT) |
9 | | - set(multiValues SOURCES) |
10 | | - cmake_parse_arguments(${prefix} |
11 | | - "${noValues}" |
12 | | - "${singleValues}" |
13 | | - "${multiValues}" |
14 | | - ${ARGN}) |
15 | | - add_circuit(${example_target} |
16 | | - SOURCES ${ARG_SOURCES} |
17 | | - |
18 | | - LINK_LIBRARIES |
19 | | - crypto3::algebra |
20 | | - crypto3::block |
21 | | - crypto3::blueprint |
22 | | - crypto3::codec |
23 | | - crypto3::containers |
24 | | - crypto3::hash |
25 | | - crypto3::kdf |
26 | | - crypto3::mac |
27 | | - marshalling::core |
28 | | - marshalling::crypto3_algebra |
29 | | - marshalling::crypto3_multiprecision |
30 | | - marshalling::crypto3_zk |
31 | | - crypto3::math |
32 | | - crypto3::modes |
33 | | - crypto3::multiprecision |
34 | | - crypto3::passhash |
35 | | - crypto3::pbkdf |
36 | | - crypto3::threshold |
37 | | - crypto3::pkpad |
38 | | - crypto3::pubkey |
39 | | - crypto3::random |
40 | | - crypto3::stream |
41 | | - crypto3::vdf |
42 | | - crypto3::zk |
43 | | - |
44 | | - ${Boost_LIBRARIES}) |
45 | | - add_dependencies(circuit_examples "${example_target}") |
46 | | - |
47 | | - if (CIRCUIT_ASSEMBLY_OUTPUT) |
48 | | - set(binary_name ${example_target}.ll) |
49 | | - else() |
50 | | - set(binary_name ${example_target}.bc) |
51 | | - endif() |
52 | | - |
53 | | - add_custom_target(${example_target}_assign |
54 | | - COMMAND $<TARGET_FILE:assigner> -b ${binary_name} -i ${CMAKE_CURRENT_SOURCE_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) |
58 | | - add_dependencies(assign_examples ${example_target}_assign) |
59 | | - |
60 | | - add_custom_target(${example_target}_prove |
61 | | - COMMAND $<TARGET_FILE:transpiler> -m gen-test-proof -i ${CMAKE_CURRENT_SOURCE_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) |
65 | | - add_dependencies(prove_examples ${example_target}_prove) |
66 | | -endfunction() |
67 | | - |
68 | | -add_example(arithmetics_example SOURCES arithmetics.cpp INPUT arithmetics.inp) |
69 | | -add_example(integer_arithmetics_example SOURCES integer_arithmetics.cpp INPUT integer_arithmetics.inp) |
70 | | -add_example(poseidon_example SOURCES poseidon.cpp INPUT poseidon.inp) |
71 | | -add_example(merkle_tree_poseidon_example SOURCES merkle_tree_poseidon.cpp INPUT merkle_tree_poseidon.inp) |
72 | | -add_example(merkle_tree_sha2_256_example SOURCES merkle_tree_sha2_256.cpp INPUT merkle_tree_sha2_256.inp) |
73 | | -add_example(sha256_example SOURCES sha2_256.cpp INPUT sha2_256.inp) |
74 | | -add_example(balance_example SOURCES balance.cpp INPUT balance.inp) |
75 | | -add_example(memory_example SOURCES memory.cpp INPUT memory.inp) |
76 | | -add_example(polynomial_example SOURCES polynomial.cpp INPUT polynomial.inp) |
77 | | -add_example(pallas_curve_addition_example |
78 | | - SOURCES pallas_curve_examples/pallas_curve_add.cpp |
79 | | - INPUT pallas_curve_examples/pallas_curve_add.inp) |
80 | | -#add_example(pallas_curve_multiplication_example |
81 | | -# SOURCES pallas_curve_examples/pallas_curve_mul.cpp |
82 | | -# INPUT pallas_curve_examples/pallas_curve_mul.inp) |
83 | | -#add_example(pallas_curve_mul_add_example |
84 | | -# SOURCES pallas_curve_examples/pallas_curve_mul_add.cpp |
85 | | -# INPUT pallas_curve_examples/pallas_curve_mul_add.inp) |
86 | | -add_example(ed25519_curve_add SOURCES ed25519_curve_add.cpp INPUT ed25519_curve_add.inp) |
87 | | -add_example(strlen_example SOURCES strlen.cpp INPUT strlen.inp) |
| 3 | +add_subdirectory(cpp) |
0 commit comments