diff options
author | Josh Blum | 2013-08-01 01:12:24 -0700 |
---|---|---|
committer | Josh Blum | 2013-08-01 01:12:24 -0700 |
commit | a23bf59c46dae7aa25c4763c6122d0822c88abc7 (patch) | |
tree | af37ea0c6b2872071938390c857e4efcb4975d86 /lib/CMakeLists.txt | |
parent | 1897808616c91d277e24335a337bec92592fb87a (diff) | |
download | sandhi-a23bf59c46dae7aa25c4763c6122d0822c88abc7.tar.gz sandhi-a23bf59c46dae7aa25c4763c6122d0822c88abc7.tar.bz2 sandhi-a23bf59c46dae7aa25c4763c6122d0822c88abc7.zip |
gras: jit factory api + unit tests
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r-- | lib/CMakeLists.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ab94525..2d61b91 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -57,6 +57,7 @@ list(APPEND GRAS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/element.cpp ${CMAKE_CURRENT_SOURCE_DIR}/element_uid.cpp ${CMAKE_CURRENT_SOURCE_DIR}/factory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/jit_factory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sbuffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/buffer_queue_circ.cpp @@ -104,6 +105,35 @@ else() endif() ######################################################################## +# Setup factory compiler +######################################################################## +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) + 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}) + SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/jit_factory.cpp + PROPERTIES COMPILE_DEFINITIONS "CLANG_EXECUTABLE=${CLANG_EXECUTABLE}" + ) +endif() + +######################################################################## # Build library ######################################################################## add_library(gras SHARED ${GRAS_SOURCES}) |