X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=CMakeLists.txt;h=d819be2908b5d3b352933c89a203192039bee666;hb=1c2cacdef64e4939f8edc223fd13be56fd9e82c9;hp=3ee670d08ba856916968bce4418f4716ec253b94;hpb=330135d22f875bc85f8441e501f97d8f4c55e498;p=apitrace diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee670d..d819be2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ 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) +# But DONT force clang if we are cross-compiling to Android. +if (APPLE AND NOT ANDROID_NDK) set (CMAKE_C_COMPILER "clang") set (CMAKE_CXX_COMPILER "clang++") endif () @@ -34,18 +35,16 @@ set (ENABLE_EGL true CACHE BOOL "Enable EGL support.") ############################################################################## # Find dependencies -# Ensure __thread is support -if (NOT MSVC) +# Check for compiler TLS support. We don't use compiler TLS support on Windows +# because, even if the compiler supports it, Windows XP does not support TLS on +# DLLs. +if (NOT WIN32) 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 () + if (HAVE_COMPILER_TLS) + add_definitions (-DHAVE_COMPILER_TLS=__thread) + else () + message (WARNING "C++ compiler does not support __thread keyword.") endif () endif () @@ -175,6 +174,11 @@ if (MINGW) endif () endif () +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + # For RTLD_DEFAULT and RTLD_NEXT + add_definitions (-D_GNU_SOURCE) +endif () + # Put all executables into the same top level build directory, regardless of # which subdirectory they are declared @@ -191,6 +195,11 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) + CHECK_INCLUDE_FILES(proc/readproc.h READPROC_H_FOUND) + if (READPROC_H_FOUND) + add_definitions (-DHAVE_READPROC_H) + find_library (proc_LIBRARY NAMES proc procps) + endif () endif() if (WIN32 OR APPLE) @@ -247,6 +256,13 @@ endif () if (WIN32) add_subdirectory (thirdparty/less) + add_subdirectory (thirdparty/directxtex) +endif () + +if (CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") + add_subdirectory (thirdparty/libbacktrace) + include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libbacktrace) + set (LIBBACKTRACE_LIBRARIES backtrace) endif () # Always use bundled QJSon. @@ -293,6 +309,7 @@ endif () add_library (common STATIC common/trace_callset.cpp common/trace_dump.cpp + common/trace_fast_callset.cpp common/trace_file.cpp common/trace_file_read.cpp common/trace_file_write.cpp @@ -308,10 +325,10 @@ add_library (common STATIC common/trace_profiler.cpp common/trace_option.cpp common/${os} + common/trace_backtrace.cpp ) set_target_properties (common PROPERTIES - COMPILE_DEFINITIONS APITRACE_SOURCE_DIR="${CMAKE_SOURCE_DIR}" # Ensure it can be statically linked in shared libraries COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}" ) @@ -352,13 +369,18 @@ install ( scripts/jsondiff.py scripts/profileshader.py scripts/retracediff.py - scripts/samples.py scripts/snapdiff.py scripts/tracecheck.py scripts/tracediff.py scripts/unpickle.py DESTINATION ${SCRIPTS_INSTALL_DIR} ) +if (WIN32) + install ( + PROGRAMS scripts/convert.py + DESTINATION ${SCRIPTS_INSTALL_DIR} + ) +endif () ############################################################################## # GUI @@ -391,7 +413,7 @@ if (MSVC) ) endif () -set (CPACK_PACKAGE_VERSION_MAJOR "3") +set (CPACK_PACKAGE_VERSION_MAJOR "4") set (CPACK_PACKAGE_VERSION_MINOR "0") # Use current date in YYYYMMDD format as patch number