FLTK Cairo builds (autoconf + CMake)

33 views
Skip to first unread message

Albrecht Schlosser

unread,
Mar 1, 2021, 5:47:22 AM3/1/21
to fltk.coredev
Hi All,

I committed an updated version of our autoconf/configure + CMake build
files for Cairo support.

This version relies entirely on pkg-config to find the required flags
and libs. As discussed recently I'm planning to implement the "no
pkg-config" mode for autoconf but I do currently not intend to do this
for CMake builds.

I tested this new version on Linux + macOS successfully but I don't have
a working Cairo installation on Windows so I can't test that.

Can you please test in your environments if the new Cairo build support
works and report here?

Specific questions:

- does it work with autoconf --enable-cairo ?
- does it work with cmake -D OPTION_CAIRO=ON ?

If the build works then test/cairo_test should display the cairo demo image.


Related questions regarding build environments:

Which package managers are you using on macOS?

I installed Homebrew (arm64) on my M1 MacBook and installed autoconf and
Cairo support files (libs) with:

$ brew install autoconf
$ brew install cairo

I installed CMake on macOS from cmake.org (.dmg file).

Thanks in advance for your tests and feedback.

Albrecht Schlosser

unread,
Mar 1, 2021, 5:59:35 AM3/1/21
to fltkc...@googlegroups.com
On 3/1/21 11:47 AM Albrecht Schlosser wrote:
>
> Can you please test in your environments if the new Cairo build support
> works and report here?
>
> Specific questions:
>
> - does it work with autoconf --enable-cairo ?
> - does it work with cmake -D OPTION_CAIRO=ON ?

I forgot:

- does `fltk-config --use-cairo --compile test/cairo_test.cxx` work?

- do `fltk-config [--use-cairo] --cxxflags` and `--ldflags` etc. work as
expected?

Manolo

unread,
Mar 1, 2021, 7:12:57 AM3/1/21
to fltk.coredev


On Monday, March 1, 2021 at 11:59:35 AM UTC+1 Albrecht Schlosser wrote:
I have tested on my macOS setup with fink (rather than Homebrew).

> - does it work with configure --enable-cairo ?
This followed by make runs OK

> - does it work with cmake -D OPTION_CAIRO=ON ?
This followed by make runs OK
 

- does `fltk-config --use-cairo --compile test/cairo_test.cxx` work?
Yes it does.


- do `fltk-config [--use-cairo] --cxxflags` and `--ldflags` etc. work as
expected?
It does work, but cairo-related options appear also without --use-cairo :
xxxxx% ./fltk-config --cxxflags
-I. -I/opt/sw/include/cairo -I/opt/sw/include -I/opt/sw/include/freetype2 -I/opt/X11/include -I./png -I./jpeg -I/opt/sw/include/cairo -I/opt/sw/include -I/opt/sw/include/freetype2 -I/opt/X11/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT

They don't appear when ldflags are asked :
% ./fltk-config --ldflags
-L./lib -lfltk -pthread -lpthread -framework Cocoa

Albrecht Schlosser

unread,
Mar 1, 2021, 7:29:06 AM3/1/21
to fltkc...@googlegroups.com
On 3/1/21 1:12 PM Manolo wrote:
>
> On Monday, March 1, 2021 at 11:59:35 AM UTC+1 Albrecht Schlosser wrote:
> I have tested on my macOS setup with fink (rather than Homebrew).
>
> > - does it work with configure --enable-cairo ?
>
> This followed by make runs OK
>
> > - does it work with cmake -D OPTION_CAIRO=ON ?
>
> This followed by make runs OK
>
> - does `fltk-config --use-cairo --compile test/cairo_test.cxx` work?
>
> Yes it does.

Thank you very much for your quick tests and feedback!

> - do `fltk-config [--use-cairo] --cxxflags` and `--ldflags` etc.
> work as expected?
>
> It does work, but cairo-related options appear also without --use-cairo :
> xxxxx% ./fltk-config --cxxflags
> -I. -I/opt/sw/include/cairo -I/opt/sw/include
> -I/opt/sw/include/freetype2 -I/opt/X11/include -I./png -I./jpeg
> -I/opt/sw/include/cairo -I/opt/sw/include -I/opt/sw/include/freetype2
> -I/opt/X11/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -D_THREAD_SAFE -D_REENTRANT

Okay, I'll check and compare this on my system. Maybe this has always
been so.

(MacBook is just installing Big Sur 11.2.2...)

> They don't appear when ldflags are asked :
> % ./fltk-config --ldflags
> -L./lib -lfltk -pthread -lpthread -framework Cocoa
Good, thanks.

Is there a difference between fltk-config generated by configure vs CMake?

Manolo

unread,
Mar 1, 2021, 9:02:27 AM3/1/21
to fltk.coredev
On Monday, March 1, 2021 at 1:29:06 PM UTC+1 Albrecht Schlosser wrote:

Is there a difference between fltk-config generated by configure vs CMake?

Here is what I get with fltk-config generated by CMake and in <build-dir> :
 
  /Users/xxx/Desktop/buildCairo/fltk-config --use-images --compile clipboard.cxx
works OK

   /Users/xxx/Desktop/buildCairo/fltk-config --use-gl --compile OpenGL3test.cxx
works OK

 /Users/xxx/Desktop/buildCairo/fltk-config --cxxflags
-I/Users/xxx/Desktop/buildCairo -I/Users/xxx/Documents/fltk/fltk-git -I/opt/sw/include/cairo -I/opt/sw/include -I/opt/sw/include/freetype2 -I/opt/X11/include -isysroot /Applications/Xcode-12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT

/Users/xxx/Desktop/buildCairo/fltk-config --ldflags
-L/Users/xxx/Desktop/buildCairo/lib -lfltk -lm -lpthread -framework Cocoa

Reply all
Reply to author
Forward
0 new messages