diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eee549f22..f418cf1060 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -436,19 +436,6 @@ if (OPENGL_GL) include_directories(${OPENGL_INCLUDE_DIR}) endif() -if(ENABLE_LLVM) - find_package(LLVM) - if (LLVM_FOUND) - add_definitions(-DHAS_LLVM=1) - set(HAS_LLVM 1) - - include_directories(${LLVM_INCLUDE_DIRS}) - list(APPEND LIBS ${LLVM_LIBRARIES}) - - message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") - endif() -endif() - set(USE_X11 0) if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT ENABLE_HEADLESS) diff --git a/CMakeTests/FindLLVM.cmake b/CMakeTests/FindLLVM.cmake deleted file mode 100644 index 006ca9e899..0000000000 --- a/CMakeTests/FindLLVM.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# This file only exists because LLVM's cmake files are broken. -# This affects both LLVM 3.4 and 3.5. -# Hopefully when they fix their cmake system we don't need this garbage. - -include(CheckLibraryExists) - -list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config") -list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config-3.5") -list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config-3.4") - -foreach(LLVM_CONFIG_NAME ${LLVM_CONFIG_EXECUTABLES}) - find_program(LLVM_CONFIG_EXE NAMES ${LLVM_CONFIG_NAME}) - if (LLVM_CONFIG_EXE) - execute_process(COMMAND ${LLVM_CONFIG_EXE} --version OUTPUT_VARIABLE LLVM_PACKAGE_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if (LLVM_PACKAGE_VERSION VERSION_GREATER "3.3") - execute_process(COMMAND ${LLVM_CONFIG_EXE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS - OUTPUT_STRIP_TRAILING_WHITESPACE ) - execute_process(COMMAND ${LLVM_CONFIG_EXE} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS - OUTPUT_STRIP_TRAILING_WHITESPACE ) - check_library_exists(LLVM-${LLVM_PACKAGE_VERSION} LLVMVerifyFunction "${LLVM_LDFLAGS}" HAVE_DYNAMIC_LLVM_${LLVM_PACKAGE_VERSION}) - if (HAVE_DYNAMIC_LLVM_${LLVM_PACKAGE_VERSION}) - set(LLVM_LIBRARIES "${LLVM_LDFLAGS} -lLLVM-${LLVM_PACKAGE_VERSION}") - set(CMAKE_REQUIRED_LIBRARIES ${LLVM_LIBRARIES}) - CHECK_CXX_SOURCE_COMPILES( - "#include - #include - int main(int argc, char **argv) - { - LLVMInitializeAllTargetInfos(); - LLVMInitializeAllTargetMCs(); - LLVMInitializeAllDisassemblers(); - return 0; - }" - LLVM_FOUND) - unset(CMAKE_REQUIRED_LIBRARIES) - - if (LLVM_FOUND) - break() - endif() - endif() - endif() - endif() -endforeach() diff --git a/Source/Core/UICommon/CMakeLists.txt b/Source/Core/UICommon/CMakeLists.txt index 6bfc4be9bd..77a407d6d1 100644 --- a/Source/Core/UICommon/CMakeLists.txt +++ b/Source/Core/UICommon/CMakeLists.txt @@ -8,3 +8,13 @@ if(LIBUSB_FOUND) endif() add_dolphin_library(uicommon "${SRCS}" "${LIBS}") + +if(ENABLE_LLVM) + find_package(LLVM CONFIG QUIET) + if(LLVM_FOUND) + message(STATUS "LLVM found, enabling LLVM support in disassembler") + target_compile_definitions(uicommon PRIVATE HAS_LLVM) + target_link_libraries(uicommon PRIVATE ${LLVM_AVAILABLE_LIBS}) + target_include_directories(uicommon PRIVATE ${LLVM_INCLUDE_DIRS}) + endif() +endif()