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 --- .gitignore | 16 ---------------- build/.gitignore | 1 - build/bootstrap.build | 7 ------- build/export.build | 6 ------ build/root.build | 6 ------ buildfile | 8 -------- 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 + manifest | 15 --------------- tests/.gitignore | 1 - tests/build/.gitignore | 1 - tests/build/bootstrap.build | 5 ----- tests/build/root.build | 14 -------------- tests/buildfile | 1 - tests/test/buildfile | 4 ---- tests/test/driver.cxx | 13 ------------- tests/test/test.out | 1 - 37 files changed, 174 insertions(+), 174 deletions(-) delete mode 100644 .gitignore delete mode 100644 build/.gitignore delete mode 100644 build/bootstrap.build delete mode 100644 build/export.build delete mode 100644 build/root.build delete mode 100644 buildfile 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 delete mode 100644 manifest delete mode 100644 tests/.gitignore delete mode 100644 tests/build/.gitignore delete mode 100644 tests/build/bootstrap.build delete mode 100644 tests/build/root.build delete mode 100644 tests/buildfile delete mode 100644 tests/test/buildfile delete mode 100644 tests/test/driver.cxx delete mode 100644 tests/test/test.out diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a887fdd..0000000 --- a/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Compiler/linker output. -# -*.d -*.ii -*.o -*.obj -*.so -*.dll -*.a -*.lib -*.exp -*.exe -*.exe.dlls/ -*.exe.manifest - -version diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index 225c27f..0000000 --- a/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -config.build diff --git a/build/bootstrap.build b/build/bootstrap.build deleted file mode 100644 index b6e8537..0000000 --- a/build/bootstrap.build +++ /dev/null @@ -1,7 +0,0 @@ -project = libformat - -using version -using config -using dist -using test -using install diff --git a/build/export.build b/build/export.build deleted file mode 100644 index 25c99aa..0000000 --- a/build/export.build +++ /dev/null @@ -1,6 +0,0 @@ -$out_root/: -{ - include libformat/ -} - -export $out_root/libformat/lib{format} diff --git a/build/root.build b/build/root.build deleted file mode 100644 index 8ceadfa..0000000 --- a/build/root.build +++ /dev/null @@ -1,6 +0,0 @@ -cxx.std = 11 - -using cxx - -hxx{*}: extension = hxx -cxx{*}: extension = cxx diff --git a/buildfile b/buildfile deleted file mode 100644 index 27e0dec..0000000 --- a/buildfile +++ /dev/null @@ -1,8 +0,0 @@ -./: libformat/ tests/ doc{version} file{manifest} - -doc{version}: file{manifest} # Generated by the version module. -doc{version}: dist = true - -# Don't install tests. -# -dir{tests/}: install = false 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! diff --git a/manifest b/manifest deleted file mode 100644 index 23cf1bb..0000000 --- a/manifest +++ /dev/null @@ -1,15 +0,0 @@ -: 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/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index e54525b..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -driver diff --git a/tests/build/.gitignore b/tests/build/.gitignore deleted file mode 100644 index 225c27f..0000000 --- a/tests/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -config.build diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build deleted file mode 100644 index 2c2de24..0000000 --- a/tests/build/bootstrap.build +++ /dev/null @@ -1,5 +0,0 @@ -project = # Unnamed subproject. - -using config -using dist -using test diff --git a/tests/build/root.build b/tests/build/root.build deleted file mode 100644 index a2ee38a..0000000 --- a/tests/build/root.build +++ /dev/null @@ -1,14 +0,0 @@ -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/tests/buildfile b/tests/buildfile deleted file mode 100644 index 1a8bcc9..0000000 --- a/tests/buildfile +++ /dev/null @@ -1 +0,0 @@ -./: test/ diff --git a/tests/test/buildfile b/tests/test/buildfile deleted file mode 100644 index 92d2804..0000000 --- a/tests/test/buildfile +++ /dev/null @@ -1,4 +0,0 @@ -import libs = libformat%lib{format} - -exe{driver}: cxx{driver} $libs -exe{driver}: test.output = test.out diff --git a/tests/test/driver.cxx b/tests/test/driver.cxx deleted file mode 100644 index fb2939d..0000000 --- a/tests/test/driver.cxx +++ /dev/null @@ -1,13 +0,0 @@ -// file: tests/test/driver.cxx -*- C++ -*- - -#include - -#include - -int -main () -{ - using namespace std; - - cout << format ("Hello", "World") << endl; -} diff --git a/tests/test/test.out b/tests/test/test.out deleted file mode 100644 index 8ab686e..0000000 --- a/tests/test/test.out +++ /dev/null @@ -1 +0,0 @@ -Hello, World! -- cgit v1.1