# file      : cxx/hybrid/binary/custom/buildfile
# license   : not copyrighted - public domain

if ($build.meta_operation != 'dist')
{
  assert ($stl) \
    "config.xsde_examples.stl should be set to true for this example"

  assert ($iostream) \
    "config.xsde_examples.iostream should be set to true for this example"

  assert ($exceptions) \
    "config.xsde_examples.exceptions should be set to true for this example"

  assert ($reuse_style != 'none') \
    "config.xsde_examples.reuse_style should not be set to 'none' for this example"

  assert (!$custom_allocator || $default_allocator) \
    "config.xsde_examples.default_allocator should be set to true for this example"
}

import libs = libxsde%lib{xsde}

exe{driver}: {hxx ixx txx cxx}{* -library    -library-pskel    -library-sskel     \
                                             -library-pimpl    -library-simpl     \
                                 -xml-schema -xml-schema-pskel -xml-schema-sskel} \
             {hxx ixx     cxx}{   library     library-pskel     library-sskel}    \
             {hxx         cxx}{               library-pimpl     library-simpl}    \
             {hxx            }{   xml-schema  xml-schema-pskel  xml-schema-sskel} \
             $libs

exe{driver}: xml{library}: test.input = true

# Note that the xml-schema.xsd file need not exist and is only used to derive
# the names of the included header files.
#
<{hxx ixx cxx}{library library-pskel library-sskel}                      \
 {hxx     cxx}{        library-pimpl library-simpl}>: xsd{library} $xsde
{{
  # For options contained in cxx_hybrid_options variable see build/root.build.
  #
  $xsde cxx-hybrid $cxx_hybrid_options             \
        --generate-parser                          \
        --generate-serializer                      \
        --generate-aggregate                       \
        --extern-xml-schema xml-schema.xsd         \
        --generate-insertion orawstream            \
        --hxx-prologue '#include "orawstream.hxx"' \
        --generate-extraction irawstream           \
        --hxx-prologue '#include "irawstream.hxx"' \
        --output-dir $out_base                     \
        $path($<[0])
}}

# Note that the xml-schema.xsd file need not exist nor it is being
# generated. It is only used to derive the names of the resulting header
# files.
#
<{hxx}{xml-schema xml-schema-pskel xml-schema-sskel}>: $xsde
{{
  $xsde cxx-hybrid $cxx_hybrid_options \
        --generate-xml-schema          \
        --generate-parser              \
        --generate-serializer          \
        --output-dir $out_base         \
        xml-schema.xsd
}}

cxx.poptions =+ "-I$out_base" "-I$src_base"

if ($reuse_style == 'mixin' && $cxx.class == 'gcc')
  cxx.coptions += -Wno-overloaded-virtual
