]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Always use bundled zlib and libpng sources.
[apitrace] / CMakeLists.txt
index 7da18a7ab5dfbb71a94b8b03d681aa10040b479c..f388991973368cc101f53fafb78da64bbecd333a 100755 (executable)
@@ -15,13 +15,6 @@ find_package (OpenGL REQUIRED)
 find_package (Qt4 4.7 COMPONENTS QtCore QtGui QtWebKit)
 find_package (QJSON)
 
-if (NOT WIN32)
-    # Always use the bundled zlib and libpng sources on Windows to make it easy
-    # to deploy the wrappers DLLs
-    find_package (ZLIB)
-    find_package (PNG)
-endif (NOT WIN32)
-
 if (NOT WIN32)
     find_package (X11 REQUIRED)
 
@@ -119,25 +112,24 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
 
 ##############################################################################
 # Bundled dependencies
+#
+# We always use the bundled zlib and libpng sources:
+# - on Windows to make it easy to deploy the wrappers DLLs
+# - on unices to prevent symbol collisions when tracing applications that link
+# against other versions of these libraries
 
-# Use bundled ZLIB if system one can't be found
-if (NOT ZLIB_FOUND)
-    set (ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
-    set (ZLIB_LIBRARIES zlib)
-    add_subdirectory (zlib EXCLUDE_FROM_ALL)
-endif (NOT ZLIB_FOUND)
+set (ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
+set (ZLIB_LIBRARIES z_bundled)
+add_subdirectory (zlib EXCLUDE_FROM_ALL)
 
 include_directories (${ZLIB_INCLUDE_DIRS})
 link_libraries (${ZLIB_LIBRARIES})
 
-# Use bundled LIBPNG if system one can't be found
-if (PNG_FOUND)
-else (PNG_FOUND)
-    set (PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libpng)
-    set (PNG_DEFINITIONS "")
-    set (PNG_LIBRARIES png)
-    add_subdirectory (libpng EXCLUDE_FROM_ALL)
-endif (PNG_FOUND)
+set (PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libpng)
+set (PNG_DEFINITIONS "")
+set (PNG_LIBRARIES png_bundled)
+
+add_subdirectory (libpng EXCLUDE_FROM_ALL)
 include_directories (${PNG_INCLUDE_DIR})
 add_definitions (${PNG_DEFINITIONS})
 link_libraries (${PNG_LIBRARIES})
@@ -283,7 +275,14 @@ else ()
         DEPENDS glxtrace.py gltrace.py trace.py glxapi.py glapi.py glparams.py gltypes.py stdapi.py
     )
 
-    add_library (glxtrace SHARED glxtrace.cpp trace_writer.cpp os_posix.cpp ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
+    add_library (glxtrace SHARED
+        ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
+        glxtrace.cpp
+        glsnapshot.cpp
+        trace_writer.cpp
+        image.cpp
+        os_posix.cpp
+    )
 
     set_target_properties (glxtrace PROPERTIES
         # avoid the default "lib" prefix
@@ -296,7 +295,7 @@ else ()
         LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
     )
 
-    target_link_libraries (glxtrace dl)
+    target_link_libraries (glxtrace dl ${X11_X11_LIB})
     
     install (TARGETS glxtrace LIBRARY DESTINATION lib)
 endif ()