The is All Purpose Library - libap is a collection of useful procedures tailored for engineering applications.
It is written in modern C++, uses CMake as its build system, and is continuously tested across multiple environments (Linux, macOS, and Windows) via GitHub Actions.
The library is split into three main logical parts which can be selectively enabled or disabled during compilation.
- Unified Library: When compiling, parent
aplibrary target is created which bundles all object files from the selected modules into a single target. - Dependencies: The
aptarget explicitly requires the core components (AP_BASE) to be enabled. If additional modules likeUSE_FLTKorUSE_GLare toggled on, their respective source objects and interface link flags are automatically appended into this unified library.
Core engineering, mathematics, and curve generation utilities. These have no external dependencies.
- Airfoils
ap_naca: Generates geometric coordinates for 4-digit and 5-digit NACA airfoils.ap_airfoil: Reads and writes airfoil coordinates data files; interfaces with theap_nacamodule.
- Basic Math Procedures
ap_basicMath: Collection of fundamental mathematical procedures, primarily geometric.ap_vector: 3D vector algebra (Header-only implementation).ap_matrix: 3x3 matrix algebra (Header-only implementation).
- Bezier and B-Spline Curves
ap_bezier: Generates Bezier curves and provides associated geometric operations.ap_bspline: Generates B-Spline curves and provides associated geometric operations.ap_bezierAirfoil: Generates parametric airfoil geometries using Bezier curves.
- Convert & Utilities
ap_convert: Standardized, type-safe casting wrappers maintaining high precision when converting floating-point values to strings.ap_distribution: Non-linear point distribution profiles over specified distances, optimized for computational meshing procedures.
- Interprocess & Execution
ap_externalExe: Cross-platform, standardized execution of external applications and scripts (supports call abstractions, piping, and native Windows CreateProcess or POSIX forks).ap_gnuplotPipe: A streaming pipe interface directly to Gnuplot plotting software.ap_xfoil: Standard callbacks and automated execution pipelines for the XFOIL aerodynamic panel code via pipes.
- Processing & Filtering
ap_filter: A basic digital low-pass filter framework for vector data series.ap_substitute: Template-driven text file parser designed to search/replace values using markers and scrape structural results from output logs.
Optional visual wrappers and native widgets leveraging the Fast Light Toolkit GUI.
ap_flDialogs: Enhanced FLTK modal dialogs with customizable formatting to seamlessly match a parent application's styling.ap_flFilesHandling: Standardized user file-system workflows including browse dialogs, existential verification, and access permission validation.ap_glFLTKcolor: Utility mapping internal FLTK color identifiers to standard RGB profiles, useful for uniform OpenGL viewport rendering.
Vector font engines and overlays optimized for real-time graphics rendering pipeline viewports.
ap_glTechFont: A custom technical vector font drawn via low-level primitives (GL_LINES). Supports custom lineweights, colorization, scene-bound rotation vectors, and screen-space camera alignment.ap_glTextLine: A multi-character layout manager utilizingap_glTechFontto build structural lines of text inside an active OpenGL viewport context.
dox: Project documentation assets and manuals. (See the internalREADME.mdinsidedoxfor build rules).extern: Submodules and third-party dependencies managed by the repository.fltk: GUI layout library pulled optionally for UI components.googletest: Test assertion and mocking architecture.
include: Centralized structure containing the exposed public header API files.src: C++ implementation source code files.tests: Automated suite of isolated unit tests.
Clone the library to the desired directory.
git clone git@github.com:jacmie/libap.gitUpdate git submodules (gtest, FLTK):
git submodule update --init --recursiveThe library offers modular control over what gets compiled. You can selectively disable the core layer or explicitly pull optional graphics wrappers depending on your project constraints.
| CMake Option | Default | Description |
|---|---|---|
AP_BASE |
ON |
Compiles the core computational libraries (ap_base and unified ap). |
USE_FLTK |
OFF |
Compiles FLTK interface modules (ap_fl). Requires FLTK dependencies. |
USE_GL |
OFF |
Compiles OpenGL technical typography engines (ap_gl). Requires OpenGL drivers. |
BUILD_GTESTS |
OFF |
Configures and builds the automated unit test suites using GoogleTest. |
Before running scenarios that enable USE_FLTK or BUILD_GTESTS, you must handle their external dependencies. This requires either building the packaged submodules locally (refer to the documentation inside the extern directory for step-by-step instructions) or pointing CMake to valid, pre-installed versions of FLTK and GoogleTest already available on your operating system.
Compiles only the core math and computational components without any external dependencies.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j8Compiles the base components alongside the FLTK interface extensions.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_FLTK=ON
cmake --build . -j8Compiles the base components alongside the viewport font renderer modules.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_GL=ON
cmake --build . -j8Compiles all base assets, GUI layers, OpenGL typography modules, and prepares the GoogleTest execution suite.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_FLTK=ON -DUSE_GL=ON -DBUILD_GTESTS=ON
cmake --build . -j8
ctest --output-on-failureBuilds only the OpenGL typography component library, omitting the unified ap target and core base math libraries.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_GL=ON -DAP_BASE=OFF
cmake --build . -j8Builds only the FLTK addon interface libraries, skipping compilation of the core computational targets.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_FLTK=ON -DAP_BASE=OFF
cmake --build . -j8To run the tests on the project (testing the libap takes few seconds):
# from the build directory,
# additional option to make verbose output in case of failure
ctest --output-on-failureOnly the libraries and corresponding headers that were selected during the configuration are installed.
When installing, targets and headers are sorted into system-standard structural conventions:
- Libraries (
.a/.lib): Installed to${CMAKE_INSTALL_LIBDIR}(e.g.,lib/). - Headers (
.h): Copied component-by-component into${CMAKE_INSTALL_INCLUDEDIR}/ap/(e.g.,include/ap/). - CMake Interface Files: Module exports (
apTargets.cmake,apConfig.cmake) are deployed to${CMAKE_INSTALL_LIBDIR}/cmake/ap/.
You can control the installation path in three ways depending on your workflow preferences:
Installs the library directly into your operating system's standard directories (e.g., /usr/local on Linux/macOS). This usually requires root privileges.
cmake --install .Defines the installation destination during the initial configuration step. This is ideal when setting up repeatable build configurations or using package managers.
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/custom_directory
cmake --build . -j8
cmake --install .Overrides the installation destination on the fly during the actual installation step without requiring a project re-configuration.
cmake --install . --prefix /path/to/custom_directoryWhen libap is installed, it exports native CMake configuration targets. This allows downstream consumer software to look up the library components via standard find_package infrastructure.
Add the following pattern to your application's CMakeLists.txt:
# Locate the installed library and request desired modules
find_package(ap REQUIRED COMPONENTS fltk)
# Link your application against the specific exported namespace targets
add_executable(my_engineering_app main.cpp)
target_link_libraries(my_engineering_app PRIVATE ap::ap_fl)Depending on your installation architecture, the exported namespaces available for linking are:
ap::ap(Unified base target combining objects)ap::ap_base(Isolated base computational library)ap::ap_fl(Isolated FLTK component library)ap::ap_gl(Isolated OpenGL component library)