diff --git a/CMakeLists.txt b/CMakeLists.txt index e0ae189..a69d865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ SET( CMAKE_CXX_FLAGS "" ) FIND_PACKAGE(Boost COMPONENTS program_options ) SET_PACKAGE_PROPERTIES(Boost PROPERTIES URL "http://www.boost.org" DESCRIPTION "Boost library support" TYPE OPTIONAL) -SET(USE_BOOST ${Boost_FOUND}) + OPTION( USE_OPENCV "Add OpenCV support" ON ) IF( USE_OPENCV ) @@ -103,6 +103,7 @@ SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "L ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support" ) ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors" ) + IF( WIN32 ) INCLUDE( cmake/Win32.cmake ) ENDIF() @@ -131,10 +132,8 @@ ADD_FEATURE_INFO(PlaYUVerTools PLAYUVER_BUILD_APP "Build Command line too ADD_SUBDIRECTORY( lib ) ADD_SUBDIRECTORY( modules ) -IF( ${USE_BOOST} ) - IF( ${PLAYUVER_BUILD_TOOLS} ) - ADD_SUBDIRECTORY( tools ) - ENDIF() +IF( ${PLAYUVER_BUILD_TOOLS} ) + ADD_SUBDIRECTORY( tools ) ENDIF() IF( ${PLAYUVER_BUILD_APP} ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 4a76c21..984c7d4 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -4,7 +4,13 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../ ) -INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) +# +# Add boost support +# +IF( NOT ${Boost_FOUND} ) + MESSAGE("Using internal boost program options lib") + ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/external/boost_program_options ) +ENDIF() set(plaYUver_Lib_SRCS # Frame @@ -13,13 +19,10 @@ set(plaYUver_Lib_SRCS PlaYUVerFrameStats.cpp # Stream PlaYUVerStream.cpp + # Command Line Parser + PlaYUVerCmdParser.cpp ) -IF( USE_BOOST ) - # Command Line Parser - LIST( APPEND plaYUver_Lib_SRCS PlaYUVerCmdParser.cpp ) -ENDIF() - IF( USE_FFMPEG ) LIST( APPEND plaYUver_Lib_SRCS LibAvContextHandle.cpp ) ENDIF() diff --git a/lib/external/boost_program_options/CMakeLists.txt b/lib/external/boost_program_options/CMakeLists.txt new file mode 100644 index 0000000..66d891c --- /dev/null +++ b/lib/external/boost_program_options/CMakeLists.txt @@ -0,0 +1,29 @@ +### +### CMakeLists for playuver external component +### + + +# +# Boost Library +# + +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include ) + +set(BoostProgramOptions_SRCS + src/cmdline.cpp + src/config_file.cpp + src/options_description.cpp + src/parsers.cpp + src/variables_map.cpp + src/value_semantic.cpp + src/positional_options.cpp + src/utf8_codecvt_facet.cpp + src/convert.cpp + src/winmain.cpp + src/split.cpp +) + +ADD_LIBRARY( BoostProgramOptions STATIC ${BoostProgramOptions_SRCS} ) + +SET( Boost_FOUND TRUE PARENT_SCOPE) +SET( Boost_LIBRARIES BoostProgramOptions PARENT_SCOPE) diff --git a/lib/external/boost_program_options/include/boost/program_options.hpp b/lib/external/boost_program_options/include/boost/program_options.hpp new file mode 100644 index 0000000..dc35011 --- /dev/null +++ b/lib/external/boost_program_options/include/boost/program_options.hpp @@ -0,0 +1,25 @@ +// Copyright Vladimir Prus 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See www.boost.org/libs/program_options for documentation. + +#ifndef PROGRAM_OPTIONS_VP_2003_05_19 +#define PROGRAM_OPTIONS_VP_2003_05_19 + +#if defined(_MSC_VER) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/lib/external/boost_program_options/include/boost/program_options/cmdline.hpp b/lib/external/boost_program_options/include/boost/program_options/cmdline.hpp new file mode 100644 index 0000000..8705e60 --- /dev/null +++ b/lib/external/boost_program_options/include/boost/program_options/cmdline.hpp @@ -0,0 +1,90 @@ +// Copyright Vladimir Prus 2004. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_CMDLINE_HPP_VP_2004_03_13 +#define BOOST_CMDLINE_HPP_VP_2004_03_13 + +namespace boost { namespace program_options { namespace command_line_style { + /** Various possible styles of options. + + There are "long" options, which start with "--" and "short", + which start with either "-" or "/". Both kinds can be allowed or + disallowed, see allow_long and allow_short. The allowed character + for short options is also configurable. + + Option's value can be specified in the same token as name + ("--foo=bar"), or in the next token. + + It's possible to introduce long options by the same character as + short options, see allow_long_disguise. + + Finally, guessing (specifying only prefix of option) and case + insensitive processing are supported. + */ + enum style_t { + /// Allow "--long_name" style + allow_long = 1, + /// Allow "--foo=10 + */ + allow_long_disguise = short_case_insensitive << 1, + /** The more-or-less traditional unix style. */ + unix_style = (allow_short | short_allow_adjacent | short_allow_next + | allow_long | long_allow_adjacent | long_allow_next + | allow_sticky | allow_guessing + | allow_dash_for_short), + /** The default style. */ + default_style = unix_style + }; +}}} + + +#endif + diff --git a/lib/external/boost_program_options/include/boost/program_options/config.hpp b/lib/external/boost_program_options/include/boost/program_options/config.hpp new file mode 100644 index 0000000..8b70521 --- /dev/null +++ b/lib/external/boost_program_options/include/boost/program_options/config.hpp @@ -0,0 +1,52 @@ +// Copyright (c) 2004 Hartmut Kaiser +// +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_PROGRAM_OPTIONS_CONFIG_HK_2004_01_11 +#define BOOST_PROGRAM_OPTIONS_CONFIG_HK_2004_01_11 + +#include +#include + +// Support for autolinking. +#if BOOST_VERSION >= 103100 // works beginning from Boost V1.31.0 + +/////////////////////////////////////////////////////////////////////////////// +// enable automatic library variant selection +#if !defined(BOOST_PROGRAM_OPTIONS_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \ + !defined(BOOST_PROGRAM_OPTIONS_NO_LIB) + +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +#define BOOST_LIB_NAME boost_program_options +// tell the auto-link code to select a dll when required: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_PROGRAM_OPTIONS_DYN_LINK) +# define BOOST_DYN_LINK +#endif + +// And include the header that does the work: +#include + +#endif // auto-linking disabled + +#endif // BOOST_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_PROGRAM_OPTIONS_DYN_LINK) +// export if this is our own source, otherwise import: +#ifdef BOOST_PROGRAM_OPTIONS_SOURCE +# define BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_EXPORT +#else +# define BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_IMPORT +#endif // BOOST_PROGRAM_OPTIONS_SOURCE +#endif // DYN_LINK + +#ifndef BOOST_PROGRAM_OPTIONS_DECL +#define BOOST_PROGRAM_OPTIONS_DECL +#endif + + +#endif // PROGRAM_OPTIONS_CONFIG_HK_2004_01_11 + diff --git a/lib/external/boost_program_options/include/boost/program_options/detail/cmdline.hpp b/lib/external/boost_program_options/include/boost/program_options/detail/cmdline.hpp new file mode 100644 index 0000000..8e3bcc6 --- /dev/null +++ b/lib/external/boost_program_options/include/boost/program_options/detail/cmdline.hpp @@ -0,0 +1,159 @@ +// Copyright Vladimir Prus 2002-2004. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + + +#ifndef BOOST_CMDLINE_VP_2003_05_19 +#define BOOST_CMDLINE_VP_2003_05_19 + +#include +#include +#include +#include +#include +#include + + +#include + +#include + +#include +#include + +#if defined(BOOST_MSVC) +# pragma warning (push) +# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::positional_options_description' +#endif + +namespace boost { namespace program_options { namespace detail { + + /** Command line parser class. Main requirements were: + - Powerful enough to support all common uses. + - Simple and easy to learn/use. + - Minimal code size and external dependencies. + - Extensible for custom syntaxes. + + First all options are registered. After that, elements of command line + are extracted using operator++. + + For each element, user can find + - if it's an option or an argument + - name of the option + - index of the option + - option value(s), if any + + Sometimes the registered option name is not equal to the encountered + one, for example, because name abbreviation is supported. Therefore + two option names can be obtained: + - the registered one + - the one found at the command line + + There are lot of style options, which can be used to tune the command + line parsing. In addition, it's possible to install additional parser + which will process custom option styles. + + @todo mininal match length for guessing? + */ + class BOOST_PROGRAM_OPTIONS_DECL cmdline { + public: + + typedef ::boost::program_options::command_line_style::style_t style_t; + + typedef function1, + const std::string&> + additional_parser; + + typedef function1, std::vector&> + style_parser; + + /** Constructs a command line parser for (argc, argv) pair. Uses + style options passed in 'style', which should be binary or'ed values + of style_t enum. It can also be zero, in which case a "default" + style will be used. If 'allow_unregistered' is true, then allows + unregistered options. They will be assigned index 1 and are + assumed to have optional parameter. + */ + cmdline(const std::vector& args); + + /** @overload */ + cmdline(int argc, const char*const * argv); + + void style(int style); + + /** returns the canonical option prefix associated with the command_line_style + * In order of precedence: + * allow_long : allow_long + * allow_long_disguise : allow_long_disguise + * allow_dash_for_short : allow_short | allow_dash_for_short + * allow_slash_for_short: allow_short | allow_slash_for_short + * + * This is mainly used for the diagnostic messages in exceptions + */ + int get_canonical_option_prefix(); + + void allow_unregistered(); + + void set_options_description(const options_description& desc); + void set_positional_options( + const positional_options_description& m_positional); + + std::vector