diff --git a/2024/07/ncurses_demo1/.gitignore b/2024/07/ncurses_demo1/.gitignore new file mode 100644 index 0000000..787f33f --- /dev/null +++ b/2024/07/ncurses_demo1/.gitignore @@ -0,0 +1,3 @@ +build +.venv +CMakeUserPresets.json diff --git a/2024/07/ncurses_demo1/CMakeLists.txt b/2024/07/ncurses_demo1/CMakeLists.txt new file mode 100644 index 0000000..2690e12 --- /dev/null +++ b/2024/07/ncurses_demo1/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.28) +project(ncurses_demo1) + +set(CMAKE_CXX_STANDARD 17) + +find_package(Curses REQUIRED) + +add_executable(ncurses_demo1 src/main.cpp) +target_include_directories(ncurses_demo1 PUBLIC ${Curses_INCLUDE_DIRS}) +target_link_libraries(ncurses_demo1 Curses::Curses) diff --git a/2024/07/ncurses_demo1/README.md b/2024/07/ncurses_demo1/README.md new file mode 100644 index 0000000..4cb8c92 --- /dev/null +++ b/2024/07/ncurses_demo1/README.md @@ -0,0 +1,21 @@ +# NCurses Demo1 + +## Installation + +``` +python -m venv .venv +source $(readlink -f .venv/bin/activate) +python -m pip install conan +conan install conanfile.py --build=missing +cmake ../../ -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_VERBOSE_MAKEFILE=true +make +``` + +## Running + +in build/Release run ./ncurses_demo1 + +## Troubleshooting + +Sometimes you can issue with opening terminal xterm-* +Check TERMINFO if they point correctly or you have properly set ~/.terminfo (you can symlink it) diff --git a/2024/07/ncurses_demo1/conanfile.py b/2024/07/ncurses_demo1/conanfile.py new file mode 100644 index 0000000..4a537ab --- /dev/null +++ b/2024/07/ncurses_demo1/conanfile.py @@ -0,0 +1,12 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout + +class NcursesDemo1(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires("ncurses/6.5") + + def layout(self): + cmake_layout(self) diff --git a/2024/07/ncurses_demo1/src/main.cpp b/2024/07/ncurses_demo1/src/main.cpp new file mode 100644 index 0000000..85d5f54 --- /dev/null +++ b/2024/07/ncurses_demo1/src/main.cpp @@ -0,0 +1,14 @@ +#include +#include + +int main(int argc, char** argv) { + initscr(); + + printw("Hello World!"); + refresh(); + + getch(); + + endwin(); + return 0; +}