X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=CMakeLists.txt;h=f019049e3f561e9f395ee23cfc481621fa443da2;hb=13ae9a9b9844db27dd33e0274984f0caf0e1e370;hp=9fe20026c6e438be1778bd8fff0bf6e64d591f57;hpb=c748fbcb434374ec13e14cc837ade7c581789e0c;p=apitrace diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fe2002..f019049 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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) @@ -301,6 +328,7 @@ add_library (common STATIC common/image_pnm.cpp common/image_png.cpp common/${os} + common/workqueue.cpp ) set_target_properties (common PROPERTIES