Cairo on Windows vs 2017 140 or 141

Has anyone gotten Cairo working on Windows with 140 or 141? I know there’s a few other posts floating around on here on this topic from over a year ago. If anyone has got it running I’d love some pointers.

thanks

I’m actively working on this at the moment. We’re likely moving Cairo into an “official” CinderBlock similar to OpenCV as the binaries are rather large. Building it is fairly challenging but I should have something up in the coming days (hoping <1 week).

1 Like

Hi, may I ask if the work is done?
I compiled several samples depends on cairo in VS2017 141, and got errors about linking issues.

I am working from VS2017 141 and I’ve worked out all the issues with all the Cairo samples. Replacing the lib with a 141 built one will get rid of the linking error you get with the Cinder supplied version. Without having to get into that you can also paste a fix into all the samples:

FILE _iob[] = { *stdin, *stdout, *stderr };
extern “C” FILE * __cdecl __iob_func(void) { return _iob; }

So you can get those Cairo samples to build, but some of them are going to reveal a pretty big problem when you run them. Double buffering is enabled but the mechanism that is supposed to give you handle to the back buffer is actually giving the handle of the window. The good news is that this is fixable and that the right method of getDC() is already in place. In cinder::app::Renderer.cpp change:

HDC Renderer2d::getDc() const
{
return mWindowImpl->getDc();
}

to

HDC Renderer2d::getDc() const
{
return mImpl->getDc();
}

The mImpl->getDc() method is declared in cinder::app::msw::RendererImpl2dGdi.h as:

virtual HDC getDc() const { return ( mDoubleBuffer ) ? mDoubleBufferDc : mPaintDc; }

There are a lot of samples that are affected, including Renderer2dBasic which doesn’t use Cairo. I have only be playing with Cinder for about a week so I don’t know how long it’s been like this. I will see how it goes with my pull request.

Was there any movement with an updated cinder block for Cairo? It would be great to have some vector drawing tools work out of the box with the latest version of Cinder (with vs v141 etc).

If not, then if anyone has some pointers as to how to go about rebuilding the library (as mentioned above) for vs 2017 that would be great.

Looks like Ryan made some progress on this here https://github.com/cinder/Cinder/pull/1648 which hasnt been merged in yet. Will look into this.