Skip to content

Commit e2dfceb

Browse files
jwinarskeJoel Winarske
authored andcommitted
move to v1.30.1
1 parent 4f58aea commit e2dfceb

13 files changed

+208
-379
lines changed

.travis.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,9 @@ compiler:
99
- clang
1010

1111
env:
12-
- BUILD_TYPE=Debug CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
13-
- BUILD_TYPE=Debug CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
14-
- BUILD_TYPE=Debug CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
15-
16-
- BUILD_TYPE=Release CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
17-
- BUILD_TYPE=Release CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
18-
- BUILD_TYPE=Release CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
19-
20-
- BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
21-
- BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
22-
- BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE"
12+
- BUILD_TYPE=Debug
13+
- BUILD_TYPE=Release
14+
- BUILD_TYPE=MinSizeRel
2315

2416
addons:
2517
apt:
@@ -30,26 +22,27 @@ install:
3022
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"; fi
3123
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir ${DEPS_DIR} && cd ${DEPS_DIR} && pwd; fi
3224

33-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry wget --no-check-certificate https://cmake.org/files/v3.11/cmake-3.11.0-Linux-x86_64.tar.gz; fi
34-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "96d67e21f0983ebf0fffc5b106ec338c *cmake-3.11.0-Linux-x86_64.tar.gz" > cmake_md5.txt; fi
25+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry wget --no-check-certificate https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-x86_64.tar.gz; fi
26+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "06bb006122e8e094f942bc9b2d999c92 *cmake-3.17.3-Linux-x86_64.tar.gz" > cmake_md5.txt; fi
3527
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then md5sum -c cmake_md5.txt; fi
36-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xvf cmake-3.11.0-Linux-x86_64.tar.gz > /dev/null; fi
37-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv cmake-3.11.0-Linux-x86_64 cmake-install; fi
28+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xvf cmake-3.17.3-Linux-x86_64.tar.gz > /dev/null; fi
29+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv cmake-3.17.3-Linux-x86_64 cmake-install; fi
3830
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH; fi
3931

40-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry wget --no-check-certificate https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz; fi
41-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "a6103c8157246dd1ac70528878994f31 *go1.11.1.linux-amd64.tar.gz" > go_md5.txt; fi
32+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry wget --no-check-certificate https://golang.org/dl/go1.14.4.linux-amd64.tar.gz; fi
33+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "0ea61d0d7e05bbe454b8b19569ad86c8 *go1.14.4.linux-amd64.tar.gz" > go_md5.txt; fi
4234
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then md5sum -c go_md5.txt; fi
43-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf go1.11.1.linux-amd64.tar.gz > /dev/null; fi
35+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf go1.14.4.linux-amd64.tar.gz > /dev/null; fi
4436
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export GOROOT=${DEPS_DIR}/go; fi
4537
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then PATH=${DEPS_DIR}/go/bin:$PATH; fi
46-
4738

4839
before_script:
4940
- cd ${TRAVIS_BUILD_DIR}
5041
- mkdir build && cd build
51-
- cmake -DCMAKE_VERBOSE_MAKEFILE=FALSE -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
52-
-DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/build/dist ${CMAKE_ARGS}
53-
..
42+
- cmake ..
43+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}
44+
-DCMAKE_VERBOSE_MAKEFILE=TRUE
45+
-DCMAKE_STAGING_PREFIX=${TRAVIS_BUILD_DIR}/dist/usr/local
46+
5447
script:
5548
- cmake --build . --config ${BUILD_TYPE} --target install

CMakeLists.txt

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.10.2)
22

33
if(NOT CMAKE_BUILD_TYPE)
44
set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE)
@@ -10,7 +10,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake")
1010
if(NOT BUILD_NUMBER)
1111
set(BUILD_NUMBER 0)
1212
endif()
13-
set(ASSISTANT_SDK_CPP_VERSION 0.1.${BUILD_NUMBER})
13+
set(ASSISTANT_SDK_CPP_VERSION 0.0.1.${BUILD_NUMBER})
1414

1515
set(PACKAGE_NAME assistant-sdk-cpp)
1616
project(${PACKAGE_NAME} VERSION "${ASSISTANT_SDK_CPP_VERSION}" LANGUAGES CXX C)
@@ -25,45 +25,42 @@ include(build_dependencies)
2525

2626
set(CMAKE_CXX_STANDARD_REQUIRED 11)
2727
set(CMAKE_CXX_STANDARD 11)
28+
set(CMAKE_CXX_EXTENSIONS OFF)
2829

2930
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
3031
include(FindThreads)
3132

33+
include(googleapis)
3234

33-
set(GOOGLEAPIS_API_CCS
34-
${GOOGLEAPIS_GENS_PATH}/google/api/http.grpc.pb.cc
35-
${GOOGLEAPIS_GENS_PATH}/google/api/http.pb.cc
36-
${GOOGLEAPIS_GENS_PATH}/google/api/annotations.grpc.pb.cc
37-
${GOOGLEAPIS_GENS_PATH}/google/api/annotations.pb.cc
38-
)
39-
set(GOOGLEAPIS_TYPE_CCS
40-
${GOOGLEAPIS_GENS_PATH}/google/type/latlng.pb.cc
41-
${GOOGLEAPIS_GENS_PATH}/google/type/latlng.grpc.pb.cc
42-
)
43-
set(GOOGLEAPIS_RPC_CCS
44-
)
45-
set(GOOGLEAPIS_ASSISTANT_PATH google/assistant/embedded/v1alpha2)
46-
set(GOOGLEAPIS_ASSISTANT_CCS
47-
${GOOGLEAPIS_GENS_PATH}/${GOOGLEAPIS_ASSISTANT_PATH}/embedded_assistant.pb.cc
48-
${GOOGLEAPIS_GENS_PATH}/${GOOGLEAPIS_ASSISTANT_PATH}/embedded_assistant.grpc.pb.cc
35+
protobuf_generate_grpc_cpp(
36+
${PROTO_BASE_PATH}/google/api/http.proto
37+
${PROTO_BASE_PATH}/google/api/annotations.proto
38+
${PROTO_BASE_PATH}/google/type/latlng.proto
39+
${PROTO_BASE_PATH}/google/assistant/embedded/v1alpha2/embedded_assistant.proto
4940
)
5041
set(GOOGLEAPIS_CCS
51-
${GOOGLEAPIS_ASSISTANT_CCS} ${GOOGLEAPIS_API_CCS}
52-
${GOOGLEAPIS_RPC_CCS} ${GOOGLEAPIS_TYPE_CCS}
42+
${_gRPC_PROTO_GENS_DIR}/google/api/http.grpc.pb.cc
43+
${_gRPC_PROTO_GENS_DIR}/google/api/http.pb.cc
44+
${_gRPC_PROTO_GENS_DIR}/google/api/annotations.grpc.pb.cc
45+
${_gRPC_PROTO_GENS_DIR}/google/api/annotations.pb.cc
46+
${_gRPC_PROTO_GENS_DIR}/google/type/latlng.pb.cc
47+
${_gRPC_PROTO_GENS_DIR}/google/type/latlng.grpc.pb.cc
48+
${_gRPC_PROTO_GENS_DIR}/google/assistant/embedded/v1alpha2/embedded_assistant.pb.cc
49+
${_gRPC_PROTO_GENS_DIR}/google/assistant/embedded/v1alpha2/embedded_assistant.grpc.pb.cc
5350
)
5451
set_source_files_properties(${GOOGLEAPIS_CCS} PROPERTIES GENERATED TRUE)
52+
include_directories(${_gRPC_PROTO_GENS_DIR})
5553

56-
set(CORE_SRCS src/base64_encode.cc src/json_util.cc)
54+
set(CORE_SRCS src/base64_encode.cc)
5755
set(AUDIO_INPUT_FILE_SRCS src/audio_input_file.cc)
5856
set(ASSISTANT_AUDIO_SRCS src/run_assistant_audio.cc src/audio_pa.cc)
5957
set(ASSISTANT_FILE_SRCS src/run_assistant_file.cc)
6058
set(ASSISTANT_TEXT_SRCS src/run_assistant_text.cc)
6159

62-
63-
include_directories(src)
64-
65-
66-
set(EXE_DEPS googleapis_ccs portaudio_ext)
60+
include_directories(
61+
src
62+
${CMAKE_CURRENT_BINARY_DIR}/grpc_ext-prefix/src/grpc_ext/third_party/abseil-cpp
63+
)
6764

6865
if(WIN32 AND MSVC)
6966
add_definitions(-D_WIN32_WINNT=0x600)
@@ -77,34 +74,38 @@ else()
7774
set(_ALLTARGETS_LIBRARIES ${CMAKE_DL_LIBS} rt m ${CMAKE_THREAD_LIBS_INIT})
7875
endif()
7976

80-
8177
set(LDFLAGS
82-
grpc++ grpc gpr grpc_cronet address_sorting
83-
upb absl_base absl_strings absl_throw_delegate
84-
${_PROTOBUF_LIBRARIES} ${_CARES_LIBRARIES}
78+
grpc++ grpc address_sorting upb cares gpr
79+
${_ABSL_LIBRARIES} ${_PROTOBUF_LIBRARIES}
8580
${_ZLIB_LIBRARIES} ${_SSL_LIBRARIES}
8681
${_ALLTARGETS_LIBRARIES}
8782
)
8883

84+
if(NOT HAVE_GETOPT_C)
85+
set(EXT_DEPS gperf_ext)
86+
endif()
87+
set(EXT_DEPS ${EXT_DEPS} portaudio_ext)
8988

90-
add_library(googleapis_ccs STATIC ${GOOGLEAPIS_CCS})
91-
add_dependencies(googleapis_ccs googleapis)
92-
93-
add_executable(run_assistant_text ${CORE_SRCS} ${ASSISTANT_TEXT_SRCS})
94-
target_link_libraries(run_assistant_text googleapis_ccs ${LDFLAGS})
95-
add_dependencies(run_assistant_text ${EXE_DEPS})
89+
add_executable(run_assistant_text ${GOOGLEAPIS_CCS} ${CORE_SRCS} ${ASSISTANT_TEXT_SRCS})
90+
target_link_libraries(run_assistant_text ${LDFLAGS})
91+
add_dependencies(run_assistant_text ${EXT_DEPS})
9692

97-
add_executable(run_assistant_file ${CORE_SRCS} ${AUDIO_INPUT_FILE_SRCS} ${ASSISTANT_FILE_SRCS})
98-
target_link_libraries(run_assistant_file googleapis_ccs ${LDFLAGS})
99-
add_dependencies(run_assistant_file ${EXE_DEPS})
93+
add_executable(run_assistant_file ${GOOGLEAPIS_CCS} ${CORE_SRCS} ${AUDIO_INPUT_FILE_SRCS} ${ASSISTANT_FILE_SRCS})
94+
target_link_libraries(run_assistant_file ${LDFLAGS})
95+
add_dependencies(run_assistant_file ${EXT_DEPS})
10096

101-
add_executable(run_assistant_audio ${CORE_SRCS} ${AUDIO_SRCS} ${ASSISTANT_AUDIO_SRCS})
102-
target_link_libraries(run_assistant_audio googleapis_ccs ${LDFLAGS} ${_PORTAUDIO_LIB})
103-
add_dependencies(run_assistant_audio ${EXE_DEPS})
97+
add_executable(run_assistant_audio ${GOOGLEAPIS_CCS} ${CORE_SRCS} ${AUDIO_SRCS} ${ASSISTANT_AUDIO_SRCS})
98+
target_link_libraries(run_assistant_audio ${LDFLAGS} ${_PORTAUDIO_LIB})
99+
add_dependencies(run_assistant_audio ${EXT_DEPS})
104100

101+
if(APPLE)
102+
target_link_libraries(run_assistant_text "-framework CoreFoundation")
103+
target_link_libraries(run_assistant_file "-framework CoreFoundation")
104+
target_link_libraries(run_assistant_audio "-framework CoreFoundation")
105+
endif()
105106

106107
install (TARGETS run_assistant_audio run_assistant_text run_assistant_file
107-
RUNTIME DESTINATION bin
108+
RUNTIME DESTINATION bin
108109
)
109110

110111
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/make_uninstall.cmake")

README.md

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Google Assistant SDK for devices - C++
22

3+
### Linux / OSX build status
4+
[![Build Status](https://travis-ci.com/jwinarske/assistant-sdk-cpp.svg?branch=cmake)](https://travis-ci.com/jwinarske/assistant-sdk-cpp)
5+
6+
### Windows build status
7+
[![Build status](https://ci.appveyor.com/api/projects/status/op7vmksh3p0jkln4/branch/cmake?svg=true)](https://ci.appveyor.com/project/jwinarske/assistant-sdk-cpp/branch/cmake)
8+
39
## Requirements
410

511
This project is officially supported on Ubuntu 14.04. Other Linux distributions may be able to run
@@ -29,7 +35,6 @@ sudo rm -rf /usr/local/bin/grpc_* /usr/local/bin/protoc \
2935
```
3036
git clone https://github.com/googlesamples/assistant-sdk-cpp.git
3137
cd assistant-sdk-cpp
32-
export PROJECT_PATH=$(pwd)
3338
```
3439

3540
2. Install dependencies
@@ -39,78 +44,51 @@ sudo apt-get install libasound2-dev # For ALSA sound output
3944
sudo apt-get install libcurl4-openssl-dev # CURL development library
4045
```
4146

42-
3. Build Protocol Buffer, gRPC, and Google APIs
43-
```
44-
git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
45-
GRPC_PATH=${PROJECT_PATH}/grpc
46-
cd ${GRPC_PATH}
47-
48-
git submodule update --init
49-
50-
cd third_party/protobuf
51-
./autogen.sh && ./configure && make
52-
sudo make install
53-
sudo ldconfig
54-
55-
export LDFLAGS="$LDFLAGS -lm"
56-
cd ${GRPC_PATH}
57-
make clean
58-
make
59-
sudo make install
60-
sudo ldconfig
61-
62-
cd ${PROJECT_PATH}
63-
git clone https://github.com/googleapis/googleapis.git
64-
cd googleapis/
65-
make LANGUAGE=cpp
66-
```
67-
68-
4. Make sure you setup environment variable `$GOOGLEAPIS_GENS_PATH`
69-
```
70-
export GOOGLEAPIS_GENS_PATH=${PROJECT_PATH}/googleapis/gens
71-
```
72-
73-
5. Build this project
47+
3. Build this project
7448
```
75-
cd ${PROJECT_PATH}
76-
make run_assistant
49+
mkdir build && cd build
50+
cmake .. -DCMAKE_STAGING_PREFIX=`pwd`/dist/usr/local
51+
make install -j
7752
```
7853

79-
6. Get credentials file. It must be an end-user's credentials.
54+
4. Get credentials file. It must be an end-user's credentials.
8055

8156
* Go to the [Actions Console](https://console.actions.google.com/) and register your device model, following [these instructions](https://developers.google.com/assistant/sdk/guides/library/python/embed/register-device)
8257
* Move it in this folder and rename it to `client_secret.json`
8358
* run `get_credentials.sh` in this folder. It will create the file `credentials.json`.
8459

85-
7. Start one of the `run_assistant` samples:
60+
5. Start one of the `run_assistant` samples:
8661

8762
```bash
88-
./run_assistant_file --input ./resources/weather_in_mountain_view.raw --output ./response.wav --credentials ./credentials.json
63+
export LD_LIBRARY_PATH=`pwd`/dist/usr/local/lib
64+
./dist/usr/local/bin/run_assistant_file --input ../resources/weather_in_mountain_view.raw --output ./response.wav --credentials ../credentials.json
8965
aplay ./response.wav --rate=16000 --format=S16_LE
9066
```
9167

9268
On a Linux workstation, you can alternatively use ALSA for audio input:
9369

9470
```bash
95-
./run_assistant_audio --credentials ./credentials.json
71+
export LD_LIBRARY_PATH=`pwd`/dist/usr/local/lib
72+
./dist/usr/local/bin/run_assistant_audio --credentials ../credentials.json
9673
```
9774

9875
You can use a text-based query instead of audio. This allows you to continually enter text queries to the Assistant.
9976

10077
```bash
101-
./run_assistant_text --credentials ./credentials.json
78+
export LD_LIBRARY_PATH=`pwd`/dist/usr/local/lib
79+
./dist/usr/local/bin/run_assistant_text --credentials ../credentials.json
10280
```
10381

10482
This takes input from `cin`, so you can send data to the program when it starts.
10583

10684
```bash
107-
echo "what time is it" | ./run_assistant_text --credentials ./credentials.json
85+
echo "what time is it" | ./dist/usr/local/bin/run_assistant_text --credentials ../credentials.json
10886
```
10987

11088
To change the locale, include a `locale` parameter:
11189

11290
```bash
113-
echo "Bonjour" | ./run_assistant_text --credentials ./credentials.json --locale "fr-FR"
91+
echo "Bonjour" | ./dist/usr/local/bin/run_assistant_text --credentials ../credentials.json --locale "fr-FR"
11492
```
11593

11694
Default Assistant gRPC API endpoint is `embeddedassistant.googleapis.com`. If you want to test with a custom Assistant gRPC API endpoint, you can pass `--api_endpoint CUSTOM_API_ENDPOINT`.
@@ -120,7 +98,7 @@ Default Assistant gRPC API endpoint is `embeddedassistant.googleapis.com`. If yo
12098
To get a visual output from the Assistant, provide a command to be run alongside every step of the conversation. It will execute that command along along with a provided argument of a temporary HTML file.
12199

122100
```bash
123-
echo "what time is it" | ./run_assistant_text --credentials ./credentials.json --html_out google-chrome
101+
echo "what time is it" | ./dist/usr/local/bin/run_assistant_text --credentials ../credentials.json --html_out google-chrome
124102
```
125103

126104
After you enter text, it will run `google-chrome /tmp/google-assistant-cpp-screen-out.html`.

appveyor.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ init:
6868
- echo BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%
6969

7070
stack:
71-
- go 1.11
71+
- go 1.14.4
7272

7373
install:
74+
- echo Downloading Yasm...
75+
- mkdir windows_build_tools
76+
- powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe', 'windows_build_tools\yasm.exe')"
77+
- set PATH=%cd%\windows_build_tools;%PATH%
7478
- cmake --version
7579
- go version
80+
- yasm --version
7681

7782
build:
7883
parallel: true
@@ -85,12 +90,15 @@ build_script:
8590
- mkdir build
8691
- cd build
8792

88-
- cmake %CMAKE_TOOLCHAIN_ARGS% -G"%GENERATOR%" -DCMAKE_VERBOSE_MAKEFILE=TRUE
93+
- cmake %CMAKE_TOOLCHAIN_ARGS% -G"%GENERATOR%"
94+
-DCMAKE_VERBOSE_MAKEFILE=TRUE
8995
-DCMAKE_BUILD_TYPE=%CONFIGURATION%
90-
"-DCMAKE_INSTALL_PREFIX=%DIST_DIR%\%APPVEYOR_BUILD_WORKER_IMAGE%"
96+
-DCMAKE_ASM_NASM_COMPILER="yasm.exe"
97+
-DCMAKE_STAGING_PREFIX="%DIST_DIR%\%APPVEYOR_BUILD_WORKER_IMAGE%\${CMAKE_INSTALL_PREFIX}"
9198
-DBUILD_NUMBER=%APPVEYOR_BUILD_NUMBER% %CMAKE_ARGS%
9299
..
93100

101+
- set CL=/MP
94102
- cmake --build . --config %CONFIGURATION% --target all
95103

96104
after_build:

0 commit comments

Comments
 (0)