From ef4070dd12a9aedec805003beaad3816ca4dc3f4 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 19 Jun 2017 18:26:51 +0300 Subject: Move project into intermediate sub-directory --- libformat/.gitignore | 16 ++++++++++++++++ libformat/build/.gitignore | 1 + libformat/build/bootstrap.build | 7 +++++++ libformat/build/export.build | 6 ++++++ libformat/build/root.build | 6 ++++++ libformat/buildfile | 23 +++++----------------- libformat/export.hxx | 36 ----------------------------------- libformat/format.cxx | 11 ----------- libformat/format.hxx | 10 ---------- libformat/libformat/buildfile | 21 ++++++++++++++++++++ libformat/libformat/export.hxx | 36 +++++++++++++++++++++++++++++++++++ libformat/libformat/format.cxx | 11 +++++++++++ libformat/libformat/format.hxx | 10 ++++++++++ libformat/manifest | 15 +++++++++++++++ libformat/tests/.gitignore | 1 + libformat/tests/build/.gitignore | 1 + libformat/tests/build/bootstrap.build | 5 +++++ libformat/tests/build/root.build | 14 ++++++++++++++ libformat/tests/buildfile | 1 + libformat/tests/test/buildfile | 4 ++++ libformat/tests/test/driver.cxx | 13 +++++++++++++ libformat/tests/test/test.out | 1 + 22 files changed, 174 insertions(+), 75 deletions(-) create mode 100644 libformat/.gitignore create mode 100644 libformat/build/.gitignore create mode 100644 libformat/build/bootstrap.build create mode 100644 libformat/build/export.build create mode 100644 libformat/build/root.build delete mode 100644 libformat/export.hxx delete mode 100644 libformat/format.cxx delete mode 100644 libformat/format.hxx create mode 100644 libformat/libformat/buildfile create mode 100644 libformat/libformat/export.hxx create mode 100644 libformat/libformat/format.cxx create mode 100644 libformat/libformat/format.hxx create mode 100644 libformat/manifest create mode 100644 libformat/tests/.gitignore create mode 100644 libformat/tests/build/.gitignore create mode 100644 libformat/tests/build/bootstrap.build create mode 100644 libformat/tests/build/root.build create mode 100644 libformat/tests/buildfile create mode 100644 libformat/tests/test/buildfile create mode 100644 libformat/tests/test/driver.cxx create mode 100644 libformat/tests/test/test.out (limited to 'libformat') diff --git a/libformat/.gitignore b/libformat/.gitignore new file mode 100644 index 0000000..a887fdd --- /dev/null +++ b/libformat/.gitignore @@ -0,0 +1,16 @@ +# Compiler/linker output. +# +*.d +*.ii +*.o +*.obj +*.so +*.dll +*.a +*.lib +*.exp +*.exe +*.exe.dlls/ +*.exe.manifest + +version diff --git a/libformat/build/.gitignore b/libformat/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/libformat/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/libformat/build/bootstrap.build b/libformat/build/bootstrap.build new file mode 100644 index 0000000..b6e8537 --- /dev/null +++ b/libformat/build/bootstrap.build @@ -0,0 +1,7 @@ +project = libformat + +using version +using config +using dist +using test +using install diff --git a/libformat/build/export.build b/libformat/build/export.build new file mode 100644 index 0000000..25c99aa --- /dev/null +++ b/libformat/build/export.build @@ -0,0 +1,6 @@ +$out_root/: +{ + include libformat/ +} + +export $out_root/libformat/lib{format} diff --git a/libformat/build/root.build b/libformat/build/root.build new file mode 100644 index 0000000..8ceadfa --- /dev/null +++ b/libformat/build/root.build @@ -0,0 +1,6 @@ +cxx.std = 11 + +using cxx + +hxx{*}: extension = hxx +cxx{*}: extension = cxx diff --git a/libformat/buildfile b/libformat/buildfile index 4f6f156..27e0dec 100644 --- a/libformat/buildfile +++ b/libformat/buildfile @@ -1,21 +1,8 @@ -lib{format}: {hxx cxx}{format} hxx{export} +./: libformat/ tests/ doc{version} file{manifest} -# For pre-releases use the complete version to make sure they cannot be used -# in place of another pre-release or the final version. -# -if $version.pre_release - lib{format}: bin.lib.version = @"-$version.project_id" -else - lib{format}: bin.lib.version = @"-$version.major.$version.minor" - -cxx.poptions =+ "-I$out_root" "-I$src_root" -obja{*}: cxx.poptions += -DLIBFORMAT_STATIC_BUILD -objs{*}: cxx.poptions += -DLIBFORMAT_SHARED_BUILD - -lib{format}: cxx.export.poptions = "-I$out_root" "-I$src_root" -liba{format}: cxx.export.poptions += -DLIBFORMAT_STATIC -libs{format}: cxx.export.poptions += -DLIBFORMAT_SHARED +doc{version}: file{manifest} # Generated by the version module. +doc{version}: dist = true -# Install into the libformat/ subdirectory of, say, /usr/include/. +# Don't install tests. # -install.include = $install.include/libformat/ +dir{tests/}: install = false diff --git a/libformat/export.hxx b/libformat/export.hxx deleted file mode 100644 index 125c9df..0000000 --- a/libformat/export.hxx +++ /dev/null @@ -1,36 +0,0 @@ -// file: libformat/export.hxx -*- C++ -*- - -#pragma once - -// Normally we don't export class templates (but do complete specializations), -// inline functions, and classes with only inline member functions. Exporting -// classes that inherit from non-exported/imported bases (e.g., std::string) -// will end up badly. The only known workarounds are to not inherit or to not -// export. Also, MinGW GCC doesn't like seeing non-exported function being -// used before their inline definition. The workaround is to reorder code. In -// the end it's all trial and error. - -#if defined(LIBFORMAT_STATIC) // Using static. -# define LIBFORMAT_EXPORT -#elif defined(LIBFORMAT_STATIC_BUILD) // Building static. -# define LIBFORMAT_EXPORT -#elif defined(LIBFORMAT_SHARED) // Using shared. -# ifdef _WIN32 -# define LIBFORMAT_EXPORT __declspec(dllimport) -# else -# define LIBFORMAT_EXPORT -# endif -#elif defined(LIBFORMAT_SHARED_BUILD) // Building shared. -# ifdef _WIN32 -# define LIBFORMAT_EXPORT __declspec(dllexport) -# else -# define LIBFORMAT_EXPORT -# endif -#else -// If none of the above macros are defined, then we assume we are being used -// by some third-party build system that cannot/doesn't signal the library -// type. Note that this fallback works for both static and shared but in case -// of shared will be sub-optimal compared to having dllimport. -// -# define LIBFORMAT_EXPORT // Using static or shared. -#endif diff --git a/libformat/format.cxx b/libformat/format.cxx deleted file mode 100644 index 421f50d..0000000 --- a/libformat/format.cxx +++ /dev/null @@ -1,11 +0,0 @@ -// file: libformat/format.cxx -*- C++ -*- - -#include - -using namespace std; - -string -format (const string& g, const string& n) -{ - return g + ", " + n + '!'; -} diff --git a/libformat/format.hxx b/libformat/format.hxx deleted file mode 100644 index 9c813ac..0000000 --- a/libformat/format.hxx +++ /dev/null @@ -1,10 +0,0 @@ -// file: libformat/format.hxx -*- C++ -*- - -#pragma once - -#include - -#include - -LIBFORMAT_EXPORT std::string -format (const std::string& greeting, const std::string& name); diff --git a/libformat/libformat/buildfile b/libformat/libformat/buildfile new file mode 100644 index 0000000..4f6f156 --- /dev/null +++ b/libformat/libformat/buildfile @@ -0,0 +1,21 @@ +lib{format}: {hxx cxx}{format} hxx{export} + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. +# +if $version.pre_release + lib{format}: bin.lib.version = @"-$version.project_id" +else + lib{format}: bin.lib.version = @"-$version.major.$version.minor" + +cxx.poptions =+ "-I$out_root" "-I$src_root" +obja{*}: cxx.poptions += -DLIBFORMAT_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBFORMAT_SHARED_BUILD + +lib{format}: cxx.export.poptions = "-I$out_root" "-I$src_root" +liba{format}: cxx.export.poptions += -DLIBFORMAT_STATIC +libs{format}: cxx.export.poptions += -DLIBFORMAT_SHARED + +# Install into the libformat/ subdirectory of, say, /usr/include/. +# +install.include = $install.include/libformat/ diff --git a/libformat/libformat/export.hxx b/libformat/libformat/export.hxx new file mode 100644 index 0000000..125c9df --- /dev/null +++ b/libformat/libformat/export.hxx @@ -0,0 +1,36 @@ +// file: libformat/export.hxx -*- C++ -*- + +#pragma once + +// Normally we don't export class templates (but do complete specializations), +// inline functions, and classes with only inline member functions. Exporting +// classes that inherit from non-exported/imported bases (e.g., std::string) +// will end up badly. The only known workarounds are to not inherit or to not +// export. Also, MinGW GCC doesn't like seeing non-exported function being +// used before their inline definition. The workaround is to reorder code. In +// the end it's all trial and error. + +#if defined(LIBFORMAT_STATIC) // Using static. +# define LIBFORMAT_EXPORT +#elif defined(LIBFORMAT_STATIC_BUILD) // Building static. +# define LIBFORMAT_EXPORT +#elif defined(LIBFORMAT_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBFORMAT_EXPORT __declspec(dllimport) +# else +# define LIBFORMAT_EXPORT +# endif +#elif defined(LIBFORMAT_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBFORMAT_EXPORT __declspec(dllexport) +# else +# define LIBFORMAT_EXPORT +# endif +#else +// If none of the above macros are defined, then we assume we are being used +// by some third-party build system that cannot/doesn't signal the library +// type. Note that this fallback works for both static and shared but in case +// of shared will be sub-optimal compared to having dllimport. +// +# define LIBFORMAT_EXPORT // Using static or shared. +#endif diff --git a/libformat/libformat/format.cxx b/libformat/libformat/format.cxx new file mode 100644 index 0000000..421f50d --- /dev/null +++ b/libformat/libformat/format.cxx @@ -0,0 +1,11 @@ +// file: libformat/format.cxx -*- C++ -*- + +#include + +using namespace std; + +string +format (const string& g, const string& n) +{ + return g + ", " + n + '!'; +} diff --git a/libformat/libformat/format.hxx b/libformat/libformat/format.hxx new file mode 100644 index 0000000..9c813ac --- /dev/null +++ b/libformat/libformat/format.hxx @@ -0,0 +1,10 @@ +// file: libformat/format.hxx -*- C++ -*- + +#pragma once + +#include + +#include + +LIBFORMAT_EXPORT std::string +format (const std::string& greeting, const std::string& name); diff --git a/libformat/manifest b/libformat/manifest new file mode 100644 index 0000000..23cf1bb --- /dev/null +++ b/libformat/manifest @@ -0,0 +1,15 @@ +: 1 +name: libformat +version: 1.0.0 +summary: The "Hello World" example formatter library +license: MIT +tags: c++, hello, world, formatter, example +description: \ +A simple library that implements the "Hello World" formatting in C++. +\ +url: http://www.example.org/libformat +email: hello-users@example.org +build-email: builds@build2.org +requires: c++11 +depends: * build2 >= 0.5.0- +depends: * bpkg >= 0.5.0- diff --git a/libformat/tests/.gitignore b/libformat/tests/.gitignore new file mode 100644 index 0000000..e54525b --- /dev/null +++ b/libformat/tests/.gitignore @@ -0,0 +1 @@ +driver diff --git a/libformat/tests/build/.gitignore b/libformat/tests/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/libformat/tests/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/libformat/tests/build/bootstrap.build b/libformat/tests/build/bootstrap.build new file mode 100644 index 0000000..2c2de24 --- /dev/null +++ b/libformat/tests/build/bootstrap.build @@ -0,0 +1,5 @@ +project = # Unnamed subproject. + +using config +using dist +using test diff --git a/libformat/tests/build/root.build b/libformat/tests/build/root.build new file mode 100644 index 0000000..a2ee38a --- /dev/null +++ b/libformat/tests/build/root.build @@ -0,0 +1,14 @@ +cxx.std = 11 + +using cxx + +hxx{*}: extension = hxx +cxx{*}: extension = cxx + +# Every exe{} in this subproject is by default a test. +# +exe{*}: test = true + +# Specify the test target for cross-testing. +# +test.target = $cxx.target diff --git a/libformat/tests/buildfile b/libformat/tests/buildfile new file mode 100644 index 0000000..1a8bcc9 --- /dev/null +++ b/libformat/tests/buildfile @@ -0,0 +1 @@ +./: test/ diff --git a/libformat/tests/test/buildfile b/libformat/tests/test/buildfile new file mode 100644 index 0000000..92d2804 --- /dev/null +++ b/libformat/tests/test/buildfile @@ -0,0 +1,4 @@ +import libs = libformat%lib{format} + +exe{driver}: cxx{driver} $libs +exe{driver}: test.output = test.out diff --git a/libformat/tests/test/driver.cxx b/libformat/tests/test/driver.cxx new file mode 100644 index 0000000..fb2939d --- /dev/null +++ b/libformat/tests/test/driver.cxx @@ -0,0 +1,13 @@ +// file: tests/test/driver.cxx -*- C++ -*- + +#include + +#include + +int +main () +{ + using namespace std; + + cout << format ("Hello", "World") << endl; +} diff --git a/libformat/tests/test/test.out b/libformat/tests/test/test.out new file mode 100644 index 0000000..8ab686e --- /dev/null +++ b/libformat/tests/test/test.out @@ -0,0 +1 @@ +Hello, World! -- cgit v1.1