Browse Source

Fixed cmake build.

pool
Jianping Wu 6 years ago
parent
commit
55a7110af2
  1. 1
      .gitignore
  2. 17
      .vscode/launch.json
  3. 9
      CMakeLists.txt
  4. 32
      build/env.sh
  5. 2
      cnutil/cnutil.go
  6. 4
      main.go
  7. 2
      rpc/rpc.go
  8. 4
      stratum/api.go
  9. 2
      stratum/blocks.go
  10. 2
      stratum/handlers.go
  11. 4
      stratum/miner.go
  12. 16
      stratum/stratum.go
  13. 2
      util/util.go

1
.gitignore vendored

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

17
.vscode/launch.json vendored

@ -0,0 +1,17 @@ @@ -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": []
}
]
}

9
CMakeLists.txt

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

32
build/env.sh

@ -1,32 +0,0 @@ @@ -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 "$@"

2
cnutil/cnutil.go

@ -1,7 +1,7 @@ @@ -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"

4
main.go

@ -10,8 +10,8 @@ import ( @@ -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"

2
rpc/rpc.go

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

4
stratum/api.go

@ -6,8 +6,8 @@ import ( @@ -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) {

2
stratum/blocks.go

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

2
stratum/handlers.go

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

4
stratum/miner.go

@ -10,8 +10,8 @@ import ( @@ -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 {

16
stratum/stratum.go

@ -13,9 +13,9 @@ import ( @@ -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 { @@ -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 (

2
util/util.go

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

Loading…
Cancel
Save