amatrix

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

commit d4d8079877fbd0bd616b2aed9c13dfea4bc71ce8
parent 737d167f0d3b0acf0cf676a704cb4bf13e397212
Author: Abishek V Ashok <abishekvashok@gmail.com>
Date:   Mon,  4 Dec 2017 17:49:54 +0530

Merge pull request #17 from hoijui/cmake

Adds CMake build system support
Diffstat:
M.gitignore | 1+
M.travis.yml | 9++++++++-
ACMakeLists.txt | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MREADME.md | 28+++++++++++++++++++++++-----
Mcmatrix.c | 2++
5 files changed, 92 insertions(+), 6 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ +/build config.h Makefile stamp-h diff --git a/.travis.yml b/.travis.yml @@ -8,7 +8,14 @@ compiler: - gcc - clang +env: + - CONFIGURE_CMD=configure + - CONFIGURE_CMD=cmake + script: - - ./configure + - mkdir -p build + - cd build + - if [[ $CONFIGURE_CMD == 'configure' ]]; then export CC=${CC} && ../configure ; fi + - if [[ $CONFIGURE_CMD == 'cmake' ]]; then cmake -DCMAKE_C_COMPILER="${CC}" .. ; fi - make diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -0,0 +1,58 @@ +# CMake build system for CMatrix + +cmake_minimum_required(VERSION 2.8) + +project(CMatrix LANGUAGES C) +set(VERSION "1.2") + +# These are relative to CMAKE_INSTALL_PREFIX +# which by default is "/usr/local" +set(CONSOLE_FONTS_DIRS "share/consolefonts" "lib/kbd/consolefonts") +set(X_FONTS_DIRS "lib/X11/fonts/misc" "X11R6/lib/X11/fonts/misc" "share/fonts/X11/misc") + +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) + +Set(CURSES_NEED_NCURSES TRUE) +find_package(Curses) +include_directories(${CURSES_INCLUDE_DIR}) +add_definitions(-DHAVE_NCURSES_H) + +add_executable(cmatrix cmatrix.c) + +target_link_libraries(cmatrix ${CURSES_LIBRARIES}) + +install(TARGETS cmatrix DESTINATION bin) + +if (UNIX) + foreach (CONSOLE_FONTS_DIR ${CONSOLE_FONTS_DIRS}) + if (IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/${CONSOLE_FONTS_DIR}") + message(STATUS "Installing matrix console fonts to ${CMAKE_INSTALL_PREFIX}/${CONSOLE_FONTS_DIR}") + install(FILES + "${CMAKE_SOURCE_DIR}/matrix.fnt" + "${CMAKE_SOURCE_DIR}/matrix.psf.gz" + DESTINATION "${CONSOLE_FONTS_DIR}") + endif () + endforeach () + foreach (X_FONTS_DIR ${X_FONTS_DIRS}) + if (IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR}") + message(STATUS "Installing matrix X window fonts to ${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR}") + install(FILES + "${CMAKE_SOURCE_DIR}/mtx.pcf" + DESTINATION "${X_FONTS_DIR}") + install(CODE + "message(STATUS \"Running mkfontdir ${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR} ...\")") + install(CODE + "execute_process(COMMAND \"${MKFONTDIR}\" \"${CMAKE_INSTALL_PREFIX}/${X_FONTS_DIR}\")") + install(CODE + "message(STATUS \"If this is the first time you have installed CMatrix you will probably have to restart X window in order to use the mtx.pcf font.\")") + endif () + endforeach () +endif () + diff --git a/README.md b/README.md @@ -10,14 +10,32 @@ control-c (Ctrl+C) or by pressing q. If you wish for more of a screen saver effect, you must specify `-s` on the command line. For usage info, use `cmatrix -h`. [![Build Status](https://travis-ci.org/abishekvashok/cmatrix.svg?branch=master)](https://travis-ci.org/abishekvashok/cmatrix) + ### Dependencies You'll probably need a decent ncurses library to get this to work. -### Installing cmatrix -To install cmatrix, in the cmatrix directory run: -- `./configure` -- `make` -- `make install` +### Building and installing cmatrix +To install cmatrix, use either of the following methods from within the cmatrix directory. + +#### Using `configure` (recommended for most linux user) +``` +./configure +make +make install +``` + +#### Using CMake +Here we also show an out-of-source build in the sub directory "build". +``` +mkdir -p build +cd build +# to install to "/usr/local" +cmake .. +# or to install to "/usr" +#cmake -DCMAKE_INSTALL_PREFIX=/usr .. +make +make install +``` ### Running cmatrix After you have installed cmatrix just run `cmatrix` to run cmatrix :) diff --git a/cmatrix.c b/cmatrix.c @@ -32,7 +32,9 @@ #include <termios.h> #include <signal.h> +#ifndef EXCLUDE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_NCURSES_H #include <ncurses.h>