Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 0 additions & 64 deletions cpp/CMakeLists.txt

This file was deleted.

105 changes: 0 additions & 105 deletions cpp/example_usage.cpp

This file was deleted.

33 changes: 0 additions & 33 deletions cpp/simple_example.cpp

This file was deleted.

75 changes: 60 additions & 15 deletions nix/include.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,74 @@ pkgs.stdenv.mkDerivation {
installPhase = ''
runHook preInstall

# Install headers with proper structure
mkdir -p $out/include/core
# BACKWARD COMPATIBILITY:
# The installed include structure uses cpp/ and core/ directories to remain
# compatible with logos-module-builder and other downstream projects that
# expect the original layout. The internal source is organized differently
# (src/client/, src/provider/) but the installed output maintains the old paths.
#
# Since the source files use relative includes (e.g., "../logos_mode.h") that
# work for the internal structure, we use sed to flatten these paths when
# installing to the flat cpp/ directory.

mkdir -p $out/include
mkdir -p $out/include/cpp
mkdir -p $out/include/core

# Install core headers
if [ -f core/interface.h ]; then
cp core/interface.h $out/include/core/
fi
# Install all SDK source files into include/cpp/
# From src/ root
for file in logos_api.cpp logos_api.h token_manager.cpp token_manager.h logos_mode.h plugin_registry.h; do
if [ -f src/$file ]; then
cp src/$file $out/include/cpp/
fi
done

# Install cpp headers and sources
for file in logos_api.cpp logos_api.h logos_api_client.cpp logos_api_client.h \
logos_api_consumer.cpp logos_api_consumer.h logos_api_provider.cpp logos_api_provider.h \
token_manager.cpp token_manager.h module_proxy.cpp module_proxy.h logos_mode.h; do
if [ -f cpp/$file ]; then
cp cpp/$file $out/include/cpp/
# From src/client/
for file in logos_api_client.cpp logos_api_client.h logos_api_consumer.cpp logos_api_consumer.h; do
if [ -f src/client/$file ]; then
cp src/client/$file $out/include/cpp/
fi
done

if [ -f cpp/logos_mode.h ]; then
cp cpp/logos_mode.h $out/include/
# From src/provider/
for file in logos_api_provider.cpp logos_api_provider.h module_proxy.cpp module_proxy.h; do
if [ -f src/provider/$file ]; then
cp src/provider/$file $out/include/cpp/
fi
done

# Flatten include paths in cpp/ directory
# The source uses relative paths like "../logos_mode.h" which need to become "logos_mode.h"
# in the flat cpp/ directory structure.
# NOTE: These rewrites are for backward compatibility and may be changed later
# when downstream projects are updated to use the new include structure.
for file in $out/include/cpp/*.cpp $out/include/cpp/*.h; do
if [ -f "$file" ]; then
sed -i \
-e 's|#include "../logos_mode.h"|#include "logos_mode.h"|g' \
-e 's|#include "../logos_api.h"|#include "logos_api.h"|g' \
-e 's|#include "../token_manager.h"|#include "token_manager.h"|g' \
-e 's|#include "../plugin_registry.h"|#include "plugin_registry.h"|g' \
-e 's|#include "../provider/module_proxy.h"|#include "module_proxy.h"|g' \
-e 's|#include "logos_api_consumer.h"|#include "logos_api_consumer.h"|g' \
"$file"
# ^^^ All above rewrites are for backward compatibility, may change later
fi
done

# Install core headers (interface.h from provider/core/ goes to include/core/)
if [ -f src/provider/core/interface.h ]; then
cp src/provider/core/interface.h $out/include/core/
# Fix the include path: ../../logos_api.h becomes ../cpp/logos_api.h
# NOTE: This rewrite is for backward compatibility and may be changed later
sed -i 's|#include "../../logos_api.h"|#include "../cpp/logos_api.h"|g' $out/include/core/interface.h
fi

# Also copy logos_mode.h to root include for backward compatibility
if [ -f src/logos_mode.h ]; then
cp src/logos_mode.h $out/include/
fi

runHook postInstall
'';
}

2 changes: 1 addition & 1 deletion nix/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pkgs.stdenv.mkDerivation {
# Build SDK library
mkdir -p build-sdk
cd build-sdk
cmake ../cpp -GNinja $cmakeFlags
cmake ../src -GNinja $cmakeFlags
ninja
cd ..

Expand Down
Loading