Skip to content

Commit

Permalink
CleunUp proof-producer Cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
akokoshn committed Sep 26, 2024
1 parent 1dca904 commit be89154
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 89 deletions.
8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,26 @@
enableDebug = false;
crypto3 = crypto3;
evm-assigner = evm-assigner;
transpiler = transpiler;
proof-producer = proof-producer;
transpiler = transpiler;
parallel-crypto3 = parallel-crypto3;
});
zkevm-framework-tests = (pkgs.callPackage ./zkevm-framework/zkevm-framework.nix {
runTests = true;
enableDebug = false;
crypto3 = crypto3;
evm-assigner = evm-assigner;
transpiler = transpiler;
proof-producer = proof-producer;
transpiler = transpiler;
parallel-crypto3 = parallel-crypto3;
});
zkevm-framework-debug-tests = (pkgs.callPackage ./zkevm-framework/zkevm-framework.nix {
enableDebug = true;
runTests = true;
crypto3 = crypto3;
evm-assigner = evm-assigner;
transpiler = transpiler;
proof-producer = proof-producer;
transpiler = transpiler;
parallel-crypto3 = parallel-crypto3;
});
zkevm-framework-clang-debug = (pkgs.callPackage ./zkevm-framework/zkevm-framework.nix {
Expand Down Expand Up @@ -233,7 +233,7 @@
enableDebug = false;
crypto3 = packages.crypto3;
evm-assigner = evm-assigner-gcc;
transpiler = packages.transpiler;
transpiler = transpiler-gcc;
proof-producer = proof-producer-gcc;
parallel-crypto3 = packages.parallel-crypto3;
});
Expand Down
2 changes: 1 addition & 1 deletion proof-producer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

find_package(crypto3 REQUIRED)
find_package(parallel-crypto3 REQUIRED)
find_package(crypto3_transpiler REQUIRED)
find_package(transpiler REQUIRED)

# TODO: move thread to actor-core
find_package(Boost REQUIRED COMPONENTS filesystem log program_options thread)
Expand Down
51 changes: 19 additions & 32 deletions proof-producer/bin/proof-producer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,54 +46,41 @@ function(setup_proof_generator_target)
# actor-zk must come first.
if(ARG_ADDITIONAL_DEPENDENCIES)
foreach(lib IN LISTS ARG_ADDITIONAL_DEPENDENCIES)
target_link_libraries(${ARG_TARGET_NAME} ${lib})
target_link_libraries(${ARG_TARGET_NAME}-lib INTERFACE ${lib})
endforeach()
endif()

set_target_properties(${ARG_TARGET_NAME} PROPERTIES
LINKER_LANGUAGE CXX
EXPORT_NAME ${ARG_TARGET_NAME}
CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${ARG_TARGET_NAME} PRIVATE "-fconstexpr-steps=2147483647")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${ARG_TARGET_NAME} PRIVATE "-fconstexpr-ops-limit=4294967295")
endif ()

target_include_directories(${ARG_TARGET_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

target_include_directories(${ARG_TARGET_NAME}-lib INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_link_libraries(${ARG_TARGET_NAME}
target_link_libraries(${ARG_TARGET_NAME}-lib INTERFACE
crypto3::all

crypto3_transpiler

crypto3::transpiler
Boost::filesystem
Boost::log
Boost::program_options
Boost::thread
)

target_link_libraries(${ARG_TARGET_NAME}-lib INTERFACE
crypto3::all
target_include_directories(${ARG_TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)

crypto3::transpiler
target_link_libraries(${ARG_TARGET_NAME} PRIVATE ${ARG_TARGET_NAME}-lib Boost::program_options)

set_target_properties(${ARG_TARGET_NAME} PROPERTIES
LINKER_LANGUAGE CXX
EXPORT_NAME ${ARG_TARGET_NAME}
CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${ARG_TARGET_NAME} PRIVATE "-fconstexpr-steps=2147483647")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${ARG_TARGET_NAME} PRIVATE "-fconstexpr-ops-limit=4294967295")
endif ()

Boost::filesystem
Boost::log
Boost::program_options
Boost::thread
)
endfunction()

# Declare single-threaded target
Expand Down
4 changes: 2 additions & 2 deletions proof-producer/bin/proof-producer/src/arg_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// limitations under the License.
//---------------------------------------------------------------------------//

#include "nil/proof-generator/arg_parser.hpp"
#include <arg_parser.hpp>

#include "nil/proof-generator/arithmetization_params.hpp"
#include <nil/proof-generator/arithmetization_params.hpp>

#include <fstream>
#include <iomanip>
Expand Down
2 changes: 1 addition & 1 deletion proof-producer/bin/proof-producer/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <optional>
#include <utility>

#include <nil/proof-generator/arg_parser.hpp>
#include <arg_parser.hpp>
#include <nil/proof-generator/file_operations.hpp>
#include <nil/proof-generator/prover.hpp>

Expand Down
3 changes: 2 additions & 1 deletion proof-producer/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

include(CMakeFindDependencyMacro)
find_dependency(crypto3 REQUIRED)
find_dependency(crypto3_transpiler)
find_dependency(transpiler REQUIRED)
find_dependency(parallel-crypto3 REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/proof-producerTargets.cmake")
24 changes: 0 additions & 24 deletions run.sh

This file was deleted.

19 changes: 11 additions & 8 deletions transpiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ endif()
cm_workspace(crypto3)
cm_project(transpiler WORKSPACE_NAME crypto3 LANGUAGES ASM C CXX)

cm_setup_version(VERSION 0.1.0 PREFIX crypto3_transpiler)
cm_setup_version(VERSION 0.1.0 PREFIX ${CURRENT_PROJECT_NAME})

find_package(crypto3 REQUIRED)

add_library(crypto3_transpiler INTERFACE)
add_library(${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
set_target_properties(${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})


target_include_directories(crypto3_transpiler INTERFACE
target_include_directories(${CURRENT_PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"

${Boost_INCLUDE_DIRS})

target_link_libraries(crypto3_transpiler INTERFACE
target_link_libraries(${CURRENT_PROJECT_NAME} INTERFACE
crypto3::all
${Boost_LIBRARIES})

Expand All @@ -44,17 +44,20 @@ cm_add_test_subdirectory(test)

include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/crypto3_transpiler)
set(CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${CURRENT_PROJECT_NAME})

configure_package_config_file(
cmake/Config.cmake.in
crypto3_transpilerConfig.cmake
${CURRENT_PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CONFIG_DIR}
)

install(TARGETS ${CURRENT_PROJECT_NAME} EXPORT ${CURRENT_PROJECT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT ${CURRENT_PROJECT_NAME}Targets NAMESPACE ${CMAKE_WORKSPACE_NAME}:: DESTINATION ${CONFIG_DIR})

# Install generated cmake config
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/crypto3_transpilerConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_PROJECT_NAME}-config.cmake
DESTINATION ${CONFIG_DIR}
)

Expand Down
12 changes: 1 addition & 11 deletions transpiler/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,4 @@ include(CMakeFindDependencyMacro)
find_dependency(Boost COMPONENTS REQUIRED
container json filesystem log log_setup program_options thread system unit_test_framework)

# Protect against multiple inclusion
if (TARGET crypto3_transpiler)
return()
endif()


add_library(crypto3_transpiler INTERFACE IMPORTED)

set_target_properties(crypto3_transpiler PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_FULL_INCLUDEDIR@"
INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES})
include("${CMAKE_CURRENT_LIST_DIR}/transpilerTargets.cmake")
2 changes: 1 addition & 1 deletion transpiler/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

include(CMTest)

cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
cm_test_link_libraries(${CURRENT_PROJECT_NAME}
crypto3::all
${Boost_LIBRARIES})

Expand Down
2 changes: 0 additions & 2 deletions zkevm-framework/bin/assigner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ target_include_directories(${TARGET_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/include
)

find_package(actor_zk REQUIRED)

find_package(proof-producer REQUIRED)

target_link_libraries(${TARGET_NAME}
Expand Down
4 changes: 2 additions & 2 deletions zkevm-framework/zkevm-framework.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
valijson,
gtest,
evm-assigner,
proof-producer,
transpiler,
parallel-crypto3,
proof-producer,
enableDebugging,
enableDebug ? false,
runTests ? false,
Expand All @@ -31,7 +31,7 @@ in stdenv.mkDerivation rec {
# enableDebugging will keep debug symbols in boost
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost) else boost) ];

buildInputs = [crypto3 evm-assigner proof-producer transpiler parallel-crypto3 intx ethash sszpp valijson gtest];
buildInputs = [crypto3 evm-assigner proof-producer parallel-crypto3 transpiler intx ethash sszpp valijson gtest];

cmakeFlags =
[
Expand Down

0 comments on commit be89154

Please sign in to comment.