Require explicit opt-in for interceptor-lib use, in case of local llvm

* CMake can find the local LLVM even without specifying LLVM_DIR, but
  we don't want to build it for interceptor-lib unless it's exactly the
  one we want, so we ask for explicit opt-in.
This commit is contained in:
baldurk
2018-02-01 17:05:58 +00:00
parent 26c6456c8e
commit f5aa915f3f
2 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ See [LICENSE](LICENSE) file in this directory.
# LLVM Build instructions
To use this in RenderDoc you must set `-DLLVM_DIR=/path/to/llvm` pointing to a compatible build of LLVM 4.0 for the target you are building. Below are instructions on how to build that compatible LLVM.
To use this in RenderDoc you must set `-DUSE_INTERCEPTOR_LIB=On -DLLVM_DIR=/path/to/llvm` pointing to a compatible build of LLVM 4.0 for the target you are building. Below are instructions on how to build that compatible LLVM.
You'll need the Android NDK r16b, and you'll need python available in your path.
@@ -70,4 +70,4 @@ cp ./lib/Target/ARM/ARM*.inc $TARGET_PATH/include/MCTargetDesc/
cp ./lib/Target/AArch64/AArch64*.inc $TARGET_PATH/include/MCTargetDesc/
```
Then you can set `-DLLVM_DIR=/path/to/llvm/install_armXX/lib/cmake/llvm` when building renderdoc and you should see a line saying that LLVM is being used to compile interceptor-lib!
Then you can set `-DUSE_INTERCEPTOR_LIB=On -DLLVM_DIR=/path/to/llvm/install_armXX/lib/cmake/llvm` when building renderdoc and you should see a line saying that LLVM is being used to compile interceptor-lib!
+10 -9
View File
@@ -355,17 +355,18 @@ if(ENABLE_GL OR ENABLE_GLES OR ENABLE_VULKAN)
list(APPEND renderdoc_objects $<TARGET_OBJECTS:rdoc_spirv>)
endif()
find_package(LLVM CONFIG)
set(HAVE_INTERCEPTOR_LIB OFF)
option(USE_INTERCEPTOR_LIB OFF)
# on Android, pull in interceptor-lib only if we have LLVM available
if(ANDROID AND LLVM_FOUND)
if(${LLVM_PACKAGE_VERSION} VERSION_LESS "4.0.0" OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER "4.0.1")
message(STATUS "LLVM ${LLVM_PACKAGE_VERSION} found - we require precisely 4.0.")
if(ANDROID AND USE_INTERCEPTOR_LIB )
find_package(LLVM CONFIG)
if(NOT LLVM_FOUND)
message(FATAL_ERROR "LLVM not found - interceptor-lib requires LLVM 4.0 available.")
elseif(${LLVM_PACKAGE_VERSION} VERSION_LESS "4.0.0" OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER "4.0.1")
message(FATAL_ERROR "LLVM ${LLVM_PACKAGE_VERSION} found - we require precisely 4.0.")
else()
message(STATUS "LLVM ${LLVM_PACKAGE_VERSION} found - enabling android hooking using interceptor-lib.")
set(HAVE_INTERCEPTOR_LIB ON)
add_subdirectory(3rdparty/interceptor-lib)
list(APPEND renderdoc_objects $<TARGET_OBJECTS:interceptor_lib>)
link_directories(${LLVM_DIR}/../..)
@@ -377,8 +378,8 @@ if(ANDROID AND LLVM_FOUND)
endif()
endif()
if(ANDROID AND NOT HAVE_INTERCEPTOR_LIB)
message(STATUS "LLVM not found - android hooking will use sometimes less reliable PLT-interception method.")
if(ANDROID AND NOT USE_INTERCEPTOR_LIB)
message(STATUS "Interceptor-lib not enabled (USE_INTERCEPTOR_LIB) - android hooking will use sometimes less reliable PLT-interception method. ")
endif()
# always pull in the amd folder