XbimGeometry icon indicating copy to clipboard operation
XbimGeometry copied to clipboard

NET 6+ cross platform support

Open florius0 opened this issue 2 years ago • 21 comments

Hi, I'm looking for a cross-platform IFC libraries, and based on tests that I've done, yours seems to be the best in terms of performance.

However, if my understanding is correct, xbim library family supports full IFC entities tesslation only on Windows because of OpenCascade I assume.

But OpenCascade docs says that since v7 there is cross-platform support

Compared to the previous (6.x) releases of Open CASCADE Technology, OCCT 7.x has a complete set of CMake scripts and projects, so that there is no need to use WOK anymore. Moreover, CMake gives you a powerful configuration tool, which allows to control many aspects of OCCT deployment. At the same time this tool is quite intuitive, which is a significant advantage over the legacy WOK utilities.

Also, based on some issues here I've come to understanding that there is an effort to make Xbim library family cross-platform, but a cross-platform version is not done yet (tried on macOS, dotnet run ... just crashes with an exit code and no other info). Is there a roadmap perhaps?

I presume as of now the main factor that makes XbimGeometry windows-only is Xbim.Geometry.Engine which seems to be just OpenCascade in msvcpp project. If it is true, is there a way to just swap it with cross-platform OpenCascade?

PS Sorry if I've got some of .net versioning stuff wrong, as a Unity dev regular .net is beyond my expertise.

florius0 avatar Jul 16 '22 13:07 florius0

Hi @florius0,

it's a little bit more complex than just compiling on another platform (I'm also using macOS now). There's an open issue #248 already covering a portion of your question.

The problem in short: XbimGeometry uses a customized compile & and runtime of Microsoft called CLR/CLI interop which supports to run unmanaged (cpp native code like OpenCascade) within an managed runtime environment like .NET. It's only supported on Win machines and it's limited to Net Framework and NetApp31 compile environments. As MS stated before, there's no plan to extend support onto .NET5+ - so no cross platform.

The solution would be. a complete redesign of the binding between .NET and native code. There are options (i.e. P/Invoke platform calls with external binding). I've started some research and work, but stopped somehow, since it's a bunch of work. On the other hand it would push Xbim to a new universe... So, @SteveLockley are there any plans related to this issue?

Cheers, Bernold

bekraft avatar Jul 22 '22 20:07 bekraft

It's great to hear that there was some research done on that matter. In unity we have direct bindings to unmanaged code just with special attributes, but I'm not sure that it is available for regular .net

So if I understood you correctly, XbimGeometry c++ code is portable by itself and the issue is with the binding only?

If it is so there is a class that is supported on .net 5+. A brief example. Will it be possible to switch to that approach?/

PS Unity way is somewhat similar, but I dont know whats underneath

florius0 avatar Jul 22 '22 20:07 florius0

No, the native cpp code of XbimGeometry (OpenCascade wrapper) is not portable due to the usage of CLR and interop calls.

bekraft avatar Jul 23 '22 07:07 bekraft

Yeah I see now, and given the size of the codebase updating it to support other platforms is no easy task. I could try running it inside docker container though

Or perhaps try to port it myself. Would you mind trying to estimate a percentage of c++ code that should be changed in order to support modern dotnet unmanaged calls?

florius0 avatar Jul 23 '22 13:07 florius0

Hi,

Any new progress on this ?

zhoub avatar Oct 07 '22 08:10 zhoub

Hi Zhoub, we have been working on this, there will be a release very shortly, I will post some dates in a few days

SteveLockley avatar Oct 10 '22 09:10 SteveLockley

Hi Zhoub, we have been working on this, there will be a release very shortly, I will post some dates in a few days

Thanks a lot ! Looking forward !

zhoub avatar Oct 11 '22 03:10 zhoub

Hi!

How is it going?

we have been working on this, there will be a release very shortly, I will post some dates in a few days

florius0 avatar Oct 15 '22 14:10 florius0

Not quite ready but you can track the progress over at feature/netcore branch.

andyward avatar Oct 18 '22 13:10 andyward