mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
More refactoring, getting rid of meson in favor of just powershell scripts
This commit is contained in:
parent
aa928ff446
commit
32a910515e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
.idea
|
||||
|
||||
build/*
|
||||
**/build/*
|
||||
.vs
|
||||
|
||||
**/*.gen.*
|
||||
|
6
.vscode/c_cpp_properties.json
vendored
6
.vscode/c_cpp_properties.json
vendored
@ -12,8 +12,10 @@
|
||||
"GEN_TIME"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.19041.0",
|
||||
"compilerPath": "C:/Users/Ed/scoop/apps/llvm/current/bin/clang++.exe",
|
||||
"intelliSenseMode": "windows-clang-x64",
|
||||
// "compilerPath": "C:/Users/Ed/scoop/apps/llvm/current/bin/clang++.exe",
|
||||
"compilerPath": "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe",
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
// "intelliSenseMode": "windows-clang-x64",
|
||||
"compileCommands": "${workspaceFolder}/project/build/compile_commands.json"
|
||||
}
|
||||
],
|
||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -27,7 +27,7 @@
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Debug bootstrap vsdbg",
|
||||
"program": "${workspaceFolder}/project/build/gencpp_bootstrap.exe",
|
||||
"program": "${workspaceFolder}/project/build/bootstrap.exe",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/project/",
|
||||
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
||||
|
@ -40,7 +40,6 @@ The keywords supported for the preprocessor are:
|
||||
* ifdef
|
||||
* elif
|
||||
* endif
|
||||
* undef
|
||||
* pragma
|
||||
|
||||
Each directive `#` line is considered one preproecessor unit, and will be treated as one Preprocessor AST. *These ASTs will be considered members or entries of braced scope they reside within*.
|
||||
|
@ -98,6 +98,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".editorconfig" />
|
||||
<None Include="project\components\temp\Readme.md" />
|
||||
<None Include="Readme.md" />
|
||||
<None Include="scripts\build.ci.ps1" />
|
||||
<None Include="scripts\build.ps1" />
|
||||
@ -111,6 +112,8 @@
|
||||
<None Include="test\Readme.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="project\components\ast.hpp" />
|
||||
<ClInclude Include="project\components\ast_types.hpp" />
|
||||
<ClInclude Include="project\components\gen.data_structures.hpp" />
|
||||
<ClInclude Include="project\components\gen.ecode.hpp" />
|
||||
<ClInclude Include="project\components\gen.eoperator.hpp" />
|
||||
@ -119,6 +122,19 @@
|
||||
<ClInclude Include="project\components\gen.header_start.hpp" />
|
||||
<ClInclude Include="project\components\gen.interface.hpp" />
|
||||
<ClInclude Include="project\components\gen.types.hpp" />
|
||||
<ClInclude Include="project\components\header_end.hpp" />
|
||||
<ClInclude Include="project\components\header_start.hpp" />
|
||||
<ClInclude Include="project\components\inlines.hpp" />
|
||||
<ClInclude Include="project\components\interface.hpp" />
|
||||
<ClInclude Include="project\components\temp\ast_inlines.hpp" />
|
||||
<ClInclude Include="project\components\temp\ecode.hpp" />
|
||||
<ClInclude Include="project\components\temp\eoperator.hpp" />
|
||||
<ClInclude Include="project\components\temp\especifier.hpp" />
|
||||
<ClInclude Include="project\components\types.hpp" />
|
||||
<ClInclude Include="project\dependencies\basic_types.hpp" />
|
||||
<ClInclude Include="project\dependencies\containers.hpp" />
|
||||
<ClInclude Include="project\dependencies\debug.hpp" />
|
||||
<ClInclude Include="project\dependencies\filesystem.hpp" />
|
||||
<ClInclude Include="project\dependencies\gen.basic_types.hpp" />
|
||||
<ClInclude Include="project\dependencies\gen.containers.hpp" />
|
||||
<ClInclude Include="project\dependencies\gen.debug.hpp" />
|
||||
@ -132,6 +148,15 @@
|
||||
<ClInclude Include="project\dependencies\gen.string.hpp" />
|
||||
<ClInclude Include="project\dependencies\gen.string_ops.hpp" />
|
||||
<ClInclude Include="project\dependencies\gen.timing.hpp" />
|
||||
<ClInclude Include="project\dependencies\hashing.hpp" />
|
||||
<ClInclude Include="project\dependencies\header_start.hpp" />
|
||||
<ClInclude Include="project\dependencies\macros.hpp" />
|
||||
<ClInclude Include="project\dependencies\memory.hpp" />
|
||||
<ClInclude Include="project\dependencies\parsing.hpp" />
|
||||
<ClInclude Include="project\dependencies\printing.hpp" />
|
||||
<ClInclude Include="project\dependencies\strings.hpp" />
|
||||
<ClInclude Include="project\dependencies\string_ops.hpp" />
|
||||
<ClInclude Include="project\dependencies\timing.hpp" />
|
||||
<ClInclude Include="project\filesystem\gen.builder.hpp" />
|
||||
<ClInclude Include="project\filesystem\gen.editor.hpp" />
|
||||
<ClInclude Include="project\filesystem\gen.scanner.hpp" />
|
||||
@ -140,6 +165,10 @@
|
||||
<ClInclude Include="project\helpers\gen.pop_ignores.inline.hpp" />
|
||||
<ClInclude Include="project\helpers\gen.push_ignores.inline.hpp" />
|
||||
<ClInclude Include="project\helpers\gen.undef.macros.hpp" />
|
||||
<ClInclude Include="project\helpers\helper.hpp" />
|
||||
<ClInclude Include="project\helpers\pop_ignores.inline.hpp" />
|
||||
<ClInclude Include="project\helpers\push_ignores.inline.hpp" />
|
||||
<ClInclude Include="project\helpers\undef.macros.hpp" />
|
||||
<ClInclude Include="singleheader\components\gen.header_start.hpp" />
|
||||
<ClInclude Include="test\DummyInclude.hpp" />
|
||||
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp" />
|
||||
@ -157,6 +186,9 @@
|
||||
<ClInclude Include="test\Parsed\Sanity.Parsed.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="project\bootstrap.cpp" />
|
||||
<ClCompile Include="project\components\ast.cpp" />
|
||||
<ClCompile Include="project\components\ast_case_macros.cpp" />
|
||||
<ClCompile Include="project\components\gen.ast.cpp" />
|
||||
<ClCompile Include="project\components\gen.ast_case_macros.cpp" />
|
||||
<ClCompile Include="project\components\gen.data.cpp" />
|
||||
@ -166,6 +198,15 @@
|
||||
<ClCompile Include="project\components\gen.interface.parsing.cpp" />
|
||||
<ClCompile Include="project\components\gen.interface.upfront.cpp" />
|
||||
<ClCompile Include="project\components\gen.untyped.cpp" />
|
||||
<ClCompile Include="project\components\interface.cpp" />
|
||||
<ClCompile Include="project\components\interface.parsing.cpp" />
|
||||
<ClCompile Include="project\components\interface.upfront.cpp" />
|
||||
<ClCompile Include="project\components\src_start.cpp" />
|
||||
<ClCompile Include="project\components\static_data.cpp" />
|
||||
<ClCompile Include="project\components\temp\etoktype.cpp" />
|
||||
<ClCompile Include="project\components\untyped.cpp" />
|
||||
<ClCompile Include="project\dependencies\debug.cpp" />
|
||||
<ClCompile Include="project\dependencies\filesystem.cpp" />
|
||||
<ClCompile Include="project\dependencies\gen.debug.cpp" />
|
||||
<ClCompile Include="project\dependencies\gen.file_handling.cpp" />
|
||||
<ClCompile Include="project\dependencies\gen.hashing.cpp" />
|
||||
@ -176,6 +217,14 @@
|
||||
<ClCompile Include="project\dependencies\gen.string.cpp" />
|
||||
<ClCompile Include="project\dependencies\gen.string_ops.cpp" />
|
||||
<ClCompile Include="project\dependencies\gen.timing.cpp" />
|
||||
<ClCompile Include="project\dependencies\hashing.cpp" />
|
||||
<ClCompile Include="project\dependencies\memory.cpp" />
|
||||
<ClCompile Include="project\dependencies\parsing.cpp" />
|
||||
<ClCompile Include="project\dependencies\printing.cpp" />
|
||||
<ClCompile Include="project\dependencies\src_start.cpp" />
|
||||
<ClCompile Include="project\dependencies\strings.cpp" />
|
||||
<ClCompile Include="project\dependencies\string_ops.cpp" />
|
||||
<ClCompile Include="project\dependencies\timing.cpp" />
|
||||
<ClCompile Include="project\gen.bootstrap.cpp" />
|
||||
<ClCompile Include="project\gen.cpp" />
|
||||
<ClCompile Include="project\gen.dep.cpp" />
|
||||
|
@ -18,18 +18,9 @@
|
||||
<ClCompile Include="project\gen.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="test\gen\build\meson-private\sanitycheckc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="test\gen\build\meson-private\sanitycheckcpp.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="test\test.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="singleheader\gen\gen.singleheader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="test\test.Upfront.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -60,9 +51,6 @@
|
||||
<ClCompile Include="project\components\gen.interface.upfront.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.dep.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.file_handling.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -75,32 +63,116 @@
|
||||
<ClCompile Include="project\dependencies\gen.printing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen.ast_case_macros.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen.data.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen.etoktype.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen.impl_start.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen.interface.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen.untyped.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.debug.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.hashing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.impl_start.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.string.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.string_ops.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\gen.timing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\gen.bootstrap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="singleheader\gen.singleheader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\temp\etoktype.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\ast.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\ast_case_macros.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\interface.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\interface.parsing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\interface.upfront.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\src_start.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\static_data.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\untyped.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\bootstrap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\debug.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\filesystem.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\hashing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\memory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\parsing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\printing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\src_start.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\string_ops.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\strings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\dependencies\timing.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="project\gen.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\gen.undef.macros.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\DummyInclude.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\gen\array.Upfront.gen.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\gen\buffer.Upfront.gen.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\gen\hashtable.Upfront.gen.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\gen\ring.Upfront.gen.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\gen\sanity.Upfront.gen.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -137,18 +209,6 @@
|
||||
<ClInclude Include="project\gen.dep.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\gen.editor.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\gen.pop_ignores.inline.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\gen.push_ignores.inline.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\gen.scanner.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\parsing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -170,9 +230,6 @@
|
||||
<ClInclude Include="project\dependencies\gen.containers.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\gen.dep.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\gen.file_handling.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -215,6 +272,117 @@
|
||||
<ClInclude Include="project\helpers\gen.undef.macros.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen.ecode.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen.eoperator.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen.especifier.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen.header_end.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen.header_start.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\gen.debug.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\gen.hashing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\gen.timing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="singleheader\components\gen.header_start.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\temp\ast_inlines.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\temp\ecode.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\temp\eoperator.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\temp\especifier.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\ast.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\ast_types.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\header_end.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\header_start.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\inlines.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\interface.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\types.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\helpers\helper.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\helpers\pop_ignores.inline.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\helpers\push_ignores.inline.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\helpers\undef.macros.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\basic_types.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\containers.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\debug.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\filesystem.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\hashing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\header_start.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\macros.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\memory.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\parsing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\printing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\string_ops.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\strings.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\dependencies\timing.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".editorconfig" />
|
||||
@ -229,6 +397,7 @@
|
||||
<None Include="scripts\gen.ps1" />
|
||||
<None Include="scripts\genccp.natstepfilter" />
|
||||
<None Include="scripts\gencpp.refactor" />
|
||||
<None Include="project\components\temp\Readme.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include=".vscode\gencpp.natvis" />
|
||||
|
@ -12,6 +12,7 @@ Builder Builder::open( char const* path )
|
||||
|
||||
result.Buffer = String::make_reserve( GlobalAllocator, Builder_StrBufferReserve );
|
||||
|
||||
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -22,7 +23,11 @@ void Builder::pad_lines( s32 num )
|
||||
|
||||
void Builder::print( Code code )
|
||||
{
|
||||
Buffer.append( code->to_string() );
|
||||
String str = code->to_string();
|
||||
const sw len = str.length();
|
||||
|
||||
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
|
||||
Buffer.append( str );
|
||||
}
|
||||
|
||||
void Builder::print_fmt( char const* fmt, ... )
|
||||
@ -35,6 +40,7 @@ void Builder::print_fmt( char const* fmt, ... )
|
||||
res = str_fmt_va( buf, count_of( buf ) - 1, fmt, va ) - 1;
|
||||
va_end( va );
|
||||
|
||||
// log_fmt( "$%s - print_fmt: %.*s\n", File.filename, res > 80 ? 80 : res, buf );
|
||||
Buffer.append( buf, res );
|
||||
}
|
||||
|
||||
@ -43,8 +49,9 @@ void Builder::write()
|
||||
bool result = file_write( & File, Buffer, Buffer.length() );
|
||||
|
||||
if ( result == false )
|
||||
log_failure("gen::File::write - Failed to write to file: %s", file_name( & File ) );
|
||||
log_failure("gen::File::write - Failed to write to file: %s\n", file_name( & File ) );
|
||||
|
||||
log_fmt( "Generated: %s\n", File.filename );
|
||||
file_close( & File );
|
||||
Buffer.free();
|
||||
}
|
||||
|
@ -1409,7 +1409,7 @@ CodeAttributes parse_attributes()
|
||||
using namespace Parser;
|
||||
push_scope();
|
||||
|
||||
Token start;
|
||||
Token start = NullToken;
|
||||
s32 len = 0;
|
||||
|
||||
if ( check(TokType::Attribute_Open) )
|
||||
@ -3186,7 +3186,7 @@ CodeConstructor parse_constructor()
|
||||
{
|
||||
eat( TokType::Assign_Classifer );
|
||||
|
||||
Token initializer_list_tok;
|
||||
Token initializer_list_tok = NullToken;
|
||||
|
||||
s32 level = 0;
|
||||
while ( left && ( currtok.Type != TokType::BraceCurly_Open || level > 0 ) )
|
||||
|
@ -34,22 +34,22 @@ s32 assert_crash( char const* condition );
|
||||
void process_exit( u32 code );
|
||||
|
||||
#if Build_Debug
|
||||
#define GEN_FATAL( fmt, ... ) \
|
||||
#define GEN_FATAL( ... ) \
|
||||
do \
|
||||
{ \
|
||||
local_persist thread_local \
|
||||
char buf[GEN_PRINTF_MAXLEN] = { 0 }; \
|
||||
\
|
||||
str_fmt(buf, GEN_PRINTF_MAXLEN, fmt, __VA_ARGS__); \
|
||||
str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__); \
|
||||
GEN_PANIC(buf); \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
|
||||
# define GEN_FATAL( fmt, ... ) \
|
||||
# define GEN_FATAL( ... ) \
|
||||
do \
|
||||
{ \
|
||||
str_fmt_out_err( fmt, __VA_ARGS__ ); \
|
||||
str_fmt_out_err( __VA_ARGS__ ); \
|
||||
process_exit(1); \
|
||||
} \
|
||||
while (0)
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define scast( Type, Value ) static_cast< Type >( Value )
|
||||
|
||||
// Num Arguments (Varadics)
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
// #if defined(__GNUC__) || defined(__clang__)
|
||||
// Supports 0-50 arguments
|
||||
#define num_args_impl( _0, \
|
||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||
@ -72,37 +72,37 @@
|
||||
0 \
|
||||
)
|
||||
|
||||
#else
|
||||
// #else
|
||||
// Supports 1-50 arguments
|
||||
#define num_args_impl( \
|
||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
||||
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
||||
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
||||
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
||||
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
|
||||
_61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
|
||||
_71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
|
||||
_81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
|
||||
_91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
|
||||
N, ... \
|
||||
) N
|
||||
// #define num_args_impl( \
|
||||
// _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||
// _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
||||
// _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
||||
// _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
||||
// _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
||||
// _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
|
||||
// _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
|
||||
// _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
|
||||
// _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
|
||||
// _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
|
||||
// N, ... \
|
||||
// ) N
|
||||
|
||||
#define num_args(...) \
|
||||
num_args_impl( __VA_ARGS__, \
|
||||
100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
|
||||
90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
|
||||
80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
|
||||
70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
|
||||
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
|
||||
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
||||
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
||||
10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
|
||||
)
|
||||
#endif
|
||||
// #define num_args(...) \
|
||||
// num_args_impl( __VA_ARGS__, \
|
||||
// 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
|
||||
// 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
|
||||
// 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
|
||||
// 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
|
||||
// 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
|
||||
// 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||
// 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||
// 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||
// 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
||||
// 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
||||
// 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
|
||||
// )
|
||||
// // #endif
|
||||
|
||||
// Stringizing
|
||||
#define stringize_va( ... ) #__VA_ARGS__
|
||||
|
@ -61,7 +61,7 @@ CodeBody gen_ecode( char const* path )
|
||||
|
||||
CodeBody gen_eoperator( char const* path )
|
||||
{
|
||||
char scratch_mem[kilobytes(1)];
|
||||
char scratch_mem[kilobytes(4)];
|
||||
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||
|
||||
file_read_contents( scratch, zero_terminate, path );
|
||||
@ -116,7 +116,7 @@ CodeBody gen_eoperator( char const* path )
|
||||
|
||||
CodeBody gen_especifier( char const* path )
|
||||
{
|
||||
char scratch_mem[kilobytes(1)];
|
||||
char scratch_mem[kilobytes(4)];
|
||||
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||
|
||||
file_read_contents( scratch, zero_terminate, path );
|
||||
|
@ -1,18 +0,0 @@
|
||||
project( 'gencpp_bootstrap', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
||||
|
||||
includes = include_directories(
|
||||
[
|
||||
'../project',
|
||||
])
|
||||
|
||||
sources = [ 'gen.bootstrap.cpp' ]
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
|
||||
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
|
||||
|
||||
endif
|
||||
|
||||
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
|
||||
|
||||
executable( 'gencpp_bootstrap', sources, include_directories : includes )
|
@ -27,13 +27,18 @@ IF they are changed the following files would need adjustment:
|
||||
**`clean.ps1`**
|
||||
Remove any generated content from the repository.
|
||||
|
||||
**`bootstrap.ps1`**
|
||||
Generate a version of gencpp where components are inlined directly to `gen.<hpp/cpp>` and `gen. <hpp/cpp>`
|
||||
Any heavily preprocessed code is not inlined and are instead generated using the code in the `helpers` directory.
|
||||
**`build.ps1`**
|
||||
Build bootstrap, singleheader, or tests. Supports MSVC or clang, release or debug.
|
||||
|
||||
**`singleheader.ps1`**
|
||||
Generate a single-header version of the library where all code that would normally good in the usual four files (see bootstrap) are inlined into a single `gen.hpp` file.
|
||||
As with the bootstrap, any heavily preprocessed code is not inlined and instead generated with helper code.
|
||||
```
|
||||
args:
|
||||
bootstrap
|
||||
singleheader
|
||||
test
|
||||
clang
|
||||
msvc
|
||||
release
|
||||
```
|
||||
|
||||
**`test.gen.build.ps1`**
|
||||
Build the metaprogram for generating the test code.
|
||||
@ -46,3 +51,6 @@ Build and run metaprogram, build test program.
|
||||
|
||||
**`test.run.ps1`**
|
||||
Build and run metaprogram, build and run test program.
|
||||
|
||||
|
||||
*Note: My env is Windows 11 with MSVC 2022 and clang 16.0.6*
|
||||
|
@ -1,78 +0,0 @@
|
||||
[string] $type = $null
|
||||
[string] $test = $false
|
||||
|
||||
foreach ( $arg in $args )
|
||||
{
|
||||
if ( $arg -eq "test" )
|
||||
{
|
||||
$test = $true
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = $arg
|
||||
}
|
||||
}
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_project = Join-Path $path_root project
|
||||
$path_project_build = Join-Path $path_project build
|
||||
$path_project_gen = Join-Path $path_project gen
|
||||
|
||||
write-host "`n`nBuilding gencpp bootstrap`n"
|
||||
|
||||
if ( -not( Test-Path $path_project_build) )
|
||||
{
|
||||
# Generate build files for bootstrap
|
||||
Push-Location $path_project
|
||||
$args_meson = @()
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_project_build
|
||||
|
||||
& meson $args_meson
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Compile bootstrap
|
||||
Push-Location $path_root
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_project_build
|
||||
|
||||
& ninja $args_ninja
|
||||
Pop-Location
|
||||
|
||||
Push-location $path_project
|
||||
if ( -not(Test-Path($path_project_gen) )) {
|
||||
New-Item -ItemType Directory -Path $path_project_gen
|
||||
}
|
||||
|
||||
# Run bootstrap
|
||||
$gencpp_bootstrap = Join-Path $path_project_build gencpp_bootstrap.exe
|
||||
|
||||
Write-Host `nRunning gencpp bootstrap...
|
||||
& $gencpp_bootstrap
|
||||
|
||||
# Format generated gencpp
|
||||
Write-Host `nBeginning format...
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file:../scripts/.clang-format'
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$include = @(
|
||||
'gen.hpp', 'gen.cpp',
|
||||
'gen.dep.hpp', 'gen.dep.cpp',
|
||||
'gen.builder.hpp', 'gen.builder.cpp'
|
||||
'gen.scanner.hpp', 'gen.scanner.cpp'
|
||||
)
|
||||
$exclude = $null
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
clang-format $formatParams $targetFiles
|
||||
Write-Host "`nFormatting complete"
|
||||
Pop-Location
|
||||
|
||||
# Build and run validation
|
||||
|
@ -1,2 +0,0 @@
|
||||
cls
|
||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'bootstrap.ci.ps1') $args"
|
367
scripts/build.ps1
Normal file
367
scripts/build.ps1
Normal file
@ -0,0 +1,367 @@
|
||||
Import-Module ./helpers/target_arch.psm1
|
||||
|
||||
cls
|
||||
|
||||
#region Arguments
|
||||
$compiler = $null
|
||||
[bool] $release = $false
|
||||
[bool] $bootstrap = $false
|
||||
[bool] $singleheader = $false
|
||||
[bool] $tests = $false
|
||||
|
||||
[array] $compilers = @( "clang", "gcc", "msvc" )
|
||||
|
||||
# This is a really lazy way of parsing the args, could use actual params down the line...
|
||||
|
||||
if ( $args ) { $args | ForEach-Object {
|
||||
switch ($_){
|
||||
{ $_ -in $compilers } { $compiler = $_; break }
|
||||
"release" { $release = $true }
|
||||
"bootstrap" { $bootstrap = $true }
|
||||
"singleheader" { $singleheader = $true }
|
||||
"tests" { $tests = $true }
|
||||
}
|
||||
}}
|
||||
#endregion Arguments
|
||||
|
||||
#region Building
|
||||
write-host "Building gencpp with $compiler"
|
||||
|
||||
Invoke-Expression "& $(join-path $PSScriptRoot 'helpers/devshell.ps1') -arch x64"
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_build = Join-Path $path_root build
|
||||
$path_project = Join-Path $path_root project
|
||||
$path_scripts = Join-Path $path_root scripts
|
||||
$path_singleheader = Join-Path $path_root singleheader
|
||||
$path_test = Join-Path $path_root test
|
||||
|
||||
write-host "Build Type: $(if ($release) {"Release"} else {"Debug"} )"
|
||||
|
||||
if ( $compiler -eq $null ) {
|
||||
write-host "No compilier specified, assuming clang available"
|
||||
$compiler = "clang"
|
||||
}
|
||||
|
||||
Push-Location $path_root
|
||||
|
||||
function run-compiler
|
||||
{
|
||||
param( $compiler, $executable, $path_build, $path_gen, $compiler_args )
|
||||
|
||||
write-host "`nBuilding $executable"
|
||||
write-host "Compiler config:"
|
||||
$compiler_args | ForEach-Object {
|
||||
write-host $_ -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
if ( -not(Test-Path($path_build) )) {
|
||||
New-Item -ItemType Directory -Path $path_build
|
||||
}
|
||||
if ( -not(Test-Path($path_gen) )) {
|
||||
New-Item -ItemType Directory -Path $path_gen
|
||||
}
|
||||
|
||||
$time_taken = Measure-Command {
|
||||
& $compiler $compiler_args
|
||||
| ForEach-Object {
|
||||
$color = 'White'
|
||||
switch ($_){
|
||||
{ $_ -match "error" } { $color = 'Red' ; break }
|
||||
{ $_ -match "warning" } { $color = 'Yellow'; break }
|
||||
}
|
||||
write-host `t $_ -ForegroundColor $color
|
||||
}
|
||||
}
|
||||
write-host "$executable built in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
|
||||
if ( $compiler -match "clang" )
|
||||
{
|
||||
$target_arch = Get-TargetArchClang
|
||||
|
||||
$flag_compile_only = '-c'
|
||||
$flag_debug = '-g'
|
||||
$flag_debug_codeview = '-gcodeview'
|
||||
$flag_define = '-D'
|
||||
$flag_include = '-I'
|
||||
$flag_library = '-l'
|
||||
$flag_library_path = '-L'
|
||||
$flag_path_output = '-o'
|
||||
$flag_preprocess_non_intergrated = '-no-integrated-cpp'
|
||||
$flag_profiling_debug = '-fdebug-info-for-profiling'
|
||||
$flag_target_arch = '-target'
|
||||
$flag_x_linker = '-Xlinker'
|
||||
$flag_machine_32 = '/machine:X64'
|
||||
$flag_machine_64 = '/machine:X64'
|
||||
$flag_win_linker = '-Wl,'
|
||||
$flag_win_subsystem_console = '/SUBSYSTEM:CONSOLE'
|
||||
$flag_win_machine_32 = '/MACHINE:X86'
|
||||
$flag_win_machine_64 = '/MACHINE:X64'
|
||||
|
||||
# $library_paths = @(
|
||||
# 'C:\Windows\System32'
|
||||
|
||||
# )
|
||||
|
||||
if ( $bootstrap )
|
||||
{
|
||||
$path_build = join-path $path_project build
|
||||
$path_gen = join-path $path_project gen
|
||||
|
||||
$include = $path_project
|
||||
$unit = join-path $path_project "bootstrap.cpp"
|
||||
$executable = join-path $path_build "bootstrap.exe"
|
||||
|
||||
$compiler_args = @(
|
||||
$flag_target_arch, $target_arch,
|
||||
$flag_preprocess_non_intergrated,
|
||||
$( $flag_define + 'GEN_TIME' ),
|
||||
$flag_path_output, $executable,
|
||||
$( $flag_include + $include )
|
||||
)
|
||||
if ( $release -eq $false ) {
|
||||
$compiler_args += $( $flag_define + 'Build_Debug' )
|
||||
$compiler_args += $flag_debug, $flag_debug_codeview, $flag_profiling_debug
|
||||
}
|
||||
|
||||
$linker_args = @(
|
||||
$flag_x_linker,
|
||||
# $( $flag_linker + $flag_win_subsystem_console ),
|
||||
$( $flag_linker + $flag_machine_64 )
|
||||
)
|
||||
$libraries = @(
|
||||
'Kernel32', # For Windows API
|
||||
# 'msvcrt', # For the C Runtime (Dynamically Linked)
|
||||
'libucrt',
|
||||
'libcmt' # For the C Runtime (Static Linkage)
|
||||
)
|
||||
$compiler_args += $linker_args
|
||||
$compiler_args += $libraries | ForEach-Object { $flag_library + $_ }
|
||||
|
||||
$compiler_args += $unit
|
||||
run-compiler clang $executable $path_build $path_gen $compiler_args
|
||||
|
||||
Push-Location $path_project
|
||||
if ( Test-Path($executable) ) {
|
||||
write-host "`nRunning bootstrap"
|
||||
$time_taken = Measure-Command { & $executable
|
||||
| ForEach-Object {
|
||||
write-host `t $_ -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
write-host "`nBootstrap completed in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ( $singleheader )
|
||||
{
|
||||
$path_build = join-path $path_singleheader build
|
||||
$path_gen = join-path $path_singleheader gen
|
||||
|
||||
$include = $path_project
|
||||
$unit = join-path $path_singleheader "singleheader.cpp"
|
||||
$executable = join-path $path_build "singleheader.exe"
|
||||
|
||||
$compiler_args = @(
|
||||
$flag_target_arch, $target_arch,
|
||||
$flag_preprocess_non_intergrated,
|
||||
$( $flag_define + 'GEN_TIME' ),
|
||||
$flag_path_output, $executable,
|
||||
$( $flag_include + $include )
|
||||
)
|
||||
if ( $release -eq $false ) {
|
||||
$compiler_args += $( $flag_define + 'Build_Debug' )
|
||||
$compiler_args += $flag_debug, $flag_debug_codeview, $flag_profiling_debug
|
||||
}
|
||||
|
||||
$compiler_args += $unit
|
||||
run-compiler clang $executable $path_build $path_gen $compiler_args
|
||||
|
||||
Push-Location $path_singleheader
|
||||
if ( Test-Path($executable) ) {
|
||||
write-host "`nRunning singleheader generator"
|
||||
$time_taken = Measure-Command { & $executable
|
||||
| ForEach-Object {
|
||||
write-host `t $_ -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
write-host "`nSingleheader generator completed in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ( $test )
|
||||
{
|
||||
# ... [your test compilation code here]
|
||||
}
|
||||
}
|
||||
|
||||
if ( $compiler -match "msvc" )
|
||||
{
|
||||
$flag_debug = '/Zi'
|
||||
$flag_define = '/D'
|
||||
$flag_include = '/I'
|
||||
$flag_full_src_path = '/FC'
|
||||
$flag_nologo = '/nologo'
|
||||
$flag_linker = '/link'
|
||||
$flag_out_name = '/OUT:'
|
||||
$flag_path_interm = '/Fo'
|
||||
$flag_path_debug = '/Fd'
|
||||
$flag_path_output = '/Fe'
|
||||
$flag_preprocess_conform = '/Zc:preprocessor'
|
||||
|
||||
[array] $compiler_args = $null
|
||||
|
||||
if ( $bootstrap )
|
||||
{
|
||||
$path_build = join-path $path_project build
|
||||
$path_gen = join-path $path_project gen
|
||||
|
||||
$include = $path_project
|
||||
$unit = join-path $path_project "bootstrap.cpp"
|
||||
$executable = join-path $path_build "bootstrap.exe"
|
||||
|
||||
|
||||
$compiler_args = @(
|
||||
$flag_nologo,
|
||||
$flag_debug,
|
||||
$flag_preprocess_conform,
|
||||
$( $flag_define + 'GEN_TIME' ),
|
||||
$flag_full_src_path,
|
||||
$( $flag_path_interm + $path_build + '\' ),
|
||||
$( $flag_path_output + $path_build + '\' ),
|
||||
$( $flag_include + $include )
|
||||
)
|
||||
|
||||
if ( $release -eq $false ) {
|
||||
$compiler_args += $( $flag_define + 'Build_Debug' )
|
||||
$compiler_args += $( $flag_path_debug + $path_build + '\' )
|
||||
}
|
||||
|
||||
$compiler_args += $unit
|
||||
run-compiler cl $executable $path_build $path_gen $compiler_args
|
||||
|
||||
Push-Location $path_project
|
||||
if ( Test-Path($executable) ) {
|
||||
write-host "`nRunning bootstrap"
|
||||
$time_taken = Measure-Command { & $executable
|
||||
| ForEach-Object {
|
||||
write-host `t $_ -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
write-host "`nBootstrap completed in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ( $singleheader )
|
||||
{
|
||||
$path_build = join-path $path_singleheader build
|
||||
$path_gen = join-path $path_singleheader gen
|
||||
|
||||
$include = $path_project
|
||||
$unit = join-path $path_singleheader "singleheader.cpp"
|
||||
$executable = join-path $path_build "singleheader.exe"
|
||||
|
||||
$compiler_args = @(
|
||||
$flag_nologo,
|
||||
$flag_debug,
|
||||
$flag_preprocess_conform,
|
||||
$( $flag_define + 'GEN_TIME' ),
|
||||
$flag_full_src_path,
|
||||
$( $flag_path_interm + $path_build + '\' ),
|
||||
$( $flag_path_output + $path_build + '\' ),
|
||||
$( $flag_include + $include )
|
||||
)
|
||||
|
||||
if ( $release -eq $false ) {
|
||||
$compiler_args += $( $flag_define + 'Build_Debug' )
|
||||
$compiler_args += $( $flag_path_debug + $path_build + '\' )
|
||||
}
|
||||
|
||||
$compiler_args += $unit
|
||||
run-compiler cl $executable $path_build $path_gen $compiler_args
|
||||
|
||||
Push-Location $path_singleheader
|
||||
if ( Test-Path($executable) ) {
|
||||
write-host "`nRunning singleheader generator"
|
||||
$time_taken = Measure-Command { & $executable
|
||||
| ForEach-Object {
|
||||
write-host `t $_ -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
write-host "`nSingleheader generator completed in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ( $test )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#pragma endregion Building
|
||||
|
||||
#pragma region Formatting
|
||||
if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) )
|
||||
{
|
||||
$path_gen = join-path $path_project gen
|
||||
|
||||
# Format generated gencpp
|
||||
Write-Host "`nBeginning format"
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file:./scripts/.clang-format'
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$include = @(
|
||||
'gen.hpp', 'gen.cpp',
|
||||
'gen.dep.hpp', 'gen.dep.cpp',
|
||||
'gen.builder.hpp', 'gen.builder.cpp'
|
||||
'gen.scanner.hpp', 'gen.scanner.cpp'
|
||||
)
|
||||
$exclude = $null
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
$time_taken = Measure-Command {
|
||||
clang-format $formatParams $targetFiles
|
||||
}
|
||||
Write-Host "`nFormatting complete in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
|
||||
if ( $singleheader )
|
||||
{
|
||||
$path_gen = join-path $path_singleheader gen
|
||||
|
||||
# Format generated gencpp
|
||||
Write-Host "`nBeginning format"
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file:./scripts/.clang-format'
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$include = @(
|
||||
'gen.hpp'
|
||||
)
|
||||
$exclude = $null
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
$time_taken = Measure-Command {
|
||||
clang-format $formatParams $targetFiles
|
||||
}
|
||||
Write-Host "`nFormatting complete in $($time_taken.TotalMilliseconds) ms"
|
||||
}
|
||||
|
||||
if ( $test )
|
||||
{
|
||||
|
||||
}
|
||||
#pragma endregion Formatting
|
||||
|
||||
Pop-Location # $path_root
|
@ -1,3 +1,8 @@
|
||||
param (
|
||||
[ValidateSet("x64", "x86", "arm", "arm64")]
|
||||
[string]$arch = "x64"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Use vswhere to find the latest Visual Studio installation
|
||||
@ -17,6 +22,9 @@ if ( -not (Test-Path $vs_devshell) ) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set the target architecture based on the parameter
|
||||
$env:VSCMD_ARG_TGT_ARCH=$arch
|
||||
|
||||
# Launch the Visual Studio Developer Shell
|
||||
Push-Location
|
||||
& $vs_devshell @args
|
25
scripts/helpers/target_arch.psm1
Normal file
25
scripts/helpers/target_arch.psm1
Normal file
@ -0,0 +1,25 @@
|
||||
# target_arch.psm1
|
||||
|
||||
function Get-TargetArchClang {
|
||||
# Get the target architecture by querying clang itself
|
||||
$output = & clang -v 2>&1
|
||||
foreach ($line in $output) {
|
||||
if ($line -like "*Target:*") {
|
||||
$clangTarget = ($line -split ':')[1].Trim()
|
||||
return $clangTarget
|
||||
}
|
||||
}
|
||||
throw "Clang target architecture could not be determined."
|
||||
}
|
||||
|
||||
function Get-TargetArchMSVC {
|
||||
# Assuming you've set the Visual Studio environment variables using `vcvarsall.bat`
|
||||
# This looks for the `VSCMD_ARG_TGT_ARCH` environment variable which Visual Studio sets to indicate the target architecture.
|
||||
$arch = $env:VSCMD_ARG_TGT_ARCH
|
||||
if (-not $arch) {
|
||||
throw "MSVC target architecture could not be determined. Ensure you've initialized the Visual Studio environment."
|
||||
}
|
||||
return $arch
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Get-TargetArchClang, Get-TargetArchMSVC
|
@ -1,16 +0,0 @@
|
||||
cls
|
||||
|
||||
if ( -not( Test-Path $path_build ) ) {
|
||||
New-Item -ItemType Directory -Path $path_build | Out-Null
|
||||
}
|
||||
if ( -not( Test-Path $path_build_interm ) ) {
|
||||
New-Item -ItemType Directory -Path $path_build_interm | Out-Null
|
||||
}
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_build = Join-Path $path_root build
|
||||
$path_gen = Join-Path $path_test gen
|
||||
$path_gen_build = Join-Path $path_gen build
|
||||
$path_scripts = Join-Path $path_root scripts
|
||||
$path_test = Join-Path $path_root test
|
||||
$path_test_build = Join-Path $path_test build
|
@ -1,73 +0,0 @@
|
||||
[string] $type = $null
|
||||
[string] $test = $false
|
||||
|
||||
foreach ( $arg in $args )
|
||||
{
|
||||
if ( $arg -eq "test" )
|
||||
{
|
||||
$test = $true
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = $arg
|
||||
}
|
||||
}
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_singleheader = Join-Path $path_root singleheader
|
||||
$path_singleheader_build = Join-Path $path_singleheader build
|
||||
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||
|
||||
write-host "`n`nBuilding gencpp singleheader`n"
|
||||
|
||||
if ( -not( Test-Path $path_singleheader_build) )
|
||||
{
|
||||
# Generate build files for meta-program
|
||||
Push-Location $path_singleheader
|
||||
$args_meson = @()
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_singleheader_build
|
||||
|
||||
& meson $args_meson
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Compile meta-program
|
||||
Push-Location $path_root
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_singleheader_build
|
||||
|
||||
& ninja $args_ninja
|
||||
Pop-Location
|
||||
|
||||
Push-location $path_singleheader
|
||||
if ( -not(Test-Path($path_singleheader_gen) )) {
|
||||
New-Item -ItemType Directory -Path $path_singleheader_gen
|
||||
}
|
||||
|
||||
# Run meta-program
|
||||
$gencpp_singleheader = Join-Path $path_singleheader_build gencpp_singleheader.exe
|
||||
|
||||
Write-Host `nRunning gencpp singleheader...
|
||||
& $gencpp_singleheader
|
||||
|
||||
# Format generated files
|
||||
Write-Host `nBeginning format...
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file:../scripts/.clang-format'
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$include = @('gen.hpp')
|
||||
$exclude = $null
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
clang-format $formatParams $targetFiles
|
||||
Write-Host "`nFormatting complete"
|
||||
Pop-Location
|
||||
|
||||
# Build and run validation
|
||||
|
@ -1,2 +0,0 @@
|
||||
cls
|
||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'singleheader.ci.ps1') $args"
|
@ -1,18 +0,0 @@
|
||||
project( 'gencpp_singleheader', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
||||
|
||||
includes = include_directories(
|
||||
[
|
||||
'../project',
|
||||
])
|
||||
|
||||
sources = [ 'gen.singleheader.cpp' ]
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
|
||||
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
|
||||
|
||||
endif
|
||||
|
||||
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
|
||||
|
||||
executable( 'gencpp_singleheader', sources, include_directories : includes )
|
Loading…
Reference in New Issue
Block a user