diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | llvm/cmake/config-ix.cmake | 16 | ||||
| -rw-r--r-- | llvm/docs/CMake.rst | 5 | ||||
| -rw-r--r-- | llvm/tools/llvm-exegesis/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | llvm/unittests/tools/llvm-exegesis/CMakeLists.txt | 3 |
5 files changed, 18 insertions, 11 deletions
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 087a563a4b9..48915c7401b 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -366,6 +366,8 @@ set(LLVM_ENABLE_LIBXML2 "ON" CACHE STRING "Use libxml2 if available. Can be ON, option(LLVM_ENABLE_LIBEDIT "Use libedit if available." ON) +option(LLVM_ENABLE_LIBPFM "Use libpfm for performance counters if available." ON) + option(LLVM_ENABLE_THREADS "Use threads if available." ON) option(LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index ff71ad32021..d717d5f61b8 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -90,13 +90,15 @@ if( NOT PURE_WINDOWS ) endif() # Check for libpfm. -check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE) -if(HAVE_LIBPFM_INITIALIZE) - check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H) - check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H) - check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H) - if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H) - set(HAVE_LIBPFM 1) +if (LLVM_ENABLE_LIBPFM) + check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE) + if(HAVE_LIBPFM_INITIALIZE) + check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H) + check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H) + check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H) + if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H) + set(HAVE_LIBPFM 1) + endif() endif() endif() diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst index b3fa4b4149e..e4da0a6714d 100644 --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -374,6 +374,11 @@ LLVM-specific variables **LLVM_USE_INTEL_JITEVENTS**:BOOL Enable building support for Intel JIT Events API. Defaults to OFF. +**LLVM_ENABLE_LIBPFM**:BOOL + Enable building with libpfm to support hardware counter measurements in LLVM + tools. + Defaults to ON. + **LLVM_ENABLE_ZLIB**:BOOL Enable building with zlib to support compression/uncompression in LLVM tools. Defaults to ON. diff --git a/llvm/tools/llvm-exegesis/CMakeLists.txt b/llvm/tools/llvm-exegesis/CMakeLists.txt index 9d6b0c35498..def182b4104 100644 --- a/llvm/tools/llvm-exegesis/CMakeLists.txt +++ b/llvm/tools/llvm-exegesis/CMakeLists.txt @@ -10,7 +10,6 @@ add_llvm_tool(llvm-exegesis add_subdirectory(lib) target_link_libraries(llvm-exegesis PRIVATE LLVMExegesis) -if(HAVE_LIBPFM) +if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM) target_link_libraries(llvm-exegesis PRIVATE pfm) endif() - diff --git a/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt b/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt index bc376e07b90..a6b1d878203 100644 --- a/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt +++ b/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt @@ -22,7 +22,6 @@ add_llvm_unittest(LLVMExegesisTests ) target_link_libraries(LLVMExegesisTests PRIVATE LLVMExegesis) -if(HAVE_LIBPFM) +if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM) target_link_libraries(LLVMExegesisTests PRIVATE pfm) endif() - |

