diff --git a/CMakeLists.txt b/CMakeLists.txt index fee6e6c11994d0f82b9af916ed84f648470690bd..020717a83d84edf653cb80f8b5ed2506811c108a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ PROJECT(WCCL) cmake_minimum_required(VERSION 2.8.0) -set(ver_major "0") -set(ver_minor "0") -set(ver_patch "4") +set(wccl_ver_major "0") +set(wccl_ver_minor "1") +set(wccl_ver_patch "1") + +set(LIBWCCL_VERSION "${wccl_ver_major}.${wccl_ver_minor}.${wccl_ver_patch}") # use some of our own Find* scripts set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeScripts) @@ -47,8 +49,6 @@ endif(CMAKE_COMPILER_IS_GNUCXX) set(LIBS "") include_directories(${WCCL_SOURCE_DIR}) -set(LIBWCCL_VERSION "${ver_major}.${ver_minor}.${ver_patch}") - find_package(Boost 1.41 REQUIRED COMPONENTS program_options system filesystem regex) if(MSVC OR BORLAND) diff --git a/libwccl/CMakeLists.txt b/libwccl/CMakeLists.txt index a763a8f4b7241e647a0216c7d0ed1daa91aacc75..bae27de315d59284ca98ff02df1259ceac071ff8 100644 --- a/libwccl/CMakeLists.txt +++ b/libwccl/CMakeLists.txt @@ -2,7 +2,9 @@ PROJECT(wccl) +configure_file(version.in include/libwccl/version.h) include_directories( ${CMAKE_CURRENT_BINARY_DIR}/include/ ) +add_definitions(-DHAVE_VERSION_H) find_package(Corpus2 1.0.12 REQUIRED) set(LIBS ${LIBS} ${Corpus2_LIBRARIES}) @@ -159,8 +161,8 @@ endif(WIN32) target_link_libraries ( wccl ${LIBS}) set_target_properties(wccl PROPERTIES - VERSION "${ver_major}.${ver_minor}" - SOVERSION ${ver_major}) + VERSION "${wccl_ver_major}.${wccl_ver_minor}" + SOVERSION ${wccl_ver_major}) if(UNIX) diff --git a/libwccl/version.in b/libwccl/version.in new file mode 100644 index 0000000000000000000000000000000000000000..51488ed26f25b93b8b786cfc7a2de968f4868fb4 --- /dev/null +++ b/libwccl/version.in @@ -0,0 +1,9 @@ +#ifndef LIBWCCL_VERSION_H +#define LIBWCCL_VERSION_H + +#define LIBWCCL_VERSION_MAJOR @wccl_ver_major@ +#define LIBWCCL_VERSION_MINOR @wccl_ver_minor@ +#define LIBWCCL_VERSION_PATCH @wccl_ver_patch@ +#define LIBWCCL_VERSION "@LIBWCCL_VERSION@" + +#endif diff --git a/wccl-apps/CMakeLists.txt b/wccl-apps/CMakeLists.txt index 9122f0f0891a14c8f8694780b978b5ba83db3363..85550bfd714fce50da42ac615ffdcf8eee19eb89 100644 --- a/wccl-apps/CMakeLists.txt +++ b/wccl-apps/CMakeLists.txt @@ -16,6 +16,7 @@ find_package(Loki REQUIRED QUIET) set(LIBS ${LIBS} loki) include_directories(${CMAKE_SOURCE_DIR}) +include_directories(${wccl_BINARY_DIR}/include) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) diff --git a/wccl-apps/wccl-features.cpp b/wccl-apps/wccl-features.cpp index c1e864103787e1514a1d6f8e6fdda6de9bc0b365..7bf41eb3f5f3ac570412bb89e7bdff2a0559947d 100644 --- a/wccl-apps/wccl-features.cpp +++ b/wccl-apps/wccl-features.cpp @@ -11,6 +11,9 @@ #include <libwccl/values/tset.h> #include <libwccl/values/strset.h> +// not checking for HAVE_VERSION..., no reason for its absence +#include <libwccl/version.h> + #include <boost/bind.hpp> #include <boost/algorithm/string.hpp> #include <boost/make_shared.hpp> @@ -444,6 +447,7 @@ int main(int argc, char** argv) ("output-header,H", value(&output_header), "Output table header") ("help,h", "Show help") + ("version", "print version string") ; boost::program_options::variables_map vm; boost::program_options::positional_options_description p; @@ -468,6 +472,11 @@ int main(int argc, char** argv) return 1; } + if (vm.count("version")) { + std::cout << "wccl-features (libwccl) " << LIBWCCL_VERSION << "\n"; + return 0; + } + foreach (const std::string& f, files) { if (f == "-") { corpus_stdin = true; diff --git a/wccl-apps/wccl-parser.cpp b/wccl-apps/wccl-parser.cpp index 1251246fd613468f550f557f1e5534e662812470..39867f189f6c2dcf311069465593065b3ac95547 100644 --- a/wccl-apps/wccl-parser.cpp +++ b/wccl-apps/wccl-parser.cpp @@ -7,6 +7,9 @@ #include <libwccl/parser/Parser.h> #include <libcorpus2/tagsetmanager.h> +// not checking for HAVE_VERSION..., no reason for its absence +#include <libwccl/version.h> + #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <boost/program_options.hpp> @@ -246,6 +249,7 @@ int main(int argc, char** argv) ("variables,V", value(&dump_variables)->zero_tokens(), "Dump variables after running each query\n") ("help,h", "Show help") + ("version", "print version string") ; boost::program_options::variables_map vm; boost::program_options::positional_options_description p; @@ -266,6 +270,11 @@ int main(int argc, char** argv) return 1; } + if (vm.count("version")) { + std::cout << "wccl-parser (libwccl) " << LIBWCCL_VERSION << "\n"; + return 0; + } + try { const Corpus2::Tagset& tagset = Corpus2::get_named_tagset(tagset_load); boost::shared_ptr<Corpus2::Sentence> sentence; diff --git a/wccl-apps/wccl-rules.cpp b/wccl-apps/wccl-rules.cpp index 758f7d9ae1d4eb901b565c1646de35bb6d0170f9..327fec449995399f4b7f4a33305ddf0a0bc8ce1f 100644 --- a/wccl-apps/wccl-rules.cpp +++ b/wccl-apps/wccl-rules.cpp @@ -15,6 +15,9 @@ #include <libcorpus2/io/reader.h> #include <libcorpus2/io/writer.h> +// not checking for HAVE_VERSION..., no reason for its absence +#include <libwccl/version.h> + namespace { bool quiet = false; @@ -206,6 +209,7 @@ int main(int argc, char** argv) ("first-sentence-only,1", value(&opts.first)->zero_tokens(), "Only process first sentence\n") ("help,h", "Show help") + ("version", "print version string") ; boost::program_options::variables_map vm; boost::program_options::positional_options_description p; @@ -227,6 +231,11 @@ int main(int argc, char** argv) return 1; } + if (vm.count("version")) { + std::cout << "wccl-rules (libwccl) " << LIBWCCL_VERSION << "\n"; + return 0; + } + foreach (const std::string& f, files) { if (f == "-") { corpus_stdin = true; diff --git a/wccl-apps/wccl-run.cpp b/wccl-apps/wccl-run.cpp index 3fa18fbe990b88fb1d6858ccb53751ebf23139b1..0fde1e5c673812fa5c973678204f7d99d39a43a0 100644 --- a/wccl-apps/wccl-run.cpp +++ b/wccl-apps/wccl-run.cpp @@ -20,6 +20,9 @@ #include <antlr/NoViableAltException.hpp> #include <antlr/MismatchedTokenException.hpp> +// not checking for HAVE_VERSION..., no reason for its absence +#include <libwccl/version.h> + namespace { bool quiet = false; bool tabs = false; @@ -390,6 +393,7 @@ int main(int argc, char** argv) ("progress,p", value(&progress)->zero_tokens(), "Show progress info") ("help,h", "Show help") + ("version", "print version string") ; boost::program_options::variables_map vm; boost::program_options::positional_options_description p; @@ -414,6 +418,11 @@ int main(int argc, char** argv) return 1; } + if (vm.count("version")) { + std::cout << "wccl-run (libwccl) " << LIBWCCL_VERSION << "\n"; + return 0; + } + foreach (const std::string& f, files) { if (f == "-") { corpus_stdin = true;