File tree 6 files changed +40
-36
lines changed
6 files changed +40
-36
lines changed Original file line number Diff line number Diff line change @@ -6,19 +6,10 @@ PROTOC_VER := $(shell protoc --version)
6
6
7
7
all : generate-proto
8
8
9
- check-protoc :
10
- ifeq (, $(shell which protoc) )
11
- $(error "No protoc in PATH, consider doing apt-get install protoc")
12
- else
13
- @echo "using $(shell which protoc)"
14
- endif
15
-
16
- check-protoc-version : check-protoc
17
- @ (env bash $( PWD) /scripts/check_protoc_version.sh)
18
-
19
9
build :
20
10
@ (env bash $( PWD) /scripts/core_build.sh)
21
11
22
- generate-proto : check-protoc-version build
23
- @which protoc-gen-go
1> /dev/null
|| (echo
" Installing protoc-gen-go" && go get github.com/golang/protobuf/
[email protected] )
12
+ generate-proto : export protoc:=${PWD}/cmake-build/protobuf/protobuf-build/protoc
13
+ generate-proto : build
14
+ @which protoc-gen-go
1> /dev/null
|| (echo
" Installing protoc-gen-go" && go install github.com/golang/protobuf/
[email protected] )
24
15
@ (env bash $( PWD) /scripts/proto_gen_go.sh)
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ include(FetchContent)
5
5
6
6
message ( STATUS "source dir ${PROJECT_SOURCE_DIR} " )
7
7
8
+ set ( THIRDPARTY_DOWNLOAD_PATH ${PROJECT_SOURCE_DIR} /3rdparty_download/download )
9
+
8
10
add_subdirectory ( protobuf )
9
11
10
12
add_custom_target ( Clean-All COMMAND ${CMAKE_BUILD_TOOL} clean )
Original file line number Diff line number Diff line change @@ -6,9 +6,20 @@ message( STATUS "Building protobuf-cpp-3.9.0 from source" )
6
6
FetchContent_Declare( protobuf
7
7
URL ${PROTOBUF_SOURCE_URL}
8
8
URL_MD5 "9562b27cc6ac5ebd087f201f1310c885"
9
- DOWNLOAD_DIR ${THIRDPARTY_DOWNLOAD_PATH}
9
+ DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} /../3rdparty_download
10
10
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR} /protobuf-src
11
11
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} /protobuf-build
12
12
)
13
13
14
- FetchContent_MakeAvailable(protobuf)
14
+ set ( protobuf_BUILD_TESTS CACHE BOOL OFF FORCE )
15
+ set ( protobuf_WITH_ZLIB CACHE BOOL OFF FORCE )
16
+ if ( NOT protobuf_POPULATED )
17
+ FetchContent_Populate( protobuf )
18
+
19
+ # Adding the following targets:
20
+ # protobuf::libprotobuf - static target
21
+ # protobuf::protoc - executable target
22
+ add_subdirectory ( ${protobuf_SOURCE_DIR} /cmake
23
+ ${protobuf_BINARY_DIR}
24
+ EXCLUDE_FROM_ALL )
25
+ endif ()
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,4 +7,21 @@ BUILD_OUTPUT_DIR="${SCRIPTS_DIR}/../cmake-build"
7
7
mkdir -p ${BUILD_OUTPUT_DIR}
8
8
pushd ${BUILD_OUTPUT_DIR}
9
9
cmake ${CMAKE_DIR}
10
+
11
+ if [[ ! ${jobs+1} ]]; then
12
+ if command -v nproc & > /dev/null
13
+ # For linux
14
+ then
15
+ jobs=$( nproc)
16
+ elif command -v sysctl & > /dev/null
17
+ # For macOS
18
+ then
19
+ jobs=$( sysctl -n hw.logicalcpu)
20
+ else
21
+ jobs=4
22
+ fi
23
+ fi
24
+
25
+ make -j ${jobs} protoc
26
+ make -j ${jobs} install/local
10
27
popd
Original file line number Diff line number Diff line change @@ -39,19 +39,21 @@ mkdir -p ../go-api/commonpb
39
39
mkdir -p ../go-api/schemapb
40
40
mkdir -p ../go-api/milvuspb
41
41
42
- protoc --proto_path=" ${GOOGLE_PROTO_DIR} " --proto_path=. \
42
+ $protoc --version
43
+
44
+ $protoc --proto_path=" ${GOOGLE_PROTO_DIR} " --proto_path=. \
43
45
--go_opt=" Mmilvus.proto=github.com/milvus-io/milvus-proto/go-api/milvuspb;milvuspb" \
44
46
--go_opt=Mcommon.proto=github.com/milvus-io/milvus-proto/go-api/commonpb \
45
47
--go_opt=Mschema.proto=github.com/milvus-io/milvus-proto/go-api/schemapb \
46
48
--go_out=plugins=grpc,paths=source_relative:./../go-api/milvuspb milvus.proto
47
49
48
- protoc --proto_path=" ${GOOGLE_PROTO_DIR} " --proto_path=. \
50
+ $ protoc --proto_path=" ${GOOGLE_PROTO_DIR} " --proto_path=. \
49
51
--go_opt=Mmilvus.proto=github.com/milvus-io/milvus-proto/go-api/milvuspb \
50
52
--go_opt=Mcommon.proto=github.com/milvus-io/milvus-proto/go-api/commonpb \
51
53
--go_opt=" Mschema.proto=github.com/milvus-io/milvus-proto/go-api/schemapb;schemapb" \
52
54
--go_out=plugins=grpc,paths=source_relative:./../go-api/schemapb schema.proto
53
55
54
- protoc --proto_path=" ${GOOGLE_PROTO_DIR} " --proto_path=. \
56
+ $ protoc --proto_path=" ${GOOGLE_PROTO_DIR} " --proto_path=. \
55
57
--go_opt=Mmilvus.proto=github.com/milvus-io/milvus-proto/go-api/milvuspb \
56
58
--go_opt=" Mcommon.proto=github.com/milvus-io/milvus-proto/go-api/commonpb;commonpb" \
57
59
--go_opt=Mschema.proto=github.com/milvus-io/milvus-proto/go-api/schemapb \
You can’t perform that action at this time.
0 commit comments