From 1b490244bf4864b96448d56a7cd20f3d5b0a0b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Sun, 21 Dec 2014 01:30:25 +0100 Subject: [PATCH] Workaround for Ubuntu broken LLVM package (llvm-3.5-dev does not have correct cmake files) --- CMakeLists.txt | 16 +++++++++++++--- evmcc/CMakeLists.txt | 2 -- libevmjit/CMakeLists.txt | 2 -- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06027b883..26a8010d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,19 @@ project(evmjit) set_property(GLOBAL PROPERTY USE_FOLDERS ON) # LLVM -find_package(LLVM REQUIRED CONFIG) -message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") -message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") +if(LLVM_DIR) # local LLVM build + find_package(LLVM REQUIRED CONFIG) + message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") + message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + # TODO: bitwriter is needed only for evmcc + llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen bitwriter) +else() + # Workaround for Ubuntu broken LLVM package + message(STATUS "Using llvm-3.5-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") + execute_process(COMMAND llvm-config-3.5 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS) + message(STATUS "LLVM include dirs: ${LLVM_INCLUDE_DIRS}") + set(LLVM_LIBS "-lLLVMBitWriter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport -lz -lpthread -lffi -ltinfo -ldl -lm") +endif() # Boost find_package(Boost REQUIRED) diff --git a/evmcc/CMakeLists.txt b/evmcc/CMakeLists.txt index b68f7e78b..4ffbf5fb5 100644 --- a/evmcc/CMakeLists.txt +++ b/evmcc/CMakeLists.txt @@ -14,7 +14,5 @@ include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ethereum) target_link_libraries(${TARGET_NAME} ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -llvm_map_components_to_libnames(LLVM_LIBS bitwriter) -target_link_libraries(${TARGET_NAME} ${LLVM_LIBS}) install(TARGETS ${TARGET_NAME} DESTINATION bin ) \ No newline at end of file diff --git a/libevmjit/CMakeLists.txt b/libevmjit/CMakeLists.txt index 140e8f24e..7c35169a7 100644 --- a/libevmjit/CMakeLists.txt +++ b/libevmjit/CMakeLists.txt @@ -15,9 +15,7 @@ set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "libs") include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) -add_definitions(${LLVM_DEFINITIONS}) -llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen) target_link_libraries(${TARGET_NAME} ${LLVM_LIBS}) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")