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. 6
      stratum/stratum.go
  13. 2
      util/util.go

1
.gitignore vendored

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

17
.vscode/launch.json vendored

@ -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 @@
cmake_minimum_required (VERSION 2.8.11) cmake_minimum_required (VERSION 2.8.11)
project(pool)
add_subdirectory(cnutil) project(keva-stratum)
add_custom_command( add_subdirectory(cnutil)
OUTPUT build/bin
COMMAND build/env.sh go get -v ./...
)
add_custom_target(build ALL DEPENDS cnutil ${CMAKE_CURRENT_BINARY_DIR}/build/bin)

32
build/env.sh

@ -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 @@
package cnutil package cnutil
// #cgo CFLAGS: -std=c11 -D_GNU_SOURCE // #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 <stdlib.h>
// #include "src/cnutil.h" // #include "src/cnutil.h"
import "C" import "C"

4
main.go

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

2
rpc/rpc.go

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

4
stratum/api.go

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

2
stratum/blocks.go

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

2
stratum/handlers.go

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

4
stratum/miner.go

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

6
stratum/stratum.go

@ -13,9 +13,9 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/kevacoin-project/keva-stratum/pool" "../pool"
"github.com/kevacoin-project/keva-stratum/rpc" "../rpc"
"github.com/kevacoin-project/keva-stratum/util" "../util"
) )
type StratumServer struct { type StratumServer struct {

2
util/util.go

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

Loading…
Cancel
Save