Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 20009f5

Browse files
authored
ci: verify pkg-config files actually work (#30)
Change the CI builds to verify the pkg-config files we create actually work. Some improvements in the `.*ignore` files.
1 parent 7abccfa commit 20009f5

File tree

6 files changed

+145
-10
lines changed

6 files changed

+145
-10
lines changed

.dockerignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Common build output directory names
2+
.build/
3+
_build/
4+
build-output/
5+
cmake-out/
6+
7+
# Common bazel output directories
8+
bazel-*
9+
10+
# Backup files for Emacs
11+
*~
12+
13+
# Ignore IDEA / IntelliJ files
14+
.idea/
15+
cmake-build-*/
16+
17+
# This is a staging directory used to upload the documents to gihub.io
18+
github-io-staging/
19+
20+
# Ignore Visual Studio Code files
21+
.vsbuild/
22+
.vscode/

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,3 @@ github-io-staging/
2020
# Ignore Visual Studio Code files
2121
.vsbuild/
2222
.vscode/
23-
24-
google/cloud/storage/testbench/__pycache__/
25-
google/cloud/storage/testbench/*.pyc

ci/test-install/bigquery/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A simple Makefile to test the `install` target.
16+
#
17+
# This is not intended to be a demonstration of how to write good Makefiles,
18+
# nor is it a general solution on how to build Makefiles for google-cloud-cpp.
19+
# It is simply a minimal file to test the installed pkg-config support files.
20+
21+
# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
22+
# our tests, but applications would typically make them configurable parameters.
23+
CXX=g++ -std=c++11
24+
CXXLD=$(CXX)
25+
26+
all: main
27+
28+
# Configuration variables to compile and link against the library.
29+
PROTOS := googleapis_cpp_cloud_bigquery_protos
30+
CXXFLAGS := $(shell pkg-config $(PROTOS) --cflags)
31+
CXXLDFLAGS := $(shell pkg-config $(PROTOS) --libs-only-L)
32+
LIBS := $(shell pkg-config $(PROTOS) --libs-only-l)
33+
34+
# A target using the Google Cloud Storage C++ client library.
35+
main: main.cc
36+
$(CXXLD) $(CXXFLAGS) $(CXXFLAGS) $(CXXLDFLAGS) -o $@ $^ $(LIBS)

ci/test-install/bigtable/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A simple Makefile to test the `install` target.
16+
#
17+
# This is not intended to be a demonstration of how to write good Makefiles,
18+
# nor is it a general solution on how to build Makefiles for google-cloud-cpp.
19+
# It is simply a minimal file to test the installed pkg-config support files.
20+
21+
# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
22+
# our tests, but applications would typically make them configurable parameters.
23+
CXX=g++ -std=c++11
24+
CXXLD=$(CXX)
25+
26+
all: main
27+
28+
# Configuration variables to compile and link against the library.
29+
PROTOS := googleapis_cpp_bigtable_protos
30+
CXXFLAGS := $(shell pkg-config $(PROTOS) --cflags)
31+
CXXLDFLAGS := $(shell pkg-config $(PROTOS) --libs-only-L)
32+
LIBS := $(shell pkg-config $(PROTOS) --libs-only-l)
33+
34+
# A target using the Google Cloud Storage C++ client library.
35+
main: main.cc
36+
$(CXXLD) $(CXXFLAGS) $(CXXFLAGS) $(CXXLDFLAGS) -o $@ $^ $(LIBS)

ci/test-install/compile-test-projects.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919

2020
set -eu
2121

22-
# For BigQuery protos
23-
cp -R /home/build/cpp-cmakefiles/ci/test-install/bigquery \
24-
/home/build/test-install-bigquery
25-
cd /home/build/test-install-bigquery
26-
cmake -H. -Bcmake-out
27-
cmake --build cmake-out -- -j "$(nproc)"
28-
cmake-out/utilize-googleapis
22+
# Verify the installed CMake config and pkgconfig files are actually usable.
2923

3024
# For Bigtable protos
3125
cp -R /home/build/cpp-cmakefiles/ci/test-install/bigtable \
@@ -34,6 +28,18 @@ cd /home/build/test-install-bigtable
3428
cmake -H. -Bcmake-out
3529
cmake --build cmake-out -- -j "$(nproc)"
3630
cmake-out/utilize-googleapis
31+
env PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
32+
make
33+
34+
# For BigQuery protos
35+
cp -R /home/build/cpp-cmakefiles/ci/test-install/bigquery \
36+
/home/build/test-install-bigquery
37+
cd /home/build/test-install-bigquery
38+
cmake -H. -Bcmake-out
39+
cmake --build cmake-out -- -j "$(nproc)"
40+
cmake-out/utilize-googleapis
41+
env PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
42+
make
3743

3844
# For spanner protos
3945
cp -R /home/build/cpp-cmakefiles/ci/test-install/spanner \
@@ -42,3 +48,5 @@ cd /home/build/test-install-spanner
4248
cmake -H. -Bcmake-out
4349
cmake --build cmake-out -- -j "$(nproc)"
4450
cmake-out/utilize-googleapis
51+
env PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
52+
make

ci/test-install/spanner/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A simple Makefile to test the `install` target.
16+
#
17+
# This is not intended to be a demonstration of how to write good Makefiles,
18+
# nor is it a general solution on how to build Makefiles for google-cloud-cpp.
19+
# It is simply a minimal file to test the installed pkg-config support files.
20+
21+
# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
22+
# our tests, but applications would typically make them configurable parameters.
23+
CXX=g++ -std=c++11
24+
CXXLD=$(CXX)
25+
26+
all: main
27+
28+
# Configuration variables to compile and link against the library.
29+
PROTOS := googleapis_cpp_spanner_protos
30+
CXXFLAGS := $(shell pkg-config $(PROTOS) --cflags)
31+
CXXLDFLAGS := $(shell pkg-config $(PROTOS) --libs-only-L)
32+
LIBS := $(shell pkg-config $(PROTOS) --libs-only-l)
33+
34+
# A target using the Google Cloud Storage C++ client library.
35+
main: main.cc
36+
$(CXXLD) $(CXXFLAGS) $(CXXFLAGS) $(CXXLDFLAGS) -o $@ $^ $(LIBS)

0 commit comments

Comments
 (0)