Skip to content

Commit

Permalink
Update 6 (#6)
Browse files Browse the repository at this point in the history
- gitlab CI configuration files
- Windows utilities
- Android app
- marimo notebook
- improved docs
  • Loading branch information
SebastianBach committed Apr 27, 2024
1 parent 57c34e7 commit dd6eaca
Show file tree
Hide file tree
Showing 86 changed files with 1,963 additions and 150 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build
scripts
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: mkdir build

- name: CMake
run: cmake -DADD_PYTHON_MODULE=ON -DADD_RUST_APP=ON -DBUILD_COVERAGE=ON -DADD_SCRIPT_TOOLS=ON ..
run: cmake -DADD_BASIC_TOOLS=ON -DADD_SDK=ON -DADD_C_LIB=ON -DADD_DYNAMIC_LIB=ON -DADD_PYTHON_MODULE=ON -DADD_RUST_APP=ON -DADD_SCRIPT_TOOLS=ON -DBUILD_COVERAGE=ON ..
working-directory: ./build

- name: build
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
run: mkdir build

- name: CMake
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DADD_PYTHON_MODULE=ON -DADD_RUST_APP=ON -DADD_QT_APP=ON -DADD_PY_DOCS=ON -DADD_LIB_DOCS=ON -DADD_ASSEMBLY_PROGRAM=ON -DADD_SCRIPT_TOOLS=ON ..
run: cmake -DCMAKE_BUILD_TYPE=Release -DADD_BASIC_TOOLS=ON -DADD_SDK=ON -DADD_C_LIB=ON -DADD_DYNAMIC_LIB=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DADD_PYTHON_MODULE=ON -DADD_RUST_APP=ON -DADD_QT_APP=ON -DADD_PY_DOCS=ON -DADD_SDK_DOCS=ON -DADD_ASSEMBLY_PROGRAM=ON -DADD_SCRIPT_TOOLS=ON ..
working-directory: ./build

- name: build
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
run: mkdir build

- name: CMake
run: cmake -DADD_SCRIPT_TOOLS=ON -DBUILD_ASAN=ON ..
run: cmake -DADD_BASIC_TOOLS=ON -DADD_SDK=ON -DADD_SCRIPT_TOOLS=ON -DADD_C_LIB=ON -DADD_DYNAMIC_LIB=ON -DBUILD_ASAN=ON ..
working-directory: ./build

- name: build
Expand Down
7 changes: 7 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include: '/gitlab/ci.yml'






61 changes: 48 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

option(ADD_PYTHON_MODULE "Include the Python Module" OFF)
option(ADD_BASIC_TOOLS "Include basic commandline tools." OFF)
option(ADD_SDK "Include static library with documentation and examples." OFF)
option(ADD_C_LIB "Include a static library with C interface." OFF)
option(ADD_DYNAMIC_LIB "Include a dynamic library." OFF)
option(ADD_PYTHON_MODULE "Include the Python module." OFF)
option(ADD_PY_DOCS "Include Python module documentation." OFF)
option(ADD_RUST_APP "Include the Rust cmdl app." OFF)
option(ADD_RUST_APP "Include the Rust cmdl app. Requires the C library." OFF)
option(ADD_JAVA_APP "Include the Java command line app." OFF)
option(ADD_LIB_DOCS "Include C++ library documentation." OFF)
option(ADD_QT_APP "Include the Qt UI App." OFF)
option(ADD_SDK_DOCS "Include C++ library documentation." OFF)
option(ADD_QT_APP "Include the Qt UI App. Requires the SDK." OFF)
option(ADD_SCRIPT_TOOLS "Include script tools." OFF)
option(ADD_ASSEMBLY_PROGRAM "Include ASM program." OFF)
option(ADD_ASSEMBLY_PROGRAM "Include ASM program. Requires the C library." OFF)

if(WIN32)
option(ADD_WIN_TOOLS "Include Windows Utilities" OFF)
endif()

project(full_stack CXX)
enable_testing()
Expand All @@ -29,13 +37,29 @@ endif()
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})

file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/lib)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/header)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/example)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/tools)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/dynamic_lib)

if(ADD_SDK)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/lib)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/header)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/example)
endif()

if(ADD_DYNAMIC_LIB)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/dynamic_lib)
endif()

file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/web)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/android)

if(ADD_BASIC_TOOLS)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/tools)
endif()

if(ADD_WIN_TOOLS)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/win)
endif()

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/wasm)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp/cppcheck)
Expand All @@ -46,7 +70,7 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp/doxygen)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib_example_build)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/script_compiler)

if(ADD_ASSEMBLY_PROGRAM)
if(ADD_ASSEMBLY_PROGRAM AND ADD_C_LIB)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/asm)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/temp/asm)
endif()
Expand All @@ -60,7 +84,7 @@ if(ADD_QT_APP)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/app)
endif()

if(ADD_LIB_DOCS)
if(ADD_SDK_DOCS)
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/product/lib/documentation)
endif()

Expand Down Expand Up @@ -117,6 +141,17 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
endif()


option(BUILD_VALGRIND "Valgrind Testing" OFF)

if(BUILD_VALGRIND)
message(STATUS "build for Valgrind testing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-leak-kinds=all --track-origins=yes --suppressions=${PROJECT_SOURCE_DIR}/valgrind.supp")
include(CTest)
endif()

endif()

add_subdirectory(src)
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# see https://docs.docker.com/build/building/multi-stage/

FROM gcc:12.2.0 AS builder
# https://hub.docker.com/_/gcc
FROM gcc:13.2.0 AS builder

RUN apt-get update && apt-get -y install cmake protobuf-compiler

Expand Down
76 changes: 16 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ The *full stack* contains:
* A Python module implemented using the Python C API.
* A unit test that tests this module.
* A *Sphinx* documentation for this module.
* A *Jupyter Notebook* showing how to use this module.
* A *Jupyter notebook* showing how to use this module.
* A *marimo* notebook using this module.
* A Python UI application that uses this module.
* A WebAssembly binary library and associated JavaScript code.
* An HTML/JavaScript frontend that uses the above WebAssembly library.
Expand All @@ -42,14 +43,18 @@ The *full stack* contains:
* A Python-based IDE front-end for this script interpreter.
* A compiler that converts scripts in the custom scripting language into bytecode.
* A runtime that executes this bytecode.
* A converter that creates Python or C++ code based on a given script written in the custom scripting language.
* A transcompiler that creates Python or C++ code based on a given script written in the custom scripting language.
* A C-wrapper library for the C++ function.
* A unit test that tests this C-wrapper library.
* A program written in Assembly language that utilizes this C-wrapper library.
* A *Rust* command line tool calling the C-wrapper library function.
* A Java Native Interface Library to extend Java.
* A unit test for that library.
* A *Java* command line tool using that library.
* A *Windows* utility library.
* A unit test for this utility library.
* A *Windows* system tray app using the utility library.
* An *Android* app.

```mermaid
flowchart LR;
Expand Down Expand Up @@ -90,6 +95,7 @@ The *full stack* contains:
PY --> PYTEST[Python Module Unit Test]
PY --> SPHINX(Sphinx Documentation)
PY --> NOTEBOOK[Jupyter Notebook]
PY --> MARIMO[Marimo Notebook]
PY --> PYAPP[Python UI App]
F --> WASM(WebAssembly + JavaScript)
Expand All @@ -104,7 +110,7 @@ The *full stack* contains:
SCRIPT_INTERPRETER --> SCRIPT_IDE[IDE]
SCRIPTLIB --> SCRIPT_COMPILER[Compiler]
SCRIPTLIB --> SCRIPT_RUNTIME[Runtime]
SCRIPTLIB --> SCRIPT_CONVERT[Converter]
SCRIPTLIB --> SCRIPT_CONVERT[Transcompiler]
F --> CWRAPPER(C Wrapper Lib)
CWRAPPER --> CWRAPPER_TEST[C Wrapper Unit Test]
Expand All @@ -114,68 +120,18 @@ The *full stack* contains:
F --> JAVA_LIB(Java Native Interface Library)
JAVA_LIB --> JAVA_UNIT_TEST[Java Unit Test]
JAVA_LIB --> JAVA_APP[Java CLI Tool]
```


# Dependencies
* Native execution of the web app and other Python apps requires requires Python 3.8+.
* Python module creation requires Python installation with Python C API dependencies.
* *docker* to containerize the web app and to build the WebAssembly library.
* *conan* to build the *conan* package.
* *Qt5* to build the C++ Qt UI app.
* *Rust* to build the Rust app.
* *Java* to build Java command line tool.


# Build
F --> WIN_LIB(Windows Utility Library)
WIN_LIB --> WIN_LIB_TEST[Library Unit Test]
WIN_LIB --> WIN_TRAY[Windows System Tray Tool]
To build and test everything:

```
# build all C++ products
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DADD_PYTHON_MODULE=ON -DADD_QT_APP=ON -DADD_RUST_APP=ON -DADD_PY_DOCS=ON -DADD_LIB_DOCS=ON -DADD_JAVA_APP=ON -DADD_SCRIPT_TOOLS=ON -DADD_ASSEMBLY_PROGRAM=ON ..
cmake --build . -j --config Release
ctest -C Release -VV
cmake --install .
# test lib example project
cd lib_example_build
cmake ../product/lib/example
cmake --build . --config Release
ctest -C Release -VV
cd ..
cd ..
# build web app container
docker build --tag title-case-web .
# build and test conan package
conan export-pkg .
conan list text_conversion
conan test ./src/test_package text_conversion/0.1.1
# build WebAssembly library
./build_wasm.sh
F --> ANDROID[Android App]
```

The collection of deliverables can be found in ```build/product```.

CMake options are:

- **ADD_PYTHON_MODULE**: To build the Python module (requires Python C API).
- **ADD_PY_DOCS**: To build the Python documentation (requires Sphinx).
- **ADD_LIB_DOCS**: To build the C++ library documentation (requires doxygen).
- **ADD_QT_APP**: To build a Qt5 UI app (requires Qt5).
- **ADD_RUST_APP**: To build the Rust command line tool (requires Rust).
- **ADD_JAVA_APP**: To build the Java command line tool (requires Java).
- **ADD_SCRIPT_TOOLS**: To build the script tools.
- **ADD_ASSEMBLY_PROGRAM**: To build the Assembly program.
# Build

See also ```.github/workflows/build.yml```.
See the [build instructions](doc/build.md) on how to build the included software.

# Usage

See the [user guide](user_guide.md) on how to use the included software.
See the [user guide](doc/user_guide.md) on how to use the included software.
11 changes: 0 additions & 11 deletions changelog.md

This file was deleted.

Loading

0 comments on commit dd6eaca

Please sign in to comment.