File: build.sh

package info (click to toggle)
mongo-cxx-driver 4.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 14,632 kB
  • sloc: cpp: 60,864; python: 962; sh: 496; xml: 253; perl: 94; makefile: 22
file content (25 lines) | stat: -rwxr-xr-x 810 bytes parent folder | download
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
#!/usr/bin/env bash

set -o errexit
set -o pipefail

# Sanity-check that static library macros are not set when building against the shared library.
# Users don't need to include this section in their projects.
if ! pkg-config --cflags libmongocxx | grep -v -q -- -DBSONCXX_STATIC; then
  echo "Expected BSONCXX_STATIC to not be set" >&2
  exit 1
fi

if ! pkg-config --cflags libmongocxx | grep -v -q -- -DMONGOCXX_STATIC; then
  echo "Expected MONGOCXX_STATIC to not be set" >&2
  exit 1
fi

rm -rf build/*
cd build

"${CXX:?}" $CXXFLAGS -Wall -Wextra -Werror -std="c++${CXX_STANDARD:?}" -c -o hello_mongocxx.o ../../../hello_mongocxx.cpp $(pkg-config --cflags libmongocxx)

"${CXX:?}" $LDFLAGS -std="c++${CXX_STANDARD:?}" -o hello_mongocxx hello_mongocxx.o $(pkg-config --libs libmongocxx)

./hello_mongocxx