-
Notifications
You must be signed in to change notification settings - Fork 46
/
CMakeLists.txt
66 lines (47 loc) · 3.02 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
#
# @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 GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/v2/cmd/aergocli/cmd.githash=`git describe --tags`\" ./cmd/aergocli/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS libtool)
add_custom_target(aergosvr GO111MODULE=on 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 libtool)
add_custom_target(polaris GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags`\" ./cmd/polaris/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
add_custom_target(colaris GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/v2/cmd/colaris/cmd.githash=`git describe --tags`\" ./cmd/colaris/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
add_custom_target(aergoluac GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags`\" ./cmd/aergoluac/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS libtool)
add_custom_target(brick GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} ${GFLAG} -ldflags \"-X 'github.com/aergoio/aergo/v2/cmd/brick/context.GitHash=`git describe --tags`'
-X 'github.com/aergoio/aergo-lib/log.defaultConfStr=`cat ./cmd/brick/arglog.toml`'\" ./cmd/brick/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS libtool)
add_custom_target(mpdumpdiag GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags`\" ./tools/mpdumpdiag/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
add_custom_target(deps DEPENDS libtool)
add_custom_target(check GO111MODULE=on go test -timeout 600s ./...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS build)
add_custom_target(cover-check GO111MODULE=on go test -timeout 600s -coverprofile c.out ./...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS build)
add_custom_target(distclean GO111MODULE=on 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=${CMAKE_CURRENT_LIST_DIR}/types --go_opt=paths=source_relative --go-grpc_out=${CMAKE_CURRENT_LIST_DIR}/types --go-grpc_opt=paths=source_relative ${PROTO_DIR}/*.proto
COMMAND GO111MODULE=on go build ../types/...)
add_custom_target(protoclean rm -f ../types/*.pb.go)
add_subdirectory(libtool)