Building Ogre .NET bindings

Problems building or running the engine, queries about how to use features etc.
Post Reply
demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 3

Building Ogre .NET bindings

Post by demeter » Fri Aug 09, 2019 3:49 pm

Hello,

I found out Ogre has official .NET bindings now-a-days and would like to use it because I'm experienced with .NET but know only little about C++ and zero about cmake. :)

I found this bit of info: https://github.com/OGRECave/ogre/tree/m ... les/Csharp but I can't find that "build/csharp" folder that it talks about. I downloaded the master branch and looked for build, csharp, and *.cs, but except for a cmake file and the demo .cs file, I cant find anything.

I also searched through a prebuilt SDK download, but I didnt find any "ogre.dll", i did find a "libOgre.ddl" though.

Does anyone know how to build for .NET use, or know of some more info about this?

thanks
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 920
Joined: Sun Mar 30, 2014 2:51 pm
x 206
Contact:

Re: Building Ogre .NET bindings

Post by paroj » Fri Aug 09, 2019 5:19 pm

the contents of "build/csharp/" will be auto-generated if you build ogre with the CSharp component (requires SWIG). Here, "build" refers to the build folder.
The prebuild SDK currently does not include the .NET part as it was not yet tested on Windows. However I probably can change that for the devel builds..
0 x

demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 3

Re: Building Ogre .NET bindings

Post by demeter » Fri Aug 09, 2019 9:20 pm

Hi, i gotten a lot further now...

* I managed to get CMake generate with csharp support (i had to manually configure the SWIG exe (swigwin 4.0.0) in CMakeCache.txt) -> then it worked
* I built the c++ OGRE.sln -> csharp folder
* Building these cs files failed, so i made a .net project and used Visual Studio to see what was going on. I fixed two simple mistakes (an unneeded override and an enum that used uint values but was signed int) -> ogre.dll

But now, lastly, i'm lacking this libOgre.so you speak of. It didn't get generated anywhere, and when I run the built example.cs it complains Unable to load DLL 'libOgre_d', so that makes sense. But I don't know where to get it.

thanks
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 920
Joined: Sun Mar 30, 2014 2:51 pm
x 206
Contact:

Re: Building Ogre .NET bindings

Post by paroj » Sat Aug 10, 2019 7:08 am

The csharp bindings consist of two parts. The ogre.dll you built and the libOgre.so native Part (probably Ogre_d.dll on Windows).
It should be located in build/lib or the csharp subfolder. Maybe you will have to rename it to libOgre_d.dll
0 x

demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 3

Re: Building Ogre .NET bindings

Post by demeter » Sat Aug 10, 2019 3:15 pm

The libOgre project doesn't build, because OgreOverlay doesn;t build, because it didn't find ft2build.h.

So apparently is from the FreeType library (although the CMake log suggested FreeType was good to go). So, I downloaded freetype (https://github.com/ubawurinna/freetype-windows-binaries), added the include folder and now it gives me linker errors, eg.:

unresolved external symbol _FT_Init_FreeType referenced in function "public: virtual void __thiscall Ogre::Font::loadResource(class Ogre::Resource *)" (?loadResource@Font@Ogre@@UAEXPAVResource@2@@Z) OgreOverlay C:\ogre3d\build\Components\Overlay\OgreFont.obj 1

I can see the mising method names with a texteditor in the freetype.lib, so it's the right library. But when i add them to the library folders in the Visual Studio project, it keeps giving the same linker errors. So, either I include them incorrectly, or it doesnt like something about it...
0 x

frostbyte2
Gnoblar
Posts: 8
Joined: Mon Jun 03, 2019 2:45 pm
x 8

Re: Building Ogre .NET bindings

Post by frostbyte2 » Sat Aug 10, 2019 3:49 pm

meh, loading precompiled c++ binaries never works...( can be mismatched compiler version, compilation/linker flags etc )
its best to build all dependencies from source with the same compiler env/settings and on the same machine( just to be on the safe side )
that way if anything goes wrong at least you know whats the problem so you can fix it.
afaik ogre build scripts should download all dependencies and build them for you
otherwise https://bitbucket.org/cabalistic/ogredeps
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 920
Joined: Sun Mar 30, 2014 2:51 pm
x 206
Contact:

Re: Building Ogre .NET bindings

Post by paroj » Sat Aug 10, 2019 8:03 pm

Yeah, freetype should have been built in build/Dependencies. Maybe it did Not properly find the debug lib name
0 x

demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 3

Re: Building Ogre .NET bindings

Post by demeter » Sun Aug 11, 2019 9:27 pm

I think I'm almost there now... I can build almost all projects (dlls) of Ogre, and when I copy the build output to the example build output folder, the example starts but crashes when loading the scene. Indeed: dll Plugin_DotScene wont compile yet. (I just ignored it until now because I believed it unneeded for my usecase).

As a matter of fact, only 2 projects with errors remain:

Image

I searched for these identifiers to try fixing the mismatches, but can't find their origin...

If you want me to repost this as a new question, let me know. This is just a "getting the 2 remaining Ogre dlls to build on Windows" problem.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 920
Joined: Sun Mar 30, 2014 2:51 pm
x 206
Contact:

Re: Building Ogre .NET bindings

Post by paroj » Sun Aug 11, 2019 11:11 pm

Something is wrong with your pugixml build. Either disable ogre_tools and dotscene Plugin in cmake or Go Back to the 1.12.1 tag
1 x

demeter
Gnoblar
Posts: 5
Joined: Fri Aug 09, 2019 2:51 pm
x 3

Re: Building Ogre .NET bindings

Post by demeter » Mon Aug 12, 2019 11:51 am

It works!

Wow, quite a journey :) Thanks for the help.

I made an extensive blog about the cleaned up process, for my future self and maybe others: https://hellholegames.wordpress.com/201 ... evelopers/

Thanks for all the help!!
3 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 920
Joined: Sun Mar 30, 2014 2:51 pm
x 206
Contact:

Re: Building Ogre .NET bindings

Post by paroj » Fri Aug 16, 2019 11:08 am

demeter wrote:
Mon Aug 12, 2019 11:51 am
I made an extensive blog about the cleaned up process, for my future self and maybe others: https://hellholegames.wordpress.com/201 ... evelopers/
https://github.com/OGRECave/ogre/pull/1242

just updated the devel build to include the C# sources as well. Everything .NET related is now in lib/cli/. Take a look at the latest SDK master snapshot whether this simplifies things for you.
1 x

Post Reply