Closed bluetarpmedia closed 8 months ago
I was thinking the same. Note that this will require:
std
, std.compat
} .
{ ifc
, obj
} with the identical switches we will use to build the test. The files probably should just stay in the MSVC build current directory since they don't need to be shared, and then we don't need to add a /reference
switch on the command line. Here's what I used FWIW: cl /std:c++latest /EHsc /nologo /W4 /MD /c "%VCToolsInstallDir%\modules\std.ixx"
and cl /std:c++latest /EHsc /nologo /W4 /MD /c "%VCToolsInstallDir%\modules\std.compat.ixx"
.
del *.obj
(as I do in mine), it should be modified to not erase the std*.obj
files... I changed my cleanup step to del pure2-*.obj mixed-*.obj
./experimental-module
to std.obj std.compat.obj
to the MSVC command line (including those obj's seems to work fine even for mixed-*
files that use #include
and don't use them)I can go ahead and make all these changes in one commit, including checking in my std*.ifc
and std*.obj
files in the MSVC regression test directory, and then everything should be consistent and working except for the CI flow... could you then make a PR to apply the same to the CI environment?
Apologies in advance that checking in the std*
modules files added 35M. They should not change often though, if that helps.
If that causes issues and I should remove them again, please speak up and let me know!
See the discussion at https://github.com/hsutter/cppfront/commit/3b78cf171b82b2ea92f1a201922f1ec98f757bfc#commitcomment-112286068. The correct thing to do in this case is to have CI build the module, and cache it and restore it using https://github.com/actions/cache/.
Nice work @hsutter
One thing I noticed is that it’s not necessary to import std;
as well as import std.compat;
because the latter includes the former.
(Shame about the name because it doesn’t seem to suggest that; something like import std+;
makes more sense to me.)
Thanks! STL (the person) just mentioned that too.
I've removed import std;
since it's not needed, and added some build setup notes: 72cfb62c6db215541adfaa85b54acd334a75b0a8
Now that MSVC (with
/std:c++latest
) supportsimport std;
it's possible to remove the Microsoft-only experimentalimport std.core;
etc lines fromcpp2util.h
and replace them withimport std;
orimport std.compat;
.As described in #943, the
import std.core;
code was not working in the GitHub-hosted CI runner, so the MSVC regression tests have been updated to run cppfront with-include-std
to#include
headers instead of importing any modules.I experimented with
import std;
and GitHub-hosted runners and documented two methods to get them building correctly:msbuild
for a Visual Studio solutioncl.exe
in a shell, which is applicable for cppfront's GitHub CI workflowhttps://github.com/bluetarpmedia/msvc-import-std-github
So this suggestion involves 2 changes:
cpp2util.h
to useimport std;
(where available)-import-std
behaviour, and modify the MSVC build job to compileimport std;
modules support first before then compiling the tests (more info in mymsvc-import-std-github
repo)