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)
##############################################################################
# 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)
set (REQUIRE_GUI REQUIRED)
endif ()
find_package (Qt4 4.7 COMPONENTS QtCore QtGui QtWebKit ${REQUIRE_GUI})
- find_package (QJSON ${REQUIRE_GUI})
endif ()
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)
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;
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);
}
}