# Boost.GIL (Generic Image Library)
#
# Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2018 Mateusz Loskot <mateusz@loskot.net>
#
# 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)

# TODO: Remove -Wno-unused below once tests have been cleaned up, and no longer use of assert() macro, etc.

variant ubsan_integer
    : release
    :
    <cxxflags>"-std=c++11 -Wno-unused -fstrict-aliasing -fno-omit-frame-pointer -fsanitize=integer -fno-sanitize-recover=integer -fsanitize-blacklist=libs/gil/.ci/blacklist.supp"
    <linkflags>"-fsanitize=integer"
    <debug-symbols>on
    <define>BOOST_USE_ASAN=1
    ;

variant ubsan_nullability
    : release
    :
    <cxxflags>"-std=c++11 -Wno-unused -fstrict-aliasing -fno-omit-frame-pointer -fsanitize=nullability -fno-sanitize-recover=nullability -fsanitize-blacklist=libs/gil/.ci/blacklist.supp"
    <linkflags>"-fsanitize=nullability"
    <debug-symbols>on
    <define>BOOST_USE_ASAN=1
    ;

variant ubsan_undefined
    : release
    :
    <cxxflags>"-std=c++11 -Wno-unused -fstrict-aliasing -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-blacklist=libs/gil/.ci/blacklist.supp"
    <linkflags>"-fsanitize=undefined"
    <debug-symbols>on
    <define>BOOST_USE_ASAN=1
    ;

project boost-gil
    :
    requirements
        # MSVC: Since VS2017, default is -std:c++14, so no explicit switch is required.
        <toolset>msvc:<asynch-exceptions>on
        <toolset>msvc:<cxxflags>/W4
        <toolset>msvc:<cxxflags>/bigobj
        <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE <define>_CRT_SECURE_NO_WARNINGS <define>_CRT_NONSTDC_NO_DEPRECATE <define>NOMINMAX
        <toolset>intel:<debug-symbols>off
        <toolset>gcc:<cxxflags>"-std=c++11 -pedantic -fstrict-aliasing -Wcast-align -Wconversion -Wextra -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter "
        <toolset>darwin:<cxxflags>"-std=c++11 -pedantic -fstrict-aliasing -Wcast-align -Wconversion -Wextra -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter "
        # variant filter for clang is necessary to allow ubsan_* variants declare distinct set of <cxxflags>
        <toolset>clang,<variant>debug:<cxxflags>"-std=c++11 -pedantic -fstrict-aliasing -Wcast-align -Wconversion -Wextra -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter -Wsign-conversion"
        <toolset>clang,<variant>release:<cxxflags>"-std=c++11 -pedantic -fstrict-aliasing -Wcast-align -Wconversion -Wextra -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter -Wsign-conversion"
    ;

build-project example ;
build-project test ;
build-project numeric/test ;
build-project toolbox/test ;
build-project io/test ;
