Skip to content

Commit

Permalink
Introduce global CMakeLits.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
akokoshn committed Oct 15, 2024
1 parent f2f6baf commit 9ddbe57
Show file tree
Hide file tree
Showing 26 changed files with 161 additions and 286 deletions.
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.27)

project(placeholder)

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")
endif()
if (${ZKEVM_FRAMEWORK_ENABLE})
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/evm-assigner")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/zkevm-framework")
endif()
if ((${PROOF_PRODUCER_ENABLE}) OR (${ZKEVM_FRAMEWORK_ENABLE}))
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/proof-producer")
endif()
if (${DEBUG_TOOLS_ENABLE})
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/debug-tools")
endif()
4 changes: 2 additions & 2 deletions crypto3/crypto3.nix → crypto3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
in stdenv.mkDerivation {
name = "Crypto3";

src = lib.sourceByRegex ./. [ ".*" ];
src = lib.sourceByRegex ./. ["^crypto3(/.*)?$" "CMakeLists.txt"];
hardeningDisable = [ "fortify" ];

nativeBuildInputs = [ cmake ninja pkg-config ] ++
Expand All @@ -42,7 +42,7 @@ in stdenv.mkDerivation {
checkPhase = ''
# JUNIT file without explicit file name is generated after the name of the master test suite inside `CMAKE_CURRENT_SOURCE_DIR`
export BOOST_TEST_LOGGER=JUNIT:HRF
ctest --verbose --output-on-failure -R
cd crypto3 && ctest --verbose --output-on-failure -R && cd ..
mkdir -p ${placeholder "out"}/test-logs
find .. -type f -name '*_test.xml' -exec cp {} ${placeholder "out"}/test-logs \;
'';
Expand Down
46 changes: 45 additions & 1 deletion crypto3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,51 @@ endif()
find_package(Boost REQUIRED COMPONENTS container random filesystem log log_setup program_options thread system unit_test_framework timer)

add_subdirectories("${CMAKE_CURRENT_LIST_DIR}/libs/")
add_subdirectories("${CMAKE_CURRENT_LIST_DIR}/libs/marshalling")
add_subdirectories("${CMAKE_CURRENT_LIST_DIR}/libs/marshalling/")

add_library(${CMAKE_WORKSPACE_NAME}_all INTERFACE)
add_library(${CMAKE_WORKSPACE_NAME}::all ALIAS ${CMAKE_WORKSPACE_NAME}_all)
target_link_libraries(${CMAKE_WORKSPACE_NAME}_all INTERFACE
crypto3::algebra
crypto3::block
crypto3::blueprint
crypto3::transpiler
crypto3::codec
crypto3::containers
crypto3::hash
crypto3::marshalling-algebra
crypto3::marshalling-core
crypto3::marshalling-multiprecision
crypto3::marshalling-zk
crypto3::math
crypto3::multiprecision
crypto3::passhash
crypto3::pubkey
crypto3::random
crypto3::stream
crypto3::threshold
crypto3::zk)

add_library(${CMAKE_WORKSPACE_NAME}_common INTERFACE)
add_library(${CMAKE_WORKSPACE_NAME}::common ALIAS ${CMAKE_WORKSPACE_NAME}_common)
target_link_libraries(${CMAKE_WORKSPACE_NAME}_common INTERFACE
crypto3::algebra
crypto3::benchmark_tools
crypto3::block
crypto3::blueprint
crypto3::transpiler
crypto3::codec
crypto3::hash
crypto3::marshalling-algebra
crypto3::marshalling-core
crypto3::marshalling-multiprecision
crypto3::marshalling-zk
crypto3::multiprecision
crypto3::passhash
crypto3::pubkey
crypto3::random
crypto3::stream
crypto3::threshold)

if(BUILD_BENCH_TESTS)
add_subdirectory(benchmarks)
Expand Down
4 changes: 2 additions & 2 deletions debug-tools/debug-tools.nix → debug-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
ninja,
pango,
pangomm,
crypto3,
}:
let
inherit (lib) optional;
in stdenv.mkDerivation {
name = "debug-tools";

src = lib.sourceByRegex ./. [ ".*" ];
src = lib.sourceByRegex ./. ["^crypto3(/.*)?$" "^parallel-crypto3(/.*)?$" "CMakeLists.txt"];

nativeBuildInputs = [ cmake ninja pkg-config ] ++
(lib.optional (!stdenv.isDarwin) gdb) ++
Expand All @@ -36,6 +35,7 @@ in stdenv.mkDerivation {
cmakeFlags =
[
"-DCMAKE_BUILD_TYPE=Release"
"-DDEBUG_TOOLS_ENABLE=TRUE"
"-G Ninja"
];

Expand Down
2 changes: 0 additions & 2 deletions debug-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

find_package(crypto3 REQUIRED)

find_package(Boost REQUIRED COMPONENTS filesystem log program_options)

# Read version from VERSION file
Expand Down
1 change: 0 additions & 1 deletion debug-tools/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(crypto3 REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/debug-toolsTargets.cmake")
9 changes: 6 additions & 3 deletions evm-assigner/evm-assigner.nix → evm-assigner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
boost_lib ? boost183,
gdb,
lldb,
cmake_modules,
ethash,
intx,
sszpp,
valijson,
gtest,
crypto3,
enableDebugging,
enableDebug ? false,
runTests ? false,
Expand All @@ -21,7 +23,7 @@ let
in stdenv.mkDerivation rec {
name = "evm-assigner";

src = lib.sourceByRegex ./. [ ".*" ];
src = lib.sourceByRegex ./. ["^evm-assigner(/.*)?$" "^crypto3(/.*)?$" "^parallel-crypto3(/.*)?$" "CMakeLists.txt"];
hardeningDisable = [ "fortify" ];

nativeBuildInputs = [ cmake ninja pkg-config ] ++
Expand All @@ -31,13 +33,14 @@ in stdenv.mkDerivation rec {
# enableDebugging will keep debug symbols in boost
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost_lib) else boost_lib) ];

buildInputs = [crypto3 ethash intx gtest];
buildInputs = [sszpp valijson cmake_modules ethash intx gtest];

cmakeFlags =
[
(if runTests then "-DBUILD_TESTS=TRUE" else "")
(if runTests then "-DBUILD_ASSIGNER_TESTS=TRUE" else "")
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
"-DZKEVM_FRAMEWORK_ENABLE=TRUE"
"-G Ninja"
];

Expand Down
21 changes: 0 additions & 21 deletions evm-assigner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,3 @@ endif()
include(CTest)

add_subdirectory(lib)

# INSTALL

set(CONFIG_PATH ${CMAKE_INSTALL_LIBDIR}/cmake/evm-assigner)
set(TARGET_NAMESPACE evm-assigner::)
install(EXPORT assignerTargets NAMESPACE ${TARGET_NAMESPACE} DESTINATION ${CONFIG_PATH})

include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/Config.cmake.in
evm-assigner-config.cmake
INSTALL_DESTINATION ${CONFIG_PATH}
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/evm-assigner-config.cmake
DESTINATION ${CONFIG_PATH}
)

cable_add_archive_package()
4 changes: 1 addition & 3 deletions evm-assigner/lib/assigner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ add_library(${PROJECT_NAME} STATIC ${evmone_sources})

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)

find_package(parallel-crypto3 REQUIRED)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/evmc>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/evmone>)

target_link_libraries(${PROJECT_NAME}
PUBLIC intx::intx parallel-crypto3::all ethash::keccak)
PUBLIC intx::intx crypto3::common ethash::keccak)

set_target_properties(
${PROJECT_NAME}
Expand Down
Loading

0 comments on commit 9ddbe57

Please sign in to comment.