diff options
author | Josh Blum | 2013-08-05 00:59:07 -0700 |
---|---|---|
committer | Josh Blum | 2013-08-05 00:59:07 -0700 |
commit | cb68dc4b2de256176e5ed224767241b033e2ede9 (patch) | |
tree | f54b52f4922234ab4365c6ccd0b69282828a4468 /lib/CMakeLists.txt | |
parent | 21bb17612dec27213805321fb656788ec423453f (diff) | |
download | sandhi-cb68dc4b2de256176e5ed224767241b033e2ede9.tar.gz sandhi-cb68dc4b2de256176e5ed224767241b033e2ede9.tar.bz2 sandhi-cb68dc4b2de256176e5ed224767241b033e2ede9.zip |
gras: work on using clang api - but commented out
The last thing missing is that the API use case
doesnt automatically have default C++ include paths.
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r-- | lib/CMakeLists.txt | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 2d61b91..f8aaebc 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -107,26 +107,34 @@ endif() ######################################################################## # Setup factory compiler ######################################################################## + +#step 1) call into the LLVM find package find_program(LLVM_CONFIG_EXECUTABLE llvm-config DOC "llvm-config executable") if(LLVM_CONFIG_EXECUTABLE) find_package(LLVM) endif() -if(LLVM_FOUND) - find_program(CLANG_EXECUTABLE clang DOC "clang executable") - set(CLANG_FOUND ${CLANG_EXECUTABLE}) -else() - message(WARNING "LLVM library not found - optional for factory compiler") -endif() -if(NOT CLANG_FOUND) - message(WARNING "Clang executable not found - optional for factory compiler") -endif() -if(CLANG_FOUND) +#step 2) setup LLVM if found and find Clang +if(LLVM_FOUND) + add_definitions(-DHAVE_LLVM) add_definitions(${LLVM_CFLAGS}) link_directories(${LLVM_LIBRARY_DIRS}) include_directories(${LLVM_INCLUDE_DIRS}) list(APPEND GRAS_LIBRARIES ${LLVM_MODULE_LIBS}) list(APPEND GRAS_LIBRARIES ${LLVM_LDFLAGS}) + find_package(Clang) +endif() + +#step 3) setup Clang if found +if(CLANG_FOUND) + add_definitions(-DHAVE_CLANG) + include_directories(${CLANG_INCLUDE_DIRS}) + list(APPEND GRAS_LIBRARIES ${CLANG_LIBS}) +endif() + +#step 4) find clang executable as backup (found llvm but not clang dev) +find_program(CLANG_EXECUTABLE clang DOC "clang executable") +if(CLANG_EXECUTABLE) SET_SOURCE_FILES_PROPERTIES( ${CMAKE_CURRENT_SOURCE_DIR}/jit_factory.cpp PROPERTIES COMPILE_DEFINITIONS "CLANG_EXECUTABLE=${CLANG_EXECUTABLE}" |