stable release

This commit is contained in:
rjawor 2015-04-30 09:29:10 +02:00
parent db63cf776e
commit b790c6898f
11 changed files with 155 additions and 103 deletions

View File

@ -3,23 +3,45 @@
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project(concordia C CXX) project(concordia C CXX)
set (CONCORDIA_VERSION_MAJOR 0) set (CONCORDIA_VERSION_MAJOR 1)
set (CONCORDIA_VERSION_MINOR 1) set (CONCORDIA_VERSION_MINOR 0)
# Whether to use stop words # Whether to use stop words
set (STOP_WORDS_ENABLED "false") set (STOP_WORDS_ENABLED "false")
include(CheckTypeSize)
# Type of the characters in SA # Type of the characters in SA
set (INDEX_CHARACTER_TYPE "unsigned int") CHECK_TYPE_SIZE("unsigned int" UINT_SIZE)
set (INDEX_CHARACTER_TYPE_MAX_VALUE "ULONG_MAX") message(STATUS "UINT_SIZE: ${UINT_SIZE}")
# The above allows for (roughly) 2^32 = 4 294 967 295 words in corpus. 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()
# Suffix markers
set (SUFFIX_MARKER_TYPE "unsigned long")
set (SUFFIX_MARKER_TYPE_MAX_VALUE "ULLONG_MAX")
set (SUFFIX_MARKER_SENTENCE_BYTES 2) set (SUFFIX_MARKER_SENTENCE_BYTES 2)
# The above settings assign 4 bytes to sentence id and 2 bytes each for suffix offset and sentence length.
# 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.
# This allows to store 2^32=4 294 967 296 sentences no longer than 65536 words. # This allows to store 2^32=4 294 967 296 sentences no longer than 65536 words.
# After changing these values be sure to adjust tests (as well as the above calculations). # 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 # Also, you might want to run TooLongHashTest from test_hash_generator.cpp
@ -93,17 +115,6 @@ if(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
link_directories(${LIBCONFIG_LIB}) link_directories(${LIBCONFIG_LIB})
endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE}) endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
# ----------------------------------------------------
# Snowball stemmer
# ----------------------------------------------------
find_library(LIBSTEMMER_LIB NAMES stemmer REQUIRED)
find_path(LIBSTEMMER_INCLUDE libstemmer.h)
if(EXISTS ${LIBSTEMMER_LIB} AND EXISTS ${LIBSTEMMER_INCLUDE})
message(STATUS "Found libstemmer")
include_directories(${LIBSTEMMER_INCLUDE})
link_directories(${LIBSTEMMER_LIB})
endif(EXISTS ${LIBSTEMMER_LIB} AND EXISTS ${LIBSTEMMER_INCLUDE})
# ---------------------------------------------------- # ----------------------------------------------------
# Logging # Logging
@ -149,6 +160,9 @@ set(ALL_DIRECTORIES concordia concordia-console libdivsufsort utf8 utf8case)
include_directories("${concordia_SOURCE_DIR}") include_directories("${concordia_SOURCE_DIR}")
# In order to include dynamically generated libdivsufsort headers
include_directories("${concordia_SOURCE_DIR}/build/libdivsufsort/include")
foreach(dir ${ALL_DIRECTORIES}) foreach(dir ${ALL_DIRECTORIES})
link_directories("${concordia_BINARY_DIR}/${dir}") link_directories("${concordia_BINARY_DIR}/${dir}")
add_subdirectory(${dir}) add_subdirectory(${dir})
@ -191,4 +205,3 @@ if(DOXYGEN_FOUND)
endif(DOXYGEN_FOUND) endif(DOXYGEN_FOUND)

View File

@ -1,60 +1,61 @@
Concordia Installation & Build Manual Concordia Installation & Build Manual
================================= =================================
This file describes how to compile, build This page describes how to compile, build
and install Concordia library. and install Concordia library.
Requirements ========= Requirements ===============
============ Before you compile, make sure you have these installed:
- g++ compiler
- cmake
- Boost library
- Log4cpp
- (optional) Doxygen
- (optional) TeX
* cmake ========= Ubuntu package list ========
* Boost library
* Log4cpp
* libstemmer (Snowball stemming library)
* (optional) Doxygen
Boost Ubuntu installation On Ubuntu 14.04, the above software comes in standard packages. Here is the complete list of these packages:
========================= - g++
- cmake
- libboost-dev
- libboost-serialization-dev
- libboost-test-dev
- libboost-filesystem-dev
- libboost-system-dev
- libboost-program-options-dev
- libboost-iostreams-dev
- libboost-regex-dev
- libboost-locale-dev
- liblog4cpp5-dev
- libconfig++-dev
- libconfig-dev
- libpcre3-dev
- doxygen
- texlive-font-utils
sudo apt-get install libboost-dev libboost-serialization-dev libboost-test-dev libboost-filesystem-dev libboost-system-de libboost-program-options-dev libboost-iostreams-dev ========= Ubuntu requirements install command =======
Log4cpp Ubuntu installation If you want to install all the above packages at once, simply use the below command (this will also install the optional packages):
===========================
sudo apt-get install liblog4cpp5-dev sudo apt-get install g++ cmake libboost-dev libboost-serialization-dev libboost-test-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-iostreams-dev libboost-regex-dev libboost-locale-dev liblog4cpp5-dev libconfig++-dev libconfig-dev libpcre3-dev doxygen texlive-font-utils
libconfig Ubuntu installation ========= Build & installation procedure ===========
=============================
sudo apt-get install libconfig++-dev To build and install Concordia, navigate to its home directory and issue the following commands:
sudo apt-get install libconfig-dev
libstemmer Ubuntu installation
==============================
sudo apt-get install libstemmer-dev
Perl-compatible regular expressions (PCRE) Ubuntu installation
=======================================================
sudo apt-get install libpcre3-dev
Doxygen Ubuntu installation
=======================================================
sudo apt-get install doxygen
Installation procedure
======================
mkdir build mkdir build
cd build cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE .. ../cmake.sh
make make
make test make test
make install sudo make install
Documentation After that it is strongly recommended to run ldconfig to update linker info with newly installed shared libraries:
=============
sudo ldconfig -v
========= Documentation ===========================
If Doxygen is available, a successful compilation generates documentation data in three If Doxygen is available, a successful compilation generates documentation data in three
formats in the build/doc directory. formats in the build/doc directory.
@ -67,3 +68,24 @@ cd doc/latex
make make
This should generate a single file called refman.pdf in the same directory. This should generate a single file called refman.pdf in the same directory.
========= Sample program ============================
In order to verify whether Concordia has been installed successfully, run the following minimal example. Prepare the file test.cpp with the following contents (remember to substitute <CONCORDIA_HOME> with the path of the unpacked Concordia package).
#include <concordia/concordia.hpp>
#include <iostream>
using namespace std;
int main() {
Concordia concordia("<CONCORDIA_HOME>/tests/resources/concordia-config/concordia.cfg");
cout << concordia.getVersion() << endl;
}
Compilation method:
g++ test.cpp -lconcordia -lconfig++ -lboost_system -lboost_serialization -lboost_unit_test_framework -lboost_filesystem -lboost_program_options -lboost_iostreams -lboost_regex -lboost_locale -lutf8case

View File

@ -1,7 +1,7 @@
add_executable(concordia-console concordia-console.cpp) add_executable(concordia-console concordia-console.cpp)
target_link_libraries(concordia-console concordia utf8case ${Boost_LIBRARIES} ${LIBCONFIG_LIB} ${LIBSTEMMER_LIB}) target_link_libraries(concordia-console concordia utf8case ${Boost_LIBRARIES} ${LIBCONFIG_LIB})
if (WITH_RE2) if (WITH_RE2)
target_link_libraries(concordia-console re2) target_link_libraries(concordia-console re2)

View File

@ -9,7 +9,6 @@ install(TARGETS concordia-server DESTINATION lib/)
install(FILES concordia_server.hpp DESTINATION include/concordia-server/) install(FILES concordia_server.hpp DESTINATION include/concordia-server/)
target_link_libraries(concordia-server log4cpp) target_link_libraries(concordia-server log4cpp)
target_link_libraries(concordia-server ${LIBSTEMMER_LIB})
target_link_libraries(concordia-server ${Boost_LIBRARIES}) target_link_libraries(concordia-server ${Boost_LIBRARIES})
if (WITH_RE2) if (WITH_RE2)

View File

@ -72,7 +72,6 @@ if(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE}) endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
target_link_libraries(concordia log4cpp) target_link_libraries(concordia log4cpp)
target_link_libraries(concordia ${LIBSTEMMER_LIB})
target_link_libraries(concordia ${Boost_LIBRARIES}) target_link_libraries(concordia ${Boost_LIBRARIES})
target_link_libraries(concordia divsufsort) target_link_libraries(concordia divsufsort)

View File

@ -1,49 +1,68 @@
/** \page compilation Concordia Installation & Build Manual /** \page compilation Concordia Installation & Build Manual
This file describes how to compile, build This page describes how to compile, build
and install Concordia library. and install Concordia library.
\section compilation1 Requirements \section compilation1 Requirements
Before you compile, make sure you have these installed:
- g++ compiler
- cmake - cmake
- Boost library - Boost library
- Log4cpp - Log4cpp
- libstemmer (Snowball stemming library)
- (optional) Doxygen - (optional) Doxygen
- (optional) TeX
\subsection compilation1_1 Boost Ubuntu installation \subsection compilation1_1 Ubuntu package list
sudo apt-get install libboost-dev libboost-serialization-dev libboost-test-dev libboost-filesystem-dev libboost-system-de libboost-program-options-dev libboost-iostreams-dev On Ubuntu 14.04, the above software comes in standard packages. Here is the complete list of these packages:
- g++
- cmake
- libboost-dev
- libboost-serialization-dev
- libboost-test-dev
- libboost-filesystem-dev
- libboost-system-dev
- libboost-program-options-dev
- libboost-iostreams-dev
- libboost-regex-dev
- libboost-locale-dev
- liblog4cpp5-dev
- libconfig++-dev
- libconfig-dev
- libpcre3-dev
- doxygen
- texlive-font-utils
\subsection compilation1_2 Log4cpp Ubuntu installation \subsection compilation1_2 Ubuntu requirements install command
sudo apt-get install liblog4cpp5-dev If you want to install all the above packages at once, simply use the below command (this will also install the optional packages):
\subsection compilation1_3 Libconfig Ubuntu installation \verbatim
sudo apt-get install libconfig++-dev sudo apt-get install g++ cmake libboost-dev libboost-serialization-dev libboost-test-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-iostreams-dev libboost-regex-dev libboost-locale-dev liblog4cpp5-dev libconfig++-dev libconfig-dev libpcre3-dev doxygen texlive-font-utils
sudo apt-get install libconfig-dev
\subsection compilation1_4 Libstemmer Ubuntu installation \endverbatim
sudo apt-get install libstemmer-dev
\subsection compilation1_5 Perl-compatible regular expressions (PCRE) Ubuntu installation
sudo apt-get install libpcre3-dev
\subsection compilation1_6 Doxygen Ubuntu installation
sudo apt-get install doxygen
\section compilation2 Build & installation procedure \section compilation2 Build & installation procedure
mkdir build<br/> To build and install Concordia, navigate to its home directory and issue the following commands:
cd build<br/>
../cmake.sh<br/> \verbatim
make<br/>
make test<br/> mkdir build
make install cd build
../cmake.sh
make
make test
sudo make install
\endverbatim
After that it is strongly recommended to run ldconfig to update linker info with newly installed shared libraries:
\verbatim
sudo ldconfig -v
\endverbatim
\section compilation3 Documentation \section compilation3 Documentation
@ -54,24 +73,29 @@ The man files in doc/man will be installed during installation. Open doc/html/in
a HTML version of the same documentation. The latex directory contains uncompiled latex a HTML version of the same documentation. The latex directory contains uncompiled latex
files. To generate a single pdf file run files. To generate a single pdf file run
\verbatim
cd doc/latex cd doc/latex
make make
\endverbatim
This should generate a single file called refman.pdf in the same directory. This should generate a single file called refman.pdf in the same directory.
\section compilation4 Sample program \section compilation4 Sample program
Sample program using the library: In order to verify whether Concordia has been installed successfully, run the following minimal example. Prepare the file test.cpp with the following contents (remember to substitute <CONCORDIA_HOME> with the path of the unpacked Concordia package).
\verbatim \verbatim
#include <concordia/concordia.hpp> #include <concordia/concordia.hpp>
#include <iostream>
using namespace std; using namespace std;
int main() { int main() {
Concordia concordia("concordia.cfg"); Concordia concordia("<CONCORDIA_HOME>/tests/resources/concordia-config/concordia.cfg");
cout << concordia.getVersion() << endl; cout << concordia.getVersion() << endl;
} }
@ -82,7 +106,7 @@ Compilation method:
\verbatim \verbatim
g++ test.cpp -lconcordia -lconfig++ -lboost_system -lboost_serialization -lboost_unit_test_framework -lboost_filesystem -lboost_program_options -lboost_iostreams g++ test.cpp -lconcordia -lconfig++ -lboost_system -lboost_serialization -lboost_unit_test_framework -lboost_filesystem -lboost_program_options -lboost_iostreams -lboost_regex -lboost_locale -lutf8case
\endverbatim \endverbatim
*/ */

View File

@ -15,7 +15,7 @@ BOOST_AUTO_TEST_CASE( ConcordiaVersion )
{ {
Concordia concordia = Concordia(TestResourcesManager::getTestConcordiaConfigFilePath("concordia.cfg")); Concordia concordia = Concordia(TestResourcesManager::getTestConcordiaConfigFilePath("concordia.cfg"));
std::string version = concordia.getVersion(); std::string version = concordia.getVersion();
BOOST_CHECK_EQUAL( version , "0.1"); BOOST_CHECK_EQUAL( version , "1.0");
} }

View File

@ -3,13 +3,14 @@
#include <string> #include <string>
#include <climits> #include <climits>
#include "concordia/common/config.hpp"
#include "concordia/example.hpp" #include "concordia/example.hpp"
BOOST_AUTO_TEST_SUITE(exampleTest) BOOST_AUTO_TEST_SUITE(exampleTest)
BOOST_AUTO_TEST_CASE( ExceedingId ) BOOST_AUTO_TEST_CASE( ExceedingId )
{ {
unsigned long maxId = (ULLONG_MAX >> 8) - 1; SUFFIX_MARKER_TYPE maxId = (SUFFIX_MARKER_TYPE_MAX_VALUE >> 8) - 1;
Example example1("Test", maxId); Example example1("Test", maxId);
bool exceptionThrown = false; bool exceptionThrown = false;

View File

@ -4,7 +4,7 @@
#include "tests/common/test_resources_manager.hpp" #include "tests/common/test_resources_manager.hpp"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "divsufsort.h" #include <divsufsort.h>
BOOST_AUTO_TEST_SUITE(utils) BOOST_AUTO_TEST_SUITE(utils)

View File

@ -92,10 +92,3 @@ if(BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif(BUILD_EXAMPLES) endif(BUILD_EXAMPLES)
## Add 'uninstall' target ##
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake")

View File

@ -160,3 +160,4 @@ if(BUILD_DIVSUFSORT64)
"${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" @ONLY) "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" DESTINATION include) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" DESTINATION include)
endif(BUILD_DIVSUFSORT64) endif(BUILD_DIVSUFSORT64)