mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-21 23:34:44 -08:00
segemented builds
This commit is contained in:
parent
0e32838da1
commit
aecc2c59dd
@ -115,7 +115,7 @@ The vast majority of macros should be single-line subsitutions that either add:
|
||||
|
||||
## On base code generation
|
||||
|
||||
There are ***five*** header files which are automatically generated by [base_codegen.hpp](./helpers/base_codegen.hpp). They are all located in [components/gen](./components/gen/).
|
||||
There are ***five*** header files which are automatically generated using [base_codegen.hpp](./helpers/base_codegen.hpp) by [base.cpp](./base.cpp). They are all located in [components/gen](./components/gen/).
|
||||
|
||||
* [`ecode.hpp`](./components/gen/ecode.hpp): `CodeType` enum definition and related implementaiton. Generation is based off of [`ECodeType.csv](./enums/ECodeTypes.csv).
|
||||
* [`especifier.hpp`](./components/gen/especifier.hpp): `Specifier` enum definition, etc. Generated using [`ESpecifier.csv`](./enums/ESpecifier.csv).
|
||||
|
@ -320,7 +320,7 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false )
|
||||
|
||||
CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_definition = false )
|
||||
{
|
||||
FixedArena_32KB scratch; fixed_arena_init(& scratch);
|
||||
FixedArena_64KB scratch; fixed_arena_init(& scratch);
|
||||
AllocatorInfo scratch_info = fixed_arena_allocator_info(& scratch);
|
||||
|
||||
FileContents enum_content = file_read_contents( scratch_info, file_zero_terminate, etok_path );
|
||||
|
@ -1,11 +1,14 @@
|
||||
// Includes are exposed to base directory
|
||||
|
||||
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||
#define GEN_EXPOSE_BACKEND
|
||||
#define GEN_C_LIKE_CPP 1
|
||||
#include "../base/gen.cpp"
|
||||
|
||||
#include "gen.cpp"
|
||||
#include "helpers/push_ignores.inline.hpp"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
GEN_NS_BEGIN
|
||||
#include "helpers/base_codegen.hpp"
|
||||
#include "helpers/misc.hpp"
|
||||
@ -19,9 +22,9 @@ constexpr char const* generation_notice =
|
||||
|
||||
#include <cstdlib> // for system()
|
||||
|
||||
constexpr char const* path_format_style = "../scripts/.clang-format ";
|
||||
constexpr char const* scratch_file = "gen/scratch.hpp";
|
||||
constexpr char const* path_base = "../base/";
|
||||
#define path_format_style "../scripts/.clang-format "
|
||||
#define scratch_file "gen/scratch.hpp"
|
||||
#define path_base "../base/"
|
||||
|
||||
Code format( Code code ) {
|
||||
return code_refactor_and_format(code, scratch_file, nullptr, path_format_style );
|
||||
@ -31,25 +34,26 @@ int gen_main()
|
||||
{
|
||||
gen::init();
|
||||
|
||||
Code push_ignores = scan_file( path_base "helpers/push_ignores.inline.hpp" );
|
||||
Code pop_ignores = scan_file( path_base "helpers/pop_ignores.inline.hpp" );
|
||||
Code push_ignores = scan_file( (path_base "helpers/push_ignores.inline.hpp") );
|
||||
Code pop_ignores = scan_file( (path_base "helpers/pop_ignores.inline.hpp") );
|
||||
|
||||
// gen_dep.hpp
|
||||
{
|
||||
Code platform = scan_file( "dependencies/platform.hpp" );
|
||||
Code macros = scan_file( "dependencies/macros.hpp" );
|
||||
Code basic_types = scan_file( "dependencies/basic_types.hpp" );
|
||||
Code debug = scan_file( "dependencies/debug.hpp" );
|
||||
Code memory = scan_file( "dependencies/memory.hpp" );
|
||||
Code string_ops = scan_file( "dependencies/string_ops.hpp" );
|
||||
Code printing = scan_file( "dependencies/printing.hpp" );
|
||||
Code containers = scan_file( "dependencies/containers.hpp" );
|
||||
Code hashing = scan_file( "dependencies/hashing.hpp" );
|
||||
Code strings = scan_file( "dependencies/strings.hpp" );
|
||||
Code filesystem = scan_file( "dependencies/filesystem.hpp" );
|
||||
Code timing = scan_file( "dependencies/timing.hpp" );
|
||||
Code platform = scan_file( path_base "dependencies/platform.hpp" );
|
||||
Code macros = scan_file( path_base "dependencies/macros.hpp" );
|
||||
Code basic_types = scan_file( path_base "dependencies/basic_types.hpp" );
|
||||
Code debug = scan_file( path_base "dependencies/debug.hpp" );
|
||||
Code memory = scan_file( path_base "dependencies/memory.hpp" );
|
||||
Code string_ops = scan_file( path_base "dependencies/string_ops.hpp" );
|
||||
Code printing = scan_file( path_base "dependencies/printing.hpp" );
|
||||
Code containers = scan_file( path_base "dependencies/containers.hpp" );
|
||||
Code hashing = scan_file( path_base "dependencies/hashing.hpp" );
|
||||
Code strings = scan_file( path_base "dependencies/strings.hpp" );
|
||||
Code filesystem = scan_file( path_base "dependencies/filesystem.hpp" );
|
||||
Code timing = scan_file( path_base "dependencies/timing.hpp" );
|
||||
Code parsing = scan_file( path_base "dependencies/parsing.hpp" );
|
||||
|
||||
Builder _header = builder_open("gen/gen.dep.hpp");
|
||||
Builder _header = builder_open( "gen/gen.dep.hpp");
|
||||
Builder* header = & _header;
|
||||
builder_print_fmt( header, generation_notice );
|
||||
builder_print_fmt( header, "// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)\n" );
|
||||
@ -67,6 +71,7 @@ int gen_main()
|
||||
builder_print( header, strings );
|
||||
builder_print( header, filesystem );
|
||||
builder_print( header, timing );
|
||||
builder_print( header, parsing );
|
||||
|
||||
builder_print_fmt( header, "\nGEN_NS_END\n" );
|
||||
builder_write(header);
|
||||
@ -74,15 +79,16 @@ int gen_main()
|
||||
|
||||
// gen_dep.cpp
|
||||
{
|
||||
Code src_start = scan_file( "dependencies/src_start.cpp" );
|
||||
Code debug = scan_file( "dependencies/debug.cpp" );
|
||||
Code string_ops = scan_file( "dependencies/string_ops.cpp" );
|
||||
Code printing = scan_file( "dependencies/printing.cpp" );
|
||||
Code memory = scan_file( "dependencies/memory.cpp" );
|
||||
Code hashing = scan_file( "dependencies/hashing.cpp" );
|
||||
Code strings = scan_file( "dependencies/strings.cpp" );
|
||||
Code filesystem = scan_file( "dependencies/filesystem.cpp" );
|
||||
Code timing = scan_file( "dependencies/timing.cpp" );
|
||||
Code src_start = scan_file( path_base "dependencies/src_start.cpp" );
|
||||
Code debug = scan_file( path_base "dependencies/debug.cpp" );
|
||||
Code string_ops = scan_file( path_base "dependencies/string_ops.cpp" );
|
||||
Code printing = scan_file( path_base "dependencies/printing.cpp" );
|
||||
Code memory = scan_file( path_base "dependencies/memory.cpp" );
|
||||
Code hashing = scan_file( path_base "dependencies/hashing.cpp" );
|
||||
Code strings = scan_file( path_base "dependencies/strings.cpp" );
|
||||
Code filesystem = scan_file( path_base "dependencies/filesystem.cpp" );
|
||||
Code timing = scan_file( path_base "dependencies/timing.cpp" );
|
||||
Code parsing = scan_file( path_base "dependencies/parsing.cpp" );
|
||||
|
||||
Builder _src = builder_open( "gen/gen.dep.cpp" );
|
||||
Builder* src = & _src;
|
||||
@ -99,6 +105,7 @@ int gen_main()
|
||||
builder_print( src, strings );
|
||||
builder_print( src, filesystem );
|
||||
builder_print( src, timing );
|
||||
builder_print( src, parsing );
|
||||
|
||||
builder_print_fmt( src, "\nGEN_NS_END\n" );
|
||||
builder_write(src);
|
||||
@ -115,18 +122,18 @@ int gen_main()
|
||||
|
||||
// gen.hpp
|
||||
{
|
||||
Code header_start = scan_file( "components/header_start.hpp" );
|
||||
Code types = scan_file( "components/types.hpp" );
|
||||
Code ast = scan_file( "components/ast.hpp" );
|
||||
Code ast_types = scan_file( "components/ast_types.hpp" );
|
||||
Code code_types = scan_file( "components/code_types.hpp" );
|
||||
Code interface = scan_file( "components/interface.hpp" );
|
||||
Code inlines = scan_file( "components/inlines.hpp" );
|
||||
Code header_end = scan_file( "components/header_end.hpp" );
|
||||
Code header_start = scan_file( path_base "components/header_start.hpp" );
|
||||
Code types = scan_file( path_base "components/types.hpp" );
|
||||
Code ast = scan_file( path_base "components/ast.hpp" );
|
||||
Code ast_types = scan_file( path_base "components/ast_types.hpp" );
|
||||
Code code_types = scan_file( path_base "components/code_types.hpp" );
|
||||
Code interface = scan_file( path_base "components/interface.hpp" );
|
||||
Code inlines = scan_file( path_base "components/inlines.hpp" );
|
||||
Code header_end = scan_file( path_base "components/header_end.hpp" );
|
||||
|
||||
CodeBody ecode = gen_ecode ( "enums/ECodeTypes.csv" );
|
||||
CodeBody eoperator = gen_eoperator ( "enums/EOperator.csv" );
|
||||
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
|
||||
CodeBody ecode = gen_ecode ( path_base "enums/ECodeTypes.csv" );
|
||||
CodeBody eoperator = gen_eoperator ( path_base "enums/EOperator.csv" );
|
||||
CodeBody especifier = gen_especifier( path_base "enums/ESpecifier.csv" );
|
||||
CodeBody ast_inlines = gen_ast_inlines();
|
||||
|
||||
Builder _header = builder_open( "gen/gen.hpp" );
|
||||
@ -167,43 +174,23 @@ int gen_main()
|
||||
builder_print_fmt( header, "GEN_NS_END\n\n" );
|
||||
builder_print( header, pop_ignores );
|
||||
builder_write(header);
|
||||
|
||||
Builder header_ecode = builder_open( "components/gen/ecode.hpp" );
|
||||
builder_print( & header_ecode, gen_component_header );
|
||||
builder_print( & header_ecode, format(ecode) );
|
||||
builder_write( & header_ecode);
|
||||
|
||||
Builder header_eoperator = builder_open( "components/gen/eoperator.hpp" );
|
||||
builder_print( & header_eoperator, gen_component_header );
|
||||
builder_print( & header_eoperator, format(eoperator) );
|
||||
builder_write( & header_eoperator );
|
||||
|
||||
Builder header_especifier = builder_open( "components/gen/especifier.hpp" );
|
||||
builder_print( & header_especifier, gen_component_header );
|
||||
builder_print( & header_especifier, format(especifier) );
|
||||
builder_write( & header_especifier);
|
||||
|
||||
Builder header_ast_inlines = builder_open( "components/gen/ast_inlines.hpp" );
|
||||
builder_print( & header_ast_inlines, gen_component_header );
|
||||
builder_print( & header_ast_inlines, format(ast_inlines) );
|
||||
builder_write( & header_ast_inlines);
|
||||
}
|
||||
|
||||
// gen.cpp
|
||||
{
|
||||
Code src_start = scan_file( "components/src_start.cpp" );
|
||||
Code static_data = scan_file( "components/static_data.cpp" );
|
||||
Code ast_case_macros = scan_file( "components/ast_case_macros.cpp" );
|
||||
Code ast = scan_file( "components/ast.cpp" );
|
||||
Code code_serialization = scan_file( "components/code_serialization.cpp" );
|
||||
Code interface = scan_file( "components/interface.cpp" );
|
||||
Code upfront = scan_file( "components/interface.upfront.cpp" );
|
||||
Code lexer = scan_file( "components/lexer.cpp" );
|
||||
Code parser = scan_file( "components/parser.cpp" );
|
||||
Code parsing_interface = scan_file( "components/interface.parsing.cpp" );
|
||||
Code untyped = scan_file( "components/interface.untyped.cpp" );
|
||||
Code src_start = scan_file( path_base "components/src_start.cpp" );
|
||||
Code static_data = scan_file( path_base "components/static_data.cpp" );
|
||||
Code ast_case_macros = scan_file( path_base "components/ast_case_macros.cpp" );
|
||||
Code ast = scan_file( path_base "components/ast.cpp" );
|
||||
Code code_serialization = scan_file( path_base "components/code_serialization.cpp" );
|
||||
Code interface = scan_file( path_base "components/interface.cpp" );
|
||||
Code upfront = scan_file( path_base "components/interface.upfront.cpp" );
|
||||
Code lexer = scan_file( path_base "components/lexer.cpp" );
|
||||
Code parser = scan_file( path_base "components/parser.cpp" );
|
||||
Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" );
|
||||
Code untyped = scan_file( path_base "components/interface.untyped.cpp" );
|
||||
|
||||
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
||||
CodeBody etoktype = gen_etoktype( path_base "enums/ETokType.csv", path_base "enums/AttributeTokens.csv" );
|
||||
CodeBody nspaced_etoktype = def_global_body( args(
|
||||
etoktype
|
||||
));
|
||||
@ -239,16 +226,11 @@ int gen_main()
|
||||
builder_print_fmt( src, "GEN_NS_END\n\n");
|
||||
builder_print( src, pop_ignores );
|
||||
builder_write(src);
|
||||
|
||||
Builder src_etoktype = builder_open( "components/gen/etoktype.cpp" );
|
||||
builder_print( & src_etoktype, gen_component_header );
|
||||
builder_print( & src_etoktype, formatted_toktype );
|
||||
builder_write( & src_etoktype);
|
||||
}
|
||||
|
||||
// gen_builder.hpp
|
||||
{
|
||||
Code builder = scan_file( "auxillary/builder.hpp" );
|
||||
Code builder = scan_file( path_base "auxillary/builder.hpp" );
|
||||
|
||||
Builder header = builder_open( "gen/gen.builder.hpp" );
|
||||
builder_print_fmt( & header, generation_notice );
|
||||
@ -262,7 +244,7 @@ int gen_main()
|
||||
|
||||
// gen_builder.cpp
|
||||
|
||||
Code builder = scan_file( "auxillary/builder.cpp" );
|
||||
Code builder = scan_file( path_base "auxillary/builder.cpp" );
|
||||
|
||||
Builder src = builder_open( "gen/gen.builder.cpp" );
|
||||
builder_print_fmt( & src, generation_notice );
|
||||
@ -275,15 +257,13 @@ int gen_main()
|
||||
|
||||
// gen_scanner.hpp
|
||||
{
|
||||
Code parsing = scan_file( "dependencies/parsing.hpp" );
|
||||
Code scanner = scan_file( "auxillary/scanner.hpp" );
|
||||
Code scanner = scan_file( path_base "auxillary/scanner.hpp" );
|
||||
|
||||
Builder header = builder_open( "gen/gen.scanner.hpp" );
|
||||
builder_print_fmt( & header, generation_notice );
|
||||
builder_print_fmt( & header, "#pragma once\n\n" );
|
||||
builder_print( & header, def_include( txt("gen.hpp") ) );
|
||||
builder_print_fmt( & header, "\nGEN_NS_BEGIN\n" );
|
||||
builder_print( & header, parsing );
|
||||
builder_print( & header, scanner );
|
||||
builder_print_fmt( & header, "\nGEN_NS_END\n" );
|
||||
builder_write(& header);
|
||||
@ -291,14 +271,12 @@ int gen_main()
|
||||
|
||||
// gen_scanner.cpp
|
||||
{
|
||||
Code parsing = scan_file( "dependencies/parsing.cpp" );
|
||||
Code scanner = scan_file( "auxillary/scanner.cpp" );
|
||||
Code scanner = scan_file( path_base "auxillary/scanner.cpp" );
|
||||
|
||||
Builder src = builder_open( "gen/gen.scanner.cpp" );
|
||||
builder_print_fmt( & src, generation_notice );
|
||||
builder_print( & src, def_include( txt("gen.scanner.hpp") ) );
|
||||
builder_print_fmt( & src, "\nGEN_NS_BEGIN\n" );
|
||||
builder_print( & src, parsing );
|
||||
builder_print( & src, scanner );
|
||||
builder_print_fmt( & src, "GEN_NS_END\n" );
|
||||
builder_write( & src);
|
@ -20,7 +20,7 @@ Push-Location $path_root
|
||||
$release = $null
|
||||
$verbose = $false
|
||||
$base = $false
|
||||
[bool] $segemented = $false
|
||||
[bool] $segmented = $false
|
||||
[bool] $singleheader = $false
|
||||
[bool] $c_library = $false
|
||||
[bool] $unreal = $false
|
||||
@ -37,7 +37,7 @@ if ( $args ) { $args | ForEach-Object {
|
||||
"release" { $release = $true }
|
||||
"debug" { $release = $false }
|
||||
"base" { $base = $true }
|
||||
"segemented" { $segemented = $true }
|
||||
"segmented" { $segmented = $true }
|
||||
"singleheader" { $singleheader = $true }
|
||||
"c_library" { $c_library = $true }
|
||||
"unreal" { $unreal = $true }
|
||||
@ -153,13 +153,13 @@ if ( $segmented )
|
||||
$flag_link_win_subsystem_console
|
||||
)
|
||||
|
||||
$includes = @( $path_project)
|
||||
$includes = @( $path_base)
|
||||
$unit = join-path $path_segmented "segmented.cpp"
|
||||
$executable = join-path $path_build "segmented.exe"
|
||||
|
||||
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
||||
|
||||
Push-Location $path_project
|
||||
Push-Location $path_segmented
|
||||
if ( Test-Path( $executable ) ) {
|
||||
write-host "`nRunning segmented"
|
||||
$time_taken = Measure-Command { & $executable
|
||||
|
Loading…
Reference in New Issue
Block a user