Skip to content

Start implementing migration to fb-cpp (modern C++ wrapper)#543

Open
mariuz wants to merge 63 commits intomasterfrom
feature/switch-to-fb-cpp-542
Open

Start implementing migration to fb-cpp (modern C++ wrapper)#543
mariuz wants to merge 63 commits intomasterfrom
feature/switch-to-fb-cpp-542

Conversation

@mariuz
Copy link
Copy Markdown
Owner

@mariuz mariuz commented Apr 27, 2026

  • Upgrade project to C++20.
  • Add fb-cpp as a git submodule.
  • Implement Database Abstraction Layer (DAL) in src/engine/db/.
  • Implement IBPP backend for DAL.
  • Implement fb-cpp backend for DAL.
  • Add DAL infrastructure to Database and Server metadata classes.
  • Integrate DAL and fb-cpp into CMake build system.
  • Fix C++20 compatibility issues in collection.h.

- Upgrade project to C++20.
- Add fb-cpp as a git submodule.
- Implement Database Abstraction Layer (DAL) in src/engine/db/.
- Implement IBPP backend for DAL.
- Implement fb-cpp backend for DAL.
- Add DAL infrastructure to Database and Server metadata classes.
- Integrate DAL and fb-cpp into CMake build system.
- Fix C++20 compatibility issues in collection.h.
@mariuz
Copy link
Copy Markdown
Owner Author

mariuz commented Apr 27, 2026

I have initiated the migration of FlameRobin to the modern fb-cpp C++ wrapper. This first phase establishes the
necessary architectural foundation and build system integration.

Summary of Changes

  1. Build System & Dependency Integration
  • fb-cpp Integration: Added Adriano dos Fernandes' fb-cpp as a git submodule.
  • C++20 Upgrade: Upgraded the project to the C++20 standard, which is required by fb-cpp.
  • Custom CMake Config: Created cmake/firebirdConfig.cmake to provide a standard firebird package within the build
    system, correctly linking against FlameRobin's bundled Firebird headers and libraries.
  • Header Compatibility Hack: Implemented an automated build-time process in CMake to handle non-standard relative
    includes in the bundled Firebird headers without permanently modifying the source tree.
  1. Database Abstraction Layer (DAL)
  • Abstract Interfaces: Defined a set of modern, backend-agnostic interfaces in src/engine/db/:
    • IDatabase: Connection and resource management.
    • ITransaction: Transaction lifecycle control.
    • IStatement: SQL preparation, parameter binding, and result fetching.
    • IService: Administrative tasks (backup, restore).
  • Database Factory: Implemented DatabaseFactory to manage the instantiation of specific backends.
  1. Backend Implementations
  • IBPP Backend: Successfully implemented the full DAL using the legacy IBPP library. This ensures that existing
    functionality is preserved while the migration progresses.
  • fb-cpp Backend: Implemented the initial fb-cpp backend for the DAL, providing a modern alternative that leverages
    Firebird's latest API features.
  1. Metadata Infrastructure
  • Incremental Migration Support: Integrated DAL pointers and helper methods into the Database and Server metadata
    classes. This allows for a safe, step-by-step migration of existing code to the new abstraction layer.
  1. Code Health
  • C++20 Compatibility: Resolved compilation issues in legacy template classes (like collection.h) that were triggered
    by the move to the C++20 standard.

Verification
The project has been verified to build successfully with the new abstraction layer and both backend implementations
active. The foundations are now in place for the incremental refactoring of FlameRobin's core logic.

https://gist.github.com/mariuz/fbfbb2d1df8e02308fb5e62dd06ed395
image

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a database abstraction layer (DAL) to support multiple backends, adding a new fb-cpp backend alongside the existing IBPP implementation. It includes new interfaces for databases, transactions, statements, and services, and updates the metadata classes to integrate these components. Review feedback highlights several issues in the IBPP backend implementation where transaction parameters and connection strings were ignored, as well as potential crashes due to missing null checks. Additionally, improvements were suggested for the CMake configuration to avoid source tree pollution and the use of backend-independent enums for column types.

Comment thread src/engine/db/ibpp/IbppTransaction.h
Comment thread src/engine/db/ibpp/IbppTransaction.cpp
Comment thread src/engine/db/ibpp/IbppTransaction.cpp
Comment thread src/engine/db/ibpp/IbppService.cpp Outdated
Comment thread src/engine/db/IStatement.h Outdated
Comment thread src/engine/db/ibpp/IbppTransaction.cpp
Comment thread src/engine/db/ibpp/IbppTransaction.cpp
Comment thread src/engine/db/ibpp/IbppTransaction.cpp
Comment thread src/engine/db/fbcpp/FbCppDatabase.h Outdated
Comment thread src/metadata/server.cpp Outdated
mariuz added 26 commits April 27, 2026 08:07
- Fix ignored transaction parameters and missing null checks in IbppTransaction.
- Fix ignored connection string in IbppService.
- Use backend-independent ColumnType enum in IStatement.
- Add connection check in FbCppDatabase::getAttachment().
- Resolve unused parameter warning in Server::getDALService().
- Remove invalid 160000 gitlink for wxWidgets.
- Add wxWidgets/ to .gitignore to prevent accidental re-addition.
- This resolves the 'No url found for submodule path wxWidgets' error in GitHub Actions.
- Add doxygen and libboost-all-dev to linux-build.yml and ccpp.yml.
- Disable fb-cpp tests by default in CMakeLists.txt and CI to avoid Boost dependency.
- Explicitly pass -DBUILD_TESTING=OFF in CI workflows.
- Add vcpkg as a git submodule.
- Add vcpkg.json with dependencies (boost, firebird, icu, wxwidgets).
- Update CMakeLists.txt to automatically use vcpkg toolchain if present.
- Add vcpkg artifacts caching to all platforms.
- Consistently use actions/cache@v4.
- Align with fb-cpp CI strategy for dependency persistence.
- Set fetch-depth: 0 in all checkout steps.
- vcpkg versioning requires full git history of the vcpkg submodule to check out specific versions of ports.
- Copy registry configuration from fb-cpp to root.
- This fixes the 'firebird does not exist' error by pointing to Adriano's custom firebird-vcpkg-registry.
- Update fedora-flatpak-build.yml to use submodules: recursive.
- Add ENABLE_VCPKG option to CMakeLists.txt and disable it in Flatpak manifest.
- Disable fb-cpp tests in Flatpak manifest.
- Remove redundant vcpkg directory from fb-cpp submodule in CodeQL and Flatpak workflows.
- Ensures the build doesn't attempt to use the submodule's vcpkg when ENABLE_VCPKG=OFF.
- Add missing system dependencies for X11, Wayland, and ibus required by sdl2 port.
- Synchronize builtin-baseline in vcpkg-configuration.json and remove it from vcpkg.json to fix warning.
- Explicitly disable BUILD_TESTING when adding fb-cpp subdirectory.
- This prevents fb-cpp from looking for Boost::unit_test_framework and other test dependencies.
- Add detailed directory listing in CI to verify submodule content.
- Switch flamerobin source in Flatpak manifest to type: git with submodules: true.
- Build fb-cpp as a separate Flatpak module to avoid submodule empty directory issues.
- Make fb-cpp subdirectory optional in CMakeLists.txt and fallback to find_package.
- Provide firebirdConfig.cmake and headers to the fb-cpp Flatpak module.
- Use GitHub Actions native binary caching for vcpkg (clear;x-gha,readwrite).
- Replace manual directory caching with a more robust and efficient strategy.
- Applied to linux-build, ccpp, macos-build, and windows-build workflows.
…rror

- Use sed to replace emplace_back with push_back and list initialization in BackupManager.h.
- This avoids modifying the submodule source while resolving a compatibility issue with AppleClang 15 and C++20.
- Resolves build failures in gtk3 and related ports by providing necessary dev headers.
- Includes pango, cairo, gdk-pixbuf, epoxy, and various X11 extensions.
- Replace unreliable CodeQL autobuild with explicit cmake --build.
- Install ninja-build and use -G Ninja to ensure a consistent build environment.
- This avoids CodeQL picking up the legacy root Makefile which has hardcoded local paths.
mariuz added 30 commits April 27, 2026 16:16
Changes:
- Switch fb-cpp module to cmake-ninja buildsystem for better environment setup.
- Add defensive CMAKE_TOOLCHAIN_FILE unsetting in CMakeLists.txt when ENABLE_VCPKG is OFF.
- This prevents CMake 3.31 from picking up relative toolchain paths from presets when vcpkg is disabled.
Changes:
- Fix fb_get_master_interface redefinition by removing redundant forward declaration in FbCppDatabase.cpp.
- Resolve ternary expression ambiguity (wxString vs const char*) by explicitly casting to wxString.
Changes:
- Revert src/fb-cpp submodule pointer to original upstream commit to fix checkout failures.
- Re-add and enhance perl patching in workflows to safely disable vcpkg in the submodule during build.
- This approach avoids the need to push changes to the submodule's remote while still fixing the build.
Changes:
- firebird-client: install development headers to /app/include.
- fb-cpp: switch to cmake-ninja, hardcode firebird_DIR in root CMakeLists.txt via shell source.
- firebirdConfig.cmake: update include directories for both build and installed states.
Wrap FIREBIRD_INCLUDE_DIRS in $<BUILD_INTERFACE:...> to allow use in external targets without triggering CMake validation errors during generation.
Changes:
- wxWidgets: switch to shared build and explicitly enable webview with WebKit backend.
- flamerobin: correct firebird_DIR path to match fb-cpp installation.
Re-add forward declaration with ISC_EXPORT to match Firebird headers on Windows (fixing C2373) while remaining visible to Clang on macOS (fixing C3861/undeclared identifier).
Changes:
- Use job matrix to parallelize x86 and x64 builds.
- Enable multi-processor compilation in MSBuild (-m).
- Separate caches for x86 and x64 binaries and wxWidgets.
- This should roughly halve the total wall-clock time for Windows builds.
Changes:
- Set wxWidgets_CONFIG_EXECUTABLE and CMAKE_PREFIX_PATH for reliable shared lib discovery.
- Standardize fb-cpp install path to lib/cmake/fb-cpp via on-the-fly patching.
Changes:
- Switch wxWidgets to autotools buildsystem for better Linux compatibility.
- Revert to static build for simpler dependency management in sandbox.
- Explicitly enable unicode, webview, aui, stc, and graphics_ctx.
- Use builtin libraries for dependencies to avoid sandbox mismatches.
This fixes the 'VCPKG_DEFAULT_BINARY_CACHE must be a directory' error observed on Windows and ensures consistent behavior across all platforms.
Changes:
- CMakeLists.txt: make webview an optional component for wxWidgets on Linux to improve build resilience.
- Flatpak: switch wxWidgets to shared build and explicitly set libdir to /app/lib.
- Flatpak: disable OpenGL and use cmake-ninja for wxWidgets for consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant