updates to scripts

This commit is contained in:
2024-07-01 00:39:41 -04:00
parent 53d86daf0a
commit b24699407e
5 changed files with 87 additions and 24 deletions

View File

@@ -1,33 +1,60 @@
$path_root = git rev-parse --show-toplevel
$path_backend = join-path $path_backend 'backend'
$path_binaries = join-path $path_bin 'binaries'
$path_examples = join-path $path_examples 'examples'
$path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
verify-path $path_binaries
verify-path $path_thirdparty
clear-host
$misc = join-path $PSScriptRoot 'helpers/misc.ps1'
. $misc
$url_sokol = 'https://github.com/Ed94/sokol-odin.git'
$path_root = git rev-parse --show-toplevel
$path_backend = join-path $path_root 'backend'
$path_build = join-path $path_root 'build'
$path_examples = join-path $path_root 'examples'
$path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
verify-path $path_build
verify-path $path_thirdparty
#region CPU_Info
$path_system_details = join-path $path_build 'system_details.ini'
if ( test-path $path_system_details ) {
$iniContent = Get-IniContent $path_system_details
$CoreCount_Physical = $iniContent["CPU"]["PhysicalCores"]
$CoreCount_Logical = $iniContent["CPU"]["LogicalCores"]
}
elseif ( $IsWindows ) {
$CPU_Info = Get-CimInstance ClassName Win32_Processor | Select-Object -Property NumberOfCores, NumberOfLogicalProcessors
$CoreCount_Physical, $CoreCount_Logical = $CPU_Info.NumberOfCores, $CPU_Info.NumberOfLogicalProcessors
new-item -path $path_system_details -ItemType File
"[CPU]" | Out-File $path_system_details
"PhysicalCores=$CoreCount_Physical" | Out-File $path_system_details -Append
"LogicalCores=$CoreCount_Logical" | Out-File $path_system_details -Append
}
write-host "Core Count - Physical: $CoreCount_Physical Logical: $CoreCount_Logical"
#endregion CPU_Info
$url_freetype = 'https://github.com/Ed94/odin-freetype.git'
$url_harfbuzz = 'https://github.com/Ed94/odin_harfbuzz.git'
$url_sokol = 'https://github.com/floooh/sokol-odin.git'
$url_sokol_tools = 'https://github.com/floooh/sokol-tools-bin.git'
$path_freetype = join-path $path_thirdparty 'freetype'
$path_harfbuzz = join-path $path_thirdparty 'harfbuzz'
$path_sokol = join-path $path_thirdparty 'sokol'
$path_sokol_tools = join-path $path_thirdparty 'sokol-tools'
$sokol_build_clibs_command = join-path $path_scripts 'build_sokol_library.ps1'
clone-gitrepo $path_freetype $url_freetype
clone-gitrepo $path_sokol_tools $url_sokol_tools
Update-GitRepo -path $path_sokol -url $url_sokol -build_command $sokol_build_clibs_command
Update-GitRepo -path $path_sokol -url $url_sokol -build_command $sokol_build_clibs_command
Update-GitRepo -path $path_harfbuzz -url $url_harfbuzz -build_command '.\scripts\build.ps1'
push-location $path_thirdparty
$path_sokol_dlls = join-path $path_sokol 'sokol'
$path_sokol_dlls = $path_sokol
$third_party_dlls = Get-ChildItem -Path $path_sokol_dlls -Filter '*.dll'
foreach ($dll in $third_party_dlls) {
$destination = join-path $path_binaries $dll.Name
$destination = join-path $path_build $dll.Name
Copy-Item $dll.FullName -Destination $destination -Force
}
pop-location
@@ -44,6 +71,12 @@ function build-SokolBackendDemo
{
write-host 'Building VEFontCache: Sokol Backend Demo'
$compile_shaders = join-path $path_scripts "compile_sokol_shaders.ps1"
& $compile_shaders
$executable = join-path $path_build 'sokol_demo.exe'
$pdb = join-path $path_build 'sokol_demo.pdb'
$build_args = @()
$build_args += $command_build
$build_args += './sokol_demo'

View File

@@ -1,18 +1,21 @@
$devshell = Join-Path $PSScriptRoot 'devshell.ps1'
& $devshell -arch amd64
$path_root = git rev-parse --show-toplevel
$path_backend = join-path $path_backend 'backend'
$path_binaries = join-path $path_bin 'binaries'
$path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
$path_root = '../..'
$path_backend = join-path $path_root 'backend'
$path_build = join-path $path_root 'build'
$path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
$path_sokol = Join-Path $path_thirdparty 'sokol'
if (test-path $path_sokol)
$path_sokol = join-path $path_thirdparty 'sokol'
$path_sokol_examples = join-path $path_sokol 'examples'
if ( (test-path $path_sokol) -and (test-path "$path_sokol/sokol") )
{
Move-Item -Path "$path_sokol/sokol/*" -Destination $path_sokol -Force
Remove-Item -Path $path_sokol -Recurse -Force
Remove-Item -Path $path_sokol_examples -Recurse -Force
Remove-Item -Path "$path_sokol/sokol" -Recurse -Force
Remove-Item -Path $path_sokol_examples -Recurse -Force
}
push-location $path_sokol
& '.\build_clibs_windows.cmd'
pop-location

9
scripts/clean.ps1 Normal file
View File

@@ -0,0 +1,9 @@
$path_root = git rev-parse --show-toplevel
$path_backend = join-path $path_root 'backend'
$path_build = join-path $path_root 'build'
$path_examples = join-path $path_root 'examples'
$path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
if ( test-path $path_build ) { Remove-Item $path_build -Verbose -Force -Recurse }
# if ( test-path $path_thirdparty) { Remove-Item $path_thirdparty -Verbose -Force -Recurse }

View File

@@ -24,7 +24,6 @@ $flag_format_odin = '--format=sokol_odin'
$flag_module = '--module'
push-location $path_backend_sokol
& $sokol_shdc --input $shadersrc_simple_font_glyph --output $shaderout_simple_font_glyph --slang 'hlsl4' $flag_format_odin
& $sokol_shdc --input $shadersrc_blit_atlas --output $shaderout_blit_atlas --slang 'hlsl4' $flag_format_odin $flag_module='blit_atlas'
& $sokol_shdc --input $shadersrc_render_glyph --output $shaderout_render_glyph --slang 'hlsl4' $flag_format_odin $flag_module='render_glyph'
& $sokol_shdc --input $shadersrc_draw_text --output $shaderout_draw_text --slang 'hlsl4' $flag_format_odin $flag_module='draw_text'

View File

@@ -8,6 +8,25 @@ function clone-gitrepo { param( [string] $path, [string] $url )
}
}
function Get-IniContent { param([ string]$filePath )
$ini = @{}
$currentSection = $null
switch -regex -file $filePath
{
"^\[(.+)\]$" {
$currentSection = $matches[1].Trim()
$ini[$currentSection] = @{}
}
"^(.+?)\s*=\s*(.*)" {
$key, $value = $matches[1].Trim(), $matches[2].Trim()
if ($null -ne $currentSection) {
$ini[$currentSection][$key] = $value
}
}
}
return $ini
}
# TODO(Ed): This is garbage for odin's output..
function Invoke-WithColorCodedOutput { param( [scriptblock] $command )
& $command 2>&1 | ForEach-Object {