Warning, /sdk/heaptrack/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 if (CMAKE_VERSION VERSION_LESS "2.8.12") 0002 cmake_minimum_required(VERSION 2.8.9) 0003 set(HEAPTRACK_BUILD_GUI OFF) 0004 elseif (CMAKE_VERSION VERSION_LESS "3.16.0") 0005 cmake_minimum_required(VERSION 2.8.12) 0006 else() 0007 cmake_minimum_required(VERSION 3.16.0) 0008 endif() 0009 0010 project(heaptrack) 0011 enable_testing() 0012 0013 if(NOT CMAKE_BUILD_TYPE) 0014 message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") 0015 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 0016 endif() 0017 0018 set(HEAPTRACK_VERSION_MAJOR 1) 0019 set(HEAPTRACK_VERSION_MINOR 5) 0020 set(HEAPTRACK_VERSION_PATCH 80) 0021 set(HEAPTRACK_LIB_VERSION 1.5.80) 0022 set(HEAPTRACK_LIB_SOVERSION 2) 0023 set(HEAPTRACK_FILE_FORMAT_VERSION 3) 0024 0025 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 0026 0027 option(APPIMAGE_BUILD "configure build for bundling in an appimage" OFF) 0028 0029 set(REQUIRED_IN_APPIMAGE "") 0030 if (APPIMAGE_BUILD) 0031 set(REQUIRED_IN_APPIMAGE REQUIRED) 0032 endif() 0033 0034 include(FeatureSummary) 0035 find_package(Boost 1.60.0 ${REQUIRED_IN_APPIMAGE} COMPONENTS system filesystem iostreams container) 0036 set_package_properties(Boost PROPERTIES TYPE RECOMMENDED PURPOSE "Boost container libraries can greatly improve performance (via pmr allocators)") 0037 find_package(Threads REQUIRED) 0038 find_package(ZLIB REQUIRED) 0039 0040 if (${Boost_IOSTREAMS_FOUND}) 0041 find_package(ZSTD ${REQUIRED_IN_APPIMAGE}) 0042 0043 include(CheckCXXSourceCompiles) 0044 include(CMakePushCheckState) 0045 cmake_push_check_state() 0046 set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS}) 0047 set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES}) 0048 check_cxx_source_compiles("#include <boost/iostreams/filter/zstd.hpp> 0049 int main() { boost::iostreams::zstd_decompressor(); return 0; }" 0050 BOOST_IOSTREAMS_HAS_ZSTD 0051 ) 0052 cmake_pop_check_state() 0053 endif() 0054 set_package_properties(ZSTD PROPERTIES TYPE RECOMMENDED PURPOSE "Zstandard offers better (de)compression performance compared with gzip/zlib, making heaptrack faster and datafiles smaller.") 0055 0056 if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") 0057 set(HEAPTRACK_BUILD_TRACK_DEFAULT ON) 0058 set(HEAPTRACK_BUILD_INTERPRET_DEFAULT ON) 0059 else() 0060 set(HEAPTRACK_BUILD_TRACK_DEFAULT OFF) 0061 set(HEAPTRACK_BUILD_INTERPRET_DEFAULT OFF) 0062 endif() 0063 0064 option( 0065 HEAPTRACK_BUILD_TRACK 0066 "Disable this option to skip building the tracker part for heaptrack, e.g. to only build the GUI." 0067 ${HEAPTRACK_BUILD_TRACK_DEFAULT} 0068 ) 0069 0070 option( 0071 HEAPTRACK_BUILD_INTERPRET 0072 "Disable this option to skip building the interpret part for heaptrack." 0073 ${HEAPTRACK_BUILD_INTERPRET_DEFAULT} 0074 ) 0075 0076 if (CMAKE_CROSSCOMPILING) 0077 set(HEAPTRACK_BUILD_ANALYZE_DEFAULT OFF) 0078 else() 0079 set(HEAPTRACK_BUILD_ANALYZE_DEFAULT ON) 0080 endif() 0081 0082 option( 0083 HEAPTRACK_BUILD_PRINT 0084 "Disable this option to skip building heaptrack_print, e.g. when you're cross-compiling." 0085 ${HEAPTRACK_BUILD_ANALYZE_DEFAULT} 0086 ) 0087 0088 option( 0089 HEAPTRACK_BUILD_GUI 0090 "Disable this option to skip building the Qt / KDE Frameworks based GUI for heaptrack." 0091 ${HEAPTRACK_BUILD_ANALYZE_DEFAULT} 0092 ) 0093 0094 option( 0095 HEAPTRACK_USE_QT6 0096 "Use Qt6/KF6 when building the Qt / KDE Frameworks based GUI for heaptrack." 0097 OFF 0098 ) 0099 if(HEAPTRACK_USE_QT6) 0100 set(QT_VERSION_MAJOR 6) 0101 # possibly works with older Qt6, but I didn't test that yet 0102 set(QT_MIN_VERSION 6.5.0) 0103 else() 0104 set(QT_VERSION_MAJOR 5) 0105 set(QT_MIN_VERSION 5.10.0) 0106 endif() 0107 0108 option( 0109 HEAPTRACK_USE_LIBUNWIND 0110 "Define preferred unwind functionality - Libunwind as ON and unwind_tables as OFF." 0111 ON 0112 ) 0113 0114 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 0115 0116 if (NOT MSVC) 0117 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") 0118 endif() 0119 0120 set(CMAKE_CXX_STANDARD 14) 0121 set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 0122 0123 include (CheckCXXSourceCompiles) 0124 0125 # cfree() does not exist in glibc 2.26+. 0126 # See: https://bugs.kde.org/show_bug.cgi?id=383889 0127 include(CheckSymbolExists) 0128 check_symbol_exists(cfree malloc.h HAVE_CFREE) 0129 check_symbol_exists(valloc stdlib.h HAVE_VALLOC) 0130 0131 set(BIN_INSTALL_DIR "bin") 0132 set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)") 0133 set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}") 0134 set(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/heaptrack/libexec") 0135 0136 file(RELATIVE_PATH LIBEXEC_REL_PATH 0137 "${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}" 0138 "${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_DIR}") 0139 0140 file(RELATIVE_PATH LIB_REL_PATH 0141 "${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}" 0142 "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/heaptrack") 0143 0144 set(ECM_ENABLE_SANITIZERS "" CACHE STRING "semicolon-separated list of sanitizers to enable for code that is not injected into client applications") 0145 0146 if (ECM_ENABLE_SANITIZERS) 0147 find_package(ECM 1.0.0 NO_MODULE) 0148 if (ECM_FOUND) 0149 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) 0150 endif() 0151 endif() 0152 0153 if (HEAPTRACK_BUILD_TRACK) 0154 if (HEAPTRACK_USE_LIBUNWIND) 0155 find_package(Libunwind REQUIRED) 0156 endif() 0157 0158 check_cxx_source_compiles( 0159 "#ifdef __linux__ 0160 #include <stdio_ext.h> 0161 #endif 0162 #include <fcntl.h> 0163 #include <dlfcn.h> 0164 #include <link.h> 0165 int main() { return 0; }" 0166 HAVE_LINUX_HEADERS) 0167 0168 if (NOT HAVE_LINUX_HEADERS) 0169 message(FATAL_ERROR "You are missing some Linux/BSD headers required to compile heaptrack.") 0170 endif() 0171 endif() 0172 0173 add_subdirectory(3rdparty) 0174 add_subdirectory(src) 0175 add_subdirectory(tests) 0176 0177 # Let releaseme know about this: 0178 # SKIP_PO_INSTALL 0179 # (KF5I18n is optional in src/analyze/CMakeLists.txt...) 0180 0181 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)