1env:
2  - BUILD_DOCS=false
3jobs:
4  include:
5    - # only build docs on main
6      if: branch = main
7      env: BUILD_DOCS=true
8
9language: cpp
10matrix:
11  include:
12    - os: linux
13      dist: xenial
14      addons:
15        apt:
16          sources:
17            - sourceline: 'ppa:beineri/opt-qt-5.12.1-xenial'
18          packages:
19            - qt512base valgrind
20            - doxygen
21      env:
22        - QMAKESPEC=linux-g++
23        - EVAL="CC=gcc && CXX=g++"
24        - CFLAGS="-Os"
25        - LDFLAGS="-Wl,--no-undefined -lm"
26        - QMAKEFLAGS="-config release"
27        - QT_NO_CPU_FEATURE=rdrnd
28    - os: linux
29      dist: xenial
30      addons:
31        apt:
32          sources:
33            - sourceline: 'ppa:beineri/opt-qt-5.12.1-xenial'
34          packages:
35            - qt512base
36      env:
37        - QMAKESPEC=linux-clang
38        - EVAL="CC=clang && CXX=clang++"
39        - CFLAGS="-Oz"
40        - LDFLAGS="-Wl,--no-undefined -lm"
41        - QMAKEFLAGS="-config release"
42        - MAKEFLAGS=-s
43        - TESTARGS=-silent
44    - os: linux
45      dist: xenial
46      env:
47        - QMAKESPEC=linux-gcc-freestanding
48        - EVAL="CXX=false"
49        - CFLAGS="-ffreestanding -Os"
50        - LDFLAGS="-Wl,--no-undefined -lm"
51    - os: linux
52      dist: xenial
53      env:
54        - QMAKESPEC=linux-gcc-no-math
55        - EVAL="CXX=false && touch src/math.h src/float.h"
56        - CFLAGS="-ffreestanding -DCBOR_NO_FLOATING_POINT -Os"
57        - LDFLAGS="-Wl,--no-undefined"
58        - LDLIBS=""
59    - os: osx
60      env:
61        - QMAKESPEC=macx-clang
62        - CFLAGS="-Oz"
63        - QMAKEFLAGS="-config debug"
64        - MAKEFLAGS=-s
65        - TESTARGS=-silent
66        - PATH=/usr/local/opt/qt5/bin:$PATH
67install:
68  - if [ "${TRAVIS_OS_NAME}" != "linux" ]; then
69        brew update;
70        brew install qt5;
71    fi
72script:
73  - PATH=`echo /opt/qt*/bin`:$PATH
74  - eval "$EVAL"
75  - make -s -f Makefile.configure configure | tee .config
76  - make -k
77        CFLAGS="$CFLAGS -march=native -g1 -Wall -Wextra -Werror"
78        CPPFLAGS="-DNDEBUG -DCBOR_ENCODER_WRITER_CONTROL=-1 -DCBOR_PARSER_READER_CONTROL=-1"
79        lib/libtinycbor.a
80  - size lib/libtinycbor.a | tee sizes
81  - make -s clean
82  - make -k
83        CFLAGS="$CFLAGS -O0 -g"
84        LDFLAGS="$LDFLAGS" ${LDLIBS+LDLIBS="$LDLIBS"}
85  - grep -q freestanding-pass .config || make
86        QMAKEFLAGS="$QMAKEFLAGS QMAKE_CXX=$CXX"
87        tests/Makefile
88  - grep -q freestanding-pass .config ||
89        (cd tests && make TESTARGS=-silent check -k
90        TESTRUNNER=`which valgrind 2>/dev/null`)
91  - make -s clean
92  - ! [ $BUILD_DOCS ] || ./scripts/update-docs.sh
93