Skip to content

Commit 0cb89ca

Browse files
Unified Library & CMake OS Conditional Check
StenoByte Core & Helper files are now compiled and included as a library called "StenoByte_Library". Moved Core & Helper Files to a new directory called "includes". CMakeLists.txt is now configured to check the OS the application is being built for and to change it accordingly. Minor updates to README.
1 parent 0cb21b1 commit 0cb89ca

File tree

7 files changed

+50
-17
lines changed

7 files changed

+50
-17
lines changed

CMakeLists.txt

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,41 @@ project(StenoByte_Prototype C)
33

44
set(CMAKE_C_STANDARD 23)
55

6-
find_package(PkgConfig REQUIRED)
7-
pkg_search_module(LIBEVDEV REQUIRED libevdev)
8-
9-
add_executable(StenoByte_Prototype main.c
10-
StenoByte_Helper_for_Linux.c
11-
StenoByte_Helper.h
12-
StenoByte_Core.c
13-
StenoByte_Core.h)
14-
target_include_directories(StenoByte_Prototype PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
15-
target_link_libraries(StenoByte_Prototype PRIVATE ${LIBEVDEV_LIBRARIES})
6+
# Linux Variant
7+
if (LINUX)
8+
# Finds Libevdev Library
9+
find_package(PkgConfig REQUIRED)
10+
pkg_search_module(LIBEVDEV REQUIRED libevdev)
11+
12+
# Prints Location of Libevdev Library
13+
message(STATUS "libevdev include dirs: ${LIBEVDEV_INCLUDE_DIRS}")
14+
message(STATUS "libevdev libraries: ${LIBEVDEV_LIBRARIES}")
15+
16+
## StenoByte Library for Linux Library
17+
add_library(StenoByte_Library STATIC
18+
includes/StenoByte_Helper_for_Linux.c
19+
includes/StenoByte_Core.c)
20+
target_include_directories(StenoByte_Library PRIVATE
21+
${LIBEVDEV_INCLUDE_DIRS}
22+
includes)
23+
target_link_libraries(StenoByte_Library PRIVATE ${LIBEVDEV_LIBRARIES})
24+
25+
# MacOS Variant
26+
elseif (APPLE)
27+
message(FATAL_ERROR "Unfortunately StenoByte is not yet compatible with MacOS,
28+
but support for MacOS is in the works!")
29+
30+
# Windows Variant
31+
elseif (WIN32)
32+
message(FATAL_ERROR "Unfortunately StenoByte is not yet compatible with Windows,
33+
but support for Windows is in the works!")
34+
35+
# Throws an error if system is incompatible
36+
else ()
37+
message(FATAL_ERROR "Unfortunately your system is not compatible with StenoByte")
38+
endif ()
39+
40+
# Main App
41+
add_executable(StenoByte_Prototype main.c)
42+
target_include_directories(StenoByte_Prototype PRIVATE ${LIBEVDEV_INCLUDE_DIRS} StenoByte_Library)
43+
target_link_libraries(StenoByte_Prototype PRIVATE ${LIBEVDEV_LIBRARIES} StenoByte_Library)

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
A stenotype inspired terminal app for typing out bytes quickly.
33

44
This program is designed to allow you to build up a byte using eight keys from your keyboard, with each key
5-
corresponding to a bit in a byte (which is made up of eight bits). When you press & hold down those keys, their
5+
corresponding to a bit in a byte (which is made up of eight bits). When you press and hold down those keys, their
66
associated bits are set to 1. When the keys are released or are not being pushed, their associated bits are set to 0.
77

8-
When you are ready to turn those bits into a byte, press the Space Bar and the application will convert those bits into
8+
When you are ready to turn those bits into a byte, press the Space Bar, and the application will convert those bits into
99
a byte and display it as a decimal.
1010

11-
This application is currently designed to work in Linux.
11+
This application is currently designed to work on Linux.
1212

1313
For the time-being, this app requires elevated privileges (e.g. `sudo`) to run.
1414

@@ -40,6 +40,11 @@ sudo apt -y install build-essential cmake git libevdev-dev
4040
sudo pacman -S gcc cmake git libevdev
4141
````
4242

43+
#### Install Dependencies on Alpine
44+
```shell
45+
apk add --update build-base 'cmake>3.30' libevdev libevdev-dev gdb
46+
```
47+
4348
### Step 2: Clone this repository
4449
Run:
4550
```shell
@@ -80,5 +85,5 @@ maintaining this repository.
8085
## License
8186
Copyright (C) 2025 Asami De Almeida
8287

83-
Released under the Apache License 2.0 License. See the following pages for more information:
84-
* [Apache License 2.0](LICENSE)
88+
Released under the Apache Licence 2.0 Licence. See the following pages for more information:
89+
* [Apache Licence 2.0](LICENSE)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void compute_byte() {
5151
*/
5252
void setup_subvalues_array() {
5353
for (int i = BITS_ARR_SIZE; i >= 0; i--) {
54-
constexpr u_int8_t val = 0;
54+
const u_int8_t val = 0;
5555
subvalues_arr[i] = val ^ 1 << i;
5656
}
5757
}

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
limitations under the License.
1717
*/
1818

19-
#include "StenoByte_Core.h"
19+
#include "includes/StenoByte_Core.h"
2020

2121

2222
int main() {

0 commit comments

Comments
 (0)