summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/structgen
diff options
context:
space:
mode:
authorMathieu Féry <[email protected]>2023-06-15 19:18:34 +0200
committerMathieu Féry <[email protected]>2023-06-16 10:51:24 +0200
commit738c15d654f67ec8aeccec2b46f5a0804c793491 (patch)
tree259b5149ce3975acdd1e514d0afa291ec4362c69 /src/java/com/jogamp/gluegen/structgen
parent88309192b450e09ba16e9d72adac178c4ce47dc3 (diff)
feat(feature): Enable pragma once management
Diffstat (limited to 'src/java/com/jogamp/gluegen/structgen')
-rw-r--r--src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
index 13bf418..52c20e0 100644
--- a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
+++ b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
@@ -98,12 +98,15 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
}
private static final String STRUCTGENOUTPUT_OPTION = "structgen.output";
+ private static final String STRUCTGENPRAGMA_ONCE = "structgen.enable.pragma.once";
private static final String STRUCTGENOUTPUT = PropertyAccess.getProperty("jogamp.gluegen."+STRUCTGENOUTPUT_OPTION, true, "gensrc");
+ private static final String STRUCTGENPRAGMAONCE = PropertyAccess.getProperty("jogamp.gluegen."+STRUCTGENPRAGMA_ONCE, true, "false");
private Filer filer;
private Messager messager;
private Elements eltUtils;
private String outputPath;
+ private boolean enablePragmaOnce;
private final static Set<String> generatedStructs = new HashSet<String>();
@@ -118,6 +121,9 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
outputPath = processingEnv.getOptions().get(STRUCTGENOUTPUT_OPTION);
outputPath = outputPath == null ? STRUCTGENOUTPUT : outputPath;
+
+ final String enablePragmaOnceOpt = processingEnv.getOptions().get(STRUCTGENPRAGMAONCE);
+ enablePragmaOnce = Boolean.parseBoolean(enablePragmaOnceOpt == null ? STRUCTGENPRAGMAONCE : enablePragmaOnceOpt);
}
private File locateSource(final String packageName, final String relativeName) {
@@ -211,7 +217,7 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
headerParent = root0.substring(0, root0.length()-headerFile.getName().length()-1);
rootOut = headerParent.substring(0, headerParent.length()-packageName.length()) + "..";
}
- System.err.println("CStruct: "+headerFile+", abs: "+headerFile.isAbsolute()+", headerParent "+headerParent+", rootOut "+rootOut);
+ System.err.println("CStruct: "+headerFile+", abs: "+headerFile.isAbsolute()+", headerParent "+headerParent+", rootOut "+rootOut+", enablePragmaOnce"+enablePragmaOnce);
generateStructBinding(element, struct, isPackageOrType, rootOut, packageName, headerFile, headerParent);
} catch (final IOException ex) {
@@ -276,7 +282,8 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
GlueGen.setDebug(true);
}
new GlueGen().run(reader, filename, AnnotationProcessorJavaStructEmitter.class,
- includePaths, cfgFiles, outputPath1, false /* copyCPPOutput2Stderr */);
+ includePaths, cfgFiles, outputPath1, false /* copyCPPOutput2Stderr */,
+ enablePragmaOnce /* enablePragmaOnce */);
configFile.delete();
generatedStructs.add(finalType);