some cleanup of unused macros in test files, preparing bootstrap and single header code + scripts

This commit is contained in:
Edward R. Gonzalez 2023-07-24 18:51:49 -04:00
parent 49ef1a2e87
commit b5cad6e8a1
16 changed files with 136 additions and 8 deletions

14
project/gen.bootstrap.cpp Normal file
View File

@ -0,0 +1,14 @@
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND
#include "gen.cpp"
using namespace gen;
void gen_main()
{
return 0;
}

18
project/meson.build Normal file
View File

@ -0,0 +1,18 @@
project( 'gencpp_bootstrap', 'c', 'cpp', default_options : ['buildtype=debug'] )
includes = include_directories(
[
'../project',
])
sources = [ 'gen.bootstrap.cpp' ]
if get_option('buildtype').sartswith('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 )

41
scripts/bootstrap.ci.ps1 Normal file
View File

@ -0,0 +1,41 @@
[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_bootstrap build
write-host "`n`nBuilding gencpp bootstrap`n"
if ( -not( Test-Path $path_project_build) )
{
# Generate build files for meta-program
Push-Location $path_project
$args_meson = @()
$args_meson += "setup"
$args_meson += $path_project_build
& meson $args_meson
Pop-Location
}
# Compile meta-program
Push-Location $path_root
$args_ninja = @()
$args_ninja += "-C"
$args_ninja += $path_project_build
& ninja $args_ninja
Pop-Location

2
scripts/bootstrap.ps1 Normal file
View File

@ -0,0 +1,2 @@
cls
Invoke-Expression "& $(Join-Path $PSScriptRoot 'bootstrap.ci.ps1') $args"

View File

@ -0,0 +1,41 @@
[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
write-host "`n`nBuilding gencpp bootstrap`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

2
scripts/singleheader.ps1 Normal file
View File

@ -0,0 +1,2 @@
cls
Invoke-Expression "& $(Join-Path $PSScriptRoot 'singleheader.ci.ps1') $args"

View File

View File

@ -0,0 +1,18 @@
project( 'gen_singleheader', 'c', 'cpp', default_options : ['buildtype=debug'] )
includes = include_directories(
[
'../project',
])
sources = [ 'gen.singleheader.cpp' ]
if get_option('buildtype').sartswith('debug')
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
endif
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
executable( 'gen_singlehader', sources, include_directories : includes )

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#if GEN_TIME #if GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#if GEN_TIME #if GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#if GEN_TIME #if GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#if GEN_TIME #if GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#ifdef GEN_TIME #ifdef GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,5 +1,4 @@
#if GEN_TIME #if GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,7 +1,6 @@
// Testing to make sure backend of library is operating properly. // Testing to make sure backend of library is operating properly.
#ifdef GEN_TIME #ifdef GEN_TIME
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND

View File

@ -1,4 +1,3 @@
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND