Now the standalone build works properly.

This commit is contained in:
Relintai 2024-01-25 16:47:26 +01:00
parent ff114c379f
commit 1cd8c0e134
4 changed files with 23 additions and 13 deletions

View File

@ -103,6 +103,8 @@ def add_mlpp(env):
else: else:
# Static compilation # Static compilation
module_env.add_source_files(env.modules_sources, sources) 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/*")): for x in sorted(glob.glob("platform/*")):
if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"): 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") Export("env")
# build subdirs, the build order is dependent on link order. # build subdirs, the build order is dependent on link order.
add_mlpp(env)
SConscript("platform/SCsub") SConscript("platform/SCsub")
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
add_mlpp(env)
SConscript("platform/main/SCsub")
# Microsoft Visual Studio Project Generation # Microsoft Visual Studio Project Generation
if env["vsproj"]: if env["vsproj"]:
if os.name != "nt": if os.name != "nt":

View File

@ -12,9 +12,3 @@ env.add_source_files(env.platform_sources, "image.cpp")
lib = env.add_library("platform", env.platform_sources) lib = env.add_library("platform", env.platform_sources)
env.Prepend(LIBS=[lib]) 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])

11
platform/main/SCsub Normal file
View File

@ -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])

View File

@ -1,16 +1,16 @@
#include "sfw.h" #include "sfw.h"
//#include "test/mlpp_tests.h" #include "test/mlpp_tests.h"
//#include "test/mlpp_matrix_tests.h" #include "test/mlpp_matrix_tests.h"
int main() { int main() {
SFWCore::setup(); SFWCore::setup();
//Ref<MLPPTests> tests; Ref<MLPPTests> tests;
//tests.instance(); tests.instance();
//tests->test_statistics(); tests->test_statistics();
//tests->test_multivariate_linear_regression_gradient_descent(true); //tests->test_multivariate_linear_regression_gradient_descent(true);