Skip to content

Commit

Permalink
Build assigner with nix
Browse files Browse the repository at this point in the history
  • Loading branch information
akokoshn committed Apr 18, 2024
1 parent 17b3d11 commit 1f0dd2f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/run-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ jobs:
with:
fetch-depth: 0

- name: Run build
run: nix build -L

- name: Run checks
run: nix flake -L check
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ nix develop
## Clone

```plain
git clone https://github.com/NilFoundation/zkEVM-framework.git
git clone https://<GITGUB TOKEN>@github.com/NilFoundation/zkEVM-framework.git
```

If you want Nix to use your local version of dependency instead of cloning it from GitHub,
Expand All @@ -79,15 +79,22 @@ Same option applies to `nix build` and etc.
## Build

```plain
cmake -B ${BUILD_DIR:-build} -DCMAKE_BUILD_TYPE=Release .
cmake --build ${BUILD_DIR:-build}
cmake --preset release
cmake --build --preset release
```

Or with Nix:

```bash
nix build
```
## Assigner

### Build && run

```bash
nix run .#assigner -- -b block -t assignments -e pallas
```

## Test

Expand Down
15 changes: 6 additions & 9 deletions bin/assigner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ set(TARGET_NAME assigner)
set(SOURCES
src/main.cpp)

add_executable(${TARGET_NAME} ${SOURCES})

target_compile_options(${TARGET_NAME} PRIVATE -std=c++23)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(ASSIGNER_INCLUDES ${CMAKE_INSTALL_PREFIX}/include ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(ASSIGNER_LIBS ${CMAKE_INSTALL_PREFIX}/lib)
add_executable(${TARGET_NAME} ${SOURCES})

target_include_directories(${TARGET_NAME}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../libs/data_types/include>
$<$<BOOL:${Boost_FOUND}>:${Boost_INCLUDE_DIRS}>
${ASSIGNER_INCLUDES})
${CMAKE_CURRENT_SOURCE_DIR}/include)

target_link_directories(${TARGET_NAME} PRIVATE ${ASSIGNER_LIBS})
target_link_libraries(${TARGET_NAME} PRIVATE evmone zkEVMDataTypes ${Boost_LIBRARIES})

install(TARGETS ${TARGET_NAME})
7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
ninja
boost
deps.sszpp
deps.evmc
evm_assigner
crypto3
blueprint
Expand Down Expand Up @@ -157,6 +158,12 @@
{
packages = forAllSystems ({ pkgs }: { default = makeReleaseBuild { inherit pkgs; }; });
checks = forAllSystems ({ pkgs }: { default = makeTests { inherit pkgs; }; });
apps = forAllSystems ({ pkgs }: {
assigner = {
type = "app";
program = "${self.packages.${pkgs.system}.default}/bin/assigner";
};
});
devShells = forAllSystems ({ pkgs }: { default = makeDevShell { inherit pkgs; }; });
};
}

0 comments on commit 1f0dd2f

Please sign in to comment.