Merge pull request #4855 from Orphis/cmake_llvm
cmake: Move LLVM import to UICommon
This commit is contained in:
commit
c9696ccdd5
|
@ -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)
|
||||
|
|
|
@ -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 <llvm-c/Disassembler.h>
|
||||
#include <llvm-c/Target.h>
|
||||
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()
|
|
@ -21,7 +21,7 @@ add_definitions(-D__STDC_CONSTANT_MACROS)
|
|||
|
||||
macro(add_dolphin_library lib srcs libs)
|
||||
add_library(${lib} STATIC ${srcs})
|
||||
target_link_libraries(${lib} ${libs})
|
||||
target_link_libraries(${lib} PUBLIC ${libs})
|
||||
endmacro()
|
||||
|
||||
add_subdirectory(Core)
|
||||
|
|
|
@ -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 HAVE_LLVM)
|
||||
target_link_libraries(uicommon PRIVATE ${LLVM_AVAILABLE_LIBS})
|
||||
target_include_directories(uicommon PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <disasm.h> // Bochs
|
||||
|
||||
#if defined(HAS_LLVM)
|
||||
#if defined(HAVE_LLVM)
|
||||
// PowerPC.h defines PC.
|
||||
// This conflicts with a function that has an argument named PC
|
||||
#undef PC
|
||||
|
@ -28,7 +28,7 @@ private:
|
|||
u32* host_instructions_count, u64 starting_pc) override;
|
||||
};
|
||||
|
||||
#if defined(HAS_LLVM)
|
||||
#if defined(HAVE_LLVM)
|
||||
class HostDisassemblerLLVM : public HostDisassembler
|
||||
{
|
||||
public:
|
||||
|
@ -153,7 +153,7 @@ std::string HostDisassemblerX86::DisassembleHostBlock(const u8* code_start, cons
|
|||
|
||||
HostDisassembler* GetNewDisassembler(const std::string& arch)
|
||||
{
|
||||
#if defined(HAS_LLVM)
|
||||
#if defined(HAVE_LLVM)
|
||||
if (arch == "x86")
|
||||
return new HostDisassemblerLLVM("x86_64-none-unknown");
|
||||
else if (arch == "aarch64")
|
||||
|
|
|
@ -37,5 +37,5 @@ include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/Externals/glslang/SPIRV)
|
|||
|
||||
# Link against glslang, the other necessary libraries are referenced by the executable.
|
||||
add_dolphin_library(videovulkan "${SRCS}" "${LIBS}")
|
||||
target_link_libraries(videovulkan glslang)
|
||||
target_link_libraries(videovulkan PRIVATE glslang)
|
||||
|
||||
|
|
|
@ -62,5 +62,5 @@ endif()
|
|||
add_dolphin_library(videocommon "${SRCS}" "${LIBS}")
|
||||
|
||||
if(LIBAV_FOUND)
|
||||
target_link_libraries(videocommon ${LIBS} ${LIBAV_LIBRARIES})
|
||||
target_link_libraries(videocommon PRIVATE ${LIBS} ${LIBAV_LIBRARIES})
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue