From 1cd8c0e134764414ed7a548275135d1b35f34bc3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 25 Jan 2024 16:47:26 +0100 Subject: [PATCH] Now the standalone build works properly. --- SConstruct | 9 +++++++-- platform/SCsub | 6 ------ platform/main/SCsub | 11 +++++++++++ platform/{ => main}/main.cpp | 10 +++++----- 4 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 platform/main/SCsub rename platform/{ => main}/main.cpp (52%) diff --git a/SConstruct b/SConstruct index 71ea193..e70917e 100644 --- a/SConstruct +++ b/SConstruct @@ -103,6 +103,8 @@ def add_mlpp(env): else: # Static compilation module_env.add_source_files(env.modules_sources, sources) + lib = env.add_library("mlpp", env.modules_sources) + env.Prepend(LIBS=[lib]) for x in sorted(glob.glob("platform/*")): if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"): @@ -660,12 +662,15 @@ if selected_platform in platform_list: Export("env") # build subdirs, the build order is dependent on link order. - add_mlpp(env) - + SConscript("platform/SCsub") SConscript("platform/" + selected_platform + "/SCsub") # build selected platform + add_mlpp(env) + + SConscript("platform/main/SCsub") + # Microsoft Visual Studio Project Generation if env["vsproj"]: if os.name != "nt": diff --git a/platform/SCsub b/platform/SCsub index cb08fad..5f44b6e 100644 --- a/platform/SCsub +++ b/platform/SCsub @@ -12,9 +12,3 @@ env.add_source_files(env.platform_sources, "image.cpp") lib = env.add_library("platform", env.platform_sources) env.Prepend(LIBS=[lib]) -# TODO Move this to somewhere else, so it can be easily overridden -env.main_sources = [] - -env.add_source_files(env.main_sources, "main.cpp") -lib = env.add_library("main", env.main_sources) -env.Prepend(LIBS=[lib]) diff --git a/platform/main/SCsub b/platform/main/SCsub new file mode 100644 index 0000000..a8cba13 --- /dev/null +++ b/platform/main/SCsub @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from compat import open_utf8 + +Import("env") + +env.main_sources = [] + +env.add_source_files(env.main_sources, "main.cpp") +lib = env.add_library("main", env.main_sources) +env.Prepend(LIBS=[lib]) diff --git a/platform/main.cpp b/platform/main/main.cpp similarity index 52% rename from platform/main.cpp rename to platform/main/main.cpp index 2a6233e..caa4869 100644 --- a/platform/main.cpp +++ b/platform/main/main.cpp @@ -1,16 +1,16 @@ #include "sfw.h" -//#include "test/mlpp_tests.h" -//#include "test/mlpp_matrix_tests.h" +#include "test/mlpp_tests.h" +#include "test/mlpp_matrix_tests.h" int main() { SFWCore::setup(); - //Ref tests; - //tests.instance(); + Ref tests; + tests.instance(); - //tests->test_statistics(); + tests->test_statistics(); //tests->test_multivariate_linear_regression_gradient_descent(true);