Skip to content

Commit

Permalink
use the same precompiled header for all proof-producer binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyMlashkin committed Dec 13, 2024
1 parent 980a896 commit 960806a
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 42 deletions.
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ set_target_properties(crypto3_precompiled_headers PROPERTIES
CXX_STANDARD_REQUIRED TRUE
)

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated-dummy-23.cpp)
add_library(crypto3_precompiled_headers_23 STATIC ${CMAKE_CURRENT_BINARY_DIR}/generated-dummy-23.cpp)
set_target_properties(crypto3_precompiled_headers_23 PROPERTIES
LINKER_LANGUAGE CXX
EXPORT_NAME proof_generatorOutputArtifacts
CXX_STANDARD 23
CXX_STANDARD_REQUIRED TRUE
)
# End of precompiled headers

add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/crypto3")
if ((${PARALLEL_CRYPTO3_ENABLE}) OR (${PROOF_PRODUCER_ENABLE}) OR (${ZKEVM_FRAMEWORK_ENABLE}))
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/parallel-crypto3")
Expand Down
4 changes: 3 additions & 1 deletion crypto3/libs/algebra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTER
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${CMAKE_WORKSPACE_NAME}::multiprecision)
${CMAKE_WORKSPACE_NAME}::multiprecision
Boost::random
)

include(CMTest)
add_tests(test)
Expand Down
4 changes: 1 addition & 3 deletions crypto3/libs/algebra/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
#---------------------------------------------------------------------------#

cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}

Boost::unit_test_framework
Boost::random)
Boost::unit_test_framework)

add_custom_target(algebra_runtime_tests)

Expand Down
3 changes: 1 addition & 2 deletions crypto3/libs/blueprint/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ macro(define_blueprint_example name)
${CMAKE_WORKSPACE_NAME}::hash
${CMAKE_WORKSPACE_NAME}::multiprecision
${CMAKE_WORKSPACE_NAME}::zk

${Boost_LIBRARIES})
)
set_target_properties(${full_example_name} PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED TRUE)
endmacro()

Expand Down
5 changes: 2 additions & 3 deletions crypto3/libs/hash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@ target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${${CURRENT_PROJECT_NAME}_INTERFACE_LIBRARIES}
${CMAKE_WORKSPACE_NAME}::multiprecision
${CMAKE_WORKSPACE_NAME}::algebra

Boost::container)
target_link_libraries(crypto3_precompiled_headers ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
target_link_libraries(crypto3_precompiled_headers_23 ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})

target_link_libraries(crypto3_precompiled_headers ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
Expand Down
1 change: 1 addition & 0 deletions crypto3/libs/marshalling/zk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTER

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
Boost::container
Boost::random

crypto3::multiprecision
crypto3::algebra
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/transpiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTER
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${Boost_LIBRARIES})
Boost::container)

include(CMTest)
add_tests(test)
Expand Down
3 changes: 2 additions & 1 deletion crypto3/libs/transpiler/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
crypto3::math
crypto3::random
crypto3::zk
${Boost_LIBRARIES})
Boost::unit_test_framework
)
set_target_properties(_cm_internal_tests-crypto3-transpiler-test PROPERTIES CXX_STANDARD 20)
target_precompile_headers(_cm_internal_tests-crypto3-transpiler-test REUSE_FROM crypto3_precompiled_headers)

Expand Down
3 changes: 2 additions & 1 deletion parallel-crypto3/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ cm_test_link_libraries(
crypto3::math
crypto3::multiprecision
crypto3::random
${Boost_LIBRARIES}
Boost::unit_test_framework
Boost::timer
)
set_target_properties(_cm_internal_tests--parallel-crypto3-benchmarks PROPERTIES CXX_STANDARD 20)
target_precompile_headers(_cm_internal_tests--parallel-crypto3-benchmarks REUSE_FROM crypto3_precompiled_headers)
Expand Down
4 changes: 1 addition & 3 deletions parallel-crypto3/libs/parallel-containers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${CMAKE_WORKSPACE_NAME}::core

crypto3::algebra
crypto3::hash

${Boost_LIBRARIES})
crypto3::hash)

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ macro(define_containers_example example)
add_executable(${target_name} ${example}.cpp)
target_link_libraries(${target_name} PRIVATE
${CMAKE_WORKSPACE_NAME}::algebra
${CMAKE_WORKSPACE_NAME}::hash
${Boost_LIBRARIES})
${CMAKE_WORKSPACE_NAME}::hash)

set_target_properties(${target_name} PROPERTIES CXX_STANDARD 20)
endmacro()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ include(CMTest)
cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
crypto3::algebra
crypto3::hash
Boost::random)
Boost::random
Boost::unit_test_framework
)
set_target_properties(_cm_internal_tests-actor-containers-test PROPERTIES CXX_STANDARD 20)
target_precompile_headers(_cm_internal_tests-actor-containers-test REUSE_FROM crypto3_precompiled_headers)

Expand Down
2 changes: 1 addition & 1 deletion parallel-crypto3/libs/parallelization-utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTER
$<$<BOOL:${Boost_FOUND}>:${Boost_INCLUDE_DIRS}>)

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${Boost_LIBRARIES})
Boost::container)

add_tests(test)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ if(NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
endif()

cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
${Boost_LIBRARIES})
Boost::container
Boost::unit_test_framework
)

macro(define_actor_core_test name)
set(test_name "actor_core_${name}_test")
Expand Down
2 changes: 1 addition & 1 deletion proof-producer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ endif()

set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})

add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libs/output_artifacts")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libs/preset")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libs/assigner")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/bin/proof-producer")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libs/output_artifacts")

if (ENABLE_TESTS)
enable_testing()
Expand Down
3 changes: 2 additions & 1 deletion proof-producer/bin/proof-producer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ endfunction()

set(SINGLE_THREADED_TARGET "${CURRENT_PROJECT_NAME}-single-threaded")
setup_proof_generator_target(TARGET_NAME ${SINGLE_THREADED_TARGET} ADDITIONAL_DEPENDENCIES crypto3::all)
target_precompile_headers(${SINGLE_THREADED_TARGET} REUSE_FROM proof_generatorOutputArtifacts)

set(MULTI_THREADED_TARGET "${CURRENT_PROJECT_NAME}-multi-threaded")
setup_proof_generator_target(TARGET_NAME ${MULTI_THREADED_TARGET} ADDITIONAL_DEPENDENCIES parallel-crypto3::all crypto3::common)
target_precompile_headers(${MULTI_THREADED_TARGET} REUSE_FROM ${SINGLE_THREADED_TARGET})
target_precompile_headers(${MULTI_THREADED_TARGET} REUSE_FROM proof_generatorOutputArtifacts)

# Install
install(TARGETS ${SINGLE_THREADED_TARGET} RUNTIME DESTINATION bin)
Expand Down
5 changes: 1 addition & 4 deletions proof-producer/libs/output_artifacts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()
target_link_libraries(proof_generatorOutputArtifacts
PUBLIC
crypto3::common
Boost::log
Boost::program_options
)

set_target_properties(proof_generatorOutputArtifacts PROPERTIES
Expand All @@ -25,9 +25,6 @@ set_target_properties(proof_generatorOutputArtifacts PROPERTIES
CXX_STANDARD_REQUIRED TRUE
)

# TODO: reactivate, when it will be a static library
# target_precompile_headers(proof_generatorOutputArtifacts REUSE_FROM crypto3_precompiled_headers_23)

install(TARGETS proof_generatorOutputArtifacts
DESTINATION ${CMAKE_INSTALL_LIBDIR})

Expand Down
6 changes: 2 additions & 4 deletions proof-producer/tests/libs/output_artifacts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ function(add_output_artifacts_test target)
crypto3::common
)

if (NOT target STREQUAL "test_range")
target_precompile_headers(${target}_single_thread REUSE_FROM test_range_single_thread)
endif()
target_precompile_headers(${target}_multi_thread REUSE_FROM test_range_single_thread)
target_precompile_headers(${target}_single_thread REUSE_FROM proof_generatorOutputArtifacts)
target_precompile_headers(${target}_multi_thread REUSE_FROM proof_generatorOutputArtifacts)

add_dependencies(tests_output_artifacts_single_thread ${target}_single_thread)
add_dependencies(tests_output_artifacts_multi_thread ${target}_multi_thread)
Expand Down
2 changes: 1 addition & 1 deletion zkevm-framework/libs/json_helpers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ find_package(valijson REQUIRED)
find_package(Boost COMPONENTS REQUIRED json)

add_library(zkEVMJsonHelpers SHARED json_helpers.cpp)
target_link_libraries(zkEVMJsonHelpers PUBLIC ${Boost_LIBRARIES} PRIVATE valijson)
target_link_libraries(zkEVMJsonHelpers PUBLIC Boost::container PRIVATE valijson)
target_include_directories(zkEVMJsonHelpers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_features(zkEVMJsonHelpers PUBLIC cxx_std_23)
# It seems like exceptions is the only way to catch errors in valijson
Expand Down
2 changes: 1 addition & 1 deletion zkevm-framework/libs/rpc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(zkEVMRpc SHARED data_extractor.cpp)

find_package(Boost COMPONENTS REQUIRED json log)
target_link_libraries(zkEVMRpc PUBLIC NilCore ${Boost_LIBRARIES} zkEVMJsonHelpers)
target_link_libraries(zkEVMRpc PUBLIC NilCore Boost::container zkEVMJsonHelpers)
target_include_directories(zkEVMRpc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include)

Expand Down

0 comments on commit 960806a

Please sign in to comment.