aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author ClarkeCode <clarke.john.robert@gmail.com>2023-06-14 05:41:28 +0200
committer ClarkeCode <clarke.john.robert@gmail.com>2023-06-14 06:35:15 +0200
commit9c8bc64662b3b3e352e59fbf58eca46f72117f5a (patch)
tree5e15ae43d1b21459bdf271da7ef12e26e0de9561
parent5433008d163e7e85cd7ee668e769c649e318f491 (diff)
Rough draft of compiling headless simulation
-rw-r--r--SConstruct45
-rw-r--r--src/headless/main.cpp (renamed from headless_main.cpp)4
2 files changed, 47 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
new file mode 100644
index 0000000..50edb8f
--- /dev/null
+++ b/SConstruct
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+import os
+import sys
+from glob import glob
+from pathlib import Path
+
+def GlobRecursive(pattern, nodes=['.']):
+ import SCons
+ results = []
+ for node in nodes:
+ nnodes = []
+ for f in Glob(str(node) + '/*', source=True):
+ if type(f) is SCons.Node.FS.Dir:
+ nnodes.append(f)
+ results += GlobRecursive(pattern, nnodes)
+ results += Glob(str(node) + '/' + pattern, source=True)
+ return results
+
+# For future reference:
+# - CCFLAGS are compilation flags shared between C and C++
+# - CFLAGS are for C-specific compilation flags
+# - CXXFLAGS are for C++-specific compilation flags
+# - CPPFLAGS are for pre-processor flags
+# - CPPDEFINES are for pre-processor defines
+# - LINKFLAGS are for linking flags
+env = Environment(
+ CPPDEFINES=["OPENVIC_HEADLESS_SIM"]
+)
+
+# Require C++20
+if sys.platform == "win32" or sys.platform == "msys":
+ env.Append(CXXFLAGS=["/std:c++20", "/EHsc"])
+else:
+ env.Append(CXXFLAGS=["-std=c++20"])
+
+# Tweak this if you want to use different folders, or more folders, to store your source code in.
+paths = ["src"]
+env.Append(CPPPATH=paths)
+sources = GlobRecursive("*.cpp", paths)
+
+program = env.Program("headless-sim", sources)
+
+
+Default(program)
+
diff --git a/headless_main.cpp b/src/headless/main.cpp
index 20d89ee..70a57a9 100644
--- a/headless_main.cpp
+++ b/src/headless/main.cpp
@@ -1,8 +1,8 @@
#ifdef OPENVIC_HEADLESS_SIM
#include <iostream>
#include <string>
-#include "src/openvic/Simulation.hpp"
-#include "src/openvic/dataloader/Dataloader.hpp"
+#include "openvic/Simulation.hpp"
+#include "openvic/dataloader/Dataloader.hpp"
int main() {