# file      : cxx/hybrid/polymorphism/multischema/buildfile
# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

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

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

  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}

exe{driver}: {hxx     cxx}{* -test -test-pskel -test-pimpl  \
                                   -test-sskel -test-simpl  \
                             -type -type-pskel -type-pimpl  \
                                   -type-sskel -type-simpl} \
             {hxx ixx cxx}{   test  test-pskel  test-sskel  \
                              type  type-pskel  type-sskel} \
             {hxx     cxx}{         test-pimpl  test-simpl  \
                                    type-pimpl  type-simpl} \
             $libs

exe{driver}: xml{test-000}: test.input  = true
exe{driver}: std{test-000}: test.stdout = true

<{hxx ixx cxx}{test test-pskel test-sskel}                   \
 {hxx     cxx}{     test-pimpl test-simpl}>: xsd{test} $xsde
{{
  re = ($cxx.target.class != 'windows' \
        ? '%.*/([^/]*)%$1%'            \
        : '%.*\\([^\\]*)%$1%')

  $xsde cxx-hybrid $cxx_hybrid_options          \
        --generate-parser                       \
        --generate-serializer                   \
        --generate-aggregate                    \
        --generate-polymorphic                  \
        --include-regex $re                     \
        --generate-typeinfo                     \
        --polymorphic-type base                 \
        --polymorphic-schema $src_base/type.xsd \
        --output-dir $out_base                  \
        $path($<[0])
}}

<{hxx ixx cxx}{type type-pskel type-sskel}                   \
 {hxx     cxx}{     type-pimpl type-simpl}>: xsd{type} $xsde
{{
  $xsde cxx-hybrid $cxx_hybrid_options \
        --generate-parser              \
        --generate-serializer          \
        --generate-aggregate           \
        --generate-polymorphic         \
        --generate-typeinfo            \
        --polymorphic-type base        \
        --output-dir $out_base         \
        $path($<[0])
}}

cxx.poptions =+ "-I$out_base"

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