|
1 |
| -set(CLANG_SRC_DIR "${LLVM_SRC_DIR}/tools/clang") |
2 |
| -set(CLANG_BUILD_DIR "${LLVM_BUILD_DIR}/tools/clang") |
3 | 1 |
|
4 |
| -add_definitions(-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS) |
| 2 | +find_package(LLVM REQUIRED CONFIG) |
| 3 | +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") |
| 4 | +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") |
5 | 5 |
|
6 |
| -set(CMAKE_CXX_FLAGS "-Wall -Wno-enum-compare -Wno-strict-aliasing -std=gnu++0x ${CMAKE_CXX_FLAGS}") |
| 6 | +find_package(Clang REQUIRED CONFIG) |
| 7 | +message(STATUS "Found Clang using ClangConfig.cmake in: ${Clang_DIR}") |
7 | 8 |
|
8 |
| -# Depending on the platform and version of clang, the clang library will |
9 |
| -# be named libclang or liblibclang. Now we detect that. |
10 |
| -find_library(CLANG_LIBRARY |
11 |
| - NAMES clang libclang |
12 |
| - PATHS "${LLVM_BUILD_DIR}/lib" |
13 |
| - NO_DEFAULT_PATH) |
| 9 | +#include_directories(${LLVM_INCLUDE_DIRS}) |
| 10 | +#add_definitions(${LLVM_DEFINITIONS}) |
14 | 11 |
|
15 |
| -include_directories( |
16 |
| - "${LLVM_SRC_DIR}/include" |
17 |
| - "${LLVM_BUILD_DIR}/include" |
18 |
| - "${CLANG_SRC_DIR}/include" |
19 |
| - "${CLANG_BUILD_DIR}/include") |
20 |
| -link_directories("${LLVM_BUILD_DIR}/lib") |
21 |
| - |
22 |
| -if(NOT CLANG_LIBRARY) |
23 |
| - if(NOT MOZART_CACHED_BUILD) |
24 |
| - message(FATAL_ERROR "Could not find clang library in ${LLVM_BUILD_DIR}") |
25 |
| - set("CLANG_LIBRARY" "/not_found/") |
26 |
| - endif() |
27 |
| - # With MOZART_CACHED_BUILD, we should not require LLVM/Clang at all |
28 |
| - # TODO: Fail verbosely if target "generator" is ever required. |
29 |
| -else() |
30 |
| - add_executable(generator EXCLUDE_FROM_ALL |
31 |
| - generator.cc interfaces.cc implementations.cc builtins.cc utils.cc) |
32 |
| - target_link_libraries(generator "${CLANG_LIBRARY}") |
33 |
| -endif() |
| 12 | +add_executable(generator EXCLUDE_FROM_ALL generator.cc interfaces.cc implementations.cc builtins.cc utils.cc) |
| 13 | +target_link_libraries(generator clangFrontend clangAST) |
0 commit comments