forked from aergoio/aergo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
71 lines (53 loc) · 2.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# @file CMakeLists.txt
# @copyright defined in aergo/LICENSE.txt
#
cmake_minimum_required(VERSION 3.0)
project(aergo NONE)
set(BIN_DIR ${CMAKE_CURRENT_LIST_DIR}/bin)
set(PROTO_DIR ${CMAKE_CURRENT_LIST_DIR}/aergo-protobuf/proto)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(GCFLAGS "-gcflags=\"-N" "-l\"")
set(GFLAG -tags Debug)
endif()
add_custom_target(build ALL DEPENDS aergocli aergosvr aergoluac brick)
add_custom_target(aergocli GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/cmd/aergocli/cmd.githash=`git describe --tags`\" ./cmd/aergocli/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS vendor libtool)
add_custom_target(aergosvr GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags` -X main.gitRevision=`git rev-parse --short HEAD` -X main.gitBranch=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`\" ./cmd/aergosvr/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS vendor libtool)
add_custom_target(polaris GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/cmd/polaris/cmd.githash=`git rev-parse HEAD`\" ./cmd/polaris/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS vendor)
add_custom_target(colaris GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/cmd/colaris/cmd.githash=`git rev-parse HEAD`\" ./cmd/colaris/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS vendor)
add_custom_target(aergoluac GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags`\" ./cmd/aergoluac/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS vendor libtool)
add_custom_target(brick GOBIN=${BIN_DIR} go install ${GCFLAGS} ${GFLAG} -ldflags \"-X 'github.com/aergoio/aergo/cmd/brick/context.GitHash=`git describe --tags`'
-X 'github.com/aergoio/aergo/vendor/github.com/aergoio/aergo-lib/log.defaultConfStr=`cat ./cmd/brick/arglog.toml`'\" ./cmd/brick/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS vendor libtool)
set(VENDOR ${CMAKE_CURRENT_LIST_DIR}/vendor)
add_custom_command(OUTPUT ${VENDOR}
COMMAND glide install
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS glide.yaml glide.lock)
add_custom_target(vendor DEPENDS ${VENDOR})
add_custom_target(deps DEPENDS vendor libtool)
add_custom_target(check go test -timeout 60s ./...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS build)
add_custom_target(cover-check go test -coverprofile c.out ./...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS build)
add_custom_target(distclean go clean ..
COMMAND rm -rf ${BIN_DIR}/aergo* ${BIN_DIR}/brick
DEPENDS libtool-clean)
add_custom_target(protoc
COMMAND protoc -I/usr/local/include -I${PROTO_DIR} --go_out=plugins=grpc:$ENV{GOPATH}/src ${PROTO_DIR}/*.proto
COMMAND go build ../types/...)
add_custom_target(protoclean rm -f ../types/*.pb.go)
add_subdirectory(libtool)