mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 22:21:16 +00:00
After the amm_module refactor, this crate is linked only by the module (the
UI delegates to modules().amm_module and links nothing), so its home under
apps/amm/ and the name "client" were both misnomers: it's the AMM business
logic the module wraps, reached across an FFI boundary — the same relationship
logos_execution_zone has with wallet_ffi. Co-locate it with the module that
owns it and name it for that role.
The FFI surface is unchanged — the exported functions are already amm_* (not
amm_client_*) — so only the crate, directory, generated header, dylib, and
package names move. The module's call sites are untouched; it just includes the
renamed header.
- apps/amm/client → modules/amm/ffi (git-tracked rename; history preserved)
- crate amm_client → amm_ffi: package name, include/amm_ffi.h, libamm_ffi.dylib,
AMM_FFI_H guard, build.rs output path, tests/public_api.rs import
- workspace member path + Cargo.lock
- flake.nix: pname, -p, header-copy path, dylib install_name, packages.amm_ffi,
ammModuleOutputs externalLibInputs, DYLD wrapper
- modules/amm: metadata external_libraries, CMakeLists EXTERNAL_LIBS, impl
#include + comments, README, flake note
- apps/amm/flake.nix: drop the now-dead amm_client external-lib input (the UI
links no external lib of its own)
Resulting layout:
modules/amm/
src/ # C++ module (amm_module_impl.{h,cpp})
ffi/ # Rust crate amm_ffi (Cargo.toml, src/, include/amm_ffi.h)
46 lines
1.5 KiB
CMake
46 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.21)
|
|
project(AmmUiPlugin LANGUAGES CXX)
|
|
|
|
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Network Qml Quick QuickControls2)
|
|
qt_standard_project_setup(REQUIRES 6.8)
|
|
|
|
include(CTest)
|
|
|
|
if(DEFINED ENV{LOGOS_MODULE_BUILDER_ROOT})
|
|
include($ENV{LOGOS_MODULE_BUILDER_ROOT}/cmake/LogosModule.cmake)
|
|
else()
|
|
message(FATAL_ERROR "LogosModule.cmake not found. Set LOGOS_MODULE_BUILDER_ROOT.")
|
|
endif()
|
|
|
|
set(LOGOS_WALLET_SOURCE_DIR
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../shared/wallet"
|
|
CACHE PATH "Path to the shared Logos wallet module"
|
|
)
|
|
set(LOGOS_WALLET_GENERATED_DIR
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/generated_code"
|
|
CACHE PATH "Path to generated Logos SDK sources"
|
|
)
|
|
add_subdirectory("${LOGOS_WALLET_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/shared-wallet")
|
|
|
|
# ui_qml module with a hand-written C++ backend (QtRO .rep view contract +
|
|
# generated *SimpleSource/*ViewPluginBase). Mirrors the LEZ wallet UI module.
|
|
# The AMM business logic lives in the amm_module core module (declared as a
|
|
# dependency in metadata.json, reached via modules().amm_module in the backend),
|
|
# so the UI links no amm_ffi library of its own.
|
|
logos_module(
|
|
NAME amm_ui
|
|
REP_FILE src/AmmUiBackend.rep
|
|
SOURCES
|
|
src/AmmUiPluginInterface.h
|
|
src/AmmUiPlugin.h
|
|
src/AmmUiPlugin.cpp
|
|
src/AmmUiBackend.h
|
|
src/AmmUiBackend.cpp
|
|
FIND_PACKAGES
|
|
Qt6Gui
|
|
LINK_LIBRARIES
|
|
Qt6::Gui
|
|
LINK_TARGETS
|
|
logos_wallet_access
|
|
)
|