sass / libsass-net

A lightweight wrapper around libsass
MIT License
94 stars 35 forks source link

Combining the two platform builds. #9

Closed JimBobSquarePants closed 7 years ago

JimBobSquarePants commented 9 years ago

Hi there,

Have you considered embedding the two c++ binaries as a resource and delivering the correct one based on processor architecture on demand? That would save having to maintain two libraries and make it easier for people to consume the library.

AlexCuse commented 9 years ago

I'm very interested in this - had some users report issues that seem vaguely related but I have not been able to reproduce.

Been thinking about submitting this as a PR but I'm not sure I'm familiar enough with this kind of thing to properly test it. Have looked into it a good bit though, this is how NSass managed: https://github.com/TBAPI-0KA/NSass/commit/3730d3d3d374c600f0ba3d8dac88e797c4a6c794

I suspect that including the dll's as embedded resources would make things a lot easier

JimBobSquarePants commented 9 years ago

I've not been able to get the solution to build locally to have a play around but that looks like that sample could certainly be on the right path. You would have to ensure that both binaries are shadow copied across to the app location though in order to load them though and if they are not directly referenced then that might not happen automatically.

I use the system in one of my libraries to copy across embedded C++ binaries to the correct destination. I'm sure something similar could be fashioned for this circumstance.

https://github.com/JimBobSquarePants/ImageProcessor/blob/master/src/ImageProcessor/Configuration/NativeBinaryFactory.cs#L97

darrenkopp commented 9 years ago

I agree, I just haven't figured out a way to make it work simply yet. The problem with the way nsass did it is that it made it nearly impossible to build the project. I'll see if I can find some time soon to work on this, but this time of year is super busy for me.

AlexCuse commented 9 years ago

Busy here too, though I did start trying to look into this last night (i'm missing components to work with the .vcxproj project type).

If I track down installation media and add the C++ components to visual studio 2010 will that work, or should I use this as the final push that I need towards upgrading to 2013?

darrenkopp commented 9 years ago

I'm not really sure, but I'd be surprised if you were able to open the solution and compile in 2010.

JimBobSquarePants commented 9 years ago

@darrenkopp I actually might have a solution. I'll run some tests in my fork and let you know.

@AlexCuse I would most definitely update. You can grab the free Community Edition here http://www.visualstudio.com/products/visual-studio-community-vs

peterfearn commented 9 years ago

+1 from me :) - I'd have like to have done this instead of the x64 build but didn't really know where to begin.

JimBobSquarePants commented 9 years ago

@darrenkopp Hey chum, did you ever get anywhere with this? I failed miserably.

I'm looking to do some updates to Cruncher but if you have a new release coming soon I will wait for that.

darrenkopp commented 9 years ago

yeah we were talking about it over here: https://github.com/darrenkopp/libsass-net/issues/13#issuecomment-76645126. i'm gonna attempt to get pure libsass using that solution file, then it's just a matter of updating to the new api and p/invoking.

updates coming soon, trying to get taxes done at the moment

JimBobSquarePants commented 9 years ago

Awesome! :smile: I'll hold out then. Cheers!

Woland2k commented 9 years ago

Any update on this? Seems like a very big issue especially for microsoft cloud/azure since free one only supports 32bit deployment while basic plan support 64.

darrenkopp commented 9 years ago

in progress. you can however use it on both 32-bit and 64-bit currently, you just aren't able to deploy to both simultaneously, you have to know which you are using and install that specific platform version

Woland2k commented 9 years ago

Great, yeah I know that I can compile the specific version to deploy to. However we have developers using both 64 and 32 bit machines.

Woland2k commented 9 years ago

Any update or direction you going to take in implementing this? We can help with implementation if needed.

darrenkopp commented 9 years ago

basically drop the managed c++ (ala https://github.com/darrenkopp/libsass-net/tree/pinvoke) and then use p/invoke for everything. Once all the methods / structs are mapped, then it's a simple matter of doing

if (IntPtr.Size == 4) { Run32BitMethod(); } else { Run64BitMethod(); }
brbradford commented 8 years ago

Any update on this issue? This could really solve a lot of headaches for us so we are anxiously awaiting this. Thanks for all your work on this project!

darrenkopp commented 7 years ago

Done. The alpha is on nuget.