X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=CMakeLists.txt;h=81e5cdcd8f8ada8c8145aa0a18ab48539ba86f54;hb=3c772b3743c54cd950545e74f5f334b67e65696f;hp=91643c2f107fe98952f930ac6777f41f57cfdeee;hpb=7cd8920eec2d51109b2b094e1d5b18eb3840364e;p=apitrace diff --git a/CMakeLists.txt b/CMakeLists.txt index 91643c2..81e5cdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,9 @@ if (MSVC) # C99 includes for MSVC include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/msinttypes) + # No RTTI required + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-") + # Enable math constants defines add_definitions (-D_USE_MATH_DEFINES) @@ -144,6 +147,9 @@ else () # 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 + # No RTTI required + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + # Use GDB extensions if available if (CMAKE_COMPILER_IS_GNUC) set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -O0") @@ -174,6 +180,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 @@ -254,6 +265,13 @@ if (WIN32) 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 dl backtrace) + add_definitions (-DHAVE_BACKTRACE=1) +endif () + # 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 @@ -298,6 +316,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 @@ -313,6 +332,7 @@ add_library (common STATIC common/trace_profiler.cpp common/trace_option.cpp common/${os} + common/os_backtrace.cpp ) set_target_properties (common PROPERTIES @@ -320,6 +340,9 @@ set_target_properties (common PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}" ) +target_link_libraries (common + ${LIBBACKTRACE_LIBRARIES} +) if (ANDROID) target_link_libraries (common log