Adding basic ncurses demo project.

master
End of Line 2024-07-08 18:51:42 +02:00
parent 4282cc4b12
commit f3563ce6d1
5 changed files with 60 additions and 0 deletions

3
2024/07/ncurses_demo1/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build
.venv
CMakeUserPresets.json

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -0,0 +1,14 @@
#include <ncurses.h>
#include <iostream>
int main(int argc, char** argv) {
initscr();
printw("Hello World!");
refresh();
getch();
endwin();
return 0;
}