Files
logos-cpp-sdk/nix/bin.nix
Dario LipicarandClaude Opus 4.8 1bc101df1f feat: cpp-generator consumes logos-lidl; delete embedded frontend (#89)
* feat: cpp-generator consumes logos-lidl; delete embedded frontend

The canonical LIDL frontend now lives in logos-lidl. cpp-generator links it
and keeps only the C++/Qt-specific parts (impl-header parsing, the gen_client/
gen_cdylib backends, the Qt type-name mapping).

- Delete the embedded lidl_lexer/parser/serializer/validator/ast.
- Add experimental/lidl_compat.h: brings logos-lidl's std AST into the global
  scope the backends use (via `using`), a qs() std::string→QString helper, a
  QTextStream<<std::string overload, and name-compatible shims (lidlParse/
  lidlSerialize/lidlValidate) so the emission code keeps compiling.
- Re-point impl_header_parser, lidl_gen_client (+ Doxygen /// docs on the
  generated client methods), lidl_gen_cdylib, lidl_emit_common, and legacy/
  main at lidl::ModuleDecl.
- CMake: C++17 + find_package(logos-lidl) + link logos-lidl::logos_lidl.
- bin.nix: distribute only the shared C++/Qt backend helpers (compat +
  impl_header_parser + emit_common) under share/lidl-frontend, not the frontend.
- tests: drop the 4 frontend test files (covered by logos-lidl now); the
  backend tests link logos-lidl.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: pin logos-lidl to the C-ABI commit + lock it

The logos-lidl input was declared in flake.nix but missing from flake.lock,
so override chains that don't reach the nested input (the doctest harness
building a scaffolded module) couldn't resolve it. Pin the branch rev and
lock it so the component is self-contained. Re-point at master once logos-lidl
lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: re-point logos-lidl to merged master (#5)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 21:00:42 -03:00

55 lines
1.8 KiB
Nix

# Builds the logos-cpp-generator binary
{ pkgs, common, src, logos-protocol, logos-lidl }:
pkgs.stdenv.mkDerivation {
pname = "${common.pname}-generator";
version = common.version;
inherit src;
inherit (common) nativeBuildInputs cmakeFlags meta;
# logos-lidl provides the canonical LIDL frontend the generator links
# (find_package(logos-lidl) in cpp-generator/CMakeLists.txt).
buildInputs = common.buildInputs ++ [ logos-lidl ];
# Skip default configure phase since we do it in buildPhase
dontUseCmakeConfigure = true;
buildPhase = ''
runHook preBuild
# Build generator
mkdir -p build-generator
cd build-generator
cmake ../cpp-generator -GNinja -DLOGOS_PROTOCOL_ROOT=${logos-protocol} $cmakeFlags
ninja
cd ..
runHook postBuild
'';
installPhase = ''
runHook preInstall
# Install generator binary
mkdir -p $out/bin
if [ -f build-generator/bin/logos-cpp-generator ]; then
cp build-generator/bin/logos-cpp-generator $out/bin/
fi
# Shared C++/Qt codegen backend helpers for logos-qt-sdk's
# logos-qt-generator: the Qt type-name mapping (lidl_emit_common), the
# C++ impl-header source parser, and the compat shim that bridges them
# onto the canonical logos-lidl AST. The frontend itself (lexer/parser/
# AST/serializer/validator) is NOT distributed here — both generators
# link logos-lidl for it.
mkdir -p $out/share/lidl-frontend
cp cpp-generator/experimental/lidl_compat.h \
cpp-generator/experimental/impl_header_parser.h cpp-generator/experimental/impl_header_parser.cpp \
cpp-generator/experimental/lidl_emit_common.h cpp-generator/experimental/lidl_emit_common.cpp \
$out/share/lidl-frontend/
runHook postInstall
'';
}