@tokamakdev/platform-windows-x64 0.1.1-beta.54 → 0.1.1-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -18,6 +18,43 @@ function Read-TokamakValue([string] $Name) {
|
|
|
18
18
|
return [System.IO.File]::ReadAllText($path).Trim()
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
# Put the Microsoft C++ linker, from Visual Studio or its Build Tools, and
|
|
22
|
+
# the Windows libraries it links on this process's paths. A Visual Studio
|
|
23
|
+
# developer shell for x64 already has them.
|
|
24
|
+
function Use-MicrosoftLinker {
|
|
25
|
+
if ($env:VSCMD_ARG_TGT_ARCH -eq "x64") {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
$vswhere = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
|
|
29
|
+
$installation = $null
|
|
30
|
+
if (Test-Path -LiteralPath $vswhere) {
|
|
31
|
+
$installation = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
|
32
|
+
}
|
|
33
|
+
if ([string]::IsNullOrWhiteSpace($installation)) {
|
|
34
|
+
throw "Windows builds link the tokamak runtime with the Microsoft C++ build tools, which are not installed. Install Visual Studio or Visual Studio Build Tools with the `"Desktop development with C++`" workload."
|
|
35
|
+
}
|
|
36
|
+
$vcvars = Join-Path $installation "VC\Auxiliary\Build\vcvars64.bat"
|
|
37
|
+
foreach ($line in (& cmd.exe /d /c "`"$vcvars`" >nul && set")) {
|
|
38
|
+
if ($line -match '^([^=]+)=(.*)$') {
|
|
39
|
+
Set-Item -Path "env:$($Matches[1])" -Value $Matches[2]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Link the shell and runtime into the app's executable, exporting the entry
|
|
45
|
+
# points of the runtime parts the app links.
|
|
46
|
+
function Invoke-RuntimeLink([string] $Executable) {
|
|
47
|
+
Use-MicrosoftLinker
|
|
48
|
+
$runtime = Join-Path $InputDirectory "runtime/TokamakRuntime"
|
|
49
|
+
$libraries = [System.IO.File]::ReadAllText((Join-Path $runtime "link-libraries")).Trim() -split '\s+'
|
|
50
|
+
$exports = @([System.IO.File]::ReadAllLines((Join-Path $InputDirectory "metadata/exported-symbols")) | ForEach-Object { "/EXPORT:$_" })
|
|
51
|
+
$importLibrary = Join-Path $InputDirectory "runtime.lib"
|
|
52
|
+
& link.exe /NOLOGO "/OUT:$Executable" /SUBSYSTEM:WINDOWS /ENTRY:wWinMainCRTStartup /OPT:REF /OPT:ICF /INCREMENTAL:NO /NXCOMPAT /DYNAMICBASE /HIGHENTROPYVA "/IMPLIB:$importLibrary" (Join-Path $runtime "tokamak.lib") @libraries @exports
|
|
53
|
+
if ($LASTEXITCODE -ne 0) {
|
|
54
|
+
throw "linking the tokamak runtime failed with status $LASTEXITCODE"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
21
58
|
$output = [System.IO.Path]::GetFullPath($OutputDirectory)
|
|
22
59
|
$appName = Read-TokamakValue "app-name"
|
|
23
60
|
$appSlug = Read-TokamakValue "app-slug"
|
|
@@ -43,7 +80,7 @@ if (Test-Path $output) {
|
|
|
43
80
|
}
|
|
44
81
|
New-Item -ItemType Directory -Force -Path $app | Out-Null
|
|
45
82
|
Copy-Item (Join-Path $InputDirectory "app/*") $app -Recurse -Force
|
|
46
|
-
|
|
83
|
+
Invoke-RuntimeLink (Join-Path $output "$appSlug.exe")
|
|
47
84
|
$icon = Join-Path $InputDirectory "icons/windows/AppIcon.ico"
|
|
48
85
|
if (Test-Path -LiteralPath $icon -PathType Leaf) {
|
|
49
86
|
Copy-Item -LiteralPath $icon (Join-Path $output "AppIcon.ico")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
advapi32.lib kernel32.lib bcrypt.lib advapi32.lib kernel32.lib ntdll.lib userenv.lib ws2_32.lib dbghelp.lib /defaultlib:msvcrt
|
|
Binary file
|