Add support for nimble package (#232)
This commit is contained in:
parent
015e043475
commit
9a93c75e23
|
@ -14,7 +14,8 @@ nimble install stew
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
Currently tests only support Nim compiler version 1.4, and 1.6 because of yaml library limitations.
|
Currently reference tests only support Nim compiler version 1.4, and 1.6 because of yaml library limitations.
|
||||||
|
But other tests that are not using yaml can be run by Nim 1.2 - devel.
|
||||||
|
|
||||||
Dependencies:
|
Dependencies:
|
||||||
|
|
||||||
|
@ -29,13 +30,18 @@ Run the tests from folder `bindings\nim`:
|
||||||
nim test
|
nim test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or from c-kzg-4844 root folder:
|
||||||
|
|
||||||
|
```
|
||||||
|
nimble test
|
||||||
|
```
|
||||||
|
|
||||||
## How to use this bindings in your project
|
## How to use this bindings in your project
|
||||||
|
|
||||||
Because the structure of folders is not a normal Nim library, we suggest you to
|
Install via nimble:
|
||||||
clone this repository in your project sub folder or submodule it.
|
|
||||||
|
|
||||||
Then you can import one of the binding file into your project.
|
```
|
||||||
|
nimble install https://github.com/ethereum/c-kzg-4844
|
||||||
|
```
|
||||||
|
|
||||||
## Library
|
Then import one of `kzg4844/kzg`, `kzg4844/kzg_abi`, or `kzg4844/kzg_ex` into your project.
|
||||||
|
|
||||||
The library which uses this binding is [nim-kzg4844](https://github.com/status-im/nim-kzg4844).
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import strutils
|
||||||
|
from os import DirSep
|
||||||
|
|
||||||
|
const
|
||||||
|
testPath = currentSourcePath.rsplit(DirSep, 1)[0] & "/tests"
|
||||||
|
|
||||||
# Helper functions
|
# Helper functions
|
||||||
proc test(args, path: string) =
|
proc test(args, path: string) =
|
||||||
if not dirExists "build":
|
if not dirExists "build":
|
||||||
|
@ -5,10 +11,13 @@ proc test(args, path: string) =
|
||||||
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args &
|
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args &
|
||||||
" --outdir:build -r -f --hints:off --warnings:off --skipParentCfg " & path
|
" --outdir:build -r -f --hints:off --warnings:off --skipParentCfg " & path
|
||||||
|
|
||||||
task test, "Run all tests":
|
proc runAllTest*() =
|
||||||
echo ">>>>>>>>>>>>>>>> Run tests in DEBUG mode <<<<<<<<<<<<<<<<"
|
echo ">>>>>>>>>>>>>>>> Run tests in DEBUG mode <<<<<<<<<<<<<<<<"
|
||||||
test "-d:debug", "tests/test_all"
|
test "-d:debug", testPath & "/test_all"
|
||||||
echo ">>>>>>>>>>>>>>>> Run tests in RELEASE mode <<<<<<<<<<<<<<<<"
|
echo ">>>>>>>>>>>>>>>> Run tests in RELEASE mode <<<<<<<<<<<<<<<<"
|
||||||
test "-d:release", "tests/test_all"
|
test "-d:release", testPath & "/test_all"
|
||||||
echo ">>>>>>>>>>>>>>>> Run tests in RELEASE and THREADS ON mode <<<<<<<<<<<<<<<<"
|
echo ">>>>>>>>>>>>>>>> Run tests in RELEASE and THREADS ON mode <<<<<<<<<<<<<<<<"
|
||||||
test "--threads:on -d:release", "tests/test_all"
|
test "--threads:on -d:release", testPath & "/test_all"
|
||||||
|
|
||||||
|
task test, "Run all tests":
|
||||||
|
runAllTest()
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Nim bindings
|
||||||
|
|
||||||
|
This directory contains nimble stuff. Sigh, nimble is rather picky about folder structure and file naming.
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import
|
||||||
|
kzg4844/kzg,
|
||||||
|
kzg4844/kzg_ex
|
||||||
|
|
||||||
|
export
|
||||||
|
kzg,
|
||||||
|
kzg_ex
|
|
@ -0,0 +1,5 @@
|
||||||
|
import
|
||||||
|
../bindings/nim/kzg
|
||||||
|
|
||||||
|
export
|
||||||
|
kzg
|
|
@ -0,0 +1,5 @@
|
||||||
|
import
|
||||||
|
../bindings/nim/kzg_abi
|
||||||
|
|
||||||
|
export
|
||||||
|
kzg_abi
|
|
@ -0,0 +1,5 @@
|
||||||
|
import
|
||||||
|
../bindings/nim/kzg_ex
|
||||||
|
|
||||||
|
export
|
||||||
|
kzg_ex
|
|
@ -0,0 +1,45 @@
|
||||||
|
mode = ScriptMode.Verbose
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Package definition
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
packageName = "kzg4844"
|
||||||
|
version = "0.1.0"
|
||||||
|
author = "Andri Lim"
|
||||||
|
description = "Nim wrapper of c-kzg-4844"
|
||||||
|
license = "Apache License 2.0"
|
||||||
|
skipDirs = @[
|
||||||
|
"tests", "lib", "inc", "fuzz",
|
||||||
|
"bindings/csharp",
|
||||||
|
"bindings/go",
|
||||||
|
"bindings/java",
|
||||||
|
"bindings/node.js",
|
||||||
|
"bindings/python",
|
||||||
|
"bindings/rust"
|
||||||
|
]
|
||||||
|
installDirs = @[
|
||||||
|
"blst",
|
||||||
|
"src",
|
||||||
|
"bindings/nim"
|
||||||
|
]
|
||||||
|
|
||||||
|
requires "nim >= 1.2.0",
|
||||||
|
"stew"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Test code
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
import "bindings/nim/config.nims"
|
||||||
|
|
||||||
|
task test, "Run all tests":
|
||||||
|
runAllTest()
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Package installation code
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
after install:
|
||||||
|
mvDir("bindings/nim/nimble", ".")
|
||||||
|
rmDir("bindings/nim/tests")
|
Loading…
Reference in New Issue