Repository navigation
Expand file tree
/
Copy pathDOCUMENTATION.txt
More file actions
295 lines (256 loc) · 14 KB
/
Copy pathDOCUMENTATION.txt
File metadata and controls
295 lines (256 loc) · 14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# Dotnet Documentation
# Getting Started Guide:
# https://docs.microsoft.com/en-us/dotnet/core/tools/
# https://docs.microsoft.com/en-us/dotnet/core/dotnet-five
# https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code
# Build and Run commands:
dotnet build
dotnet run
dotnet run --project Project/Project.csproj
# Nuget How-To:
# https://docs.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-using-the-dotnet-cli
# How to deploy/publish:
# Note: Use "clean" instead of "publish" to clean output folder
# https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
# https://docs.microsoft.com/en-us/dotnet/core/deploying/
# https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli
# https://docs.microsoft.com/en-us/dotnet/core/deploying/ready-to-run
# https://docs.microsoft.com/en-us/dotnet/core/deploying/trim-self-contained
# https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
# NET FDE (Frame-Dependant-Executable) -> Doesn't work on systems without .NET Runtime installed
dotnet publish --configuration Release
dotnet publish -c Release
dotnet publish -c Release -r linux-x64 --self-contained false -p:PublishReadyToRun=true -p:PublishSingleFile=true
# NET SCD (Self-Contained-Deployment) -> Doesn't need .NET Runtime installed
dotnet publish -c Release -r linux-x64
dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true
dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true
# CoreRT (NativeAOT) -> Override NET SCD builds
# https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/prerequisites.md
# https://github.com/dotnet/runtimelab/tree/feature/NativeAOT
# https://github.com/dotnet/runtimelab/tree/feature/NativeAOT/samples/HelloWorld
# https://github.com/dotnet/runtimelab/tree/feature/NativeAOT/samples/NativeLibrary
# Optimize CoreRT (NativeAOT) builds
# https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/optimizing.md
# https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming-options#trimming-framework-library-features
# https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md
# ----------------------------------------------------------
# Install NET Framework SDK 5.0
# https://dotnet.microsoft.com/download/dotnet/5.0
# Install VSCode + C# Extension
# https://code.visualstudio.com/
# https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp
# Create Solution (A solution is a container of projects)
dotnet new sln -o NetDesktopTemplate
cd NetDesktopTemplate
# Create Project
dotnet new console -o NetTemplate
dotnet sln add NetTemplate/NetTemplate.csproj
# Download Core https://github.com/JuDelCo/Core
git submodule add git@github.com:JuDelCo/Core.git Core
dotnet sln add Core/Core.csproj
dotnet add NetTemplate/NetTemplate.csproj reference Core/Core.csproj
# [Alternative] Install dependencies (Nuget)
dotnet add package Raylib-cs --version 3.7.0
dotnet add package ImGui.NET --version 1.78.0
# Download Raylib-cs https://github.com/ChrisDill/Raylib-cs
git submodule add git@github.com:ChrisDill/Raylib-cs.git NetRaylib
dotnet sln add NetRaylib/Raylib-cs/Raylib-cs.csproj
dotnet add NetTemplate/NetTemplate.csproj reference NetRaylib/Raylib-cs/Raylib-cs.csproj
# Download Raylib-cs native dependencies (Linux x64)
wget -P NetRaylib/Raylib-cs/runtimes/linux-x64/native/ https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_linux_amd64.tar.gz
tar -C NetRaylib/Raylib-cs/runtimes/linux-x64/native/ --transform 's/.*\///g' -xf NetRaylib/Raylib-cs/runtimes/linux-x64/native/raylib-3.7.0_linux_amd64.tar.gz raylib-3.7.0_linux_amd64/lib/libraylib.so.3.7.0
mv NetRaylib/Raylib-cs/runtimes/linux-x64/native/libraylib.so.3.7.0 NetRaylib/Raylib-cs/runtimes/linux-x64/native/raylib.so
rm NetRaylib/Raylib-cs/runtimes/linux-x64/native/raylib-3.7.0_linux_amd64.tar.gz
# Download Raylib-cs native dependencies (MacOS x64)
wget -P NetRaylib/Raylib-cs/runtimes/osx-x64/native/ https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_macos.tar.gz
tar -C NetRaylib/Raylib-cs/runtimes/osx-x64/native/ --transform 's/.*\///g' -xf NetRaylib/Raylib-cs/runtimes/osx-x64/native/raylib-3.7.0_macos.tar.gz raylib-3.7.0_macos/lib/libraylib.3.7.0.dylib
mv NetRaylib/Raylib-cs/runtimes/osx-x64/native/libraylib.3.7.0.dylib NetRaylib/Raylib-cs/runtimes/osx-x64/native/raylib.dylib
rm NetRaylib/Raylib-cs/runtimes/osx-x64/native/raylib-3.7.0_macos.tar.gz
# Download Raylib-cs native dependencies (Windows x64)
wget -P NetRaylib/Raylib-cs/runtimes/win-x64/native/ https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip
unzip -p NetRaylib/Raylib-cs/runtimes/win-x64/native/raylib-3.7.0_win64_msvc16.zip raylib-3.7.0_win64_msvc16/lib/raylib.dll > NetRaylib/Raylib-cs/runtimes/win-x64/native/raylib.dll
rm NetRaylib/Raylib-cs/runtimes/win-x64/native/raylib-3.7.0_win64_msvc16.zip
# Download Raylib-cs native dependencies (Windows x86)
wget -P NetRaylib/Raylib-cs/runtimes/win-x86/native/ https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win32_msvc16.zip
unzip -p NetRaylib/Raylib-cs/runtimes/win-x86/native/raylib-3.7.0_win32_msvc16.zip raylib-3.7.0_win32_msvc16/lib/raylib.dll > NetRaylib/Raylib-cs/runtimes/win-x86/native/raylib.dll
rm NetRaylib/Raylib-cs/runtimes/win-x86/native/raylib-3.7.0_win32_msvc16.zip
# Download ImGui.NET https://github.com/mellinoe/ImGui.NET
git submodule add git@github.com:mellinoe/ImGui.NET.git NetImGui
dotnet sln add NetImGui/src/ImGui.NET/ImGui.NET.csproj
dotnet add NetTemplate/NetTemplate.csproj reference NetImGui/src/ImGui.NET/ImGui.NET.csproj
# Edit NetTemplate.csproj
# <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
# <OutputType>WinExe</OutputType>
#
# <IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
# <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
# <IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
#
# <PropertyGroup Condition="'$(IsLinux)'=='true'">
# <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
# </PropertyGroup>
#
# <PropertyGroup Condition="'$(IsOSX)'=='true'">
# <RuntimeIdentifier>osx-x64</RuntimeIdentifier>
# </PropertyGroup>
#
# <PropertyGroup Condition="'$(IsWindows)'=='true'">
# <RuntimeIdentifier>win-x64</RuntimeIdentifier>
# </PropertyGroup>
#
# <ItemGroup>
# <Content Include="Resources\*.*">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# </Content>
# </ItemGroup>
# Edit NetTemplate.csproj (Linux x64)
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetRaylib\Raylib-cs\runtimes\linux-x64\native\raylib.so">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>raylib.so</Link>
# </Content>
# </ItemGroup>
#
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetImGui\deps\cimgui\linux-x64\cimgui.so">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>cimgui.so</Link>
# </Content>
# </ItemGroup>
# Edit NetTemplate.csproj (MacOS x64)
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetRaylib\Raylib-cs\runtimes\osx-x64\native\raylib.dylib">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>raylib.dylib</Link>
# </Content>
# </ItemGroup>
#
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetImGui\deps\cimgui\osx-x64\cimgui.dylib">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>cimgui.dylib</Link>
# </Content>
# </ItemGroup>
# Edit NetTemplate.csproj (Windows x64)
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetRaylib\Raylib-cs\runtimes\win-x64\native\raylib.dll">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>raylib.dll</Link>
# </Content>
# </ItemGroup>
#
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetImGui\deps\cimgui\win-x64\cimgui.dll">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>cimgui.dll</Link>
# </Content>
# </ItemGroup>
# Edit NetTemplate.csproj (Windows x86)
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetRaylib\Raylib-cs\runtimes\win-x64\native\raylib.dll">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>raylib.dll</Link>
# </Content>
# </ItemGroup>
#
# <ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
# <Content Include="$(MSBuildThisFileDirectory)..\NetImGui\deps\cimgui\win-x64\cimgui.dll">
# <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
# <Link>cimgui.dll</Link>
# </Content>
# </ItemGroup>
# Add .gitignore
# # .NET Core build folders
# bin/
# obj/
git init
git add .
# Add .gitattributes
# Add .editorconfig
# Add LICENSE.md
# Add README.md
# Add CHANGELOG.md
# Add project code:
# - Program.cs
# - ImGuiImpl.cs
# - Core.cs
# Open project in VSCode, accept both prompts (create .vscode folder and restore the project so assembly references works in the editor)
# Edit launch.json (to allow input in the debug terminal of VSCode)
# "console": "integratedTerminal",
# Add .vscode/settings.json
# [OPTIONAL] Install CoreRT (NativeAOT) support (Nuget)
dotnet new nuget
# Edit nuget.config
# <add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
# <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
cd NetTemplate
dotnet add package Microsoft.DotNet.ILCompiler --prerelease
sudo apt-get install clang zlib1g-dev libkrb5-dev # libcurl4-openssl-dev
# [OPTIONAL] Optimize CoreRT build (Edit NetTemplate.csproj)
# <InvariantGlobalization>true</InvariantGlobalization>
# <DebuggerSupport>false</DebuggerSupport>
# <EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
# <EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
# <EventSourceSupport>false</EventSourceSupport>
# <HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
# <UseSystemResourceKeys>true</UseSystemResourceKeys>
#
# <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
# <IlcDisableReflection>true</IlcDisableReflection>
# <IlcOptimizationPreference>Size</IlcOptimizationPreference>
# <IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
# Build and test project:
cd NetTemplate
dotnet build
dotnet build -r linux-x64
dotnet run
dotnet run -r linux-x64
# Deploy/Publish (if CoreRT is NOT installed):
cd NetTemplate
dotnet publish -c Release --self-contained false
dotnet publish -c Release -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true
dotnet publish -c Release -r linux-x64 --self-contained false
dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true
dotnet publish -c Release -r win-x64 --self-contained false
dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true
# Deploy/Publish (if CoreRT IS installed):
cd NetTemplate
dotnet publish -c Release -p:PublishReadyToRun=true
dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true
dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true
# ----------------------------------------------------------
# [OPTIONAL] After Publish Script (Linux x64)
# <Target Name="CustomActionsAfterPublish" AfterTargets="Publish" Condition="'$(Configuration)|$(RuntimeIdentifier)' == 'Release|linux-x64'">
# <Message Importance="high" Text="Deleting old compressed executable..." />
# <Exec Command="rm -f $(pwd)/$(PublishDir)$(ProjectName)Compressed" />
#
# <Message Importance="high" Text="Striping debug info from native executable (linux) ..." />
# <Exec Command="strip $(pwd)/$(OutDir)native/$(ProjectName)" />
#
# <Message Importance="high" Text="Compressing native executable..." />
# <Exec Command="upx -qq --lzma --compress-exports=0 $(pwd)/$(OutDir)native/$(ProjectName) -o $(pwd)/$(PublishDir)$(ProjectName)Compressed" />
#
# <Message Importance="high" Text="Compressing libraries if needed..." />
# <Exec Command="chmod +x $(pwd)/$(PublishDir)raylib.so" />
# <Exec Command="chmod +x $(pwd)/$(PublishDir)cimgui.so" />
# <!--<Exec Command="upx -qqq - -lzma - -compress-exports=0 $(pwd)/$(PublishDir)raylib.so || true" />-->
# <Exec Command="upx -qqq --lzma --compress-exports=0 $(pwd)/$(PublishDir)cimgui.so || true" />
#
# <Message Importance="high" Text="Deleting unnecessary artifact files..." />
# <Exec Command="rm -f $(pwd)/$(PublishDir)$(ProjectName).pdb" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)$(ProjectName).deps.json" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)$(ProjectName).runtimeconfig.json" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)JuCore.pdb" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)ImGui.NET.pdb" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)ImGui.NET.xml" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)Raylib-cs.pdb" />
# <Exec Command="rm -f $(pwd)/$(PublishDir)Raylib-cs.xml" />
# <Exec Command="rm -rf $(pwd)/$(PublishDir)runtimes" />
# </Target>
# [OPTIONAL] Strip debug info:
# Note: ONLY for linux native executables
strip NetTemplate
# [OPTIONAL] Compress build:
# Note: UPX compressed .exe builds (windows) doesn't work on Wine/Proton on Linux, libraries (.dll) works tought
upx -qq --lzma --compress-exports=0 NetTemplate -o NetTemplateCompressed