X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=CMakeLists.txt;h=09633c14f98a08fe2cf61f6dc2e45f4bad782b21;hb=76efdcb9194d78a63307122570f9fa9c8ab62557;hp=61a3a33790fea680d6885ed4172c0a00a867cfb8;hpb=96851e094e4e9f07cd3c95c924f86dc94dfd9dfd;p=apitrace diff --git a/CMakeLists.txt b/CMakeLists.txt index 61a3a33..09633c1 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,15 @@ set (ENABLE_EGL true CACHE BOOL "Enable EGL support.") ############################################################################## # Find dependencies +# Ensure __thread is support +if (APPLE) + include (CheckCXXSourceCompiles) + check_cxx_source_compiles("__thread int i; int main() { return 0; }" HAVE_COMPILER_TLS) + if (NOT HAVE_COMPILER_TLS) + message (FATAL_ERROR "C++ compiler does not support __thread keyword. Please install XCode 4.5 or higher.") + endif () +endif () + set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set (CMAKE_USE_PYTHON_VERSION 2.7 2.6) @@ -70,7 +88,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) @@ -117,6 +135,19 @@ else () add_definitions (-Wall) # XXX: it's safer to use ssize_t everywhere instead of disabling warning add_definitions (-Wno-sign-compare) # comparison between signed and unsigned integer expressions + + # Use GDB extensions if available + if (CMAKE_COMPILER_IS_GNUC) + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -O0") + set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb") + endif () + if (CMAKE_COMPILER_IS_GNUCXX) + 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) @@ -285,11 +316,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