# Test configuration for Travis CI. See <https://travis-ci.org/>.
language: cpp

compiler:
  - gcc
  - clang

env:
  global:
    - OMP_NUM_THREADS=4

before_install:
  - sudo apt-get update -qq

# Install OpenMPI and libprimesieve
install:
  - sudo apt-get install -y openmpi-bin libopenmpi-dev
  - rm -rf primesieve-master*
  - curl -L -o primesieve-master.zip https://github.com/kimwalisch/primesieve/archive/master.zip
  - unzip primesieve-master.zip
  - cd primesieve-master
  - ./autogen.sh
  - ./configure
  - make
  - sudo make uninstall
  - sudo make install
  - cd ..

# Test build.sh script
before_script:
  - ./build.sh
  - ldd primecount
  - make distclean

# Test standard build procedure
script:
  - ./autogen.sh
  - ./configure --enable-mpi --enable-assert CXXFLAGS="-O2 -pedantic -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -Wno-unknown-pragmas"
  - make
  - sudo make install
  - make dist
  - make distcheck

# Test configuration for Travis CI. See <https://travis-ci.org/>.
language: cpp

compiler:
  - gcc
  - clang

env:
  global:
    - OMP_NUM_THREADS=4

before_install:
  - sudo apt-get update -qq

# Install OpenMPI and libprimesieve
install:
  - sudo apt-get install -y openmpi-bin libopenmpi-dev cppcheck
  - rm -rf primesieve-master*
  - curl -L -o primesieve-master.zip https://github.com/kimwalisch/primesieve/archive/master.zip
  - unzip primesieve-master.zip
  - cd primesieve-master
  - ./autogen.sh
  - ./configure
  - make
  - sudo make uninstall
  - sudo make install
  - cd ..

# Test build.sh script
before_script:
  - ./build.sh
  - ldd primecount
  - make distclean

# Test standard build procedure
script:
  - ./autogen.sh
  - ./configure --enable-mpi --enable-assert CXXFLAGS="-O2 -pedantic -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -Wno-unknown-pragmas"
  - make
  - sudo make install
  - make dist
  - make distcheck
  - cppcheck . --error-exitcode=1 -i$(cd primesieve-*; basename $(pwd))

Add Cppcheck static C/C++ code analysis
Add Cppcheck static C/C++ code analysis