Skip to content

Commit 4cbf27d

Browse files
committed
🔨 Add a script to generate the package of Unity and add a sublime build for it
1 parent 5ae7b04 commit 4cbf27d

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

‎Plugin/InteropUnityCUDA.sublime-project

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@
6565
"shell_cmd": "powershell.exe -File ${project_path:${folder}}\\buildtools\\compileProjects.ps1 -project \"all\" -action \"clean\"",
6666
"working_dir": "${project_path:${folder}}",
6767
},
68+
{
69+
"name": "Packaged Unity",
70+
"target": "terminus_exec",
71+
"focus": true,
72+
"timeit": false,
73+
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
74+
"cancel": "terminus_cancel_build",
75+
"shell_cmd": "powershell.exe -File ${project_path:${folder}}\\buildtools\\packageUnity.ps1 \"..\\com.studio-nyx.interop-unity-cuda.\"",
76+
"working_dir": "${project_path:${folder}}",
77+
},
6878
{
6979
"name": "Proj - Open Log",
7080
"cmd": [
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
param(
2+
[string]$targetFolder
3+
)
4+
5+
# Include version from dependencies.ps1
6+
. $PSScriptRoot\dependencies.ps1
7+
$version = $Env:INTEROP_UNITY_CUDA_VERSION
8+
$targetFolder = "$targetFolder$version"
9+
10+
# Check if the target folder exists
11+
if (-not (Test-Path -Path $targetFolder -PathType Container)) {
12+
Write-Host "Target folder does not exist. Creating folder: $targetFolder"
13+
New-Item -Path $targetFolder -ItemType Directory -Force
14+
}
15+
16+
17+
# Define the content of package.json
18+
$jsonContent = @{
19+
"name" = "com.studio-nyx.interop-unity-cuda"
20+
"version" = $version
21+
"displayName" = "Interop Unity CUDA"
22+
"unity" = "2021.1"
23+
"description" = "Demonstrate interoperability between Unity Engine and CUDA."
24+
"license" = "MIT"
25+
"keywords" = @("GPU", "CUDA", "OpenGL", "DX11", "Native-Plugin", "interoperability")
26+
"author" = @{
27+
"name" = "David Algis"
28+
"email" = "david.algis@tutamail.com"
29+
"url" = "https://github.com/davidAlgis"
30+
}
31+
} | ConvertTo-Json -Depth 4
32+
33+
# Create package.json in the target folder
34+
$jsonContent | Set-Content -Path (Join-Path -Path $targetFolder -ChildPath 'package.json') -Force
35+
Write-Host "package.json created in $targetFolder"
36+
37+
# Copy and paste content from another folder to the target folder
38+
$sourceFolder = "$Env:INTEROP_UNITY_CUDA_UNITY_PROJECT_ROOT\Assets"
39+
40+
Write-Host "Copy $sourceFolder to $targetFolder..."
41+
Copy-Item -Path $sourceFolder\* -Destination $targetFolder -Recurse -Force
42+

0 commit comments

Comments
 (0)