Repository navigation
Expand file tree
/
Copy pathbuild.cmd
More file actions
35 lines (32 loc) · 3.17 KB
/
Copy pathbuild.cmd
File metadata and controls
35 lines (32 loc) · 3.17 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
@echo off
:: Builds Ohman with the C# compiler that ships inside Windows (.NET Framework 4.8) - no SDK needed.
:: build.cmd -> Ohman.exe (real; asks for administrator rights), preview\Ohman.exe, tools\omenprobe.exe
:: build.cmd preview -> only preview\Ohman.exe (same UI, simulated hardware, no elevation)
:: The exe icon (app.ico) is drawn by the app itself so the mark has a single source of truth.
setlocal
cd /d "%~dp0"
set CSC=%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\csc.exe
set WPF=%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\WPF
set REFS=/r:System.Management.dll /r:System.Windows.Forms.dll /r:System.Drawing.dll /r:System.Xaml.dll /r:"%WPF%\PresentationCore.dll" /r:"%WPF%\PresentationFramework.dll" /r:"%WPF%\WindowsBase.dll"
set SRC=src\Meta.cs src\Support.cs src\Platform.cs src\Hardware.cs src\Driver.cs src\Ec.cs src\Cpu.cs src\Hid.cs src\McuKeyboard.cs src\Lighting.cs src\Keyboard.cs src\Display.cs src\Update.cs src\Theme.cs src\Controls.cs src\Curve.cs src\Sensors.cs src\Hotkeys.cs src\Engine.cs src\Bench.cs src\BenchUi.cs src\Ui.cs src\Program.cs
set RES=/resource:src\Ui.xaml,Ohman.Ui.xaml /resource:fonts\IBMPlexSans-Regular.ttf,Ohman.fonts.IBMPlexSans-Regular.ttf /resource:fonts\IBMPlexSans-Medium.ttf,Ohman.fonts.IBMPlexSans-Medium.ttf /resource:fonts\IBMPlexSans-SemiBold.ttf,Ohman.fonts.IBMPlexSans-SemiBold.ttf /resource:fonts\IBMPlexMono-Regular.ttf,Ohman.fonts.IBMPlexMono-Regular.ttf /resource:fonts\IBMPlexMono-Medium.ttf,Ohman.fonts.IBMPlexMono-Medium.ttf /resource:fonts\OFL.txt,Ohman.fonts.OFL.txt
:: Signed PawnIO modules (third_party\PawnIO.Modules, LGPL-2.1): the driver loads only these, so they travel inside the exe.
:: Game names for the benchmark (third_party\CapFrameX, MIT): exe name to the name people know the game by.
set RES=%RES% /resource:third_party\CapFrameX\games.txt,Ohman.games.txt
set RES=%RES% /resource:third_party\PawnIO.Modules\LpcACPIEC.bin,Ohman.pawnio.LpcACPIEC.bin /resource:third_party\PawnIO.Modules\IntelMSR.bin,Ohman.pawnio.IntelMSR.bin /resource:third_party\PawnIO.Modules\AMDFamily17.bin,Ohman.pawnio.AMDFamily17.bin /resource:third_party\PawnIO.Modules\COPYING,Ohman.pawnio.COPYING
if not exist preview mkdir preview
:: 1. preview build without an icon, used to generate app.ico
"%CSC%" /nologo /target:winexe /platform:x64 /optimize+ /warn:1 /out:preview\Ohman.exe /win32manifest:app.demo.manifest %RES% %REFS% %SRC%
if errorlevel 1 exit /b 1
preview\Ohman.exe --make-ico app.ico
if exist app.ico (set ICO=/win32icon:app.ico) else (set ICO=)
:: 2. preview build with the icon
"%CSC%" /nologo /target:winexe /platform:x64 /optimize+ /warn:1 /out:preview\Ohman.exe /win32manifest:app.demo.manifest %ICO% %RES% %REFS% %SRC%
if errorlevel 1 exit /b 1
if /i "%~1"=="preview" (echo Built preview\Ohman.exe & exit /b 0)
:: 3. the real thing + the probe tool
"%CSC%" /nologo /target:winexe /platform:x64 /optimize+ /warn:1 /out:Ohman.exe /win32manifest:app.manifest %ICO% %RES% %REFS% %SRC%
if errorlevel 1 exit /b 1
"%CSC%" /nologo /target:exe /platform:x64 /optimize+ /warn:1 /out:tools\omenprobe.exe /r:System.Management.dll tools\omenprobe.cs src\Meta.cs
if errorlevel 1 exit /b 1
echo Built Ohman.exe, preview\Ohman.exe and tools\omenprobe.exe