From 084904e718eeaefc22f094bd6b5ddf497b852128 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 19 Jun 2017 18:30:53 +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 -------- libprint/.gitignore | 16 ++++++++++++++++ libprint/build/.gitignore | 1 + libprint/build/bootstrap.build | 7 +++++++ libprint/build/export.build | 6 ++++++ libprint/build/root.build | 6 ++++++ libprint/buildfile | 23 +++++------------------ libprint/export.hxx | 36 ------------------------------------ libprint/libprint/buildfile | 21 +++++++++++++++++++++ libprint/libprint/export.hxx | 36 ++++++++++++++++++++++++++++++++++++ libprint/libprint/print.cxx | 13 +++++++++++++ libprint/libprint/print.hxx | 10 ++++++++++ libprint/manifest | 15 +++++++++++++++ libprint/print.cxx | 13 ------------- libprint/print.hxx | 10 ---------- libprint/tests/.gitignore | 1 + libprint/tests/build/.gitignore | 1 + libprint/tests/build/bootstrap.build | 5 +++++ libprint/tests/build/root.build | 14 ++++++++++++++ libprint/tests/buildfile | 1 + libprint/tests/test/buildfile | 4 ++++ libprint/tests/test/driver.cxx | 9 +++++++++ libprint/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 | 9 --------- tests/test/test.out | 1 - 37 files changed, 172 insertions(+), 172 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 libprint/.gitignore create mode 100644 libprint/build/.gitignore create mode 100644 libprint/build/bootstrap.build create mode 100644 libprint/build/export.build create mode 100644 libprint/build/root.build delete mode 100644 libprint/export.hxx create mode 100644 libprint/libprint/buildfile create mode 100644 libprint/libprint/export.hxx create mode 100644 libprint/libprint/print.cxx create mode 100644 libprint/libprint/print.hxx create mode 100644 libprint/manifest delete mode 100644 libprint/print.cxx delete mode 100644 libprint/print.hxx create mode 100644 libprint/tests/.gitignore create mode 100644 libprint/tests/build/.gitignore create mode 100644 libprint/tests/build/bootstrap.build create mode 100644 libprint/tests/build/root.build create mode 100644 libprint/tests/buildfile create mode 100644 libprint/tests/test/buildfile create mode 100644 libprint/tests/test/driver.cxx create mode 100644 libprint/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 1941f1a..0000000 --- a/build/bootstrap.build +++ /dev/null @@ -1,7 +0,0 @@ -project = libprint - -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 4871c4a..0000000 --- a/build/export.build +++ /dev/null @@ -1,6 +0,0 @@ -$out_root/: -{ - include libprint/ -} - -export $out_root/libprint/lib{print} 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 5dd2544..0000000 --- a/buildfile +++ /dev/null @@ -1,8 +0,0 @@ -./: libprint/ 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/libprint/.gitignore b/libprint/.gitignore new file mode 100644 index 0000000..a887fdd --- /dev/null +++ b/libprint/.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/libprint/build/.gitignore b/libprint/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/libprint/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/libprint/build/bootstrap.build b/libprint/build/bootstrap.build new file mode 100644 index 0000000..1941f1a --- /dev/null +++ b/libprint/build/bootstrap.build @@ -0,0 +1,7 @@ +project = libprint + +using version +using config +using dist +using test +using install diff --git a/libprint/build/export.build b/libprint/build/export.build new file mode 100644 index 0000000..4871c4a --- /dev/null +++ b/libprint/build/export.build @@ -0,0 +1,6 @@ +$out_root/: +{ + include libprint/ +} + +export $out_root/libprint/lib{print} diff --git a/libprint/build/root.build b/libprint/build/root.build new file mode 100644 index 0000000..8ceadfa --- /dev/null +++ b/libprint/build/root.build @@ -0,0 +1,6 @@ +cxx.std = 11 + +using cxx + +hxx{*}: extension = hxx +cxx{*}: extension = cxx diff --git a/libprint/buildfile b/libprint/buildfile index f7d8a74..5dd2544 100644 --- a/libprint/buildfile +++ b/libprint/buildfile @@ -1,21 +1,8 @@ -lib{print}: {hxx cxx}{print} hxx{export} +./: libprint/ 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{print}: bin.lib.version = @"-$version.project_id" -else - lib{print}: bin.lib.version = @"-$version.major.$version.minor" - -cxx.poptions =+ "-I$out_root" "-I$src_root" -obja{*}: cxx.poptions += -DLIBPRINT_STATIC_BUILD -objs{*}: cxx.poptions += -DLIBPRINT_SHARED_BUILD - -lib{print}: cxx.export.poptions = "-I$out_root" "-I$src_root" -liba{print}: cxx.export.poptions += -DLIBPRINT_STATIC -libs{print}: cxx.export.poptions += -DLIBPRINT_SHARED +doc{version}: file{manifest} # Generated by the version module. +doc{version}: dist = true -# Install into the libprint/ subdirectory of, say, /usr/include/. +# Don't install tests. # -install.include = $install.include/libprint/ +dir{tests/}: install = false diff --git a/libprint/export.hxx b/libprint/export.hxx deleted file mode 100644 index dedfa65..0000000 --- a/libprint/export.hxx +++ /dev/null @@ -1,36 +0,0 @@ -// file: libprint/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(LIBPRINT_STATIC) // Using static. -# define LIBPRINT_EXPORT -#elif defined(LIBPRINT_STATIC_BUILD) // Building static. -# define LIBPRINT_EXPORT -#elif defined(LIBPRINT_SHARED) // Using shared. -# ifdef _WIN32 -# define LIBPRINT_EXPORT __declspec(dllimport) -# else -# define LIBPRINT_EXPORT -# endif -#elif defined(LIBPRINT_SHARED_BUILD) // Building shared. -# ifdef _WIN32 -# define LIBPRINT_EXPORT __declspec(dllexport) -# else -# define LIBPRINT_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 LIBPRINT_EXPORT // Using static or shared. -#endif diff --git a/libprint/libprint/buildfile b/libprint/libprint/buildfile new file mode 100644 index 0000000..f7d8a74 --- /dev/null +++ b/libprint/libprint/buildfile @@ -0,0 +1,21 @@ +lib{print}: {hxx cxx}{print} 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{print}: bin.lib.version = @"-$version.project_id" +else + lib{print}: bin.lib.version = @"-$version.major.$version.minor" + +cxx.poptions =+ "-I$out_root" "-I$src_root" +obja{*}: cxx.poptions += -DLIBPRINT_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBPRINT_SHARED_BUILD + +lib{print}: cxx.export.poptions = "-I$out_root" "-I$src_root" +liba{print}: cxx.export.poptions += -DLIBPRINT_STATIC +libs{print}: cxx.export.poptions += -DLIBPRINT_SHARED + +# Install into the libprint/ subdirectory of, say, /usr/include/. +# +install.include = $install.include/libprint/ diff --git a/libprint/libprint/export.hxx b/libprint/libprint/export.hxx new file mode 100644 index 0000000..dedfa65 --- /dev/null +++ b/libprint/libprint/export.hxx @@ -0,0 +1,36 @@ +// file: libprint/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(LIBPRINT_STATIC) // Using static. +# define LIBPRINT_EXPORT +#elif defined(LIBPRINT_STATIC_BUILD) // Building static. +# define LIBPRINT_EXPORT +#elif defined(LIBPRINT_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBPRINT_EXPORT __declspec(dllimport) +# else +# define LIBPRINT_EXPORT +# endif +#elif defined(LIBPRINT_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBPRINT_EXPORT __declspec(dllexport) +# else +# define LIBPRINT_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 LIBPRINT_EXPORT // Using static or shared. +#endif diff --git a/libprint/libprint/print.cxx b/libprint/libprint/print.cxx new file mode 100644 index 0000000..32c827d --- /dev/null +++ b/libprint/libprint/print.cxx @@ -0,0 +1,13 @@ +// file: libprint/libprint.cxx -*- C++ -*- + +#include + +#include + +using namespace std; + +void +print (const string& h) +{ + cout << h << endl; +} diff --git a/libprint/libprint/print.hxx b/libprint/libprint/print.hxx new file mode 100644 index 0000000..63cb541 --- /dev/null +++ b/libprint/libprint/print.hxx @@ -0,0 +1,10 @@ +// file: libprint/print.hxx -*- C++ -*- + +#pragma once + +#include + +#include + +LIBPRINT_EXPORT void +print (const std::string& hello); diff --git a/libprint/manifest b/libprint/manifest new file mode 100644 index 0000000..f32d236 --- /dev/null +++ b/libprint/manifest @@ -0,0 +1,15 @@ +: 1 +name: libprint +version: 1.0.0 +summary: The "Hello World" example printer library +license: MIT +tags: c++, hello, world, printer, example +description: \ +A simple library that implements the "Hello World" example printer in C++. +\ +url: http://www.example.org/libprint +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/libprint/print.cxx b/libprint/print.cxx deleted file mode 100644 index 32c827d..0000000 --- a/libprint/print.cxx +++ /dev/null @@ -1,13 +0,0 @@ -// file: libprint/libprint.cxx -*- C++ -*- - -#include - -#include - -using namespace std; - -void -print (const string& h) -{ - cout << h << endl; -} diff --git a/libprint/print.hxx b/libprint/print.hxx deleted file mode 100644 index 63cb541..0000000 --- a/libprint/print.hxx +++ /dev/null @@ -1,10 +0,0 @@ -// file: libprint/print.hxx -*- C++ -*- - -#pragma once - -#include - -#include - -LIBPRINT_EXPORT void -print (const std::string& hello); diff --git a/libprint/tests/.gitignore b/libprint/tests/.gitignore new file mode 100644 index 0000000..e54525b --- /dev/null +++ b/libprint/tests/.gitignore @@ -0,0 +1 @@ +driver diff --git a/libprint/tests/build/.gitignore b/libprint/tests/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/libprint/tests/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/libprint/tests/build/bootstrap.build b/libprint/tests/build/bootstrap.build new file mode 100644 index 0000000..2c2de24 --- /dev/null +++ b/libprint/tests/build/bootstrap.build @@ -0,0 +1,5 @@ +project = # Unnamed subproject. + +using config +using dist +using test diff --git a/libprint/tests/build/root.build b/libprint/tests/build/root.build new file mode 100644 index 0000000..a2ee38a --- /dev/null +++ b/libprint/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/libprint/tests/buildfile b/libprint/tests/buildfile new file mode 100644 index 0000000..1a8bcc9 --- /dev/null +++ b/libprint/tests/buildfile @@ -0,0 +1 @@ +./: test/ diff --git a/libprint/tests/test/buildfile b/libprint/tests/test/buildfile new file mode 100644 index 0000000..c5bfff4 --- /dev/null +++ b/libprint/tests/test/buildfile @@ -0,0 +1,4 @@ +import libs = libprint%lib{print} + +exe{driver}: cxx{driver} $libs +exe{driver}: test.output = test.out diff --git a/libprint/tests/test/driver.cxx b/libprint/tests/test/driver.cxx new file mode 100644 index 0000000..27f491d --- /dev/null +++ b/libprint/tests/test/driver.cxx @@ -0,0 +1,9 @@ +// file: tests/test/driver.cxx -*- C++ -*- + +#include + +int +main () +{ + print ("Hello, World!"); +} diff --git a/libprint/tests/test/test.out b/libprint/tests/test/test.out new file mode 100644 index 0000000..8ab686e --- /dev/null +++ b/libprint/tests/test/test.out @@ -0,0 +1 @@ +Hello, World! diff --git a/manifest b/manifest deleted file mode 100644 index f32d236..0000000 --- a/manifest +++ /dev/null @@ -1,15 +0,0 @@ -: 1 -name: libprint -version: 1.0.0 -summary: The "Hello World" example printer library -license: MIT -tags: c++, hello, world, printer, example -description: \ -A simple library that implements the "Hello World" example printer in C++. -\ -url: http://www.example.org/libprint -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 c5bfff4..0000000 --- a/tests/test/buildfile +++ /dev/null @@ -1,4 +0,0 @@ -import libs = libprint%lib{print} - -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 27f491d..0000000 --- a/tests/test/driver.cxx +++ /dev/null @@ -1,9 +0,0 @@ -// file: tests/test/driver.cxx -*- C++ -*- - -#include - -int -main () -{ - print ("Hello, World!"); -} 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