2013-10-24 17:06:00 +02:00
|
|
|
# Tutorial: http://www.cmake.org/cmake/help/cmake_tutorial.html
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2013-11-29 16:19:49 +01:00
|
|
|
project(concordia C CXX)
|
2013-10-24 17:06:00 +02:00
|
|
|
|
2015-04-30 09:29:10 +02:00
|
|
|
set (CONCORDIA_VERSION_MAJOR 1)
|
|
|
|
set (CONCORDIA_VERSION_MINOR 0)
|
2013-10-24 17:06:00 +02:00
|
|
|
|
2015-04-21 21:33:08 +02:00
|
|
|
# Whether to use stop words
|
|
|
|
set (STOP_WORDS_ENABLED "false")
|
|
|
|
|
2015-04-30 09:29:10 +02:00
|
|
|
include(CheckTypeSize)
|
2014-02-20 10:49:17 +01:00
|
|
|
# Type of the characters in SA
|
2013-12-06 22:29:25 +01:00
|
|
|
|
2015-04-30 09:29:10 +02:00
|
|
|
CHECK_TYPE_SIZE("unsigned int" UINT_SIZE)
|
|
|
|
message(STATUS "UINT_SIZE: ${UINT_SIZE}")
|
|
|
|
CHECK_TYPE_SIZE("unsigned long" ULONG_SIZE)
|
|
|
|
message(STATUS "ULONG_SIZE: ${ULONG_SIZE}")
|
|
|
|
CHECK_TYPE_SIZE("unsigned long long" ULLONG_SIZE)
|
|
|
|
message(STATUS "ULLONG_SIZE: ${ULLONG_SIZE}")
|
|
|
|
|
|
|
|
if (UINT_SIZE EQUAL 4 AND ULONG_SIZE EQUAL 8)
|
|
|
|
set (INDEX_CHARACTER_TYPE "unsigned int")
|
|
|
|
set (INDEX_CHARACTER_TYPE_MAX_VALUE "UINT_MAX")
|
|
|
|
|
|
|
|
# Suffix markers
|
|
|
|
set (SUFFIX_MARKER_TYPE "unsigned long")
|
|
|
|
set (SUFFIX_MARKER_TYPE_MAX_VALUE "ULONG_MAX")
|
|
|
|
elseif(ULONG_SIZE EQUAL 4 AND ULLONG_SIZE EQUAL 8)
|
|
|
|
set (INDEX_CHARACTER_TYPE "unsigned long")
|
|
|
|
set (INDEX_CHARACTER_TYPE_MAX_VALUE "ULONG_MAX")
|
|
|
|
|
|
|
|
# Suffix markers
|
|
|
|
set (SUFFIX_MARKER_TYPE "unsigned long long")
|
|
|
|
set (SUFFIX_MARKER_TYPE_MAX_VALUE "ULLONG_MAX")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Can not find proper C++ types. Try installing in 64-bit architecture")
|
|
|
|
|
|
|
|
endif()
|
2014-02-20 10:49:17 +01:00
|
|
|
|
2015-04-09 22:17:19 +02:00
|
|
|
set (SUFFIX_MARKER_SENTENCE_BYTES 2)
|
2015-04-30 09:29:10 +02:00
|
|
|
|
|
|
|
# The above allows for (roughly) 2^32 = 4 294 967 295 words in corpus.
|
|
|
|
# It assigns 4 bytes to sentence id and 2 bytes each for suffix offset and sentence length.
|
2015-04-09 22:17:19 +02:00
|
|
|
# This allows to store 2^32=4 294 967 296 sentences no longer than 65536 words.
|
2015-04-12 12:06:41 +02:00
|
|
|
# After changing these values be sure to adjust tests (as well as the above calculations).
|
|
|
|
# Also, you might want to run TooLongHashTest from test_hash_generator.cpp
|
2013-12-06 22:29:25 +01:00
|
|
|
|
2015-04-09 22:17:19 +02:00
|
|
|
# =============================== #
|
2013-10-24 17:06:00 +02:00
|
|
|
# Production paths
|
|
|
|
# ============================== #
|
|
|
|
|
|
|
|
set (PROD_RESOURCES_DIRECTORY "${concordia_SOURCE_DIR}/prod/resources")
|
|
|
|
|
|
|
|
# ============================== #
|
|
|
|
# Testing paths
|
|
|
|
# ============================== #
|
|
|
|
|
|
|
|
set (TEST_RESOURCES_DIRECTORY "${concordia_SOURCE_DIR}/tests/resources")
|
2013-11-28 16:47:57 +01:00
|
|
|
|
2013-11-28 16:59:56 +01:00
|
|
|
file(MAKE_DIRECTORY ${TEST_RESOURCES_DIRECTORY}/temp)
|
2013-12-06 22:29:25 +01:00
|
|
|
file(MAKE_DIRECTORY ${PROD_RESOURCES_DIRECTORY}/temp)
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
|
|
|
|
2014-04-24 12:04:37 +02:00
|
|
|
set(BASE_TARGETS concordia)
|
2013-11-28 16:47:57 +01:00
|
|
|
|
|
|
|
|
2017-04-26 17:02:18 +02:00
|
|
|
|
2013-10-24 17:06:00 +02:00
|
|
|
# ================================================
|
|
|
|
# Third-party libraries
|
|
|
|
# ================================================
|
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
# Regular expression libraries
|
|
|
|
# ----------------------------------------------------
|
|
|
|
option(WITH_RE2 "Using RE2 regular expression library" OFF)
|
|
|
|
message(STATUS "Using RE2 regular expression library ${WITH_RE2}")
|
|
|
|
|
|
|
|
if(WITH_RE2)
|
|
|
|
set(HAVE_RE2 1)
|
|
|
|
endif(WITH_RE2)
|
|
|
|
|
|
|
|
option(WITH_PCRE "Using PCRE regular expression library" ON)
|
|
|
|
message(STATUS "Using PCRE regular expression library ${WITH_PCRE}")
|
|
|
|
|
|
|
|
if(WITH_PCRE)
|
|
|
|
set(HAVE_PCRE 1)
|
|
|
|
endif(WITH_PCRE)
|
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
# Boost
|
|
|
|
# ----------------------------------------------------
|
|
|
|
set(Boost_USE_STATIC_LIBS OFF)
|
|
|
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
2017-04-26 17:02:18 +02:00
|
|
|
find_package(Boost COMPONENTS
|
2014-04-24 08:36:48 +02:00
|
|
|
serialization unit_test_framework system filesystem program_options iostreams regex locale REQUIRED)
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
# libconfig
|
|
|
|
# ----------------------------------------------------
|
2015-06-22 13:52:56 +02:00
|
|
|
find_library(LIBCONFIG_LIB NAMES config++)
|
2013-10-24 17:06:00 +02:00
|
|
|
find_path(LIBCONFIG_INCLUDE libconfig.h++)
|
|
|
|
|
|
|
|
if(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
|
|
|
|
message(STATUS "Found Libconfig")
|
|
|
|
include_directories(${LIBCONFIG_INCLUDE})
|
|
|
|
link_directories(${LIBCONFIG_LIB})
|
2015-06-22 13:52:56 +02:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Libconfig not found")
|
2013-10-24 17:06:00 +02:00
|
|
|
endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
|
|
|
|
|
2015-06-22 13:52:56 +02:00
|
|
|
# ----------------------------------------------------
|
|
|
|
# ICU (I feeeeel youuuuu...)
|
|
|
|
# ----------------------------------------------------
|
|
|
|
find_library(ICU_LIB NAMES icui18n)
|
|
|
|
find_path(ICU_INCLUDE unicode)
|
|
|
|
|
|
|
|
if(EXISTS ${ICU_LIB} AND EXISTS ${ICU_INCLUDE})
|
|
|
|
message(STATUS "Found ICU")
|
|
|
|
include_directories(${ICU_INCLUDE})
|
|
|
|
link_directories(${ICU_LIB})
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "ICU not found")
|
|
|
|
endif(EXISTS ${ICU_LIB} AND EXISTS ${ICU_INCLUDE})
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
# Logging
|
|
|
|
# ----------------------------------------------------
|
2015-06-22 13:52:56 +02:00
|
|
|
find_library(LOG4CPP_LIB NAMES log4cpp)
|
2013-10-24 17:06:00 +02:00
|
|
|
find_path(LOG4CPP_INCLUDE log4cpp/Appender.hh)
|
|
|
|
|
|
|
|
if(EXISTS ${LOG4CPP_LIB} AND EXISTS ${LOG4CPP_INCLUDE})
|
|
|
|
message(STATUS "Found Log4cpp")
|
|
|
|
include_directories(${LOG4CPP_INCLUDE})
|
|
|
|
link_directories(${LOG4CPP_LIB})
|
2015-06-22 13:52:56 +02:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Log4cpp not found")
|
2013-10-24 17:06:00 +02:00
|
|
|
endif(EXISTS ${LOG4CPP_LIB} AND EXISTS ${LOG4CPP_INCLUDE})
|
|
|
|
|
|
|
|
# ================================================
|
|
|
|
# Concordia: Configuration
|
|
|
|
# ================================================
|
|
|
|
|
|
|
|
configure_file (
|
|
|
|
"${concordia_SOURCE_DIR}/concordia/common/config.hpp.in"
|
|
|
|
"${concordia_SOURCE_DIR}/concordia/common/config.hpp"
|
|
|
|
)
|
2015-04-27 16:20:54 +02:00
|
|
|
message(STATUS "Configured common/config.hpp")
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
configure_file (
|
|
|
|
"${concordia_SOURCE_DIR}/tests/resources/concordia-config/concordia.cfg.in"
|
|
|
|
"${concordia_SOURCE_DIR}/tests/resources/concordia-config/concordia.cfg"
|
|
|
|
)
|
2015-04-27 16:20:54 +02:00
|
|
|
message(STATUS "Configured tests/.../concordia.cfg")
|
|
|
|
|
|
|
|
if (EXISTS "${concordia_SOURCE_DIR}/prod/resources/concordia-config/concordia.cfg.in")
|
|
|
|
configure_file (
|
|
|
|
"${concordia_SOURCE_DIR}/prod/resources/concordia-config/concordia.cfg.in"
|
|
|
|
"${concordia_SOURCE_DIR}/prod/resources/concordia-config/concordia.cfg"
|
|
|
|
)
|
|
|
|
message(STATUS "Configured prod/.../concordia.cfg")
|
|
|
|
endif()
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
# ================================================
|
|
|
|
# Concordia: sub-projects
|
|
|
|
# ================================================
|
|
|
|
|
2017-04-26 17:02:18 +02:00
|
|
|
set(ALL_DIRECTORIES concordia concordia-console concordia-sentence-tokenizer libdivsufsort utf8 utf8case)
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
include_directories("${concordia_SOURCE_DIR}")
|
|
|
|
|
2015-04-30 09:29:10 +02:00
|
|
|
# In order to include dynamically generated libdivsufsort headers
|
|
|
|
include_directories("${concordia_SOURCE_DIR}/build/libdivsufsort/include")
|
|
|
|
|
2013-10-24 17:06:00 +02:00
|
|
|
foreach(dir ${ALL_DIRECTORIES})
|
|
|
|
link_directories("${concordia_BINARY_DIR}/${dir}")
|
|
|
|
add_subdirectory(${dir})
|
|
|
|
endforeach(dir)
|
|
|
|
|
|
|
|
|
2017-04-26 17:02:18 +02:00
|
|
|
|
2013-10-24 17:06:00 +02:00
|
|
|
# ================================================
|
|
|
|
# Tests
|
|
|
|
# ================================================
|
|
|
|
|
2014-04-24 12:04:37 +02:00
|
|
|
set(TESTS_TARGETS concordia-tests)
|
2013-10-24 17:06:00 +02:00
|
|
|
|
|
|
|
add_subdirectory(tests)
|
|
|
|
|
|
|
|
ENABLE_TESTING()
|
|
|
|
ADD_TEST(FullTest ${CMAKE_CURRENT_BINARY_DIR}/tests/unit-tests/test_runner)
|
|
|
|
|
|
|
|
# Doxygen
|
|
|
|
find_package(Doxygen)
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
FIND_PROGRAM(DOT_TOOL dot DOC "Dot tool from graphviz")
|
|
|
|
SET(DOXYFILE_LATEX ON)
|
|
|
|
SET(DOXYGEN_HAVE_DOT NO)
|
|
|
|
SET(DOXYGEN_QUIET YES)
|
2017-04-26 17:02:18 +02:00
|
|
|
|
2013-10-24 17:06:00 +02:00
|
|
|
SET(INPUT_FILES)
|
|
|
|
SET(INPUT_FILES "${INPUT_FILES} ${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
|
|
|
|
if(DOT_TOOL)
|
|
|
|
SET(DOXYGEN_HAVE_DOT YES)
|
|
|
|
message(STATUS "Graphviz found")
|
|
|
|
else(DOT_TOOL)
|
|
|
|
message(STATUS "Consider installing Graphviz for call and caller graphs in the documentation")
|
|
|
|
endif(DOT_TOOL)
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
|
|
|
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating API documentation with Doxygen" VERBATIM)
|
|
|
|
|
2017-04-26 17:02:18 +02:00
|
|
|
endif(DOXYGEN_FOUND)
|