Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,15 @@
gencpp.hpp
gencpp.cpp

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
vc140.pdb
**/*.lib
**/*.pdb
**/*.exe
**/*.dll

release/**

# Unreal
**/Unreal/*.h
**/Unreal/*.cpp
! **/Unreal/validate.unreal.cpp
project/auxillary/vis_ast/dependencies/temp
6 changes: 4 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
"args": [],
"cwd": "${workspaceFolder}/singleheader/",
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
},
{
"type": "cppvsdbg",
"request": "launch",
"name": "Debug raylib refactor vsdbg",
"program": "${workspaceFolder}/project/auxillary/vis_ast/dependencies/raylib/build/raylib_refactor.exe",
"args": [],
"cwd": "${workspaceFolder}/project/auxillary/vis_ast/dependencies/temp/raylib-master/src/",
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
}
]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"functional": "cpp",
"vector": "cpp",
"list": "cpp",
"xhash": "cpp"
"xhash": "cpp",
"glfw3.h": "c",
"stdbool.h": "c"
},
"C_Cpp.intelliSenseEngineFallback": "disabled",
"mesonbuild.configureOnOpen": true,
Expand Down
106 changes: 106 additions & 0 deletions project/auxillary/vis_ast/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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'

$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
Empty file.
24 changes: 24 additions & 0 deletions project/auxillary/vis_ast/code/platform/macros.hpp
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions project/auxillary/vis_ast/code/platform/vendor/arch.hpp
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions project/auxillary/vis_ast/code/platform/vendor/compiler.hpp
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions project/auxillary/vis_ast/code/platform/vendor/os.hpp
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions project/auxillary/vis_ast/code/platform/win32/launch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#if INTELLISENSE_DIRECTIVES
#include "win32.hpp"
#endif

int __stdcall WinMain( HINSTANCE instance, HINSTANCE prev_instance, char* commandline, int num_cmd_show)
{
return 0;
}
1 change: 1 addition & 0 deletions project/auxillary/vis_ast/code/platform/win32/types.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
using HINSTANCE = void*;
10 changes: 10 additions & 0 deletions project/auxillary/vis_ast/code/vis_ast_windows.cpp
Original file line number Diff line number Diff line change
@@ -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"
Loading