AndresTraks / BulletSharpPInvoke

.NET wrapper for the Bullet physics library using Platform Invoke
http://andrestraks.github.io/BulletSharp/
150 stars 97 forks source link

Using with Paket #53

Open sheganinans opened 5 years ago

sheganinans commented 5 years ago

In my paket.dependencies file I have a line: git https://github.com/AndresTraks/BulletSharpPInvoke.git master build: "dotnet build BulletSharp.DotNetCore.sln", source: /BulletPhysics/, OS: mono

This works and the test project compiles, however at runtime I get a DllNotFoundException for libbulletc. I think this can likely be solved with more Paket incantations, I'm just not sure what to do.

AndresTraks commented 5 years ago

Basically what you need to do is compile libbulletc similarly to the build instuctions and copy libbulletc.dll next to BulletSharp.dll in your application directory. The target architecture (x86/x64) should match your project. You probably want to compile for x64.

I don't know much about Paket or if it supports doing this automatically. You would also have to download bullet3 and call CMake from the command line to compile libbulletc.

If you add a reference to the NuGet package, then it should be able to set up precompiled versions of BulletSharp and libbulletc.dll in a way that works for most projects. I haven't tried this in a .NET Core project though. Maybe you can try that instead?

The easiest way to get something working is to compile libbulletc.dll, add it as a file to your Visual Studio project and set "Copy to Output Directory = Copy if newer" in file properties. BulletSharp will look for a file named "libbulletc.dll". It should be able to load the file if your application is 64-bit and libbulletc.dll is 64-bit. Or if your application is "Any CPU", libbulletc.dll is 64-bit and your application runs on a 64-bit machine.