Code Monkey home page Code Monkey logo

staticfiles's Introduction

AvaloniaLibs

This is holding the compiled lib files for win-x64 for libHarfBuzzSharp.lib and libSkiaSharp.lib. I found these lib files thanks to ivanjx on this forum (AvaloniaUI/Avalonia#9503). When compiling Avalonia for NativeAOT you'll still have dll references if you don't provide NativeLibraries. I'd prefer to have my apps be single file, so I've written a simple bat file to publish my Avalonia projects as NativeAOT using these lib files.

If you want to do this, you must add the following to your .csproj

  <ItemGroup>
    <DirectPInvoke Include="libHarfBuzzSharp" />
    <NativeLibrary Include="Native\win-x64\libHarfBuzzSharp.lib" Condition="$(RuntimeIdentifier.StartsWith('win-x64'))" />
    <DirectPInvoke Include="libSkiaSharp" />
    <NativeLibrary Include="Native\win-x64\libSkiaSharp.lib" Condition="$(RuntimeIdentifier.StartsWith('win-x64'))" />
  </ItemGroup>

Then if you run the following bat file, it will download the libs from this repository, and publish a NativeAOT version of your app.

:: Making sure library files exist, and download if they do not
IF NOT EXIST ".\Native\win-x64" MKDIR ".\Native\win-x64"

IF NOT EXIST .\Native\win-x64\libHarfBuzzSharp.lib ECHO Downloading libHarfBuzzSharp.lib (Approx 105 MB)...
IF NOT EXIST .\Native\win-x64\libHarfBuzzSharp.lib powershell -Command "Invoke-WebRequest https://github.com/brgishy/StaticFiles/raw/main/AvaloniaLibs/win-x64/libHarfBuzzSharp.lib?download= -Outfile .\Native\win-x64\libHarfBuzzSharp.lib"

IF NOT EXIST .\Native\win-x64\libSkiaSharp.lib ECHO Downloading libSkiaSharp.lib (Approx 392 MB)...
IF NOT EXIST .\Native\win-x64\libSkiaSharp.lib powershell -Command "Invoke-WebRequest https://github.com/brgishy/StaticFiles/raw/main/AvaloniaLibs/win-x64/libSkiaSharp.lib?download= -Outfile .\Native\win-x64\libSkiaSharp.lib"

:: Performing the Publish
SET CONFIG=Release
SET RUNTIME=win-x64

dotnet publish ^
  -r %RUNTIME% ^
  -c %CONFIG% ^
  -p:PublishAOT=true ^
  -p:TrimmerDefaultAction=link ^
  -p:InvariantGlobalization=true ^
  -p:IlcGenerateStackTraceData=false ^
  -p:IlcOptimizationPreference=Size ^
  -p:DebugType=none ^
  -p:IlcFoldIdenticalMethodBodies=true ^
  -p:IlcTrimMetadata=true  

:: Moving the compiled exe to the root folder
MOVE .\bin\%CONFIG%\net7.0\%RUNTIME%\publish\*.exe ..

SimpleWebServer

This folder contains the exe SWS.exe, which is the NativeAOT compiled output of this project https://github.com/brgishy/SimpleWebServer (if you want to see the source). It's a very helpful 16 MB file that lets you run a web server from the CWD (Current Working Directory). I use it for running content locally like my MDWiki or for running Unity WebGL Builds. If you don't want to copy / paste the SWS.exe file everywhere you use the RunSWS.bat file which will download it once to your %APPDATA% folder so it can be reused.

staticfiles's People

Contributors

brgishy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.