concordia-server/CMakeLists.txt

228 lines
7.3 KiB
CMake
Raw Normal View History

2015-06-09 13:01:42 +02:00
# Tutorial: http://www.cmake.org/cmake/help/cmake_tutorial.html
cmake_minimum_required(VERSION 2.6)
project(concordia-server CXX)
set (CONCORDIA_SERVER_VERSION_MAJOR 1)
set (CONCORDIA_SERVER_VERSION_MINOR 0)
set(BASE_TARGETS concordia-server)
# ================================================
# Functional settings
# ================================================
set (STOP_WORDS_ENABLED "false")
2015-12-16 09:58:42 +01:00
set (UNIX_USER $ENV{USER})
2015-06-09 13:01:42 +02:00
# ================================================
# Config
# ================================================
set (INDEX_DIRECTORY "${concordia-server_SOURCE_DIR}/index")
set (RESOURCES_DIRECTORY "${concordia-server_SOURCE_DIR}/resources")
configure_file (
"${concordia-server_SOURCE_DIR}/concordia.cfg.in"
"${concordia-server_SOURCE_DIR}/concordia.cfg"
)
set(COMPILED_BINARIES_PATH "${concordia-server_SOURCE_DIR}/build/concordia-server")
2017-03-03 22:21:00 +01:00
set(LEMMAGEN_BINARIES_PATH "${concordia-server_SOURCE_DIR}/LemmaGenSockets/LemmaGenSockets/bin/Debug")
2015-06-09 13:01:42 +02:00
set(SCRIPTS_PATH "${concordia-server_SOURCE_DIR}/scripts")
configure_file (
"${concordia-server_SOURCE_DIR}/scripts/cmake_stubs/start.sh.in"
"${concordia-server_SOURCE_DIR}/scripts/start.sh"
)
2019-05-16 14:50:44 +02:00
configure_file (
"${concordia-server_SOURCE_DIR}/scripts/cmake_stubs/simplestart.sh.in"
"${concordia-server_SOURCE_DIR}/scripts/simplestart.sh"
)
2015-06-09 13:01:42 +02:00
configure_file (
"${concordia-server_SOURCE_DIR}/scripts/cmake_stubs/stop.sh.in"
"${concordia-server_SOURCE_DIR}/scripts/stop.sh"
)
configure_file (
"${concordia-server_SOURCE_DIR}/scripts/cmake_stubs/restart.sh.in"
"${concordia-server_SOURCE_DIR}/scripts/restart.sh"
)
2015-12-14 15:43:33 +01:00
configure_file (
"${concordia-server_SOURCE_DIR}/scripts/cmake_stubs/watchdog.sh.in"
"${concordia-server_SOURCE_DIR}/scripts/watchdog.sh"
)
2015-06-09 13:01:42 +02:00
2015-12-16 09:48:15 +01:00
configure_file (
"${concordia-server_SOURCE_DIR}/upstart/cmake_stubs/concordia-server.conf.in"
"${concordia-server_SOURCE_DIR}/upstart/concordia-server.conf"
)
configure_file (
"${concordia-server_SOURCE_DIR}/upstart/cmake_stubs/pgbouncer.conf.in"
"${concordia-server_SOURCE_DIR}/upstart/pgbouncer.conf"
)
2017-03-03 22:21:00 +01:00
configure_file (
"${concordia-server_SOURCE_DIR}/upstart/cmake_stubs/lemmagen.conf.in"
"${concordia-server_SOURCE_DIR}/upstart/lemmagen.conf"
)
2015-12-16 09:48:15 +01:00
configure_file (
"${concordia-server_SOURCE_DIR}/db/pgbouncer.ini.in"
"${concordia-server_SOURCE_DIR}/db/pgbouncer.ini"
)
2015-06-09 13:01:42 +02:00
set(CONFIG_FILE_PATH "${concordia-server_SOURCE_DIR}/concordia.cfg")
2015-09-07 09:06:06 +02:00
set(LOG_FILE_PATH "${concordia-server_SOURCE_DIR}/logs/concordia-server.log")
2016-01-25 23:55:32 +01:00
set(PHRASE_LOG_FILE_PATH "${concordia-server_SOURCE_DIR}/logs/phrase-searches.json")
2015-08-04 12:03:28 +02:00
# --------------
# db settings
# --------------
set (DB_NAME "concordia_db")
2015-08-04 12:03:28 +02:00
set (DB_USER "concordia")
set (DB_PASSWORD "concordia")
set (DB_HOST "concordia-postgres")
set (DB_PORT "5432")
2015-08-04 12:03:28 +02:00
2015-06-09 13:01:42 +02:00
configure_file (
"${concordia-server_SOURCE_DIR}/concordia-server/config.hpp.in"
"${concordia-server_SOURCE_DIR}/concordia-server/config.hpp"
)
# ================================================
# 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)
2015-12-29 22:13:21 +01: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: ${ICU_LIB}")
include_directories(${ICU_INCLUDE})
link_directories(${ICU_LIB})
else()
message(FATAL_ERROR "ICU not found")
endif(EXISTS ${ICU_LIB} AND EXISTS ${ICU_INCLUDE})
2015-06-09 13:01:42 +02:00
# ----------------------------------------------------
# Boost
# ----------------------------------------------------
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
2017-03-03 22:21:00 +01:00
find_package(Boost COMPONENTS
2015-06-09 13:01:42 +02:00
serialization unit_test_framework system filesystem program_options iostreams regex locale REQUIRED)
# ----------------------------------------------------
# libconfig
# ----------------------------------------------------
find_library(LIBCONFIG_LIB NAMES config++ REQUIRED)
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})
endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
# ----------------------------------------------------
# Logging
# ----------------------------------------------------
find_library(LOG4CPP_LIB NAMES log4cpp REQUIRED)
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})
endif(EXISTS ${LOG4CPP_LIB} AND EXISTS ${LOG4CPP_INCLUDE})
# ----------------------------------------------------
# FastCGI
# ----------------------------------------------------
find_library(FASTCGI_LIB NAMES fcgi REQUIRED)
if(EXISTS ${FASTCGI_LIB})
message(STATUS "Found fastcgi")
link_directories(${FASTCGI_LIB})
endif(EXISTS ${FASTCGI_LIB})
# ----------------------------------------------------
# FastCGI++
# ----------------------------------------------------
find_library(FASTCGIPP_LIB NAMES fcgi++ REQUIRED)
if(EXISTS ${FASTCGIPP_LIB})
message(STATUS "Found fastcgi++")
link_directories(${FASTCGIPP_LIB})
endif(EXISTS ${FASTCGIPP_LIB})
2015-07-31 14:11:13 +02:00
# ----------------------------------------------------
# libpq
# ----------------------------------------------------
find_library(PQ_LIB NAMES pq REQUIRED)
find_path(PQ_INCLUDE libpq-fe.h HINTS "/usr/include/postgresql")
if(EXISTS ${PQ_LIB})
message(STATUS "Found libpq")
include_directories(${PQ_INCLUDE})
link_directories(${PQ_LIB})
endif(EXISTS ${PQ_LIB})
2015-06-09 13:01:42 +02:00
# ----------------------------------------------------
# Concordia
# ----------------------------------------------------
find_library(CONCORDIA_LIB NAMES conconrdia REQUIRED)
find_path(CONCORDIA_INCLUDE concordia.hpp)
if(EXISTS ${CONCORDIA_LIB} AND EXISTS ${CONCORDIA_INCLUDE})
message(STATUS "Found Concordia")
include_directories(${CONCORDIA_INCLUDE})
link_directories(${CONCORDIA_LIB})
endif(EXISTS ${CONCORDIA_LIB} AND EXISTS ${CONCORDIA_INCLUDE})
# ----------------------------------------------------
# divsufsort
# ----------------------------------------------------
find_library(DIVSUFSORT_LIB NAMES divsufsort REQUIRED)
find_path(DIVSUFSORT_INCLUDE divsufsort.h)
if(EXISTS ${DIVSUFSORT_LIB} AND EXISTS ${DIVSUFSORT_INCLUDE})
message(STATUS "Found divsufsort")
include_directories(${DIVSUFSORT_INCLUDE})
link_directories(${DIVSUFSORT_LIB})
endif(EXISTS ${DIVSUFSORT_LIB} AND EXISTS ${DIVSUFSORT_INCLUDE})
# ----------------------------------------------------
# utf8case
# ----------------------------------------------------
find_library(UTF8CASE_LIB NAMES utf8case REQUIRED)
if(EXISTS ${UTF8CASE_LIB})
message(STATUS "Found utf8case")
link_directories(${UTF8CASE_LIB})
endif(EXISTS ${UTF8CASE_LIB})
add_subdirectory(concordia-server)