language: cpp
sudo: false

matrix:
  include:
    - os: linux
      addons:
        apt:
          packages:
          - swig
          - python-dev
          - python-numpy
          - guile-2.0-dev
          - liboctave-dev
          - cmake
          - gfortran
          - binutils-mingw-w64-x86-64
          - g++-mingw-w64-x86-64
          - gfortran-mingw-w64-x86-64

      script:
        - pip install mkdocs python-markdown-math --user
        - PATH=$PATH:~/.local/bin mkdocs build
        - mkdir build && pushd build
        - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_MATLAB=OFF -DNLOPT_FORTRAN=ON -DCMAKE_C_FLAGS='-std=c89 -pedantic -D_POSIX_C_SOURCE=200112L -Wall -Wextra -Werror' -DCMAKE_CXX_FLAGS='-Wall -Wextra' ..
        - make install -j2 && ctest -j2 --output-on-failure
        - rm -rf * ~/.local
        - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF -DNLOPT_FORTRAN=ON -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-x86_64-w64-mingw32.cmake ..
        - make install -j2

    - os: osx
      install:
        - brew update
        - brew install swig octave guile || echo "nope"
      script:
        - mkdir build && pushd build
        - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DPYTHON_EXECUTABLE=/usr/bin/python -DNLOPT_FORTRAN=ON ..
        - make install && ctest --output-on-failure
