diff --git a/project/gen.bootstrap.cpp b/project/gen.bootstrap.cpp new file mode 100644 index 0000000..aa2de46 --- /dev/null +++ b/project/gen.bootstrap.cpp @@ -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; +} diff --git a/project/meson.build b/project/meson.build new file mode 100644 index 0000000..3f3f18f --- /dev/null +++ b/project/meson.build @@ -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 ) diff --git a/scripts/bootstrap.ci.ps1 b/scripts/bootstrap.ci.ps1 new file mode 100644 index 0000000..35cc82a --- /dev/null +++ b/scripts/bootstrap.ci.ps1 @@ -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 diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 new file mode 100644 index 0000000..0819482 --- /dev/null +++ b/scripts/bootstrap.ps1 @@ -0,0 +1,2 @@ +cls +Invoke-Expression "& $(Join-Path $PSScriptRoot 'bootstrap.ci.ps1') $args" diff --git a/scripts/singleheader.ci.ps1 b/scripts/singleheader.ci.ps1 new file mode 100644 index 0000000..4ce19ca --- /dev/null +++ b/scripts/singleheader.ci.ps1 @@ -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 diff --git a/scripts/singleheader.ps1 b/scripts/singleheader.ps1 new file mode 100644 index 0000000..4e1c249 --- /dev/null +++ b/scripts/singleheader.ps1 @@ -0,0 +1,2 @@ +cls +Invoke-Expression "& $(Join-Path $PSScriptRoot 'singleheader.ci.ps1') $args" diff --git a/singleheader/gen.singleheader.cpp b/singleheader/gen.singleheader.cpp new file mode 100644 index 0000000..e69de29 diff --git a/singleheader/meson.build b/singleheader/meson.build index e69de29..ee7afbf 100644 --- a/singleheader/meson.build +++ b/singleheader/meson.build @@ -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 ) diff --git a/test/Parsed/Array.Parsed.hpp b/test/Parsed/Array.Parsed.hpp index b5abea1..61b19cb 100644 --- a/test/Parsed/Array.Parsed.hpp +++ b/test/Parsed/Array.Parsed.hpp @@ -1,7 +1,6 @@ #pragma once #if GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/Parsed/Buffer.Parsed.hpp b/test/Parsed/Buffer.Parsed.hpp index 0be2f80..9c48679 100644 --- a/test/Parsed/Buffer.Parsed.hpp +++ b/test/Parsed/Buffer.Parsed.hpp @@ -1,7 +1,6 @@ #pragma once #if GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/Parsed/HashTable.Parsed.hpp b/test/Parsed/HashTable.Parsed.hpp index 1b5575b..ffe15ef 100644 --- a/test/Parsed/HashTable.Parsed.hpp +++ b/test/Parsed/HashTable.Parsed.hpp @@ -1,7 +1,6 @@ #pragma once #if GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/Parsed/Ring.Parsed.hpp b/test/Parsed/Ring.Parsed.hpp index 51483ce..cf2b1d3 100644 --- a/test/Parsed/Ring.Parsed.hpp +++ b/test/Parsed/Ring.Parsed.hpp @@ -1,7 +1,6 @@ #pragma once #if GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/Parsed/Sanity.Parsed.hpp b/test/Parsed/Sanity.Parsed.hpp index c34860f..bfa0f0f 100644 --- a/test/Parsed/Sanity.Parsed.hpp +++ b/test/Parsed/Sanity.Parsed.hpp @@ -1,6 +1,5 @@ #pragma once #ifdef GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/SOA.cpp b/test/SOA.cpp index e4f5c8c..aab9f14 100644 --- a/test/SOA.cpp +++ b/test/SOA.cpp @@ -1,5 +1,4 @@ #if GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/sanity.cpp b/test/sanity.cpp index 8ba3378..c8885a6 100644 --- a/test/sanity.cpp +++ b/test/sanity.cpp @@ -1,7 +1,6 @@ // Testing to make sure backend of library is operating properly. #ifdef GEN_TIME -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND diff --git a/test/test.cpp b/test/test.cpp index e1b1880..a91dbfa 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,4 +1,3 @@ -#define GEN_FEATURE_PARSING #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_EXPOSE_BACKEND