From 95df2ca6e0a1dc83cd191dc491ba82ed44549cae Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 6 Sep 2002 03:38:30 +0000 Subject: [PATCH] Example of templates. [SVN r15173] --- examples/template_use/Jamfile | 24 ++++++++++++ examples/template_use/include/simple.h | 12 ++++++ examples/template_use/sub/Jamfile | 44 ++++++++++++++++++++++ examples/template_use/sub/simple.cpp | 19 ++++++++++ examples/template_use/sub/simple_lib.cpp | 13 +++++++ v1/example/template_use/Jamfile | 24 ++++++++++++ v1/example/template_use/include/simple.h | 12 ++++++ v1/example/template_use/sub/Jamfile | 44 ++++++++++++++++++++++ v1/example/template_use/sub/simple.cpp | 19 ++++++++++ v1/example/template_use/sub/simple_lib.cpp | 13 +++++++ 10 files changed, 224 insertions(+) create mode 100644 examples/template_use/Jamfile create mode 100644 examples/template_use/include/simple.h create mode 100644 examples/template_use/sub/Jamfile create mode 100644 examples/template_use/sub/simple.cpp create mode 100644 examples/template_use/sub/simple_lib.cpp create mode 100644 v1/example/template_use/Jamfile create mode 100644 v1/example/template_use/include/simple.h create mode 100644 v1/example/template_use/sub/Jamfile create mode 100644 v1/example/template_use/sub/simple.cpp create mode 100644 v1/example/template_use/sub/simple_lib.cpp diff --git a/examples/template_use/Jamfile b/examples/template_use/Jamfile new file mode 100644 index 000000000..f425c2f07 --- /dev/null +++ b/examples/template_use/Jamfile @@ -0,0 +1,24 @@ +# Copyright (C) 2002, Rene Rivera. Permission to copy, use, modify, sell and +# distribute this software is granted provided this copyright notice appears in +# all copies. This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Example of how to define a template. +# This is for Boost.Build-V1 + +subproject tools/build/examples/template_use ; + +# Declare the template as a target. The sources, requirements, and +# default builds sections are copied to the targets that depend (use) +# this template. +# +template t-common + : + # SOURCES + : + # REQUIREMENTS + $(SUBDIR)/include + SOME_DEFINE + : + # DEFAULT BUILDS + ; diff --git a/examples/template_use/include/simple.h b/examples/template_use/include/simple.h new file mode 100644 index 000000000..cf304470a --- /dev/null +++ b/examples/template_use/include/simple.h @@ -0,0 +1,12 @@ +/* +Copyright (C) 2002, Rene Rivera. Permission to copy, use, modify, sell and +distribute this software is granted provided this copyright notice appears in +all copies. This software is provided "as is" without express or implied +warranty, and with no claim as to its suitability for any purpose. +*/ +#ifndef simple_h +#define simple_h + +extern int lib_call(int x); + +#endif diff --git a/examples/template_use/sub/Jamfile b/examples/template_use/sub/Jamfile new file mode 100644 index 000000000..fbe7e82fa --- /dev/null +++ b/examples/template_use/sub/Jamfile @@ -0,0 +1,44 @@ +# Copyright (C) 2002, Rene Rivera. Permission to copy, use, modify, sell and +# distribute this software is granted provided this copyright notice appears in +# all copies. This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Example of how to use a template target declared in another project. +# This is for Boost.Build-V1 + +subproject tools/build/examples/template_use/sub ; + +# Declare a library target. This 'inherits' the attributes of +# the template which in this case adds the needed include +# directory. Because templates are "special" targets they +# appear in the source dependencies section and must be +# a relative reference to the template target in it's declared +# location. +# +lib simple + : + # SOURCES +