# file      : tests/cc/libu/testscript
# license   : MIT; see accompanying LICENSE file

crosstest = false
test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.config.mode)

.include ../../common.testscript

+cat <<EOI >+build/bootstrap.build
using test
EOI

+cat <<EOI >=build/root.build
cxx.std = latest

using cxx

hxx{*}: extension = hxx
cxx{*}: extension = cxx

exe{*}: test = true
EOI

# Common source files that are symlinked in the test directories if used.
#
+cat <<EOI >=foo.hxx
  #ifndef LIBFOO_EXPORT
  #  define LIBFOO_EXPORT
  #endif

  LIBFOO_EXPORT extern int f;
  EOI

+cat <<EOI >=foo.cxx
  #include <foo.hxx>
  int f;
  EOI

+cat <<EOI >=bar.cxx
  #include <foo.hxx>
  struct b { b () {++f;} } b_;
  EOI

+cat <<EOI >=driver.cxx
  #include <cassert>
  #include <foo.hxx>
  int main () {assert (f != 0);}
  EOI

: basic
:
ln -s ../foo.hxx ../foo.cxx ../bar.cxx ../driver.cxx ./;
$* test clean <<EOI
  cc.poptions += "-I$src_base"

  ./: exe{foo}: cxx{driver} libue{foo}
  ./: lib{foo}: libul{foo}

  {libue libul}{foo}: cxx{foo bar}
  EOI

: members
:
: Test building individual libuX{} members.
:
ln -s ../foo.hxx ../foo.cxx ../bar.cxx ../driver.cxx ./;
$* test clean <<EOI
  cc.poptions += "-I$src_base"

  ./: exe{foo}:  cxx{driver} libue{foo}
  ./: liba{foo}: libua{foo}
  ./: libs{foo}: libus{foo}

  libue{foo} libul{foo}: cxx{foo bar}
  EOI
