
include_directories( ${LLVM_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/ ${CMAKE_CURRENT_SOURCE_DIR}/compiler ${CMAKE_CURRENT_BINARY_DIR} )

# List of files 
set(OpenShiva_SRCS
  Kernel.cpp
# Internal files
  Compiler_p.cpp
  CodeGenerator_p.cpp
  Lexer_p.cpp
  Parser_p.cpp
  Wrapper_p.cpp
  PixelVisitor_p.cpp
  PixelConvertExpressionFactory_p.cpp
# Wrap
  wrappers/ImageWrap_p.cpp
  wrappers/PixelWrap_p.cpp
  wrappers/RegionWrap_p.cpp
    )

# Add the OpenSHIVA library for build
add_library(OpenShiva SHARED ${OpenShiva_SRCS})
target_link_libraries(OpenShiva GTLCore )

# __STDC_LIMIT_MACROS is needed by LLVM's DataTypes.h
add_definitions( "-D__STDC_LIMIT_MACROS" )
add_definitions( -DCOUMPONENT_NAME="OpenShiva" )

add_definitions( -D_OPENSHIVA_SHIVA_STD_LIB_BUILD_DIR_="${CMAKE_CURRENT_BINARY_DIR}/../ShivaStdLib/")
add_definitions( -D_OPENSHIVA_LIB_INSTALL_="${CMAKE_INSTALL_PREFIX}/lib/")
add_definitions( -D_OPENSHIVA_SHIVA_STD_LIB_SRC_DIR_="${CMAKE_CURRENT_SOURCE_DIR}/../ShivaStdLib/")
add_definitions( -D_OPENSHIVA_SHIVA_SHARE_DIR_="${SHARE_INSTALL_DIR}/shiva" )


# Set the ABI version of the library
set_target_properties(OpenShiva PROPERTIES VERSION ${OPENSHIVA_LIB_VERSION} SOVERSION ${OPENSHIVA_LIB_SOVERSION} )

# Install target
install(TARGETS OpenShiva  DESTINATION ${LIB_INSTALL_DIR} )
install( FILES Kernel.h Version.h DESTINATION ${INCLUDE_INSTALL_DIR}/OpenShiva )

# Create and install pc file
configure_file("OpenShiva.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/OpenShiva.pc" @ONLY)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenShiva.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)  
