From 7a16120bea1fcdb3e1bfe10f8293a99a6eb9d56a Mon Sep 17 00:00:00 2001
From: Apprentice-Alchemist
<53486764+Apprentice-Alchemist@users.noreply.github.com>
Date: Fri, 22 Aug 2025 12:25:25 +0200
Subject: [PATCH 1/4] add `c_standard`/`cpp_standard` xml attributes.
---
docs/build_xml/Defines.md | 6 ++--
docs/build_xml/Files.md | 20 ++++++++++-
toolchain/android-toolchain-clang.xml | 4 ---
toolchain/android-toolchain-gcc.xml | 7 ----
toolchain/appletvos-toolchain.xml | 10 ------
toolchain/appletvsim-toolchain.xml | 10 ------
toolchain/finish-setup.xml | 5 ---
toolchain/iphoneos-toolchain.xml | 17 ---------
toolchain/iphonesim-toolchain.xml | 18 ----------
toolchain/linux-toolchain.xml | 4 ---
toolchain/mac-toolchain.xml | 17 +--------
toolchain/mingw-toolchain.xml | 4 ---
toolchain/msvc-toolchain.xml | 1 -
toolchain/watchos-toolchain.xml | 6 +---
toolchain/watchsimulator-toolchain.xml | 3 --
tools/hxcpp/BuildTool.hx | 49 ++++++++++++++++++++++++++
tools/hxcpp/Compiler.hx | 34 ++++++++++++++++++
tools/hxcpp/File.hx | 4 +++
tools/hxcpp/FileGroup.hx | 4 +++
19 files changed, 116 insertions(+), 107 deletions(-)
diff --git a/docs/build_xml/Defines.md b/docs/build_xml/Defines.md
index 8308e2417..319c47cca 100755
--- a/docs/build_xml/Defines.md
+++ b/docs/build_xml/Defines.md
@@ -37,8 +37,10 @@ Defines affecting how the code is compiled. These can be on the command line wh
| *HXCPP_CHECK_POINTER* | Add null-pointer checks,even in release mode. |
| *HXCPP_PROFILER* | Add profiler support |
| *HXCPP_TELEMETRY* | Add telemetry support |
-| *HXCPP_CPP11* | Use c++11 features and link libraries |
-| *HXCPP_CPP17* | Use c++17 features and link libraries |
+| *HXCPP_C_STANDARD* | Set default C standard |
+| *HXCPP_CXX_STANDARD* | Set default C++ standard |
+| *HXCPP_OBJC_STANDARD* | Set default Objective-C standard |
+| *HXCPP_OBJCXX_STANDARD* | Set default Objective-C++ standard |
| *exe_link* | Generate executable file (rather than dynamic library on android) |
| *static_link* | Generate static library |
| *dll_link* | Generate dynamic library |
diff --git a/docs/build_xml/Files.md b/docs/build_xml/Files.md
index f3f7383cb..8291d0718 100755
--- a/docs/build_xml/Files.md
+++ b/docs/build_xml/Files.md
@@ -2,6 +2,20 @@ Files
------
The files node defines a group of files that all share the same attributes, including relative directory, default compiler flags and dependencies. The node can be used to define a set of header files on which other files can depend, or a set of source files to be compiled and included in a target.
+```xml
+
+
+
+
+```
+
+#### Attributes
+
+ + `c_standard` = Default C standard for the file group
+ + `cxx_standard` = Default C++ standard for the file group
+ + `objc_standard` = Default Objective-C standard for the file group
+ + `objcxx_standard` = Default Objective-C++ standard for the file group
+#### Nodes
- *depend* - Declare that all files in the group depend on another file or another file group.
```xml
@@ -80,13 +94,17 @@ The files node defines a group of files that all share the same attributes, incl
- *file* - Add file to group, with optional attributes
```xml
-
+
```
+ name = name of file - may be absolute or relative to files.dir
+ tags = optional override of group tags. See [Tags.md](Tags.md).
+ + `c_standard` = C standard for the file
+ + `cxx_standard` = C++ standard for the file
+ + `objc_standard` = Objective-C standard for the file
+ + `objcxx_standard` = Objective-C++ standard for the file
+ filterout = allows files to be skipped at compile-time if the named define exists.
This is useful when the define is set sometime after the file list is parsed.
+ depend name = filename of additional dependency
diff --git a/toolchain/android-toolchain-clang.xml b/toolchain/android-toolchain-clang.xml
index 17737d80d..1858b255d 100644
--- a/toolchain/android-toolchain-clang.xml
+++ b/toolchain/android-toolchain-clang.xml
@@ -35,8 +35,6 @@
-
-
@@ -63,8 +61,6 @@
-
-
diff --git a/toolchain/android-toolchain-gcc.xml b/toolchain/android-toolchain-gcc.xml
index dc6bc55fa..2e2f50007 100644
--- a/toolchain/android-toolchain-gcc.xml
+++ b/toolchain/android-toolchain-gcc.xml
@@ -12,9 +12,6 @@
- you can also set the variable "android-19" directly
-->
-
-
-
@@ -96,8 +93,6 @@
-
-
@@ -168,7 +163,6 @@
-
@@ -218,7 +212,6 @@
-
diff --git a/toolchain/appletvos-toolchain.xml b/toolchain/appletvos-toolchain.xml
index 9b70a3eeb..fae1448da 100644
--- a/toolchain/appletvos-toolchain.xml
+++ b/toolchain/appletvos-toolchain.xml
@@ -10,8 +10,6 @@
-
-
@@ -24,10 +22,6 @@
-
-
-
-
@@ -71,10 +65,6 @@
-
-
-
-
diff --git a/toolchain/appletvsim-toolchain.xml b/toolchain/appletvsim-toolchain.xml
index 1e80b5abd..a7d853d7b 100644
--- a/toolchain/appletvsim-toolchain.xml
+++ b/toolchain/appletvsim-toolchain.xml
@@ -9,8 +9,6 @@
-
-
@@ -22,10 +20,6 @@
-
-
-
-
@@ -78,10 +72,6 @@
-
-
-
-
diff --git a/toolchain/finish-setup.xml b/toolchain/finish-setup.xml
index eef2be1ec..1e814ade3 100644
--- a/toolchain/finish-setup.xml
+++ b/toolchain/finish-setup.xml
@@ -76,11 +76,6 @@
-
-
-
-
-
diff --git a/toolchain/iphoneos-toolchain.xml b/toolchain/iphoneos-toolchain.xml
index 305aa6a49..dc8b74539 100644
--- a/toolchain/iphoneos-toolchain.xml
+++ b/toolchain/iphoneos-toolchain.xml
@@ -3,7 +3,6 @@
-
@@ -14,9 +13,6 @@
-
-
-
@@ -32,15 +28,6 @@
-
-
-
-
-
-
-
-
-
@@ -95,10 +82,6 @@
-
-
-
-
diff --git a/toolchain/iphonesim-toolchain.xml b/toolchain/iphonesim-toolchain.xml
index b98a703ad..3dded7016 100644
--- a/toolchain/iphonesim-toolchain.xml
+++ b/toolchain/iphonesim-toolchain.xml
@@ -2,8 +2,6 @@
-
-
@@ -11,9 +9,6 @@
-
-
-
@@ -26,15 +21,6 @@
-
-
-
-
-
-
-
-
-
@@ -89,10 +75,6 @@
-
-
-
-
diff --git a/toolchain/linux-toolchain.xml b/toolchain/linux-toolchain.xml
index 7b3e039cb..014bc0098 100644
--- a/toolchain/linux-toolchain.xml
+++ b/toolchain/linux-toolchain.xml
@@ -26,8 +26,6 @@
-
-
@@ -40,8 +38,6 @@
-
-
diff --git a/toolchain/mac-toolchain.xml b/toolchain/mac-toolchain.xml
index 7829dc47e..00509746a 100644
--- a/toolchain/mac-toolchain.xml
+++ b/toolchain/mac-toolchain.xml
@@ -2,19 +2,13 @@
-
-
-
-
+
-
-
-
@@ -26,15 +20,6 @@
-
-
-
-
-
-
-
-
-
diff --git a/toolchain/mingw-toolchain.xml b/toolchain/mingw-toolchain.xml
index 2e545ecd4..edc575f90 100644
--- a/toolchain/mingw-toolchain.xml
+++ b/toolchain/mingw-toolchain.xml
@@ -24,8 +24,6 @@
-
-
@@ -40,8 +38,6 @@
-
-
diff --git a/toolchain/msvc-toolchain.xml b/toolchain/msvc-toolchain.xml
index e504a6b62..fc2383848 100644
--- a/toolchain/msvc-toolchain.xml
+++ b/toolchain/msvc-toolchain.xml
@@ -69,7 +69,6 @@
-
diff --git a/toolchain/watchos-toolchain.xml b/toolchain/watchos-toolchain.xml
index 0b28e1c40..1f637f731 100644
--- a/toolchain/watchos-toolchain.xml
+++ b/toolchain/watchos-toolchain.xml
@@ -7,8 +7,7 @@
-
-
+
@@ -25,9 +24,6 @@
-
-
-
diff --git a/toolchain/watchsimulator-toolchain.xml b/toolchain/watchsimulator-toolchain.xml
index bca67ab11..125265c33 100644
--- a/toolchain/watchsimulator-toolchain.xml
+++ b/toolchain/watchsimulator-toolchain.xml
@@ -7,7 +7,6 @@
-
@@ -25,8 +24,6 @@
-
-
diff --git a/tools/hxcpp/BuildTool.hx b/tools/hxcpp/BuildTool.hx
index 9124983a4..a2c46af5c 100644
--- a/tools/hxcpp/BuildTool.hx
+++ b/tools/hxcpp/BuildTool.hx
@@ -68,6 +68,10 @@ class BuildTool
var arm64:Bool;
var m64:Bool;
var m32:Bool;
+ var defaultCStandard:Null;
+ var defaultCxxStandard:Null;
+ var defaultObjCStandard:Null;
+ var defaultObjCxxStandard:Null;
public static var os="";
public static var sAllowNumProcs = true;
@@ -160,6 +164,41 @@ class BuildTool
Profile.setEntry("parse xml");
+
+
+ if (mDefines.exists("HXCPP_C_STANDARD")) {
+ defaultCStandard = Std.parseInt(mDefines.get("HXCPP_C_STANDARD"));
+ }
+
+ // Hxcpp requires C++11, so the default standard cannot be less than that
+ if (mDefines.exists("HXCPP_CXX_STANDARD")) {
+ defaultCxxStandard = Std.parseInt(mDefines.get("HXCPP_CXX_STANDARD"));
+ if (defaultCxxStandard < 11) {
+ Log.warn('Increasing default C++ standard to C++11 instead of C++${defaultCxxStandard}');
+ defaultCxxStandard = 11;
+ }
+ } else if(mDefines.exists("HXCPP_CPP17")) {
+ defaultCxxStandard = 17;
+ } else if (mDefines.exists("HXCPP_CPP14")) {
+ defaultCxxStandard = 14;
+ } else {
+ defaultCxxStandard = 11;
+ }
+
+ if (mDefines.exists("HXCPP_OBJC_STANDARD")) {
+ defaultObjCStandard = Std.parseInt(mDefines.get("HXCPP_OBJC_STANDARD"));
+ }
+
+ if (mDefines.exists("HXCPP_OBJCXX_STANDARD")) {
+ defaultObjCxxStandard = Std.parseInt(mDefines.get("HXCPP_OBJCXX_STANDARD"));
+ if (defaultObjCxxStandard < 11) {
+ Log.warn('Increasing default Obj-C++ standard to Obj-C++11 instead of Obj-C++${defaultObjCxxStandard}');
+ defaultObjCxxStandard = 11;
+ }
+ } else {
+ defaultObjCxxStandard = 11;
+ }
+
include("toolchain/setup.xml");
@@ -982,6 +1021,11 @@ class BuildTool
if (inTags!=null)
group.mTags = inTags;
+ group.mCStandard = inXML.has.c_standard ? Std.parseInt(substitute(inXML.att.c_standard)) : defaultCStandard;
+ group.mObjCStandard = inXML.has.objc_standard ? Std.parseInt(substitute(inXML.att.objc_standard)) : defaultObjCStandard != null ? defaultObjCStandard : group.mCStandard;
+ group.mCxxStandard = inXML.has.cxx_standard ? Std.parseInt(substitute(inXML.att.cxx_standard)) : defaultCxxStandard;
+ group.mObjCxxStandard = inXML.has.objcxx_standard ? Std.parseInt(substitute(inXML.att.objcxx_standard)) : defaultObjCxxStandard != null ? defaultObjCxxStandard : group.mCxxStandard;
+
for(el in inXML.elements)
{
if (valid(el,""))
@@ -996,6 +1040,11 @@ class BuildTool
group.addFile( file );
}
+ file.mCStandard = el.has.c_standard ? Std.parseInt(substitute(el.att.c_standard)) : group.mCStandard;
+ file.mObjCStandard = el.has.objc_standard ? Std.parseInt(substitute(el.att.objc_standard)) : group.mObjCStandard;
+ file.mCxxStandard = el.has.cxx_standard ? Std.parseInt(substitute(el.att.cxx_standard)) : group.mCxxStandard;
+ file.mObjCxxStandard = el.has.objcxx_standard ? Std.parseInt(substitute(el.att.objcxx_standard)) : group.mObjCxxStandard;
+
if (el.has.tag)
{
var extra = substitute(el.att.tag);
diff --git a/tools/hxcpp/Compiler.hx b/tools/hxcpp/Compiler.hx
index 02f2fa332..6447f9955 100644
--- a/tools/hxcpp/Compiler.hx
+++ b/tools/hxcpp/Compiler.hx
@@ -191,6 +191,40 @@ class Compiler
addIdentity(ext,args);
+ switch (ext) {
+ case "c":
+ if(inFile.mCStandard != null) {
+ if(BuildTool.isMsvc()) {
+ if (inFile.mCStandard > 17) {
+ args.push('/std:clatest');
+ } else if (inFile.mCStandard >= 11) {
+ args.push('/std:c${inFile.mCStandard}');
+ }
+ } else {
+ args.push('-std=c${inFile.mCStandard}');
+ }
+ }
+ case "m":
+ if(inFile.mObjCStandard != null) {
+ args.push('-std=c${inFile.mObjCStandard}');
+ }
+ case "mm":
+ if(inFile.mObjCxxStandard != null) {
+ args.push('-std=c++${inFile.mObjCxxStandard}');
+ }
+ case "cpp", "c++", "cc":
+ if(inFile.mCxxStandard != null) {
+ if (BuildTool.isMsvc()) {
+ if (inFile.mCxxStandard > 20) {
+ args.push('/std:c++latest');
+ } else if (inFile.mCStandard >= 14) {
+ args.push('/std:c++${inFile.mCxxStandard}');
+ }
+ } else {
+ args.push('-std=c++${inFile.mCxxStandard}');
+ }
+ }
+ }
var allowPch = false;
diff --git a/tools/hxcpp/File.hx b/tools/hxcpp/File.hx
index 4b3ab33ff..525beb276 100644
--- a/tools/hxcpp/File.hx
+++ b/tools/hxcpp/File.hx
@@ -22,6 +22,10 @@ class File
public var mFilterOut:String;
public var mEmbedName:String;
public var mScramble:String;
+ public var mCStandard:Int;
+ public var mCxxStandard:Int;
+ public var mObjCStandard:Int;
+ public var mObjCxxStandard:Int;
static public var mDependMutex = new Mutex();
public function new(inName:String, inGroup:FileGroup)
diff --git a/tools/hxcpp/FileGroup.hx b/tools/hxcpp/FileGroup.hx
index b88490d20..62b5fa67d 100644
--- a/tools/hxcpp/FileGroup.hx
+++ b/tools/hxcpp/FileGroup.hx
@@ -27,6 +27,10 @@ class FileGroup
public var mNvcc:Bool;
public var mAssembler:String;
public var mObjPrefix:String;
+ public var mCStandard:Int;
+ public var mCxxStandard:Int;
+ public var mObjCStandard:Int;
+ public var mObjCxxStandard:Int;
public function new(inDir:String,inId:String,inSetImportDir = false)
{
From e2ec18888468946ab69c8b642e05781ea3c2725a Mon Sep 17 00:00:00 2001
From: Apprentice-Alchemist
<53486764+Apprentice-Alchemist@users.noreply.github.com>
Date: Sat, 31 Jan 2026 11:36:00 +0100
Subject: [PATCH 2/4] add test for `c_standard`/`cpp_standard` attributes
---
.github/workflows/test.yml | 15 +++++++++++++++
.gitignore | 5 +++++
test/RunTests.hx | 6 ++++++
test/cxx_standard/Build.xml | 15 +++++++++++++++
test/cxx_standard/c11.c | 3 +++
test/cxx_standard/c17.c | 3 +++
test/cxx_standard/cxx14.cpp | 3 +++
test/cxx_standard/main.cpp | 5 +++++
8 files changed, 55 insertions(+)
create mode 100644 test/cxx_standard/Build.xml
create mode 100644 test/cxx_standard/c11.c
create mode 100644 test/cxx_standard/c17.c
create mode 100644 test/cxx_standard/cxx14.cpp
create mode 100644 test/cxx_standard/main.cpp
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2e3ddbf6d..9dc725578 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -221,3 +221,18 @@ jobs:
run: haxe compile-cpp.hxml -D ${{ env.HXCPP_ARCH_FLAG }} -D no_http
- name: run
run: bin${{ inputs.sep }}cpp${{ inputs.sep }}TestMain-debug
+ cxx_standard:
+ runs-on: ${{ inputs.os }}
+ name: cxx_standard
+ defaults:
+ run:
+ working-directory: test/cxx_standard
+ steps:
+ - name: checkout
+ uses: actions/checkout@v4
+ - name: setup
+ uses: ./.github/workflows/setup
+ with:
+ haxe: ${{ inputs.haxe }}
+ - name: build
+ run: haxelib run hxcpp Build.xml
diff --git a/.gitignore b/.gitignore
index 4ff620b27..ae80f7d57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,11 @@ hxcpp.n
.vscode
+test/cxx_standard/main
+test/cxx_standard/main.hash
+test/cxx_standard/main.exe
+test/cxx_standard/main.exe.hash
+
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio
diff --git a/test/RunTests.hx b/test/RunTests.hx
index dd194fff9..503009cb8 100644
--- a/test/RunTests.hx
+++ b/test/RunTests.hx
@@ -114,6 +114,11 @@ class RunTests
command("cpp64"+sep+"Test",[]);
}
+ public static function cxx_standard() {
+ setDir("cxx_standard");
+ command("haxelib", ["run", "hxcpp", "Build.xml"]);
+ }
+
public static function setDir(name:String)
{
@@ -199,6 +204,7 @@ class RunTests
run("std64", std64);
run("native", native);
run("debugger", debugger);
+ run("cxx_standard", cxx_standard);
Sys.println("");
diff --git a/test/cxx_standard/Build.xml b/test/cxx_standard/Build.xml
new file mode 100644
index 000000000..0198e3145
--- /dev/null
+++ b/test/cxx_standard/Build.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/cxx_standard/c11.c b/test/cxx_standard/c11.c
new file mode 100644
index 000000000..e2a662b26
--- /dev/null
+++ b/test/cxx_standard/c11.c
@@ -0,0 +1,3 @@
+#if __STDC_VERSION__ < 201112L
+#error "Not C11"
+#endif
\ No newline at end of file
diff --git a/test/cxx_standard/c17.c b/test/cxx_standard/c17.c
new file mode 100644
index 000000000..0daa166f7
--- /dev/null
+++ b/test/cxx_standard/c17.c
@@ -0,0 +1,3 @@
+#if __STDC_VERSION__ < 201710L
+#error "Not C17"
+#endif
\ No newline at end of file
diff --git a/test/cxx_standard/cxx14.cpp b/test/cxx_standard/cxx14.cpp
new file mode 100644
index 000000000..2f26fa886
--- /dev/null
+++ b/test/cxx_standard/cxx14.cpp
@@ -0,0 +1,3 @@
+#if __cplusplus != 201402L
+#error "Not C++14"
+#endif
diff --git a/test/cxx_standard/main.cpp b/test/cxx_standard/main.cpp
new file mode 100644
index 000000000..7fb24cb6b
--- /dev/null
+++ b/test/cxx_standard/main.cpp
@@ -0,0 +1,5 @@
+#if __cplusplus < 201703L
+#error "Not C++17"
+#endif
+
+int main() { return 0; }
\ No newline at end of file
From 48f0cc4350c50be0d5d88ecd9ed5193d2afdb532 Mon Sep 17 00:00:00 2001
From: Apprentice-Alchemist
<53486764+Apprentice-Alchemist@users.noreply.github.com>
Date: Sat, 31 Jan 2026 12:11:42 +0100
Subject: [PATCH 3/4] set language standard for PCH compilation too
---
tools/hxcpp/Compiler.hx | 107 +++++++++++++++++++++++++---------------
1 file changed, 66 insertions(+), 41 deletions(-)
diff --git a/tools/hxcpp/Compiler.hx b/tools/hxcpp/Compiler.hx
index 6447f9955..e5d87acd1 100644
--- a/tools/hxcpp/Compiler.hx
+++ b/tools/hxcpp/Compiler.hx
@@ -27,6 +27,13 @@ private class FlagInfo
}
}
+enum Language {
+ C;
+ Cxx;
+ ObjC;
+ ObjCxx;
+}
+
class Compiler
{
private var mFlags:Array;
@@ -127,15 +134,21 @@ class Compiler
function addIdentity(ext:String,ioArgs:Array)
{
+ var lang = switch ext {
+ case "c": C;
+ case "m": ObjC;
+ case "mm": ObjCxx;
+ case "cpp", "c++", "cc", "cxx": Cxx;
+ default: null;
+ }
if (mAddGCCIdentity)
{
- var identity = switch(ext)
+ var identity = switch (lang)
{
- case "c" : "c";
- case "m" : "objective-c";
- case "mm" : "objective-c++";
- case "cpp" : "c++";
- case "c++" : "c++";
+ case C : "c";
+ case ObjC : "objective-c";
+ case ObjCxx : "objective-c++";
+ case Cxx : "c++";
default:"";
}
if (identity!="")
@@ -144,6 +157,49 @@ class Compiler
ioArgs.push(identity);
}
}
+ return lang;
+ }
+
+ function addStandard(lang: Language, inFile: {
+ var mCStandard:Int;
+ var mCxxStandard:Int;
+ var mObjCStandard:Int;
+ var mObjCxxStandard:Int;
+ }, args:Array) {
+ switch (lang) {
+ case C:
+ if (inFile.mCStandard != null) {
+ if (BuildTool.isMsvc()) {
+ if (inFile.mCStandard > 17) {
+ args.push('/std:clatest');
+ } else if (inFile.mCStandard >= 11) {
+ args.push('/std:c${inFile.mCStandard}');
+ }
+ } else {
+ args.push('-std=c${inFile.mCStandard}');
+ }
+ }
+ case ObjC:
+ if (inFile.mObjCStandard != null) {
+ args.push('-std=c${inFile.mObjCStandard}');
+ }
+ case ObjCxx:
+ if (inFile.mObjCxxStandard != null) {
+ args.push('-std=c++${inFile.mObjCxxStandard}');
+ }
+ case Cxx:
+ if (inFile.mCxxStandard != null) {
+ if (BuildTool.isMsvc()) {
+ if (inFile.mCxxStandard > 20) {
+ args.push('/std:c++latest');
+ } else if (inFile.mCxxStandard >= 14) {
+ args.push('/std:c++${inFile.mCxxStandard}');
+ }
+ } else {
+ args.push('-std=c++${inFile.mCxxStandard}');
+ }
+ }
+ }
}
function addOptimTags(tagFilter:Array)
@@ -190,42 +246,10 @@ class Compiler
Log.error("Unkown extension for " + inFile.mName);
- addIdentity(ext,args);
- switch (ext) {
- case "c":
- if(inFile.mCStandard != null) {
- if(BuildTool.isMsvc()) {
- if (inFile.mCStandard > 17) {
- args.push('/std:clatest');
- } else if (inFile.mCStandard >= 11) {
- args.push('/std:c${inFile.mCStandard}');
- }
- } else {
- args.push('-std=c${inFile.mCStandard}');
- }
- }
- case "m":
- if(inFile.mObjCStandard != null) {
- args.push('-std=c${inFile.mObjCStandard}');
- }
- case "mm":
- if(inFile.mObjCxxStandard != null) {
- args.push('-std=c++${inFile.mObjCxxStandard}');
- }
- case "cpp", "c++", "cc":
- if(inFile.mCxxStandard != null) {
- if (BuildTool.isMsvc()) {
- if (inFile.mCxxStandard > 20) {
- args.push('/std:c++latest');
- } else if (inFile.mCStandard >= 14) {
- args.push('/std:c++${inFile.mCxxStandard}');
- }
- } else {
- args.push('-std=c++${inFile.mCxxStandard}');
- }
- }
+ var lang = addIdentity(ext,args);
+ if (lang != null) {
+ addStandard(lang, inFile, args);
}
-
var allowPch = false;
if (asm)
@@ -608,6 +632,7 @@ class Compiler
args = args.concat( mPCHFlags );
+ addStandard(Cxx, inGroup, args);
//Log.info("", "Make pch dir " + dir );
PathManager.mkdir(dir);
From 55039d183b4f779646224b60aed5b39c6f5b79e5 Mon Sep 17 00:00:00 2001
From: Apprentice-Alchemist
<53486764+Apprentice-Alchemist@users.noreply.github.com>
Date: Sat, 31 Jan 2026 21:43:18 +0100
Subject: [PATCH 4/4] more generic name for build tool tests
---
.github/workflows/test.yml | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9dc725578..75a212984 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -221,12 +221,9 @@ jobs:
run: haxe compile-cpp.hxml -D ${{ env.HXCPP_ARCH_FLAG }} -D no_http
- name: run
run: bin${{ inputs.sep }}cpp${{ inputs.sep }}TestMain-debug
- cxx_standard:
+ build_tool:
runs-on: ${{ inputs.os }}
- name: cxx_standard
- defaults:
- run:
- working-directory: test/cxx_standard
+ name: build tool tests
steps:
- name: checkout
uses: actions/checkout@v4
@@ -234,5 +231,6 @@ jobs:
uses: ./.github/workflows/setup
with:
haxe: ${{ inputs.haxe }}
- - name: build
+ - name: test c/cxx_standard attributes
+ working-directory: test/cxx_standard
run: haxelib run hxcpp Build.xml