amatrix

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
git clone git://git.kocotian.pl/amatrix.git
Log | Files | Refs | README | LICENSE

commit d4d98810c52e2a20f551cf707cdbdac9e6ad74bc
parent 93fd3575a04b61e8b7fbc227de9c91891bd9a085
Author: Yu-Jie Lin <livibetter@gmail.com>
Date:   Sun,  4 Feb 2018 14:50:06 +0800

add osx build on Travis CI (#39)

* add osx builds on Travis CI

* check headers in CMake and only include either of termios.h or termio.h

CMake builds failed on basically 93fd357 [1] on OS X since termio.h
isn't present.

[1]: https://travis-ci.org/livibetter/cmatrix/builds/337114240

cmatrix.c do not need to include both termios.h and termio.h, the latter
is a wrapper on Linux, on POSIX, the former would do.

CMake should check the header files, not defining blindly, although it's
not needed as now cmatrix.c only includes one of the headers, however,
it's a good practice, but it should also halt the build process if
neither is found.

Diffstat:
M.travis.yml | 4+++-
MCMakeLists.txt | 22++++++++++++++++++----
Mcmatrix.c | 4+---
3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml @@ -1,6 +1,8 @@ language: c -os: linux +os: + - linux + - osx sudo: required diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -14,10 +14,24 @@ set(MKFONTDIR "/usr/bin/mkfontdir") add_definitions(-DEXCLUDE_CONFIG_H) add_definitions(-DVERSION="${VERSION}") -add_definitions(-DHAVE_SYS_IOCTL_H) -add_definitions(-DHAVE_UNISTD_H) -add_definitions(-DHAVE_TERMIOS_H) -add_definitions(-DHAVE_TERMIO_H) + +include(CheckIncludeFiles) +check_include_files("sys/ioctl.h" HAVE_SYS_IOCTL_H) +if (HAVE_SYS_IOCTL_H) + add_definitions(-DHAVE_SYS_IOCTL_H) +endif () +check_include_files("unistd.h" HAVE_UNISTD_H) +if (HAVE_UNISTD_H) + add_definitions(-DHAVE_UNISTD_H) +endif () +check_include_files("termios.h" HAVE_TERMIOS_H) +if (HAVE_TERMIOS_H) + add_definitions(-DHAVE_TERMIOS_H) +endif () +check_include_files("termio.h" HAVE_TERMIO_H) +if (HAVE_TERMIO_H) + add_definitions(-DHAVE_TERMIO_H) +endif () Set(CURSES_NEED_NCURSES TRUE) find_package(Curses) diff --git a/cmatrix.c b/cmatrix.c @@ -52,9 +52,7 @@ #ifdef HAVE_TERMIOS_H #include <termios.h> -#endif - -#ifdef HAVE_TERMIO_H +#elif defined(HAVE_TERMIO_H) #include <termio.h> #endif