<div dir="ltr">Hi!<div style>finally I modified the CMakeLists.txt to find_library and find_path for the installed cairo with gl enabled and it builds without trouble.</div><div style>Now I'm confused with the results of the program when rendering:</div>
<div style><br></div><div style><a href="https://www.dropbox.com/s/mdl9qi4xhjyxe7n/cairo-sample-osx.mov">https://www.dropbox.com/s/mdl9qi4xhjyxe7n/cairo-sample-osx.mov</a><br></div><div style><br></div><div style>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.<br>
</div><div style>Notice that right click clears all the points and start over normally. </div><div style><br></div><div style>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?</div>
<div style>Source code can be found here:</div><div style><a href="https://github.com/genete/my-test-area/blob/master/src/cairo_sample.c">https://github.com/genete/my-test-area/blob/master/src/cairo_sample.c</a><br></div>
<div style>Thanks!</div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/26 Carlos López González <span dir="ltr"><<a href="mailto:genetita@gmail.com" target="_blank">genetita@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi!<div>I'm working on create a small application sample to use a cairo_gl surface on a GtkWindow.</div>
<div>For my system configuration (OSX 10.7.5 with XCode 4.5.2) I'm using cmake.</div><div><br></div>
<div><div>First I did this:</div><div>1) Download latest release and build it with gl enabled</div><div>$ wget <a href="http://cairographics.org/releases/cairo-1.12.8.tar.xz" target="_blank">http://cairographics.org/releases/cairo-1.12.8.tar.xz</a></div>

<div>$ tar -xvf cairo-1.12.8.tar.xz</div><div>$ cd cairo-1.12.8</div><div>$ ./configure --prefix=/Users/carlos/Software/cairo/ --enable-gl=yes</div><div>$ make</div><div>$ make install</div><div>
<br></div><div>At configure time I checked that Opengl was enabled:</div><div><br></div><div>OpenGL:        yes</div><div><br></div><div>I checked that the installed cairo libraries has cairo-gl.h header.</div>
<div><br></div><div>Then I created a CMakeLists.txt for the project (it consists in a single c file)</div><div>with the following content:</div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">
project(cairo-sample)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cmake_minimum_required(VERSION 2.6)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">find_package(PkgConfig REQUIRED)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">pkg_check_modules(GTK2 REQUIRED gtk+-2.0)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">include_directories(${GTK2_INCLUDE_DIRS})</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">link_directories(${GTK2_LIBRARY_DIRS})</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">add_definitions(${GTK2_CFLAGS_OTHER})</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"># Here I add the cairo paths and libraries manually</p><p style="margin:0px;font-size:11px;font-family:Menlo">set(CAIRO_INCLUDE_DIRS "/Users/carlos/Software/cairo/include/cairo")</p>


<p style="margin:0px;font-size:11px;font-family:Menlo">set(CAIRO_LIBRARY_DIRS "/Users/carlos/Software/cairo/lib")</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">set(CAIRO_LIBRARIES cairo gl)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"># Need to add the path BEFORE because it will override the default from GTK</p>


<p style="margin:0px;font-size:11px;font-family:Menlo">include_directories(BEFORE ${CAIRO_INCLUDE_DIRS})</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">link_directories(${CAIRO_LIBRARY_DIRS})</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">add_executable(cairo-sample cairo_sample.c)<br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">target_link_libraries(cairo-sample ${CAIRO_LIBRARIES} ${GTK2_LIBRARIES})</p><div><br></div></div><div><br></div><div>Then I run cmake-gui and configure to produce a XCode project with default settings.</div>

<div>Then I open the produced project in XCode and it complains at link time:</div><div><br></div><div><p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">Ld /Users/carlos/Software/my-test-area/my-test-area/build/Debug/cairo-sample normal x86_64</p>


<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">    cd /Users/carlos/Software/my-test-area/my-test-area/src</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">    setenv MACOSX_DEPLOYMENT_TARGET 10.7</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">    /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</p>


<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">ld: warning: directory not found for option '-L/opt/local/lib/Debug'</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">ld: warning: directory not found for option '-L/Users/carlos/Software/cairo/lib/Debug'</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">Undefined symbols for architecture x86_64:</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">  "_cairo_gl_context_destroy", referenced from:</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">      _on_expose_event in cairo_sample.o</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">  "_cairo_gl_surface_create_for_window", referenced from:</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">      _on_expose_event in cairo_sample.o</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">  "_cairo_gl_surface_swapbuffers", referenced from:</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">      _on_expose_event in cairo_sample.o</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">  "_cairo_glx_device_create", referenced from:</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">      _cairo_sample_gl_context_create in cairo_sample.o</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">ld: symbol(s) not found for architecture x86_64</p>
<p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">clang: error: linker command failed with exit code 1 (use -v to see invocation)</p><div><br></div></div><div><br></div><div>I've tried to specify cairo-gl for CAIRO_LIBRARIES variable but it complains telling me this:</div>

<div><br></div><div><p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo">ld: library not found for -lcairo-gl</p><p style="margin:0px 0px 0px 12px;font-size:11px;font-family:Menlo"><br></p></div>
<div>All code can be found here:</div><div><a href="https://github.com/genete/my-test-area.git" target="_blank">https://github.com/genete/my-test-area.git</a><br></div><div><br></div><div>I would appreciate any help to allow XCode to find the installed cairo-gl libraries.</div>

<div>Thanks!</div><span class="HOEnZb"><font color="#888888">-- <br>Carlos<br><a href="http://synfig.org" target="_blank">http://synfig.org</a><br>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Carlos<br><a href="http://synfig.org" target="_blank">http://synfig.org</a><br>
</div>