Nimble support

This commit is contained in:
Ștefan Talpalaru 2020-02-02 04:16:27 +01:00
parent ad51a35021
commit 1eac158237
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
6 changed files with 31 additions and 6 deletions

View File

@ -4,3 +4,6 @@ nimcache/
# Executables shall be put in an ignored build/ directory # Executables shall be put in an ignored build/ directory
build/ build/
# copied by `nimble install`
/include

View File

@ -6,11 +6,11 @@
mode = ScriptMode.Verbose mode = ScriptMode.Verbose
packageName = "evmc" packageName = "evmc"
version = "0.0.2" version = "0.0.3"
author = "Status Research & Development GmbH" author = "Status Research & Development GmbH"
description = "A wrapper for the The Ethereum EVMC library" description = "A wrapper for the The Ethereum EVMC library"
license = "Apache License 2.0" license = "Apache License 2.0"
skipDirs = @["tests"] installDirs = @["evmc", "include"]
requires "nim >= 0.19", requires "nim >= 0.19",
"stew" "stew"
@ -35,3 +35,10 @@ task test_release, "Run all tests - prod implementation":
task test, "Run all tests - test and production implementation": task test, "Run all tests - test and production implementation":
exec "nimble test_debug" exec "nimble test_debug"
exec "nimble test_release" exec "nimble test_release"
proc copyUpstreamFiles() =
cpDir("../../include", "include")
before install:
copyUpstreamFiles()

View File

@ -1,3 +1,10 @@
import os
# when running from the Git repo
{.passC: "-I" & currentSourcePath.parentDir().parentDir().parentDir().parentDir() / "include".}
# when installed by Nimble
{.passC: "-I" & currentSourcePath.parentDir().parentDir() / "include".}
type type
evmc_bytes32* {.importc: "evmc_bytes32", header: "evmc/evmc.h", bycopy.} = object evmc_bytes32* {.importc: "evmc_bytes32", header: "evmc/evmc.h", bycopy.} = object
bytes* {.importc: "bytes".}: array[32, uint8] bytes* {.importc: "bytes".}: array[32, uint8]

View File

@ -0,0 +1,7 @@
import os
# when running from the Git repo
{.passC: "-I" & currentSourcePath.parentDir().parentDir().parentDir().parentDir() / "include".}
# when installed by Nimble
{.passC: "-I" & currentSourcePath.parentDir().parentDir() / "include".}

View File

@ -52,6 +52,8 @@ END {
for(i in consts) for(i in consts)
print consts[i] print consts[i]
} }
' > evmc.nim ' > evmc.nim.body
rm tmp.nim
cat evmc.nim.header evmc.nim.body > evmc.nim
rm tmp.nim evmc.nim.body

View File

@ -3,14 +3,13 @@
# This file may not be copied, modified, or distributed except according to # This file may not be copied, modified, or distributed except according to
# those terms. # those terms.
import os, unittest, import unittest,
stew/byteutils, stew/byteutils,
../evmc/evmc, ../evmc/evmc_nim, ./nim_host ../evmc/evmc, ../evmc/evmc_nim, ./nim_host
{.compile: "../../../examples/example_host.cpp".} {.compile: "../../../examples/example_host.cpp".}
{.compile: "../../../examples/example_vm/example_vm.c".} {.compile: "../../../examples/example_vm/example_vm.c".}
{.passC: "-I" & currentSourcePath.parentDir().parentDir().parentDir().parentDir() / "include".}
when defined(posix): when defined(posix):
{.passC: "-std=c++11".} {.passC: "-std=c++11".}