Skip to content

Commit

Permalink
Merge pull request #4855 from Orphis/cmake_llvm
Browse files Browse the repository at this point in the history
cmake: Move LLVM import to UICommon
  • Loading branch information
lioncash committed Feb 8, 2017
2 parents a9ed44c + 9ca4037 commit c9696cc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 63 deletions.
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 0 additions & 44 deletions CMakeTests/FindLLVM.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions Source/Core/UICommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 3 additions & 3 deletions Source/Core/UICommon/Disassembler.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -28,7 +28,7 @@ class HostDisassemblerX86 : public HostDisassembler
u32* host_instructions_count, u64 starting_pc) override;
};

#if defined(HAS_LLVM)
#if defined(HAVE_LLVM)
class HostDisassemblerLLVM : public HostDisassembler
{
public:
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/Vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit c9696cc

Please sign in to comment.