diff --git a/CMakeLists.txt b/CMakeLists.txt index 302b8f652c8cf5c540b09bae4527732866c57439..cac476d4c36f5f79cb23eccc8bfd95d9740f910e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,12 +72,15 @@ MARK_AS_ADVANCED(LIBCORPUS2_SRC_DATA_DIR) add_subdirectory(libpwrutils) add_subdirectory(libcorpus2) add_subdirectory(libcorpus2_whole) + if(CORPUS2_BUILD_POLIQARP) add_subdirectory(poliqarp-library) add_subdirectory(poliqarp) + add_definitions( -DWITH_POLIQARP ) else() message(STATUS "Not building Poliqarp library and wrapper") endif(CORPUS2_BUILD_POLIQARP) + add_subdirectory(corpus2tools) add_subdirectory(tests) diff --git a/libcorpus2_whole/CMakeLists.txt b/libcorpus2_whole/CMakeLists.txt index e4f6ca987c7e19c00b239ed53ac4f8f4f859f433..8312adfcf37a6c84b92fb401ed487c45179f894f 100644 --- a/libcorpus2_whole/CMakeLists.txt +++ b/libcorpus2_whole/CMakeLists.txt @@ -13,11 +13,16 @@ SET(libcorpus2_whole_SRC io/relreader.cpp io/documentreader.cpp io/documentcorpusreader.cpp - io/poliqarpdocumentreader.cpp - io/poliqarpcorpusreader.cpp io/corpusreader.cpp ) +if(CORPUS2_BUILD_POLIQARP) + SET(libcorpus2_whole_SRC ${libcorpus2_whole_SRC} + io/poliqarpdocumentreader.cpp + io/poliqarpcorpusreader.cpp + ) +endif(CORPUS2_BUILD_POLIQARP) + file(GLOB_RECURSE INCS "*.h") if(WIN32) diff --git a/libcorpus2_whole/io/corpusreader.cpp b/libcorpus2_whole/io/corpusreader.cpp index 56538ad5115a7ce386243bb1214378502f634a99..bbe0154920f040469480b842bc99c09e891b266a 100644 --- a/libcorpus2_whole/io/corpusreader.cpp +++ b/libcorpus2_whole/io/corpusreader.cpp @@ -1,7 +1,11 @@ #include <libcorpus2_whole/io/corpusreader.h> -#include <libcorpus2_whole/io/poliqarpcorpusreader.h> #include <libcorpus2_whole/io/documentcorpusreader.h> +#ifdef WITH_POLIQARP +#include <libcorpus2_whole/io/poliqarpcorpusreader.h> +#endif + + namespace Corpus2 { namespace whole{ @@ -24,14 +28,16 @@ boost::shared_ptr<Corpus> CorpusReader::read(const std::string& corpus_file_path // boost::shared_ptr<CorpusReaderI> CorpusReader::get_corpus_reader_by_type() { - if (corpus_type_ == "poliqarp") { - return boost::shared_ptr<PoliqarpCorpusReader>( - new PoliqarpCorpusReader(tagset_)); - } else if (corpus_type_ == "document") { + if (corpus_type_ == "document") { return boost::shared_ptr<DocumentCorpusReader>( new DocumentCorpusReader(tagset_)); +#ifdef WITH_POLIQARP + } else if (corpus_type_ == "poliqarp") { + return boost::shared_ptr<PoliqarpCorpusReader>( + new PoliqarpCorpusReader(tagset_)); +#endif } - throw Corpus2Error(corpus_type_ + " is unknown reader type!"); + throw Corpus2Error(corpus_type_ + " is an unknown reader type!"); } } // whole ns diff --git a/poliqarp-library/CMakeLists.txt b/poliqarp-library/CMakeLists.txt index a5561d8f82a0ab9be92d3c8fa754d547ae43b4c3..c232c81770128e80d978867ef20c6b2b6c82dbd5 100644 --- a/poliqarp-library/CMakeLists.txt +++ b/poliqarp-library/CMakeLists.txt @@ -142,7 +142,7 @@ set(poliqarpd_SRC ) add_library(poliqarpc2 SHARED ${foostring_SRC} ${progress_SRC} ${unibits_SRC} ${common_SRC} ${sakura_SRC} ${BF_SOURCES} ${PoliqarpLibrary_BINARY_DIR}/sakura/parser.h) -add_dependencies(poliqarpc2 ${PoliqarpLibrary_BINARY_DIR}/sakura/parser.ha) +#add_dependencies(poliqarpc2 ${PoliqarpLibrary_BINARY_DIR}/sakura/parser.h) set_target_properties(poliqarpc2 PROPERTIES VERSION "${pqlib_ver_major}.${pqlib_ver_minor}" SOVERSION ${pqlib_ver_major}) diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index 5e257c1d5641f62b111990d81b4524aba6f8cd1e..dd7bb2cdbcc4a500c7e0c717567973cccfc90b57 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -2,7 +2,11 @@ PROJECT(corpus2SwigWrap) -set(LIBS "corpus2" "corpus2_whole" "corpus2_poliqarpreader" "pwrutils") +set(LIBS "corpus2" "corpus2_whole" "pwrutils") + +if(CORPUS2_BUILD_POLIQARP) + set(LIBS ${LIBS} "corpus2_poliqarpreader" ) +endif(CORPUS2_BUILD_POLIQARP) include_directories (${corpus2_SOURCE_DIR}) include_directories (${pwrutils_SOURCE_DIR})