Add ci scripts (#1)
* Add ci scripts * Move config files to ci/kokoro/docker * Remove dump-logs etc * Simplified grpc installation * Add Ubuntu 16.04 kokoro config * Address code review
This commit is contained in:
parent
620940a411
commit
aefb8c98b0
26 changed files with 834 additions and 49 deletions
|
|
@ -54,7 +54,11 @@ endfunction ()
|
|||
# `foo/bar/baz.proto` then the directory containing `foo` must be in the search
|
||||
# path.
|
||||
function (google_cloud_cpp_generate_proto SRCS)
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Error: google_cloud_cpp_generate_proto() called"
|
||||
" without any proto files")
|
||||
|
|
@ -100,14 +104,19 @@ function (google_cloud_cpp_generate_proto SRCS)
|
|||
OUTPUT "${pb_cc}" "${pb_h}"
|
||||
COMMAND $<TARGET_FILE:protobuf::protoc>
|
||||
ARGS
|
||||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${protobuf_include_path} "${filename}"
|
||||
--cpp_out
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${protobuf_include_path}
|
||||
"${filename}"
|
||||
DEPENDS "${filename}" protobuf::protoc
|
||||
COMMENT "Running C++ protocol buffer compiler on ${filename}"
|
||||
VERBATIM)
|
||||
endforeach ()
|
||||
|
||||
set_source_files_properties(${${SRCS}} PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${${SRCS}}
|
||||
PROPERTIES
|
||||
GENERATED
|
||||
TRUE)
|
||||
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
|
@ -138,7 +147,11 @@ endfunction ()
|
|||
# `foo/bar/baz.proto` then the directory containing `foo` must be in the search
|
||||
# path.
|
||||
function (google_cloud_cpp_generate_grpcpp SRCS)
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(
|
||||
SEND_ERROR "Error: google_cloud_cpp_generate_grpc() called without"
|
||||
|
|
@ -188,15 +201,19 @@ function (google_cloud_cpp_generate_grpcpp SRCS)
|
|||
$<TARGET_FILE:protobuf::protoc>
|
||||
ARGS
|
||||
--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
||||
"--grpc_out=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${protobuf_include_path} "${filename}"
|
||||
"--grpc_out=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${protobuf_include_path}
|
||||
"${filename}"
|
||||
DEPENDS "${filename}" protobuf::protoc gRPC::grpc_cpp_plugin
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${filename}"
|
||||
VERBATIM)
|
||||
endforeach ()
|
||||
|
||||
set_source_files_properties(${${SRCS}} PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${${SRCS}}
|
||||
PROPERTIES
|
||||
GENERATED
|
||||
TRUE)
|
||||
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
|
@ -215,8 +232,8 @@ function (google_cloud_cpp_install_proto_library_headers target)
|
|||
relative
|
||||
"${header}")
|
||||
get_filename_component(dir "${relative}" DIRECTORY)
|
||||
install(FILES "${header}" DESTINATION
|
||||
"${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
|
||||
install(FILES "${header}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
|
||||
endforeach ()
|
||||
endfunction ()
|
||||
|
||||
|
|
@ -228,21 +245,25 @@ function (google_cloud_cpp_install_proto_library_protos target strip_prefix)
|
|||
if (NOT "${proto}" MATCHES "\\.proto$")
|
||||
continue()
|
||||
endif ()
|
||||
string(REPLACE "${strip_prefix}/"
|
||||
""
|
||||
relative
|
||||
"${proto}")
|
||||
string(REPLACE "${strip_prefix}/"
|
||||
""
|
||||
relative
|
||||
"${proto}")
|
||||
get_filename_component(dir "${relative}" DIRECTORY)
|
||||
# This is modeled after the Protobuf library, it installs the basic
|
||||
# protos (think google/protobuf/any.proto) in the include directory for
|
||||
# C/C++ code. :shrug:
|
||||
install(FILES "${proto}" DESTINATION
|
||||
"${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
|
||||
install(FILES "${proto}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
|
||||
endforeach ()
|
||||
endfunction ()
|
||||
|
||||
function (google_cloud_cpp_proto_library libname)
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Error: google_cloud_cpp_proto_library() called"
|
||||
" without any proto files")
|
||||
|
|
@ -267,7 +288,11 @@ function (google_cloud_cpp_proto_library libname)
|
|||
endfunction ()
|
||||
|
||||
function (google_cloud_cpp_grpcpp_library libname)
|
||||
cmake_parse_arguments(_opt "" "" "PROTO_PATH_DIRECTORIES" ${ARGN})
|
||||
cmake_parse_arguments(_opt
|
||||
""
|
||||
""
|
||||
"PROTO_PATH_DIRECTORIES"
|
||||
${ARGN})
|
||||
if (NOT _opt_UNPARSED_ARGUMENTS)
|
||||
message(SEND_ERROR "Error: google_cloud_cpp_proto_library() called"
|
||||
" without any proto files")
|
||||
|
|
|
|||
|
|
@ -99,14 +99,14 @@ if (protobuf_FOUND)
|
|||
"ProtobufTargets_FOUND = ${ProtobufTargets_FOUND}"
|
||||
" ProtobufTargets_VERSION = ${ProtobufTargets_VERSION}")
|
||||
endif ()
|
||||
else()
|
||||
else ()
|
||||
find_package(Protobuf QUIET)
|
||||
if (Protobuf_FOUND)
|
||||
set(ProtobufTargets_FOUND 1)
|
||||
set(ProtobufTargets_VERSION ${Protobuf_VERSION})
|
||||
|
||||
if (NOT TARGET protobuf::libprotobuf)
|
||||
add_library(protobuf::libprotobuf INTERFACE IMPORTED)
|
||||
add_library(protobuf::libprotobuf IMPORTED INTERFACE)
|
||||
set_property(TARGET protobuf::libprotobuf
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${Protobuf_INCLUDE_DIR})
|
||||
|
|
@ -117,7 +117,7 @@ else()
|
|||
endif ()
|
||||
|
||||
if (NOT TARGET protobuf::libprotobuf-lite)
|
||||
add_library(protobuf::libprotobuf-lite INTERFACE IMPORTED)
|
||||
add_library(protobuf::libprotobuf-lite IMPORTED INTERFACE)
|
||||
set_property(TARGET protobuf::libprotobuf-lite
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${Protobuf_INCLUDE_DIR})
|
||||
|
|
@ -128,7 +128,7 @@ else()
|
|||
endif ()
|
||||
|
||||
if (NOT TARGET protobuf::libprotoc)
|
||||
add_library(protobuf::libprotoc INTERFACE IMPORTED)
|
||||
add_library(protobuf::libprotoc IMPORTED INTERFACE)
|
||||
set_property(TARGET protobuf::libprotoc
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${Protobuf_INCLUDE_DIR})
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ function (_grpc_fix_grpc_cpp_plugin_target)
|
|||
set_property(TARGET gRPC::grpc_cpp_plugin
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
${_gRPC_CPP_PLUGIN_EXECUTABLE})
|
||||
else()
|
||||
else ()
|
||||
set(gRPC_FOUND "grpc_cpp_plugin-NOTFOUND")
|
||||
endif ()
|
||||
endif ()
|
||||
|
|
@ -140,7 +140,7 @@ function (_gRPC_find_library name filename)
|
|||
if (${name}_LIBRARY)
|
||||
# Use result recorded by a previous call.
|
||||
return()
|
||||
else()
|
||||
else ()
|
||||
find_library(${name}_LIBRARY_RELEASE NAMES ${filename})
|
||||
mark_as_advanced(${name}_LIBRARY_RELEASE)
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ if (_gRPC_USE_STATIC_LIBS)
|
|||
set(_gRPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
else ()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif ()
|
||||
endif ()
|
||||
|
|
@ -195,7 +195,7 @@ endif ()
|
|||
|
||||
if (_gRPC_grpc_LIBRARY)
|
||||
if (NOT TARGET gRPC::grpc)
|
||||
add_library(gRPC::grpc UNKNOWN IMPORTED)
|
||||
add_library(gRPC::grpc IMPORTED UNKNOWN)
|
||||
set_target_properties(gRPC::grpc
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_gRPC_INCLUDE_DIR}")
|
||||
|
|
@ -229,7 +229,7 @@ endif ()
|
|||
|
||||
if (_gRPC_grpc++_LIBRARY)
|
||||
if (NOT TARGET gRPC::grpc++)
|
||||
add_library(gRPC::grpc++ UNKNOWN IMPORTED)
|
||||
add_library(gRPC::grpc++ IMPORTED UNKNOWN)
|
||||
set_target_properties(gRPC::grpc++
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${_gRPC++_INCLUDE_DIR}")
|
||||
|
|
@ -266,17 +266,17 @@ if (_gRPC_grpc++_LIBRARY)
|
|||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_11)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# CMake 3.5 is still alive and kicking in some older distros, use
|
||||
# the compiler-specific versions in these cases.
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
PROPERTY INTERFACE_COMPILE_OPTIONS "-std=c++11")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_property(TARGET gRPC::grpc++
|
||||
APPEND
|
||||
PROPERTY INTERFACE_COMPILE_OPTIONS "-std=c++11")
|
||||
else()
|
||||
else ()
|
||||
message(
|
||||
WARNING
|
||||
"gRPC::grpc++ requires C++11, but this module"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue