| author | |
| committer | |
| log | 67021e2bfff0b9caea432fd996031ab880afdbc5 |
| tree | 2a4fbeeb37db3407292561c6eed9c06745df7842 |
| parent | 7c81cd30de876f8bc56a4c689372e4d388b8608c |
3 files changed, 77 insertions(+), 129 deletions(-)
CMakeLists.txt+77-4| ... | @@ -26,13 +26,86 @@ option(ZIG_TEST_COVERAGE "Build Zig with test coverage instrumentation" OFF) | ... | @@ -26,13 +26,86 @@ option(ZIG_TEST_COVERAGE "Build Zig with test coverage instrumentation" OFF) |
| 26 | # git log -p -- deps/lld | 26 | # git log -p -- deps/lld |
| 27 | option(ZIG_FORCE_EXTERNAL_LLD "If your system has the LLD patches use it instead of the embedded LLD" OFF) | 27 | option(ZIG_FORCE_EXTERNAL_LLD "If your system has the LLD patches use it instead of the embedded LLD" OFF) |
| 28 | 28 | ||
| 29 | find_package(LLVM REQUIRED CONFIG) | ||
| 30 | include_directories(${LLVM_INCLUDE_DIRS}) | ||
| 29 | 31 | ||
| 30 | find_package(llvm) | 32 | # TODO: this currently doesn't work, it currently defines UNICODE but zig |
| 31 | include_directories(${LLVM_INCLUDE_DIR}) | 33 | # uses MBCS |
| 32 | link_directories(${LLVM_LIBDIRS}) | 34 | #add_definitions(${LLVM_DEFINITIONS}) |
| 33 | 35 | ||
| 34 | find_package(clang) | 36 | link_directories(${LLVM_LIBRARY_DIRS}) |
| 37 | llvm_map_components_to_libnames(LLVM_LIBRARIES | ||
| 38 | LTO | ||
| 39 | Symbolize | ||
| 40 | XCoreDisassembler | ||
| 41 | XCoreCodeGen | ||
| 42 | XCoreAsmPrinter | ||
| 43 | SystemZDisassembler | ||
| 44 | SystemZCodeGen | ||
| 45 | SystemZAsmParser | ||
| 46 | SystemZAsmPrinter | ||
| 47 | SparcDisassembler | ||
| 48 | SparcCodeGen | ||
| 49 | SparcAsmParser | ||
| 50 | SparcAsmPrinter | ||
| 51 | PowerPCDisassembler | ||
| 52 | PowerPCCodeGen | ||
| 53 | PowerPCAsmParser | ||
| 54 | PowerPCAsmPrinter | ||
| 55 | NVPTXCodeGen | ||
| 56 | NVPTXAsmPrinter | ||
| 57 | MSP430CodeGen | ||
| 58 | MSP430AsmPrinter | ||
| 59 | MipsDisassembler | ||
| 60 | MipsCodeGen | ||
| 61 | MipsAsmParser | ||
| 62 | MipsAsmPrinter | ||
| 63 | LanaiDisassembler | ||
| 64 | LanaiCodeGen | ||
| 65 | LanaiAsmParser | ||
| 66 | LanaiAsmPrinter | ||
| 67 | HexagonDisassembler | ||
| 68 | HexagonCodeGen | ||
| 69 | HexagonAsmParser | ||
| 70 | BPFDisassembler | ||
| 71 | BPFCodeGen | ||
| 72 | BPFAsmPrinter | ||
| 73 | ARMDisassembler | ||
| 74 | ARMCodeGen | ||
| 75 | ARMAsmParser | ||
| 76 | ARMAsmPrinter | ||
| 77 | AMDGPUDisassembler | ||
| 78 | AMDGPUCodeGen | ||
| 79 | AMDGPUAsmParser | ||
| 80 | AMDGPUAsmPrinter | ||
| 81 | AArch64Disassembler | ||
| 82 | AArch64CodeGen | ||
| 83 | AArch64AsmParser | ||
| 84 | AArch64AsmPrinter | ||
| 85 | LibDriver | ||
| 86 | X86Disassembler | ||
| 87 | X86AsmParser | ||
| 88 | X86CodeGen | ||
| 89 | X86AsmPrinter | ||
| 90 | Core | ||
| 91 | ) | ||
| 92 | |||
| 93 | find_package(CLANG REQUIRED CONFIG) | ||
| 35 | include_directories(${CLANG_INCLUDE_DIRS}) | 94 | include_directories(${CLANG_INCLUDE_DIRS}) |
| 95 | set(CLANG_LIBRARIES | ||
| 96 | clangFrontend | ||
| 97 | clangDriver | ||
| 98 | clangSerialization | ||
| 99 | clangSema | ||
| 100 | clangAnalysis | ||
| 101 | clangAST | ||
| 102 | clangParse | ||
| 103 | clangSema | ||
| 104 | clangBasic | ||
| 105 | clangEdit | ||
| 106 | clangLex | ||
| 107 | ) | ||
| 108 | |||
| 36 | 109 | ||
| 37 | if(ZIG_FORCE_EXTERNAL_LLD) | 110 | if(ZIG_FORCE_EXTERNAL_LLD) |
| 38 | find_package(lld) | 111 | find_package(lld) |
cmake/Findclang.cmake deleted-50| ... | @@ -1,50 +0,0 @@ | ||
| 1 | # Copyright (c) 2016 Andrew Kelley | ||
| 2 | # This file is MIT licensed. | ||
| 3 | # See http://opensource.org/licenses/MIT | ||
| 4 | |||
| 5 | # CLANG_FOUND | ||
| 6 | # CLANG_INCLUDE_DIRS | ||
| 7 | # CLANG_LIBRARIES | ||
| 8 | |||
| 9 | find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h | ||
| 10 | PATHS | ||
| 11 | ${LLVM_INSTALL_PREFIX}/include | ||
| 12 | /usr/lib/llvm/5/include | ||
| 13 | /usr/lib/llvm-5.0/include | ||
| 14 | /mingw64/include) | ||
| 15 | |||
| 16 | if(NOT CLANG_INCLUDE_DIRS) | ||
| 17 | message(FATAL_ERROR "Failed to find CLANG header files") | ||
| 18 | endif() | ||
| 19 | |||
| 20 | macro(FIND_AND_ADD_CLANG_LIB _libname_) | ||
| 21 | string(TOUPPER ${_libname_} _prettylibname_) | ||
| 22 | find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_} | ||
| 23 | PATHS | ||
| 24 | ${LLVM_INSTALL_PREFIX}/lib | ||
| 25 | /usr/lib/llvm/5/lib | ||
| 26 | /usr/lib/llvm-5.0/lib | ||
| 27 | /mingw64/lib | ||
| 28 | /c/msys64/mingw64/lib | ||
| 29 | c:\\msys64\\mingw64\\lib) | ||
| 30 | if(CLANG_${_prettylibname_}_LIB) | ||
| 31 | set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_${_prettylibname_}_LIB}) | ||
| 32 | endif() | ||
| 33 | endmacro(FIND_AND_ADD_CLANG_LIB) | ||
| 34 | |||
| 35 | FIND_AND_ADD_CLANG_LIB(clangFrontend) | ||
| 36 | FIND_AND_ADD_CLANG_LIB(clangDriver) | ||
| 37 | FIND_AND_ADD_CLANG_LIB(clangSerialization) | ||
| 38 | FIND_AND_ADD_CLANG_LIB(clangSema) | ||
| 39 | FIND_AND_ADD_CLANG_LIB(clangAnalysis) | ||
| 40 | FIND_AND_ADD_CLANG_LIB(clangAST) | ||
| 41 | FIND_AND_ADD_CLANG_LIB(clangParse) | ||
| 42 | FIND_AND_ADD_CLANG_LIB(clangSema) | ||
| 43 | FIND_AND_ADD_CLANG_LIB(clangBasic) | ||
| 44 | FIND_AND_ADD_CLANG_LIB(clangEdit) | ||
| 45 | FIND_AND_ADD_CLANG_LIB(clangLex) | ||
| 46 | |||
| 47 | include(FindPackageHandleStandardArgs) | ||
| 48 | find_package_handle_standard_args(CLANG DEFAULT_MSG CLANG_LIBRARIES CLANG_INCLUDE_DIRS) | ||
| 49 | |||
| 50 | mark_as_advanced(CLANG_INCLUDE_DIRS CLANG_LIBRARIES) | ||
cmake/Findllvm.cmake deleted-75| ... | @@ -1,75 +0,0 @@ | ||
| 1 | # Copyright (c) 2014 Andrew Kelley | ||
| 2 | # This file is MIT licensed. | ||
| 3 | # See http://opensource.org/licenses/MIT | ||
| 4 | |||
| 5 | # LLVM_INCLUDE_DIR | ||
| 6 | # LLVM_LIBRARIES | ||
| 7 | # LLVM_LIBDIRS | ||
| 8 | |||
| 9 | if(LLVM_INSTALL_PREFIX) | ||
| 10 | find_program(LLVM_CONFIG_EXE | ||
| 11 | NAMES llvm-config-5.0 llvm-config | ||
| 12 | PATHS ${LLVM_INSTALL_PREFIX}/bin | ||
| 13 | NO_DEFAULT_PATH) | ||
| 14 | if(NOT LLVM_CONFIG_EXE) | ||
| 15 | message(FATAL_ERROR "Invalid LLVM_INSTALL_PREFIX \"${LLVM_INSTALL_PREFIX}\", could not find llvm-config") | ||
| 16 | endif() | ||
| 17 | else() | ||
| 18 | find_program(LLVM_CONFIG_EXE | ||
| 19 | NAMES llvm-config-5.0 llvm-config | ||
| 20 | PATHS | ||
| 21 | "/mingw64/bin" | ||
| 22 | "/c/msys64/mingw64/bin" | ||
| 23 | "c:/msys64/mingw64/bin" | ||
| 24 | "C:/Libraries/llvm-5.0.0/bin") | ||
| 25 | if(NOT LLVM_CONFIG_EXE) | ||
| 26 | message(FATAL_ERROR "Could not find llvm-config, use -DLLVM_INSTALL_PREFIX to specify the install path") | ||
| 27 | endif() | ||
| 28 | execute_process( | ||
| 29 | COMMAND ${LLVM_CONFIG_EXE} --prefix | ||
| 30 | OUTPUT_VARIABLE LLVM_INSTALL_PREFIX | ||
| 31 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 32 | endif() | ||
| 33 | |||
| 34 | if(${LLVM_INSTALL_PREFIX} MATCHES "^.* ") | ||
| 35 | # NOTE: this is a limitation due to llvm-config. If the path contains spaces then there's | ||
| 36 | # no way to tell from the output of llvm-config whether a space is seperating a filename, or | ||
| 37 | # just a space in the path name. | ||
| 38 | message(FATAL_ERROR "The LLVM install path \"${LLVM_INSTALL_PREFIX}\" cannot contain spaces") | ||
| 39 | endif() | ||
| 40 | |||
| 41 | execute_process( | ||
| 42 | COMMAND ${LLVM_CONFIG_EXE} --libs | ||
| 43 | OUTPUT_VARIABLE LLVM_LIBRARIES_STRING | ||
| 44 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 45 | string(REPLACE " " ";" LLVM_LIBRARIES ${LLVM_LIBRARIES_STRING}) | ||
| 46 | |||
| 47 | execute_process( | ||
| 48 | COMMAND ${LLVM_CONFIG_EXE} --system-libs | ||
| 49 | OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_STRING | ||
| 50 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 51 | string(REPLACE " " ";" LLVM_SYSTEM_LIBS ${LLVM_SYSTEM_LIBS_STRING}) | ||
| 52 | |||
| 53 | execute_process( | ||
| 54 | COMMAND ${LLVM_CONFIG_EXE} --libdir | ||
| 55 | OUTPUT_VARIABLE LLVM_LIBDIRS | ||
| 56 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 57 | |||
| 58 | execute_process( | ||
| 59 | COMMAND ${LLVM_CONFIG_EXE} --includedir | ||
| 60 | OUTPUT_VARIABLE LLVM_INCLUDE_DIR | ||
| 61 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 62 | |||
| 63 | find_library(LLVM_LIBRARY NAMES LLVM) | ||
| 64 | |||
| 65 | set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS}) | ||
| 66 | |||
| 67 | if(LLVM_LIBRARY) | ||
| 68 | set(LLVM_LIBRARIES ${LLVM_LIBRARY}) | ||
| 69 | endif() | ||
| 70 | |||
| 71 | |||
| 72 | include(FindPackageHandleStandardArgs) | ||
| 73 | find_package_handle_standard_args(LLVM DEFAULT_MSG LLVM_LIBRARIES LLVM_INCLUDE_DIR) | ||
| 74 | |||
| 75 | mark_as_advanced(LLVM_INCLUDE_DIR LLVM_LIBRARIES LLVM_LIBDIRS) | ||