diff options
Diffstat (limited to 'src/main/java/com/jogamp/gluegen')
-rw-r--r-- | src/main/java/com/jogamp/gluegen/jcpp/Feature.java | 9 | ||||
-rw-r--r-- | src/main/java/com/jogamp/gluegen/jcpp/JCPP.java | 1 | ||||
-rw-r--r-- | src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java | 12 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/com/jogamp/gluegen/jcpp/Feature.java b/src/main/java/com/jogamp/gluegen/jcpp/Feature.java index 86202fc..1628721 100644 --- a/src/main/java/com/jogamp/gluegen/jcpp/Feature.java +++ b/src/main/java/com/jogamp/gluegen/jcpp/Feature.java @@ -38,5 +38,12 @@ public enum Feature { OBJCSYNTAX, INCLUDENEXT, /** Random extensions. */ - PRAGMA_ONCE + PRAGMA_ONCE, + /** + * Unified output for reproducible platform-agnostic builds, i.e.: + * <ul> + * <li>Use unix-file-separator '/' on all platform.</li> + * </ul> + */ + UNIFIED_OUTPUT } diff --git a/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java b/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java index 3f1e057..d499372 100644 --- a/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java +++ b/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java @@ -54,6 +54,7 @@ public class JCPP implements GenericCPP { cpp.addFeature(Feature.DIGRAPHS); cpp.addFeature(Feature.TRIGRAPHS); cpp.addFeature(Feature.LINEMARKERS); + cpp.addFeature(Feature.UNIFIED_OUTPUT); cpp.addFeature(Feature.CSYNTAX); cpp.addFeature(Feature.KEEPCOMMENTS); if (enablePragmaOnce) { diff --git a/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java b/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java index 3427467..dc2d119 100644 --- a/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java +++ b/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java @@ -31,6 +31,7 @@ import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.TreeMap; +import java.util.regex.Matcher; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; @@ -638,10 +639,15 @@ public class Preprocessor implements Closeable { buf.append("#line ").append(line) .append(" \""); /* XXX This call to escape(name) is correct but ugly. */ - if (name == null) + if (name == null) { buf.append("<no file>"); - else - MacroTokenSource.escape(buf, name); + } else { + if( File.separatorChar != '/' && getFeature(Feature.UNIFIED_OUTPUT) ) { + MacroTokenSource.escape(buf, name.replaceAll(Matcher.quoteReplacement(File.separator), "/")); + } else { + MacroTokenSource.escape(buf, name); + } + } buf.append("\"").append(extra).append("\n"); return new Token(P_LINE, line, 0, buf.toString(), null); } |