project(QuantisExtensions)
cmake_minimum_required(VERSION 2.6.0)

# ########## Generates custom header definitions ##########
include(CheckIncludeFile)
include(CheckIncludeFileCXX)

# Configuration checks
CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H)


# Include directory containing generated files
include_directories(${PROJECT_BINARY_DIR})

# #################### Quantis Libraries ####################

### Quantis library
if(NOT DISABLE_QUANTIS_JAVA)
  find_package(JNI REQUIRED)
  include_directories(${JNI_INCLUDE_DIRS})
endif()


set(Quantis_Extensions_SRCS
  QuantisExtractor_C.c
  QuantisExtractor_Cpp.cpp
)

set(Public_Headers
  QuantisExtractor.h
  QuantisExtractor.hpp
)


########## Quantis_Extensions Library ##########

# Quantis_Extensions Shared library
add_library(Quantis_Extensions SHARED ${Quantis_Extensions_SRCS})
set_target_properties(Quantis_Extensions PROPERTIES
  VERSION ${CPACK_PACKAGE_VERSION}
  SOVERSION ${API_VERSION}
  CLEAN_DIRECT_OUTPUT 1

)

# Quantis_Extensions Static library
add_library(Quantis_Extensions-static STATIC ${Quantis_Extensions_SRCS})
set_target_properties(Quantis_Extensions-static PROPERTIES
  OUTPUT_NAME "Quantis_Extensions"
  CLEAN_DIRECT_OUTPUT 1
)


# Install libraries
install(TARGETS
  Quantis_Extensions Quantis_Extensions-static
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIB_DIR}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIB_DIR}
)

INSTALL(FILES ${Public_Headers} DESTINATION include)


