Re: Finding cairo_gl libraries with cmake
Carlos López González <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAF52pzK016Nm4KwK92cSQXrJt4m9P99QVNPYxgG5LO_gTBQ1ZA@mail.gmail.com> |
Hi! finally I modified the CMakeLists.txt to find_library and find_path for the installed cairo with gl enabled and it builds without trouble. Now I'm confused with the results of the program when rendering: https://www.dropbox.com/s/mdl9qi4xhjyxe7n/cairo-sample-osx.mov As you can see when running the cairo-sample application the execution goes fine until I resize the window. Then the content of the window reflects garbage and then it doesn't come back to a normal render anymore. Notice that right click clears all the points and start over normally. Any idea on why is it getting worse on each drawing? As far as I know I'm repainting the surface completely with the green background so why the two coordinates gets overwritten? Also, where is the garbage come from when resize the window? Source code can be found here: https://github.com/genete/my-test-area/blob/master/src/cairo_sample.c Thanks! 2012/12/26 Carlos López González <[email protected]> > Hi! > I'm working on create a small application sample to use a cairo_gl surface > on a GtkWindow. > For my system configuration (OSX 10.7.5 with XCode 4.5.2) I'm using cmake. > > First I did this: > 1) Download latest release and build it with gl enabled > $ wget http://cairographics.org/releases/cairo-1.12.8.tar.xz > $ tar -xvf cairo-1.12.8.tar.xz > $ cd cairo-1.12.8 > $ ./configure --prefix=/Users/carlos/Software/cairo/ --enable-gl=yes > $ make > $ make install > > At configure time I checked that Opengl was enabled: > > OpenGL: yes > > I checked that the installed cairo libraries has cairo-gl.h header. > > Then I created a CMakeLists.txt for the project (it consists in a single c > file) > with the following content: > > project(cairo-sample) > > cmake_minimum_required(VERSION 2.6) > > > find_package(PkgConfig REQUIRED) > > pkg_check_modules(GTK2 REQUIRED gtk+-2.0) > > > include_directories(${GTK2_INCLUDE_DIRS}) > > link_directories(${GTK2_LIBRARY_DIRS}) > > add_definitions(${GTK2_CFLAGS_OTHER}) > > > # Here I add the cairo paths and libraries manually > > set(CAIRO_INCLUDE_DIRS "/Users/carlos/Software/cairo/include/cairo") > > set(CAIRO_LIBRARY_DIRS "/Users/carlos/Software/cairo/lib") > > set(CAIRO_LIBRARIES cairo gl) > > > # Need to add the path BEFORE because it will override the default from GTK > > include_directories(BEFORE ${CAIRO_INCLUDE_DIRS}) > > link_directories(${CAIRO_LIBRARY_DIRS}) > > > add_executable(cairo-sample cairo_sample.c) > > target_link_libraries(cairo-sample ${CAIRO_LIBRARIES} ${GTK2_LIBRARIES}) > > > Then I run cmake-gui and configure to produce a XCode project with default > settings. > Then I open the produced project in XCode and it complains at link time: > > Ld > /Users/carlos/Software/my-test-area/my-test-area/build/Debug/cairo-sample > normal x86_64 > > cd /Users/carlos/Software/my-test-area/my-test-area/src > > setenv MACOSX_DEPLOYMENT_TARGET 10.7 > > > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang > -arch x86_64 -isysroot > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk > -L/Users/carlos/Software/my-test-area/my-test-area/build/Debug > -L/opt/local/lib/Debug -L/opt/local/lib > -L/Users/carlos/Software/cairo/lib/Debug -L/Users/carlos/Software/cairo/lib > -F/Users/carlos/Software/my-test-area/my-test-area/build/Debug -filelist > /Users/carlos/Software/my-test-area/my-test-area/build/cairo-sample.build/Debug/cairo-sample.build/Objects-normal/x86_64/cairo-sample.LinkFileList > -mmacosx-version-min=10.7 -Wl,-search_paths_first > -Wl,-headerpad_max_install_names -lcairo -lgl -lgtk-x11-2.0 -lgdk-x11-2.0 > -latk-1.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr > -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 > -lXfixes -lcairo -lX11 -lpango-1.0 -lm -lfreetype -lfontconfig > -lgobject-2.0 -lglib-2.0 -lintl -lgl -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 > -lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor > -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes > -lX11 -lpango-1.0 -lm -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 > -lintl -o > /Users/carlos/Software/my-test-area/my-test-area/build/Debug/cairo-sample > > > ld: warning: directory not found for option '-L/opt/local/lib/Debug' > > ld: warning: directory not found for option > '-L/Users/carlos/Software/cairo/lib/Debug' > > Undefined symbols for architecture x86_64: > > "_cairo_gl_context_destroy", referenced from: > > _on_expose_event in cairo_sample.o > > "_cairo_gl_surface_create_for_window", referenced from: > > _on_expose_event in cairo_sample.o > > "_cairo_gl_surface_swapbuffers", referenced from: > > _on_expose_event in cairo_sample.o > > "_cairo_glx_device_create", referenced from: > > _cairo_sample_gl_context_create in cairo_sample.o > > ld: symbol(s) not found for architecture x86_64 > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > > I've tried to specify cairo-gl for CAIRO_LIBRARIES variable but it > complains telling me this: > > ld: library not found for -lcairo-gl > > > All code can be found here: > https://github.com/genete/my-test-area.git > > I would appreciate any help to allow XCode to find the installed cairo-gl > libraries. > Thanks! > -- > Carlos > http://synfig.org > -- Carlos http://synfig.org -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo