# Copyright René Ferdinand Rivera Morell 2023-2024
# Copyright (c) 2021 Nikita Kniazev
# 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)

require-b2 5.2 ;

import feature ;

if ! [ feature.valid known-warnings ] {
    feature.feature known-warnings : hide show : incidental propagated ;
}

local 9.0-14.0 = 9.0 10.0 11.0 12.0 14.0 ;

constant boost_dependencies :
    /boost/array//boost_array
    /boost/assert//boost_assert
    /boost/config//boost_config
    /boost/core//boost_core
    /boost/endian//boost_endian
    /boost/function//boost_function
    /boost/function_types//boost_function_types
    /boost/fusion//boost_fusion
    /boost/integer//boost_integer
    /boost/io//boost_io
    /boost/iterator//boost_iterator
    /boost/move//boost_move
    /boost/mpl//boost_mpl
    /boost/optional//boost_optional
    /boost/phoenix//boost_phoenix
    /boost/pool//boost_pool
    /boost/preprocessor//boost_preprocessor
    /boost/proto//boost_proto
    /boost/range//boost_range
    /boost/regex//boost_regex
    /boost/smart_ptr//boost_smart_ptr
    /boost/static_assert//boost_static_assert
    /boost/thread//boost_thread
    /boost/throw_exception//boost_throw_exception
    /boost/type_traits//boost_type_traits
    /boost/typeof//boost_typeof
    /boost/unordered//boost_unordered
    /boost/utility//boost_utility
    /boost/variant//boost_variant ;

project /boost/spirit
    : common-requirements
        <include>include
    : requirements
        # Warnings that we have not managed to fix yet
        <known-warnings>hide,<toolset>msvc:<cxxflags>-wd4244  # conversion from 'T' to 'U', possible loss of data
        <known-warnings>hide,<toolset>msvc:<cxxflags>-wd4365  # conversion from 'T' to 'U', signed/unsigned mismatch
        <known-warnings>hide,<toolset>msvc:<cxxflags>-wd4459  # declaration of 'varname' hides global declaration

        # Enable additional useful warnings
        <warnings>extra,<toolset>gcc:<cxxflags>-Wshadow-local
        <warnings>extra,<toolset>clang-linux:<cxxflags>-Wshadow-field-in-constructor
        <warnings>extra,<toolset>clang-linux:<cxxflags>-Wshadow-uncaptured-local
        <warnings>extra,<toolset>clang-linux:<cxxflags>-Wundefined-reinterpret-cast
        <warnings>extra,<toolset>msvc:<cxxflags>-w44555  # result of expression not used

        # Broken or very high false-positive rate
        <known-warnings>hide,<toolset>gcc:<cxxflags>-Wno-maybe-uninitialized  # Too many pesky false-positives
        <known-warnings>hide,<toolset>msvc-$(9.0-14.0):<cxxflags>-wd4100  # unreferenced formal parameter
        <known-warnings>hide,<toolset>msvc-$(9.0-14.0):<cxxflags>-wd4512  # assignment operator could not be generated
        <known-warnings>hide,<toolset>msvc-$(9.0-14.0):<cxxflags>-wd4714  # function 'x' marked as __forceinline not inlined
    ;

explicit
    [ alias boost_spirit : : : : <library>$(boost_dependencies) ]
    [ alias all : boost_spirit example test ]
    ;

call-if : boost-library spirit
    ;

