]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Merge remote-tracking branch 'github/master' into mt-trace
[apitrace] / CMakeLists.txt
index 2edc51b84ae9069f8138ea3f02cc67b7ad7cd0cc..f019049e3f561e9f395ee23cfc481621fa443da2 100644 (file)
@@ -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)
 
 
@@ -25,6 +34,21 @@ set (ENABLE_EGL true CACHE BOOL "Enable EGL support.")
 ##############################################################################
 # 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)
@@ -70,7 +94,7 @@ include (CheckCXXCompilerFlag)
 
 if (WIN32)
     # http://msdn.microsoft.com/en-us/library/aa383745.aspx
-    add_definitions (-D_WIN32_WINNT=0x0501 -DWINVER=0x0501)
+    add_definitions (-D_WIN32_WINNT=0x0601 -DWINVER=0x0601)
 else (WIN32)
     CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" CXX_COMPILER_FLAG_VISIBILITY)
     if (CXX_COMPILER_FLAG_VISIBILITY)
@@ -127,6 +151,9 @@ else ()
         set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0")
         set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ggdb")
     endif ()
+
+    # Be nice to Eclipse
+    add_definitions (-fmessage-length=0)
 endif ()
 
 if (MINGW)
@@ -295,11 +322,13 @@ add_library (common STATIC
     common/trace_loader.cpp
     common/trace_resource.cpp
     common/trace_tools_trace.cpp
+    common/trace_profiler.cpp
     common/image.cpp
     common/image_bmp.cpp
     common/image_pnm.cpp
     common/image_png.cpp
     common/${os}
+    common/workqueue.cpp
 )
 
 set_target_properties (common PROPERTIES