mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Some initial boostrapping of new visual ast aux project
This commit is contained in:
parent
eaba60f80b
commit
d5a4b77033
6
.vscode/c_cpp_properties.json
vendored
6
.vscode/c_cpp_properties.json
vendored
@ -12,7 +12,8 @@
|
||||
"GEN_TIME",
|
||||
"GEN_IMPLEMENTATION",
|
||||
// "GEN_DONT_USE_NAMESPACE"
|
||||
"GEN_INTELLISENSE_DIRECTIVES"
|
||||
"GEN_INTELLISENSE_DIRECTIVES",
|
||||
"INTELLISENSE_DIRECTIVES"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.19041.0",
|
||||
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
|
||||
@ -31,7 +32,8 @@
|
||||
"GEN_TIME",
|
||||
"GEN_IMPLEMENTATION",
|
||||
// "GEN_DONT_USE_NAMESPACE"
|
||||
"GEN_INTELLISENSE_DIRECTIVES"
|
||||
"GEN_INTELLISENSE_DIRECTIVES",
|
||||
"INTELLISENSE_DIRECTIVES"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.19041.0",
|
||||
"compilerPath": "C:/Users/Ed/scoop/apps/llvm/current/bin/clang++.exe",
|
||||
|
BIN
project/auxillary/vis_ast/binaries/vis_ast.exe
Normal file
BIN
project/auxillary/vis_ast/binaries/vis_ast.exe
Normal file
Binary file not shown.
107
project/auxillary/vis_ast/build.ps1
Normal file
107
project/auxillary/vis_ast/build.ps1
Normal file
@ -0,0 +1,107 @@
|
||||
Clear-Host
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_scripts = Join-Path $path_root 'scripts'
|
||||
|
||||
$target_arch = Join-Path $path_scripts 'helpers/target_arch.psm1'
|
||||
$devshell = Join-Path $path_scripts 'helpers/devshell.ps1'
|
||||
$format_cpp = Join-Path $path_scripts 'helpers/format_cpp.psm1'
|
||||
$incremental_checks = Join-Path $path_scripts 'helpers/incremental_checks.ps1'
|
||||
$vendor_toolchain = Join-Path $path_scripts 'helpers/vendor_toolchain.ps1'
|
||||
$update_deps = Join-Path $path_scripts 'update_deps.ps1'
|
||||
|
||||
$path_project = Join-Path $path_root 'project'
|
||||
$path_aux = Join-Path $path_project 'auxillary'
|
||||
$path_vis_root = Join-Path $path_aux 'vis_ast'
|
||||
$path_binaries = Join-Path $path_vis_root 'binaries'
|
||||
$path_build = Join-Path $path_vis_root 'build'
|
||||
$path_code = Join-Path $path_vis_root 'code'
|
||||
$path_win32 = Join-Path $path_code 'win32'
|
||||
|
||||
Import-Module $target_arch
|
||||
Import-Module $format_cpp
|
||||
|
||||
#region Arguments
|
||||
$vendor = $null
|
||||
$optimize = $null
|
||||
$debug = $null
|
||||
$analysis = $false
|
||||
$dev = $false
|
||||
$verbose = $null
|
||||
$platform = $null
|
||||
$module_specified = $false
|
||||
|
||||
[array] $vendors = @( "clang", "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 $vendors } { $vendor = $_; break }
|
||||
"optimize" { $optimize = $true }
|
||||
"debug" { $debug = $true }
|
||||
"analysis" { $analysis = $true }
|
||||
"dev" { $dev = $true }
|
||||
"verbose" { $verbose = $true }
|
||||
"platform" { $platform = $true; $module_specified = $true }
|
||||
}
|
||||
}}
|
||||
#endregion Argument
|
||||
|
||||
if ( -not $module_specified )
|
||||
{
|
||||
$platform = $true
|
||||
}
|
||||
|
||||
# Load up toolchain configuraion
|
||||
. $vendor_toolchain
|
||||
. $incremental_checks
|
||||
|
||||
write-host "Building Vis AST with $vendor"
|
||||
|
||||
if ( (Test-Path $path_build) -eq $false ) {
|
||||
New-Item $path_build -ItemType Directory
|
||||
}
|
||||
|
||||
if ( (Test-Path $path_binaries) -eq $false ) {
|
||||
New-Item $path_binaries -ItemType Directory
|
||||
}
|
||||
|
||||
$includes = @(
|
||||
$paht_code
|
||||
)
|
||||
|
||||
# Microsoft
|
||||
$lib_gdi32 = 'Gdi32.lib'
|
||||
$lib_xinput = 'Xinput.lib'
|
||||
$lib_user32 = 'User32.lib'
|
||||
$lib_winmm = 'Winmm.lib'
|
||||
|
||||
$stack_size = 1024 * 1024 * 4
|
||||
|
||||
$compiler_args = @(
|
||||
($flag_define + 'UNICODE'),
|
||||
($flag_define + '_UNICODE')
|
||||
( $flag_define + 'INTELLISENSE_DIRECTIVES=0'),
|
||||
# ($flag_set_stack_size + $stack_size)
|
||||
$flag_wall
|
||||
$flag_warnings_as_errors
|
||||
$flag_optimize_intrinsics
|
||||
)
|
||||
|
||||
if ( $dev ) {
|
||||
$compiler_args += ( $flag_define + 'Build_Development=1' )
|
||||
}
|
||||
else {
|
||||
$compiler_args += ( $flag_define + 'Build_Development=0' )
|
||||
}
|
||||
|
||||
$linker_args = @(
|
||||
$flag_link_win_subsystem_windows,
|
||||
$flag_link_optiiize_references
|
||||
)
|
||||
|
||||
$unit = join-path $path_code 'vis_ast_windows.cpp'
|
||||
$executable = join-path $path_binaries 'vis_ast.exe'
|
||||
|
||||
$build_result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
0
project/auxillary/vis_ast/clean.ps1
Normal file
0
project/auxillary/vis_ast/clean.ps1
Normal file
24
project/auxillary/vis_ast/code/platform/macros.hpp
Normal file
24
project/auxillary/vis_ast/code/platform/macros.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "vendor/compiler.hpp"
|
||||
#endif
|
||||
|
||||
#define global static // Global variables
|
||||
#define internal static // Internal linkage
|
||||
#define local_persist static // Local Persisting variables
|
||||
|
||||
#define api_c extern "C"
|
||||
|
||||
#define ccast( type, value ) ( const_cast< type >( (value) ) )
|
||||
#define pcast( type, value ) ( * reinterpret_cast< type* >( & ( value ) ) )
|
||||
#define rcast( type, value ) reinterpret_cast< type >( value )
|
||||
#define scast( type, value ) static_cast< type >( value )
|
||||
|
||||
#define do_once() for ( local_persist b32 once = true; once; once = false )
|
||||
#define stmt( ... ) do { __VA_ARGS__; } while ( 0 )
|
||||
|
||||
#define array_count( array ) ( sizeof( array ) / sizeof( ( array )[0] ) )
|
||||
|
||||
#define kilobytes( x ) ( ( x ) * ( s64 )( 1024 ) )
|
||||
#define megabytes( x ) ( kilobytes( x ) * ( s64 )( 1024 ) )
|
||||
#define gigabytes( x ) ( megabytes( x ) * ( s64 )( 1024 ) )
|
||||
#define terabytes( x ) ( gigabytes( x ) * ( s64 )( 1024 ) )
|
9
project/auxillary/vis_ast/code/platform/vendor/arch.hpp
vendored
Normal file
9
project/auxillary/vis_ast/code/platform/vendor/arch.hpp
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/* Platform architecture */
|
||||
|
||||
#if defined( _WIN64 ) || defined( __x86_64__ ) || defined( _M_X64 ) || defined( __64BIT__ ) || defined( __powerpc64__ ) || defined( __ppc64__ ) || defined( __aarch64__ )
|
||||
# ifndef ARCH_64_BIT
|
||||
# define ARCH_64_BIT 1
|
||||
# endif
|
||||
#else
|
||||
# error A 32-bit architecture is not supported
|
||||
#endif
|
21
project/auxillary/vis_ast/code/platform/vendor/compiler.hpp
vendored
Normal file
21
project/auxillary/vis_ast/code/platform/vendor/compiler.hpp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Platform compiler
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# define Compiler_MSVC 1
|
||||
#elif defined( __clang__ )
|
||||
# define Compiler_Clang 1
|
||||
#else
|
||||
# error "Unknown compiler"
|
||||
#endif
|
||||
|
||||
#if defined( __has_attribute )
|
||||
# define HAS_ATTRIBUTE( attribute ) __has_attribute( attribute )
|
||||
#else
|
||||
# define HAS_ATTRIBUTE( attribute ) ( 0 )
|
||||
#endif
|
||||
|
||||
#ifdef Compiler_Clang
|
||||
# define compiler_decorated_func_name __PRETTY_NAME__
|
||||
#elif defined(Compiler_MSVC)
|
||||
# define compiler_decorated_func_name __FUNCDNAME__
|
||||
#endif
|
34
project/auxillary/vis_ast/code/platform/vendor/compiler_ignores.hpp
vendored
Normal file
34
project/auxillary/vis_ast/code/platform/vendor/compiler_ignores.hpp
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "compiler.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef Compiler_MSVC
|
||||
#pragma warning( disable: 4201 ) // Support for non-standard nameless struct or union extesnion
|
||||
#pragma warning( disable: 4100 ) // Support for unreferenced formal parameters
|
||||
#pragma warning( disable: 4800 ) // Support implicit conversion to bools
|
||||
#pragma warning( disable: 4365 ) // Support for signed/unsigned mismatch auto-conversion
|
||||
#pragma warning( disable: 4189 ) // Support for unused variables
|
||||
#pragma warning( disable: 4514 ) // Support for unused inline functions
|
||||
#pragma warning( disable: 4505 ) // Support for unused static functions
|
||||
#pragma warning( disable: 5045 ) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
|
||||
#pragma warning( disable: 5264 ) // Support for 'const' variables unused
|
||||
#pragma warning( disable: 4820 ) // Support auto-adding padding to structs
|
||||
#pragma warning( disable: 4711 ) // Support automatic inline expansion
|
||||
#pragma warning( disable: 4710 ) // Support automatic inline expansion
|
||||
#pragma warning( disable: 4805 ) // Support comparisons of s32 to bool.
|
||||
#pragma warning( disable: 5246 ) // Support for initialization of subobject without braces.
|
||||
#endif
|
||||
|
||||
#ifdef Compiler_Clang
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
#pragma clang diagnostic ignored "-Wswitch"
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#pragma clang diagnostic ignored "-Wunused-local-typedef"
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wvarargs"
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
#pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#endif
|
21
project/auxillary/vis_ast/code/platform/vendor/os.hpp
vendored
Normal file
21
project/auxillary/vis_ast/code/platform/vendor/os.hpp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Platform OS detection
|
||||
|
||||
#if defined( _WIN32 ) || defined( _WIN64 )
|
||||
# ifndef System_Windows
|
||||
# define System_Windows 1
|
||||
# endif
|
||||
#elif defined( __APPLE__ ) && defined( __MACH__ )
|
||||
# ifndef System_MacOS
|
||||
# define System_MacOS 1
|
||||
# endif
|
||||
#elif defined( __unix__ )
|
||||
# if defined( __linux__ )
|
||||
# ifndef System_Linux
|
||||
# define System_linux 1
|
||||
# endif
|
||||
# else
|
||||
# error This UNIX operating system is not supported
|
||||
# endif
|
||||
#else
|
||||
# error This operating system is not supported
|
||||
#endif
|
10
project/auxillary/vis_ast/code/vis_ast_windows.cpp
Normal file
10
project/auxillary/vis_ast/code/vis_ast_windows.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "platform/vendor/arch.hpp"
|
||||
#include "platform/vendor/compiler.hpp"
|
||||
#include "platform/vendor/compiler_ignores.hpp"
|
||||
#include "platform/vendor/os.hpp"
|
||||
|
||||
#include "platform/macros.hpp"
|
||||
|
||||
#include "platform/win32/types.hpp"
|
||||
|
||||
#include "platform/win32/launch.cpp"
|
10
project/auxillary/vis_ast/readme.md
Normal file
10
project/auxillary/vis_ast/readme.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Vis AST
|
||||
|
||||
AST visualizer for gencpp
|
||||
|
||||
This is a early start to creating frontend tooling for c/c++ using gencpp as a core component.
|
||||
I'll be exploring creating an AST explorer for this library with raylib as the graphical & general platform vendor for dependencies that go beyond the scope of gencpp.
|
||||
|
||||
For now I'll have its build script in this file, however it will heavily rely on gencpp's helper scripts.
|
||||
|
||||
Whatever sort of UX tooling I setup for this will be reused for the other tools I'll be creating for gencpp.
|
0
project/auxillary/vis_ast/rebuild.ps1
Normal file
0
project/auxillary/vis_ast/rebuild.ps1
Normal file
28
project/auxillary/vis_ast/update_deps.ps1
Normal file
28
project/auxillary/vis_ast/update_deps.ps1
Normal file
@ -0,0 +1,28 @@
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_project = Join-Path $path_root 'project'
|
||||
$path_aux = Join-Path $path_project 'auxillary'
|
||||
$path_vis_root = Join-Path $path_aux 'vis_ast'
|
||||
$path_binaries = Join-Path $path_vis_root 'binaries'
|
||||
$path_build = Join-Path $path_vis_root 'build'
|
||||
$path_code = Join-Path $path_vis_root 'code'
|
||||
$path_win32 = Join-Path $path_code 'win32'
|
||||
|
||||
$path_deps = Join-Path $path_vis_root 'dependencies'
|
||||
$path_temp = Join-Path $path_deps 'temp'
|
||||
|
||||
# Clear out the current content first
|
||||
if (Test-Path $path_deps) {
|
||||
Remove-Item $path_deps -Recurse -Force
|
||||
New-Item -ItemType Directory -Path $path_deps
|
||||
}
|
||||
New-Item -ItemType Directory -Path $path_temp
|
||||
|
||||
if ( -not (Test-Path $path_binaries) ) {
|
||||
New-Item -ItemType Directory -Path $path_binaries
|
||||
}
|
||||
|
||||
$url_raylib_zip = 'https://github.com/raysan5/raylib/archive/refs/heads/master.zip'
|
||||
$path_raylib_zip = join-path $path_temp 'raylib.zip'
|
||||
|
||||
invoke-webrequest -uri $url_raylib_zip -outfile $path_raylib_zip
|
||||
|
@ -19,6 +19,7 @@ Push-Location $path_root
|
||||
#region Arguments
|
||||
$vendor = $null
|
||||
$release = $null
|
||||
$verbose = $false
|
||||
[bool] $bootstrap = $false
|
||||
[bool] $singleheader = $false
|
||||
[bool] $test = $false
|
||||
@ -29,7 +30,8 @@ Push-Location $path_root
|
||||
|
||||
if ( $args ) { $args | ForEach-Object {
|
||||
switch ($_){
|
||||
{ $_ -in $vendors } { $vendor = $_; break }
|
||||
{ $_ -in $vendors } { $vendor = $_; break }
|
||||
"verbose" { $verbose = $true }
|
||||
"release" { $release = $true }
|
||||
"debug" { $release = $false }
|
||||
"bootstrap" { $bootstrap = $true }
|
||||
|
Loading…
Reference in New Issue
Block a user