1# Flags to control each individual feature 2option(LLDB_BUILD_INTEL_MPX "Enable Building of Intel(R) Memory Protection Extensions" ON) 3option(LLDB_BUILD_INTEL_PT "Enable Building of Intel(R) Processor Trace Tool" OFF) 4 5# Return if all features are OFF 6if (NOT LLDB_BUILD_INTEL_MPX AND NOT LLDB_BUILD_INTEL_PT) 7 return() 8endif() 9 10LIST (APPEND FEATURE_LIBS "") 11 12# Add feature specific subdirectories based on flags 13if (LLDB_BUILD_INTEL_MPX AND CMAKE_SYSTEM_NAME MATCHES "Linux") 14 add_subdirectory(intel-mpx) 15 LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelMPX) 16 SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_MPX") 17endif() 18 19if (LLDB_BUILD_INTEL_PT) 20 add_subdirectory(intel-pt) 21 LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelPT) 22 SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_PT") 23endif() 24 25# Add python wrapper if python not disabled 26if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT) 27 list(APPEND FEATURE_LIBS ${FEATURE_LIBS} ${Python3_LIBRARIES}) 28 set(LLDB_INTEL_FEATURES_PYTHON_WRAP 29 ${LLDB_BINARY_DIR}/tools/intel-features/scripts/IntelFeaturesPythonWrap.cpp) 30 set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP} 31 PROPERTIES GENERATED 1) 32 33 if (CLANG_CL) 34 set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP} 35 PROPERTIES COMPILE_FLAGS -Wno-unused-function) 36 endif() 37 38 if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND 39 NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") 40 set_property(SOURCE ${LLDB_INTEL_FEATURES_PYTHON_WRAP} 41 APPEND_STRING PROPERTY COMPILE_FLAGS 42 " -Wno-sequence-point -Wno-cast-qual") 43 endif () 44 add_subdirectory(scripts) 45endif() 46 47if (NOT CLI_WRAPPER_PREPROCESSORS) 48 return() 49endif() 50 51set_source_files_properties(cli-wrapper.cpp PROPERTIES 52 COMPILE_FLAGS ${CLI_WRAPPER_PREPROCESSORS}) 53 54add_lldb_library(lldbIntelFeatures SHARED 55 cli-wrapper.cpp 56 ${LLDB_INTEL_FEATURES_PYTHON_WRAP} 57 58 LINK_LIBS 59 ${FEATURE_LIBS} 60 ) 61 62# Add link dependencies for python wrapper 63if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT) 64 add_dependencies(lldbIntelFeatures intel-features-swig_wrapper) 65endif() 66 67install(TARGETS lldbIntelFeatures 68 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 69