version string, notcurses_version()

pull/7/head
nick black 5 years ago
parent 635d7039d7
commit 70df86ba17
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -0,0 +1,15 @@
pipeline:
prep:
image: library/debian:unstable
commands:
- apt-get update
- apt-get -y remove man-db
- apt-get -y install devscripts git-buildpackage locales
- echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
- locale-gen
- mk-build-deps --install -t'apt-get -y'
- mkdir build
- cd build
- cmake ..
- make
- LANG="en_US.UTF-8" ./notcurses-tester

@ -0,0 +1,94 @@
cmake_minimum_required(VERSION 3.13)
project(notcurses VERSION 0.0.1
DESCRIPTION "UI library for modern terminal emulators"
HOMEPAGE_URL "https://nick-black.com/dankwiki/index.php/notcurses"
LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
configure_file(tools/version.h.in include/version.h)
include(GNUInstallDirs)
file(GLOB LIBSRCS CONFIGURE_DEPENDS src/lib/*.c)
add_library(notcurses SHARED ${LIBSRCS})
target_include_directories(notcurses
PRIVATE
include
"${PROJECT_BINARY_DIR}/include"
)
set_target_properties(notcurses PROPERTIES
PUBLIC_HEADER "include/notcurses.h"
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_compile_options(notcurses
PRIVATE
-Wall -Wextra -W
)
file(GLOB BINSRCS CONFIGURE_DEPENDS src/bin/*.c)
add_executable(notcurses-demo ${BINSRCS})
target_include_directories(notcurses-demo PRIVATE include)
target_link_libraries(notcurses-demo
PRIVATE
notcurses
)
target_compile_options(notcurses-demo PRIVATE
-Wall -Wextra -W
)
file(GLOB TESTSRCS CONFIGURE_DEPENDS tests/*.cpp)
add_executable(notcurses-tester ${TESTSRCS})
find_package(GTest 1.9 REQUIRED)
target_include_directories(notcurses-tester PRIVATE include)
target_link_libraries(notcurses-tester
GTest::GTest
notcurses
)
target_compile_options(notcurses-tester PRIVATE
-Wall -Wextra -W
)
gtest_discover_tests(notcurses-tester)
enable_testing()
configure_file(tools/notcurses.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
@ONLY
)
include(CMakePackageConfigHelpers)
configure_package_config_file(tools/notcursesConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/notcurses/cmake
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/notcurses
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install(TARGETS notcurses-demo DESTINATION bin)
install(TARGETS notcurses
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT Libraries
NAMELINK_COMPONENT Development
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Development
)

@ -1,2 +1,4 @@
# notcurses
cleanroom TUI library for modern terminal emulators. definitely not curses.
[![Build Status](https://drone.dsscaw.com:4443/api/badges/dankamongmen/notcurses/status.svg)](https://drone.dsscaw.com:4443/dankamongmen/notcurses)

@ -0,0 +1,14 @@
#ifndef NOTCURSES_NOTCURSES
#define NOTCURSES_NOTCURSES
#ifdef __cplusplus
extern "C" {
#endif
const char* notcurses_version(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

@ -0,0 +1,5 @@
#include <stdlib.h>
int main(void){
return EXIT_SUCCESS;
}

@ -0,0 +1,11 @@
#include "notcurses.h"
#include "version.h"
static const char NOTCURSES_VERSION[] =
notcurses_VERSION_MAJOR "."
notcurses_VERSION_MINOR "."
notcurses_VERSION_PATCH;
const char* notcurses_version(void){
return NOTCURSES_VERSION;
}

@ -0,0 +1,12 @@
#include <clocale>
#include <iostream>
#include "main.h"
int main(int argc, char **argv){
if(!setlocale(LC_ALL, "")){
std::cerr << "Coudln't set locale based on user preferences!" << std::endl;
return EXIT_FAILURE;
}
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

@ -0,0 +1,7 @@
#ifndef NOTCURSES_TEST_MAIN
#define NOTCURSES_TEST_MAIN
#include <gtest/gtest.h>
#include <notcurses.h>
#endif

@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: @PROJECT_NAME@
Description: TUI library for modern terminal emulators
Version: @PROJECT_VERSION@
Requires:
Libs: -L${libdir} -lnotcurses
Cflags: -I${includedir}

@ -0,0 +1,2 @@
@PACKAGE_INIT@
set(NOTCURSES_DIR "@PACKAGE_SOME_INSTALL_DIR@")

@ -0,0 +1,3 @@
#define notcurses_VERSION_MAJOR "@notcurses_VERSION_MAJOR@"
#define notcurses_VERSION_MINOR "@notcurses_VERSION_MINOR@"
#define notcurses_VERSION_PATCH "@notcurses_VERSION_PATCH@"
Loading…
Cancel
Save