Fixed cmake build.

This commit is contained in:
Jianping Wu 2019-03-09 00:24:32 -08:00
parent f26802a26c
commit 55a7110af2
13 changed files with 39 additions and 58 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ Makefile
*.a
*.so
*.dylib
keva-stratum
# Configs
config.json

17
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "exec",
"program": "${workspaceFolder}/build/bin/keva-stratum",
"env": {},
"args": []
}
]
}

View File

@ -1,11 +1,6 @@
cmake_minimum_required (VERSION 2.8.11)
project(pool)
project(keva-stratum)
add_subdirectory(cnutil)
add_custom_command(
OUTPUT build/bin
COMMAND build/env.sh go get -v ./...
)
add_custom_target(build ALL DEPENDS cnutil ${CMAKE_CURRENT_BINARY_DIR}/build/bin)

View File

@ -1,32 +0,0 @@
#!/bin/sh
set -e
if [ ! -f "build/env.sh" ]; then
echo "$0 must be run from the root of the repository."
exit 2
fi
# Create fake Go workspace if it doesn't exist yet.
workspace="$PWD/build/_workspace"
root="$PWD"
ethdir="$workspace/src/github.com/kevacoin-project"
if [ ! -L "$ethdir/keva-stratum" ]; then
mkdir -p "$ethdir"
cd "$ethdir"
ln -s ../../../../../. keva-stratum
cd "$root"
fi
# Set up the environment to use the workspace.
# Also add Godeps workspace so we build using canned dependencies.
GOPATH="$workspace"
GOBIN="$PWD/build/bin"
export GOPATH GOBIN
# Run the command inside the workspace.
cd "$ethdir/keva-stratum"
PWD="$ethdir/keva-stratum"
# Launch the arguments with the configured environment.
exec "$@"

View File

@ -1,7 +1,7 @@
package cnutil
// #cgo CFLAGS: -std=c11 -D_GNU_SOURCE
// #cgo LDFLAGS: -L${SRCDIR} -lcnutil -Wl,-rpath ${SRCDIR} -lstdc++
// #cgo LDFLAGS: -L${SRCDIR} -Wl,-rpath=\$ORIGIN/cnutil -lcnutil -Wl,-rpath ${SRCDIR} -lstdc++
// #include <stdlib.h>
// #include "src/cnutil.h"
import "C"

View File

@ -10,8 +10,8 @@ import (
"runtime"
"time"
"github.com/kevacoin-project/keva-stratum/pool"
"github.com/kevacoin-project/keva-stratum/stratum"
"./pool"
"./stratum"
"github.com/goji/httpauth"
"github.com/gorilla/mux"

View File

@ -11,7 +11,7 @@ import (
"sync/atomic"
"time"
"github.com/kevacoin-project/keva-stratum/pool"
"../pool"
)
type RPCClient struct {

View File

@ -6,8 +6,8 @@ import (
"sync/atomic"
"time"
"github.com/kevacoin-project/keva-stratum/rpc"
"github.com/kevacoin-project/keva-stratum/util"
"../rpc"
"../util"
)
func (s *StratumServer) StatsIndex(w http.ResponseWriter, r *http.Request) {

View File

@ -7,7 +7,7 @@ import (
"log"
"math/big"
"github.com/kevacoin-project/keva-stratum/cnutil"
"../cnutil"
)
type BlockTemplate struct {

View File

@ -6,7 +6,7 @@ import (
"strings"
"sync/atomic"
"github.com/kevacoin-project/keva-stratum/util"
"../util"
)
var noncePattern *regexp.Regexp

View File

@ -10,8 +10,8 @@ import (
"sync/atomic"
"time"
"github.com/kevacoin-project/keva-stratum/cnutil"
"github.com/kevacoin-project/keva-stratum/util"
"../cnutil"
"../util"
)
type Job struct {

View File

@ -13,9 +13,9 @@ import (
"sync/atomic"
"time"
"github.com/kevacoin-project/keva-stratum/pool"
"github.com/kevacoin-project/keva-stratum/rpc"
"github.com/kevacoin-project/keva-stratum/util"
"../pool"
"../rpc"
"../util"
)
type StratumServer struct {
@ -53,11 +53,11 @@ type Endpoint struct {
type Session struct {
lastBlockHeight int64
sync.Mutex
conn *net.TCPConn
enc *json.Encoder
ip string
endpoint *Endpoint
validJobs []*Job
conn *net.TCPConn
enc *json.Encoder
ip string
endpoint *Endpoint
validJobs []*Job
}
const (

View File

@ -6,7 +6,7 @@ import (
"time"
"unicode/utf8"
"github.com/kevacoin-project/keva-stratum/cnutil"
"../cnutil"
)
var Diff1 = StringToBig("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")