diff options
author | Sven Gothel <[email protected]> | 2023-06-18 19:44:31 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-18 19:44:31 +0200 |
commit | ec4bce202d434cd302f3b654b83169c641b8d03c (patch) | |
tree | 61b9188384e370bafef6f13394b254dd9c614eee | |
parent | a7e6563f43a8c2415773edc39c2c8d5840c4a3dd (diff) | |
parent | d98d25f26a8231c746f8e461a6d932182376cd0b (diff) |
Merge remote-tracking branch 'Mathieu_Fery/feature/add_preserveGeneratedCPP_option'
-rw-r--r-- | src/java/com/jogamp/gluegen/GlueGen.java | 12 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java index d09e5d8..edfe360 100644 --- a/src/java/com/jogamp/gluegen/GlueGen.java +++ b/src/java/com/jogamp/gluegen/GlueGen.java @@ -105,13 +105,13 @@ public class GlueGen implements GlueEmitterControls { @SuppressWarnings("unchecked") public void run(final Reader reader, final String filename, final Class<?> emitterClass, final List<String> includePaths, final List<String> cfgFiles, final String outputRootDir, - final boolean copyCPPOutput2Stderr, final boolean enablePragmaOnce) + final boolean copyCPPOutput2Stderr, final boolean enablePragmaOnce, final boolean preserveGeneratedCPP) { try { if(debug) { Logging.getLogger().setLevel(Level.ALL); System.err.println("GlueGen.run: filename: "+filename+", emitter: "+emitterClass.getName()+", outputRootDir "+outputRootDir+ - ", copyCPPOutput2Stderr "+copyCPPOutput2Stderr+", enablePragmaOnce "+enablePragmaOnce); + ", copyCPPOutput2Stderr "+copyCPPOutput2Stderr+", enablePragmaOnce "+enablePragmaOnce+", preserveGeneratedCPP "+preserveGeneratedCPP); System.err.println("GlueGen.run: includePaths "+includePaths); System.err.println("GlueGen.run: cfgFiles "+cfgFiles); } else if( null != logLevel ) { @@ -139,7 +139,7 @@ public class GlueGen implements GlueEmitterControls { // preprocessor = new PCPP(includePaths, debug, copyCPPOutput2Stderr, enablePragmaOnce); preprocessor = new JCPP(includePaths, debug, copyCPPOutput2Stderr, enablePragmaOnce); final String cppName = preprocessor.getClass().getSimpleName(); - if(debug) { + if(debug || preserveGeneratedCPP) { System.err.println("CPP <"+cppName+"> output at (persistent): " + out.getAbsolutePath()); } else { out.deleteOnExit(); @@ -389,6 +389,7 @@ public class GlueGen implements GlueEmitterControls { final List<String> cfgFiles = new ArrayList<String>(); boolean copyCPPOutput2Stderr = false; boolean enablePragmaOnce = true; + boolean preserveGeneratedCPP = false; final List<String> includePaths = new ArrayList<String>(); for (int i = 0; i < args.length; i++) { @@ -414,6 +415,8 @@ public class GlueGen implements GlueEmitterControls { enablePragmaOnce=true; } else if (arg.equals("--disablePragmaOnce")) { enablePragmaOnce=false; + } else if (arg.equals("--preserveGeneratedCPP")) { + preserveGeneratedCPP=true; } else { usage(); } @@ -438,7 +441,7 @@ public class GlueGen implements GlueEmitterControls { try { final Class<?> emitterClass = emitterFQN == null ? null : Class.forName(emitterFQN); - new GlueGen().run(reader, filename, emitterClass, includePaths, cfgFiles, outputRootDir, copyCPPOutput2Stderr, enablePragmaOnce); + new GlueGen().run(reader, filename, emitterClass, includePaths, cfgFiles, outputRootDir, copyCPPOutput2Stderr, enablePragmaOnce, preserveGeneratedCPP); } catch (final ClassNotFoundException ex) { throw new RuntimeException("specified emitter class was not in the classpath", ex); } @@ -465,6 +468,7 @@ public class GlueGen implements GlueEmitterControls { out.println(" --dumpCPP directs CPP to dump all output to stderr as well"); out.println(" --enablePragmaOnce allow handle of #pragma once directive during parsing (default)"); out.println(" --disablePragmaOnce disable handling of #pragma once directive during parsing"); + out.println(" --preserveGeneratedCPP preserve generated CPP file during generation (File it's already preserved by debug mode)"); exit(1); } } diff --git a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java index 1072675..1cf3424 100644 --- a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java +++ b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java @@ -283,8 +283,7 @@ public class CStructAnnotationProcessor extends AbstractProcessor { } new GlueGen().run(reader, filename, AnnotationProcessorJavaStructEmitter.class, includePaths, cfgFiles, outputPath1, false /* copyCPPOutput2Stderr */, - enablePragmaOnce /* enablePragmaOnce */); - + enablePragmaOnce /* enablePragmaOnce */, false /* preserveGeneratedCPP */); configFile.delete(); generatedStructs.add(finalType); } |