From 2b145098a277f2e0e80405465e4c30993934f261 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 30 Mar 2025 12:16:00 -0500 Subject: [PATCH] test static dependencies --- flake.nix | 31 ++++++++++++++++++- .../src/DependsOnPrintStatic.cpp | 17 ++++++++++ .../src/DependsOnPrintStatic.h | 17 ++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 modules/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp create mode 100644 modules/DependsOnPrintStatic/src/DependsOnPrintStatic.h diff --git a/flake.nix b/flake.nix index a400eaa..884f184 100755 --- a/flake.nix +++ b/flake.nix @@ -160,7 +160,36 @@ buildPhase = '' clang++ \ - modules/DependsOnPrint/src/*.cpp src/App.cpp \ + modules/DependsOnPrint/src/*.cpp \ + include/utils/App/App.cpp \ + -fpic -shared \ + -I src -I include \ + -Wall \ + -o $name + ''; + + installPhase = '' + mkdir -p $out/bin + cp $name $out/bin + ''; + + }; + + DependsOnPrintStatic = pkgs.stdenvNoCC.mkDerivation { + + name = "DependsOnPrint"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + clang + ]; + + buildPhase = '' + clang++ \ + modules/DependsOnPrint/src/*.cpp \ + modules/Print/src/*.cpp \ + include/utils/App/App.cpp \ -fpic -shared \ -I src -I include \ -Wall \ diff --git a/modules/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp b/modules/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp new file mode 100644 index 0000000..81ec49b --- /dev/null +++ b/modules/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp @@ -0,0 +1,17 @@ +#include "DependsOnPrintStatic.h" +#include "modules/Print/src/Print.h" + +DependsOnPrintStatic::DependsOnPrintStatic(void* h, Archimedes::App* a) : Module(h, a) { + name = "DependsOnPrintStatic"; + + deps["Print"] = new Print(nullptr, a); +} + +DependsOnPrintStatic::~DependsOnPrintStatic() { + std::cout << "DependsOnPrintStatic Destroyed!\n"; +} + +void DependsOnPrintStatic::run() { + std::cout << "DependsOnPrintStatic lib loaded and run!\n"; + app->stopModule(self); +} diff --git a/modules/DependsOnPrintStatic/src/DependsOnPrintStatic.h b/modules/DependsOnPrintStatic/src/DependsOnPrintStatic.h new file mode 100644 index 0000000..5dede73 --- /dev/null +++ b/modules/DependsOnPrintStatic/src/DependsOnPrintStatic.h @@ -0,0 +1,17 @@ +#include "Archimedes.h" + +class DependsOnPrintStatic : public Archimedes::Module { + + public: + DependsOnPrintStatic(void*, Archimedes::App*); + ~DependsOnPrintStatic(); + void run(); + void onLoad() {} + +}; + +extern "C" { + Archimedes::Module* create(void* handle, Archimedes::App* app) { + return new DependsOnPrintStatic(handle, app); + } +}