From 0a6f053732c7a654cb9fe3e501680a104c3381a1 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 13 Apr 2010 20:52:50 +0000 Subject: [PATCH] Add CMake support for 'edis'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101177 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/CMakeLists.txt | 1 + tools/edis/CMakeLists.txt | 41 ++++++++++++++++++++++++++++++++++++ tools/edis/EDInfo.td | 1 + tools/llvm-mc/CMakeLists.txt | 1 + 4 files changed, 44 insertions(+) create mode 100644 tools/edis/CMakeLists.txt create mode 100644 tools/edis/EDInfo.td diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 8b5d77e2c42..b9c77b1c8a3 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -31,6 +31,7 @@ add_subdirectory(llvm-extract) add_subdirectory(bugpoint) add_subdirectory(llvm-bcanalyzer) add_subdirectory(llvm-stub) +add_subdirectory(edis) add_subdirectory(llvmc) if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/clang/CMakeLists.txt ) diff --git a/tools/edis/CMakeLists.txt b/tools/edis/CMakeLists.txt new file mode 100644 index 00000000000..5f11ab4798d --- /dev/null +++ b/tools/edis/CMakeLists.txt @@ -0,0 +1,41 @@ +set(SHARED_LIBRARY TRUE) +set(LLVM_NO_RTTI 1) + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/EDInfo.inc + COMMAND ${LLVM_TABLEGEN_EXE} -o ${CMAKE_CURRENT_BINARY_DIR}/EDInfo.inc + -gen-enhanced-disassembly-header ${CMAKE_CURRENT_SOURCE_DIR}/EDInfo.td + DEPENDS tblgen + COMMENT "Building enhanced disassembly semantic information header (EDInfo.inc)") +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/EDInfo.inc PROPERTIES GENERATED 1) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_llvm_library(EnhancedDisassembly + EDDisassembler.cpp + EDInst.cpp + EDMain.cpp + EDOperand.cpp + EDToken.cpp + ../../include/llvm-c/EnhancedDisassembly.h + ${CMAKE_CURRENT_BINARY_DIR}/EDInfo.inc +) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # FIXME: Deal with EDIS version? + set_target_properties(EnhancedDisassembly + PROPERTIES + LINK_FLAGS "-avoid-version -Wl,-exported_symbols_list -Wl,${CMAKE_CURRENT_SOURCE_DIR}/EnhancedDisassembly.exports -Wl,-dead_strip -Wl" + ) +endif() + +if(MSVC) + # windows.h doesn't compile with /Za + get_target_property(NON_ANSI_COMPILE_FLAGS CIndex COMPILE_FLAGS) + string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) + set_target_properties(EnhancedDisassembly PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) +endif(MSVC) + +set_target_properties(EnhancedDisassembly + PROPERTIES + LINKER_LANGUAGE CXX) + \ No newline at end of file diff --git a/tools/edis/EDInfo.td b/tools/edis/EDInfo.td new file mode 100644 index 00000000000..bd9ec079d80 --- /dev/null +++ b/tools/edis/EDInfo.td @@ -0,0 +1 @@ +// Intentionally empty. diff --git a/tools/llvm-mc/CMakeLists.txt b/tools/llvm-mc/CMakeLists.txt index 49c29324d4b..8b61a4e8db1 100644 --- a/tools/llvm-mc/CMakeLists.txt +++ b/tools/llvm-mc/CMakeLists.txt @@ -1,3 +1,4 @@ +set( LLVM_USED_LIBS EnhancedDisassembly) set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} support MC MCParser) add_llvm_tool(llvm-mc