From 1a8f7483213e36f29d098a9512ab7776e97fedc5 Mon Sep 17 00:00:00 2001 From: "Robin E. R. Davies" Date: Mon, 27 Jan 2025 02:14:30 -0500 Subject: [PATCH] Auot-versioning --- CMakeLists.txt | 19 +++++++++ README.md | 2 +- ReleaseNotes.md | 5 +++ {src => config}/NWindowsVersionInfo.hpp.in | 0 config/NWindowsVersionInfo.tsx.in | 24 +++++++++++ config/README.md | 47 ++++++++++++++++++++++ docs/src/NWindowsVersionInfo.tsx | 24 +++++++++++ docs/src/ReleaseNotes.tsx | 36 +++++++++++++++++ docs/src/assets/ReleaseNotes.txt | 3 ++ docs/src/pages/HomePage.tsx | 3 +- src/CMakeLists.txt | 5 --- 11 files changed, 161 insertions(+), 7 deletions(-) create mode 100644 ReleaseNotes.md rename {src => config}/NWindowsVersionInfo.hpp.in (100%) create mode 100644 config/NWindowsVersionInfo.tsx.in create mode 100644 config/README.md create mode 100644 docs/src/NWindowsVersionInfo.tsx create mode 100644 docs/src/ReleaseNotes.tsx create mode 100644 docs/src/assets/ReleaseNotes.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 9180b04..86f7232 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ project(nwindows ) set(NWINDOWS_RELEASE_QUALIFIER "-beta1") + + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(NWINDOWS_BUILD_DOCUMENTATION ON CACHE BOOL "Build the Vite Documentation website?") @@ -14,6 +16,23 @@ set(NWINDOWS_BUILD_EXAMPLES ON CACHE BOOL "Build the example projects?") # Set to ON if you wish to set compler options froma parent CMakeList.txt file. set(NWINDOWS_DEFAULT_COMPILER_OPTIONS OFF CACHE BOOL "Use default compiler options?") +# Set version numbers in source files. +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/config/NWindowsVersionInfo.hpp.in" + "${CMAKE_CURRENT_SOURCE_DIR}/src/include/NWindows/NWindowsVersionInfo.hpp" +) + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/config/NWindowsVersionInfo.tsx.in" + "${CMAKE_CURRENT_SOURCE_DIR}/docs/src/NWindowsVersionInfo.tsx" +) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/config/README.md" + "${CMAKE_CURRENT_SOURCE_DIR}/README.md" +) + + + if (NOT NWINDOWS_DEFAULT_COMPILER_OPTIONS) diff --git a/README.md b/README.md index 7455b26..0b159f2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Documentation](https://img.shields.io/badge/documentation-Examples-blue)](https://github.com/rerdavies/nwindows/tree/main/examples) -INITIAL DEPLOYMENT IN PROGRESS. NOT YET READY FOR USE!!! +*0.0.1-beta1* The *NWindows* library is a C++ text user interface (TUI) library for building console applications on Linux. The library uses elements to compose user interfaces using an innovative and concise manipulator system. The library provides a rich set of elements with which to build user interfaces. diff --git a/ReleaseNotes.md b/ReleaseNotes.md new file mode 100644 index 0000000..2c63e1d --- /dev/null +++ b/ReleaseNotes.md @@ -0,0 +1,5 @@ +## Release Notes + +### NWindows 0.0.1-beta1 + +Initial release of the NWindows Library. \ No newline at end of file diff --git a/src/NWindowsVersionInfo.hpp.in b/config/NWindowsVersionInfo.hpp.in similarity index 100% rename from src/NWindowsVersionInfo.hpp.in rename to config/NWindowsVersionInfo.hpp.in diff --git a/config/NWindowsVersionInfo.tsx.in b/config/NWindowsVersionInfo.tsx.in new file mode 100644 index 0000000..a88a269 --- /dev/null +++ b/config/NWindowsVersionInfo.tsx.in @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Robin E. R. Davies + * All rights reserved. + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +export const NWindowsVersion = "${PROJECT_VERSION}${NWINDOWS_RELEASE_QUALIFIER}"; \ No newline at end of file diff --git a/config/README.md b/config/README.md new file mode 100644 index 0000000..1f8c64a --- /dev/null +++ b/config/README.md @@ -0,0 +1,47 @@ +#### NWindows TUI Library +![Build Status](https://github.com/rerdavies/nwindows/actions/workflows/cmake-multi-platform.yml/badge.svg) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Documentation](https://img.shields.io/badge/documentation-Developer%20Guide-blue)](https://rerdavies.github.io/nwindows/documentation/) +[![Documentation](https://img.shields.io/badge/documentation-Examples-blue)](https://github.com/rerdavies/nwindows/tree/main/examples) + + +*${PROJECT_VERSION}${NWINDOWS_RELEASE_QUALIFIER}* + +The *NWindows* library is a C++ text user interface (TUI) library for building console applications on Linux. +The library uses elements to compose user interfaces using an innovative and concise manipulator system. The library provides a rich set of elements with which to build user interfaces. + +Built on top of the *ncursesw* library, *NWindows* works on both xterm and raw linux terminal windows, and also works over ssh. + +  ![image](docs/public/image/screenshot.png) + +Here is a simple example of an *NWindows* application that demonstrates the use of NWindow's manipulator syntax to create users interfaces. The program creates a window with a button that closes the window when clicked: + +``` +#include "NWindows/NWindows.hpp" + +using namespace nwindows; + +int main(void) { + NWindow::ptr window = NWindow::create(AUTO_SIZE, AUTO_SIZE); + + window + | title("Hello") + | add_child( + NButtonElement::create("Hello world!") + | margin({ 2,1,2,1 }) + | on_click([window](int button, NClickedEventArgs& event) + { + event.handled = true; + event.window->close(); + } + ) + ); + window->run(); +} +``` + +which displays the following output when executed. + +  ![image](docs/public/image/hello_world.png) + +See the [documentation](https://github.io/rerdavies/nwindows> for more information, and for instructions on installing, and using *NWindows*. diff --git a/docs/src/NWindowsVersionInfo.tsx b/docs/src/NWindowsVersionInfo.tsx new file mode 100644 index 0000000..d697a79 --- /dev/null +++ b/docs/src/NWindowsVersionInfo.tsx @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Robin E. R. Davies + * All rights reserved. + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +export const NWindowsVersion = "0.0.1-beta1"; diff --git a/docs/src/ReleaseNotes.tsx b/docs/src/ReleaseNotes.tsx new file mode 100644 index 0000000..a944a1b --- /dev/null +++ b/docs/src/ReleaseNotes.tsx @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Robin E. R. Davies + * All rights reserved. + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import ReleaseNodesMd from "./assets/ReleaseNotes.txt"; + + +export default function ReleaseNotes() { + return ( +
+
+

Release Notes

+
+
+
+ ); +} \ No newline at end of file diff --git a/docs/src/assets/ReleaseNotes.txt b/docs/src/assets/ReleaseNotes.txt new file mode 100644 index 0000000..419e9a2 --- /dev/null +++ b/docs/src/assets/ReleaseNotes.txt @@ -0,0 +1,3 @@ +# Hello World + +This a test file for the release notes. \ No newline at end of file diff --git a/docs/src/pages/HomePage.tsx b/docs/src/pages/HomePage.tsx index fc67f71..de92d95 100644 --- a/docs/src/pages/HomePage.tsx +++ b/docs/src/pages/HomePage.tsx @@ -34,6 +34,7 @@ import { WhereToGoFromHere } from '../DocsNav'; import Paper from '@mui/material/Paper'; import IconButton from '@mui/material/IconButton'; import PersistentScrollDiv from '../PersistentScrollDiv'; +import { NWindowsVersion } from '../NWindowsVersionInfo'; function HomePage() { @@ -43,7 +44,7 @@ function HomePage() {
-

INITIAL DEPLOYMENT IN PROGRESS. NOT YET READY FOR USE!!!

+

NWindows {NWindowsVersion}

The NWindows library is a C++ text user interface (TUI) library for building console applications. The library uses elements to compose user interfaces using an innovative and concise manipulator system. The library provides a diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6197f2a..8136653 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,11 +5,6 @@ set(CMAKE_CXX_STANDARD 20) # add_compile_definitions(_GLIBCXX_DEBUG) -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/NWindowsVersionInfo.hpp.in" - "${CMAKE_CURRENT_SOURCE_DIR}/include/NWindows/NWindowsVersionInfo.hpp" -) - add_library(nwindows include/NWindows/NClipboard.hpp