From f01d9a5e6afd28d1325bc15b1142f22336a55cad Mon Sep 17 00:00:00 2001 From: Hokeun Kim Date: Sat, 2 Apr 2022 10:42:45 +0900 Subject: [PATCH] Add LINGUA_FRANCA_TRACE to targetConfig. --- .../src/org/lflang/generator/c/CPreambleGenerator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/c/CPreambleGenerator.java b/org.lflang/src/org/lflang/generator/c/CPreambleGenerator.java index 23b9403f8b..7f12caab20 100644 --- a/org.lflang/src/org/lflang/generator/c/CPreambleGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CPreambleGenerator.java @@ -76,7 +76,7 @@ public static String generateDefineDirectives( } } if (tracing != null) { - code.pr(generateTracingDefineDirective(tracing.traceFileName)); + code.pr(generateTracingDefineDirective(targetConfig, tracing.traceFileName)); } if (hasModalReactors) { code.pr("#define MODAL_REACTORS"); @@ -108,10 +108,15 @@ private static String generateFederatedDefineDirective(CoordinationType coordina return String.join("\n", directives); } - private static String generateTracingDefineDirective(String traceFileName) { + private static String generateTracingDefineDirective( + TargetConfig targetConfig, + String traceFileName + ) { if (traceFileName == null) { + targetConfig.compileDefinitions.put("LINGUA_FRANCA_TRACE", ""); return "#define LINGUA_FRANCA_TRACE"; } + targetConfig.compileDefinitions.put("LINGUA_FRANCA_TRACE", traceFileName); return "#define LINGUA_FRANCA_TRACE " + traceFileName; }