Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ addons:
apt:
packages:
- libtool-bin
compiler:
- gcc
- clang
script:
- make
- make test
jobs:
include:
- name: gcc
compiler: gcc
script:
- make
- make test
- name: clang
compiler: clang
script:
- make
- make test
- name: gcc (cmake)
compiler: gcc
script:
- (mkdir build-cmake && cd build-cmake && cmake .. && make)
- make test LIBRARY=$PWD/build-cmake/libunibilium.a OBJECTS=
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 2.8.12)
project(unibilium LANGUAGES C)

file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/*.c)
add_library(unibilium ${SRC_FILES})
set_target_properties(unibilium PROPERTIES PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/unibilium.h
VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")

if(NOT WIN32)
execute_process(COMMAND sh -c "ncursesw6-config --terminfo-dirs 2>/dev/null || \
ncurses6-config --terminfo-dirs 2>/dev/null || \
ncursesw5-config --terminfo-dirs 2>/dev/null || \
ncurses5-config --terminfo-dirs 2>/dev/null || \
echo '/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo'"
OUTPUT_VARIABLE TERMINFO_DIRS)
# Remove trailing newline
string(STRIP "${TERMINFO_DIRS}" TERMINFO_DIRS)
else()
set(TERMINFO_DIRS "")
endif()
target_compile_definitions(unibilium PUBLIC "TERMINFO_DIRS=\"${TERMINFO_DIRS}\"")

include(GNUInstallDirs)
install(TARGETS unibilium
PUBLIC_HEADER
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
7 changes: 6 additions & 1 deletion uniutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ along with unibilium. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#ifdef _MSC_VER
# include <BaseTsd.h>
# define ssize_t SSIZE_T
#else
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
Expand Down