feat(cpp/core): añadir layout_storage publico (SQLite-backed LayoutCallbacks)
API publica con handle opaco LayoutStorage* que envuelve la persistencia
de layouts ImGui en SQLite. Cualquier app puede obtener un LayoutCallbacks
listo para app_menubar/layouts_menu_items con dos llamadas:
auto* st = fn_ui::layout_storage_open("app.db");
fn_ui::LayoutCallbacks cb;
fn_ui::layout_storage_make_callbacks(st, cb);
Tabla SQLite imgui_layouts(name, ini, updated_at) creada con
CREATE TABLE IF NOT EXISTS para no chocar con tablas pre-existentes.
fn_framework ahora enlaza SQLite::SQLite3 para que cualquier app que use
el framework herede acceso a layout_storage sin trabajo extra.
This commit is contained in:
+18
-16
@@ -91,6 +91,22 @@ endif()
|
||||
|
||||
target_link_libraries(imgui PUBLIC ${PLATFORM_LIBS})
|
||||
|
||||
# --- SQLite3 (shared by every app that uses it, including fn_framework for
|
||||
# layout_storage) ---
|
||||
# System on Linux, vendored amalgamation on Windows cross-compile.
|
||||
find_package(SQLite3 QUIET)
|
||||
if(NOT SQLite3_FOUND AND NOT TARGET sqlite3_vendored)
|
||||
set(SQLITE3_AMALG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite3)
|
||||
add_library(sqlite3_vendored STATIC ${SQLITE3_AMALG_DIR}/sqlite3.c)
|
||||
target_include_directories(sqlite3_vendored PUBLIC ${SQLITE3_AMALG_DIR})
|
||||
target_compile_definitions(sqlite3_vendored PRIVATE
|
||||
SQLITE_THREADSAFE=1
|
||||
SQLITE_ENABLE_FTS5
|
||||
SQLITE_ENABLE_JSON1
|
||||
)
|
||||
add_library(SQLite::SQLite3 ALIAS sqlite3_vendored)
|
||||
endif()
|
||||
|
||||
# --- Framework ---
|
||||
# Incluye tokens.cpp (identidad visual Mantine dark + indigo), icon_font.cpp
|
||||
# (Karla/Roboto/... + Tabler), app_settings.cpp (persistencia y ventana de
|
||||
@@ -105,6 +121,7 @@ add_library(fn_framework STATIC
|
||||
functions/core/panel_menu.cpp
|
||||
functions/core/layouts_menu.cpp
|
||||
functions/core/app_menubar.cpp
|
||||
functions/core/layout_storage.cpp
|
||||
)
|
||||
target_include_directories(fn_framework PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/framework
|
||||
@@ -115,7 +132,7 @@ target_include_directories(fn_framework PUBLIC
|
||||
target_compile_definitions(fn_framework PUBLIC
|
||||
FN_CPP_ROOT="${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
target_link_libraries(fn_framework PUBLIC imgui implot implot3d)
|
||||
target_link_libraries(fn_framework PUBLIC imgui implot implot3d SQLite::SQLite3)
|
||||
if(TRACY_ENABLE)
|
||||
target_link_libraries(fn_framework PUBLIC tracy)
|
||||
endif()
|
||||
@@ -154,21 +171,6 @@ function(add_imgui_app target)
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# --- SQLite3 (shared by every app that uses it) ---
|
||||
# System on Linux, vendored amalgamation on Windows cross-compile.
|
||||
find_package(SQLite3 QUIET)
|
||||
if(NOT SQLite3_FOUND AND NOT TARGET sqlite3_vendored)
|
||||
set(SQLITE3_AMALG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite3)
|
||||
add_library(sqlite3_vendored STATIC ${SQLITE3_AMALG_DIR}/sqlite3.c)
|
||||
target_include_directories(sqlite3_vendored PUBLIC ${SQLITE3_AMALG_DIR})
|
||||
target_compile_definitions(sqlite3_vendored PRIVATE
|
||||
SQLITE_THREADSAFE=1
|
||||
SQLITE_ENABLE_FTS5
|
||||
SQLITE_ENABLE_JSON1
|
||||
)
|
||||
add_library(SQLite::SQLite3 ALIAS sqlite3_vendored)
|
||||
endif()
|
||||
|
||||
# --- Function libraries (headers for composition) ---
|
||||
# Functions are compiled as part of apps that use them via add_imgui_app.
|
||||
# Each function is a .h/.cpp pair included by the app's CMakeLists.txt.
|
||||
|
||||
Reference in New Issue
Block a user