Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cd6b2ee
feat(ffi): add C++26 reflection FFI metadata layer and Deno bindgen
Katze719 Jun 6, 2026
83e6c24
feat: add mingw toolchain and preset
Katze719 Jun 6, 2026
78fa350
feat: implement ABI registry and status code management for serial op…
Katze719 Jun 7, 2026
6f357cd
feat: enhance status code management and introduce new status code de…
Katze719 Jun 8, 2026
22ead25
feat: add strict warning options for GCC and enhance FFI metadata wit…
Katze719 Jun 8, 2026
7abdbe4
refactor(cpp-core): remove StatusCodes aliases and tighten header layout
Katze719 Jun 8, 2026
5e1876a
refactor: simplify serial function parameters and improve type defini…
Katze719 Jun 8, 2026
9336e26
feat: add error callback support and enhance TypeScript wrapper gener…
Katze719 Jun 8, 2026
ebe892f
refactor: update README for clarity and structure, enhancing API cont…
Katze719 Jun 10, 2026
2ec39ae
feat: add CI workflow for build and testing, and update Doxygen confi…
Katze719 Jun 10, 2026
5360e87
fix: update CI workflow to use Ubuntu 24.04 and ensure GCC 16 install…
Katze719 Jun 10, 2026
aeb05f6
fix: update static assert for reflection implementation version
Katze719 Jun 10, 2026
7351f93
feat: make glue code more genereic
Katze719 Jun 11, 2026
a3db4cf
chore: rename workflow and compile test files
Katze719 Jun 11, 2026
cea69ad
chore: update checkout actions to v6
Katze719 Jun 11, 2026
acefbcf
remove: codegen
Katze719 Jun 15, 2026
64d3d47
feat: implement GCC reflection support and enhance SerialConfig valid…
Katze719 Jun 15, 2026
7332e82
feat: add GitHub Actions workflow for compile checks
Katze719 Jun 15, 2026
79d9664
feat: add support for optional FFI AST export with clang++
Katze719 Jun 16, 2026
f5fdaa9
feat: add slim JSON output for FFI API metadata and update CMake conf…
Katze719 Jun 16, 2026
b1d7362
refactor: remove GCC version checks from CMakeLists.txt
Katze719 Jun 16, 2026
51525a6
refactor: standardize JSON key naming in FFI API metadata
Katze719 Jun 16, 2026
438c055
docs: update README to reflect current FFI generation workflow with c…
Katze719 Jun 16, 2026
e1b78f2
Update .github/workflows/compile_checks.yml
Katze719 Jun 17, 2026
eb92664
Update .github/workflows/doxygen.yml
Katze719 Jun 17, 2026
52cc43e
Update .github/workflows/doxygen.yml
Katze719 Jun 17, 2026
1cf05d7
Update .github/workflows/doxygen.yml
Katze719 Jun 17, 2026
8e8bfa8
refactor: update CI workflows and improve test coverage for reflectio…
Katze719 Jun 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/compile_checks.yml
Comment thread
Katze719 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Compile Checks'

on:
push:
branches:
- '*'
pull_request:
workflow_dispatch:

jobs:
compile_checks:
name: 'Compile checks'
runs-on: ubuntu-24.04

steps:
- name: 'Checkout repository'
uses: actions/checkout@v6

- name: 'Install GCC 16.1 toolchain'
run: |
sudo apt-get update -qq
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -qq
sudo apt-get install -y gcc-16 g++-16 ninja-build cmake

- name: 'Show toolchain versions'
run: |
cmake --version
ninja --version
gcc-16 --version
g++-16 --version

- name: 'Configure CMAKE'
run: |
cmake -S . -B build/ci -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=gcc-16 \
-DCMAKE_CXX_COMPILER=g++-16

- name: 'Build compile checks'
run: |
cmake --build build/ci --target cpp_core_compile_tests

- name: 'Run CTest if registered tests exist'
run: |
ctest --test-dir build/ci --output-on-failure --no-tests=ignore
Comment thread
Katze719 marked this conversation as resolved.
31 changes: 18 additions & 13 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,48 @@ on:
paths:
- 'include/**'
- 'Doxyfile'
- 'README.md'
- 'LICENSE'
- '.github/workflows/doxygen.yml'
workflow_dispatch:

# Required for GitHub Pages deployment
permissions:
contents: write
pages: write
id-token: write
contents: read
pages: write
id-token: write

jobs:
build-docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: 'Build Doxygen HTML'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Checkout repository'
uses: actions/checkout@v6

- name: Install Doxygen + Graphviz
- name: 'Install Doxygen + Graphviz'
run: |
sudo apt-get update -qq
sudo apt-get install -y doxygen graphviz

- name: Generate documentation
- name: 'Generate documentation'
run: |
doxygen -v
doxygen Doxyfile

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
- name: 'Upload Pages artifact'
uses: actions/upload-pages-artifact@v5
with:
path: docs/html

deploy:
needs: build-docs
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: 'Deploy to GitHub Pages'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
- name: 'Deploy'
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
160 changes: 142 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ cmake_minimum_required(VERSION 3.30)
# Export compile commands to root directory
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(cpp-core LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_MODULE_STD 26)
set(CMAKE_CXX_MODULE_EXTENSIONS OFF)

option(CPP_CORE_ENABLE_AST_EXPORT "Enable clang-based JSON AST export for the FFI headers" ON)
set(
CPP_CORE_AST_JSON_OUTPUT
"${CMAKE_BINARY_DIR}/ast/cpp_core_ffi_ast.json"
CACHE FILEPATH
"Output path for the generated FFI AST JSON file"
)
set(
CPP_CORE_AST_CLANGXX
""
CACHE FILEPATH
"Path to the clang++ executable used for AST JSON export"
)
set(
CPP_CORE_AST_SLIM_JSON_OUTPUT
"${CMAKE_BINARY_DIR}/ast/cpp_core_ffi_api.json"
CACHE FILEPATH
"Output path for the reduced FFI API JSON metadata"
)

include(cmake/CPM.cmake)

CPMAddPackage(
Expand All @@ -18,17 +46,28 @@ include(${cmake-git-versioning_SOURCE_DIR}/cmake/cmake-git-versioning.cmake)
get_git_version_info()
generate_git_version(OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/cpp_core)

project(
cpp-core
VERSION "${GIT_VERSION_MAJOR}.${GIT_VERSION_MINOR}.${GIT_VERSION_PATCH}"
DESCRIPTION "Cross-platform helper library shared by cpp-linux-bindings and cpp-windows-bindings"
LANGUAGES CXX
)
set(PROJECT_VERSION "${GIT_VERSION_MAJOR}.${GIT_VERSION_MINOR}.${GIT_VERSION_PATCH}")
set(PROJECT_DESCRIPTION "Cross-platform helper library shared by cpp-linux-bindings and cpp-windows-bindings")

# Header-only library --------------------------------------------------------
add_library(cpp_core INTERFACE)
add_library(cpp_core::cpp_core ALIAS cpp_core)

add_library(cpp_core_strict_warnings INTERFACE)

target_compile_options(
cpp_core_strict_warnings
INTERFACE
-Wall
-Wextra
-Wpedantic
-Wconversion
-Wsign-conversion
-Wshadow
-Wundef
-Werror
)

# Public include directories
target_include_directories(
cpp_core
Expand All @@ -37,23 +76,100 @@ target_include_directories(
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

# Set C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Require C++23
target_compile_features(cpp_core INTERFACE cxx_std_23)
target_compile_options(cpp_core INTERFACE -freflection)

# Enable C++23 module support
set(CMAKE_CXX_MODULE_STD 23)
set(CMAKE_CXX_MODULE_EXTENSIONS OFF)
target_compile_features(cpp_core INTERFACE cxx_std_26)

include(CTest)

if(BUILD_TESTING)
add_library(cpp_core_status_code_compile_test OBJECT tests/status_code_compile_test.cpp)
target_link_libraries(cpp_core_status_code_compile_test PRIVATE cpp_core::cpp_core)
file(
GLOB_RECURSE CPP_CORE_COMPILE_TEST_SOURCES
CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.test.cpp"
)
add_library(cpp_core_compile_tests OBJECT ${CPP_CORE_COMPILE_TEST_SOURCES})
target_link_libraries(cpp_core_compile_tests PRIVATE cpp_core::cpp_core)
target_link_libraries(cpp_core_compile_tests PRIVATE cpp_core_strict_warnings)
endif()

if(CPP_CORE_ENABLE_AST_EXPORT)
find_package(Python3 COMPONENTS Interpreter REQUIRED)

file(
GLOB _cpp_core_ast_interface_headers
CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/include/cpp_core/interface/*.h"
)

set(
_cpp_core_ast_headers
"${CMAKE_CURRENT_SOURCE_DIR}/include/cpp_core/serial.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/cpp_core/error_callback.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/cpp_core/module_api.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/cpp_core/version.hpp"
${_cpp_core_ast_interface_headers}
)

if(CPP_CORE_AST_CLANGXX)
set(_cpp_core_ast_clangxx "${CPP_CORE_AST_CLANGXX}")
else()
find_program(_cpp_core_ast_clangxx NAMES clang++)
endif()

if(NOT _cpp_core_ast_clangxx)
message(
FATAL_ERROR
"CPP_CORE_ENABLE_AST_EXPORT=ON requires clang++. "
"Install clang++ or set CPP_CORE_AST_CLANGXX to an explicit path."
)
endif()

set(_cpp_core_ast_wrapper "${CMAKE_CURRENT_BINARY_DIR}/ast/cpp_core_ffi_ast.cpp")
get_filename_component(_cpp_core_ast_json_dir "${CPP_CORE_AST_JSON_OUTPUT}" DIRECTORY)
get_filename_component(_cpp_core_ast_slim_json_dir "${CPP_CORE_AST_SLIM_JSON_OUTPUT}" DIRECTORY)

file(
GENERATE
OUTPUT "${_cpp_core_ast_wrapper}"
CONTENT "#include <cpp_core/serial.h>\n"
)

add_custom_command(
OUTPUT "${CPP_CORE_AST_JSON_OUTPUT}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${_cpp_core_ast_json_dir}"
COMMAND
${CMAKE_COMMAND}
-DCPP_CORE_AST_CLANGXX=${_cpp_core_ast_clangxx}
-DCPP_CORE_AST_INCLUDE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/include
-DCPP_CORE_AST_OUTPUT=${CPP_CORE_AST_JSON_OUTPUT}
-DCPP_CORE_AST_SOURCE=${_cpp_core_ast_wrapper}
-DCPP_CORE_AST_STANDARD=${CMAKE_CXX_STANDARD}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/export_ast_json.cmake
DEPENDS "${_cpp_core_ast_wrapper}" ${_cpp_core_ast_headers}
COMMENT "Exporting FFI header AST JSON with clang++"
VERBATIM
)

add_custom_command(
OUTPUT "${CPP_CORE_AST_SLIM_JSON_OUTPUT}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${_cpp_core_ast_slim_json_dir}"
COMMAND
"${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/tools/clang_ast_to_ffi_json.py"
--input "${CPP_CORE_AST_JSON_OUTPUT}"
--output "${CPP_CORE_AST_SLIM_JSON_OUTPUT}"
--source-root "${CMAKE_CURRENT_SOURCE_DIR}"
--public-header "cpp_core/serial.h"
DEPENDS
"${CPP_CORE_AST_JSON_OUTPUT}"
"${CMAKE_CURRENT_SOURCE_DIR}/tools/clang_ast_to_ffi_json.py"
COMMENT "Reducing clang AST JSON to compact FFI API metadata"
VERBATIM
)

add_custom_target(cpp_core_ast_raw_json DEPENDS "${CPP_CORE_AST_JSON_OUTPUT}")
add_custom_target(cpp_core_ast_slim_json DEPENDS "${CPP_CORE_AST_SLIM_JSON_OUTPUT}")
endif()

# Install rules --------------------------------------------------------------
Expand All @@ -69,6 +185,14 @@ install(
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(CPP_CORE_ENABLE_AST_EXPORT)
install(
FILES "${CPP_CORE_AST_SLIM_JSON_OUTPUT}"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cpp_core
OPTIONAL
)
endif()

# CMake package configuration ------------------------------------------------
include(CMakePackageConfigHelpers)

Expand Down
23 changes: 23 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
"value": "x64",
"strategy": "external"
}
},
{
"name": "mingw",
"displayName": "MinGW-w64 (cross)",
"description": "Cross-compile for Windows using MinGW-w64",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/mingw",
"toolchainFile": "${sourceDir}/cmake/mingw-toolchain.cmake",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -77,6 +88,18 @@
"displayName": "MSVC Release",
"configurePreset": "msvc",
"configuration": "Release"
},
{
"name": "mingw-debug",
"displayName": "MinGW Debug",
"configurePreset": "mingw",
"configuration": "Debug"
},
{
"name": "mingw-release",
"displayName": "MinGW Release",
"configurePreset": "mingw",
"configuration": "Release"
}
]
}
4 changes: 2 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PROJECT_NAME = "cpp-core"
PROJECT_BRIEF = "Header-only C++ helper library"
PROJECT_NUMBER = "1.0"
OUTPUT_DIRECTORY = docs/html
OUTPUT_DIRECTORY = docs
CREATE_SUBDIRS = NO

# Build options ----------------------------------------------------------
Expand All @@ -22,7 +22,7 @@ RECURSIVE = YES

# HTML output ------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = .
HTML_OUTPUT = html
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
Expand Down
Loading