]> git.cworth.org Git - apitrace/commitdiff
Merge branch 'master' into mt-trace
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 27 Oct 2012 11:31:59 +0000 (12:31 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 27 Oct 2012 11:35:22 +0000 (12:35 +0100)
1  2 
CMakeLists.txt
retrace/glretrace_egl.cpp

diff --combined CMakeLists.txt
index 0e174e65834bbf9aca860aeb1037e2d8ea2175f9,a9efe6d6ce746567d7ee95309f8f17ce5e38af3a..213325cfaa17dc81533207e9b01002ac7119db66
@@@ -1,14 -1,5 +1,14 @@@
  cmake_minimum_required (VERSION 2.8)
  
 +
 +# Use clang on MacOSX. gcc doesn't support __thread key, and Apple has
 +# abandoned it for clang.  This must be done before the project is defined.
 +if (APPLE)
 +    set (CMAKE_C_COMPILER "clang")
 +    set (CMAKE_CXX_COMPILER "clang++")
 +endif ()
 +
 +
  project (apitrace)
  
  
@@@ -34,21 -25,6 +34,21 @@@ set (ENABLE_EGL true CACHE BOOL "Enabl
  ##############################################################################
  # Find dependencies
  
 +# Ensure __thread is support
 +if (NOT MSVC)
 +    include (CheckCXXSourceCompiles)
 +    check_cxx_source_compiles("__thread int i; int main() { return 0; }" HAVE_COMPILER_TLS)
 +    if (NOT HAVE_COMPILER_TLS)
 +        if (APPLE)
 +            message (FATAL_ERROR "C++ compiler does not support __thread keyword. Please install XCode 4.5 or higher.")
 +        else (MINGW32)
 +            message (FATAL_ERROR "C++ compiler does not support __thread keyword. Please use MinGW g++ version 4.4 or higher")
 +        else ()
 +            message (FATAL_ERROR "C++ compiler does not support __thread keyword.")
 +        endif ()
 +    endif ()
 +endif ()
 +
  set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  
  set (CMAKE_USE_PYTHON_VERSION 2.7 2.6)
@@@ -69,7 -45,6 +69,6 @@@ if (ENABLE_GUI
          set (REQUIRE_GUI REQUIRED)
      endif ()
      find_package (Qt4 4.7 COMPONENTS QtCore QtGui QtWebKit ${REQUIRE_GUI})
-     find_package (QJSON ${REQUIRE_GUI})
  endif ()
  
  if (WIN32)
@@@ -216,16 -191,11 +215,11 @@@ if (WIN32
      add_subdirectory (thirdparty/less)
  endif ()
  
- # The Qt website provides binaries for Windows and MacOSX, and they are
- # automatically found by cmake without any manual intervention.  The situation
- # for QJSON is substantially different: there are no binaries for QJSON
- # available, and there is no standard installation directory that is detected
- # by cmake.
- #
- # By bundling the QJSON source, we make it much more easier to build the GUI on
- # Windows and MacOSX.  But we only use the bundled sources when ENABLE_GUI is
- # AUTO.
- if (QT4_FOUND AND NOT QJSON_FOUND AND (ENABLE_GUI STREQUAL "AUTO"))
+ # Always use bundled QJSon.
+ # - The packaged versions QJson are very old, and do not support NaN/Infinity.
+ # - To make it easier to build the GUI on Windows and MacOSX, as there are no
+ # binaries at all.
+ if (QT4_FOUND)
      add_subdirectory (thirdparty/qjson EXCLUDE_FROM_ALL)
      set (QJSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
      set (QJSON_LIBRARY_DIRS)
index 79b16217b5b51f81bca0ce0f8a799bae02d0c07d,10c950b038d4f398457162c3caa086fc17d728c9..45855643f5b55272e494be1bcef8a799e26c928f
@@@ -127,7 -127,6 +127,7 @@@ static void retrace_eglDestroySurface(t
      it = drawable_map.find(orig_surface);
  
      if (it != drawable_map.end()) {
 +        glretrace::Context *currentContext = glretrace::getCurrentContext();
          if (!currentContext || it->second != currentContext->drawable) {
              // TODO: reference count
              delete it->second;
@@@ -203,7 -202,10 +203,11 @@@ static void retrace_eglDestroyContext(t
      it = context_map.find(orig_context);
  
      if (it != context_map.end()) {
-         delete it->second;
++        glretrace::Context *currentContext = glretrace::getCurrentContext();
+         if (it->second != currentContext) {
+             // TODO: reference count
+             delete it->second;
+         }
          context_map.erase(it);
      }
  }