# file      : cxx/hybrid/file-per-type/buildfile
# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

if ($build.meta_operation != 'dist')
{
  assert ($reuse_style != 'none') \
    "config.xsde_tests.reuse_style should not be set to 'none' for this test"

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

import libs = libxsde%lib{xsde}

# @@ TMP: redo via dyndep when we have make dependency generation (or
#    --file-list?) in the XSD/e compiler. See XSD.
#
exe{driver}: {        cxx}{driver                                      } \
             {hxx ixx cxx}{test             test-pskel       test-sskel} \
             {hxx     cxx}{                 test-pimpl       test-simpl} \
             {hxx ixx cxx}{a                   a-pskel          a-sskel} \
             {hxx     cxx}{                    a-pimpl          a-simpl} \
             {hxx ixx cxx}{b                   b-pskel          b-sskel} \
             {hxx     cxx}{                    b-pimpl          b-simpl} \
             {hxx ixx cxx}{derived       derived-pskel    derived-sskel} \
             {hxx     cxx}{              derived-pimpl    derived-simpl} \
             {hxx ixx cxx}{base             base-pskel       base-sskel} \
             {hxx     cxx}{                 base-pimpl       base-simpl} \
             {hxx        }{xml-schema xml-schema-pskel xml-schema-sskel} \
             $libs

<{hxx ixx cxx}{test       test-pskel    test-sskel} \
 {hxx     cxx}{           test-pimpl    test-simpl} \
 {hxx ixx cxx}{a             a-pskel       a-sskel} \
 {hxx     cxx}{              a-pimpl       a-simpl} \
 {hxx ixx cxx}{b             b-pskel       b-sskel} \
 {hxx     cxx}{              b-pimpl       b-simpl} \
 {hxx ixx cxx}{derived derived-pskel derived-sskel} \
 {hxx     cxx}{        derived-pimpl derived-simpl} \
 {hxx ixx cxx}{base       base-pskel    base-sskel} \
 {hxx     cxx}{           base-pimpl    base-simpl}>: xsd{test a b} $xsde
{{
  $xsde cxx-hybrid $cxx_hybrid_options     \
        --generate-parser                  \
        --generate-serializer              \
        --generate-aggregate               \
        --file-per-type                    \
        --extern-xml-schema xml-schema.xsd \
        --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"

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