From f089a1a2321e77bfb5f60c2cd79dac14eac9bf63 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 19 Jun 2017 18:30:13 +0300 Subject: Move project into intermediate sub-directory --- .gitignore | 16 ---------------- INSTALL | 1 - build/.gitignore | 1 - build/bootstrap.build | 7 ------- build/export.build | 6 ------ build/root.build | 6 ------ buildfile | 9 --------- libhello/.gitignore | 16 ++++++++++++++++ libhello/INSTALL | 1 + libhello/build/.gitignore | 1 + libhello/build/bootstrap.build | 7 +++++++ libhello/build/export.build | 6 ++++++ libhello/build/root.build | 6 ++++++ libhello/buildfile | 29 ++++++----------------------- libhello/export.hxx | 36 ------------------------------------ libhello/hello.cxx | 16 ---------------- libhello/hello.hxx | 28 ---------------------------- libhello/libhello/buildfile | 26 ++++++++++++++++++++++++++ libhello/libhello/export.hxx | 36 ++++++++++++++++++++++++++++++++++++ libhello/libhello/hello.cxx | 16 ++++++++++++++++ libhello/libhello/hello.hxx | 28 ++++++++++++++++++++++++++++ libhello/manifest | 18 ++++++++++++++++++ libhello/tests/.gitignore | 1 + libhello/tests/build/.gitignore | 1 + libhello/tests/build/bootstrap.build | 5 +++++ libhello/tests/build/root.build | 14 ++++++++++++++ libhello/tests/buildfile | 1 + libhello/tests/test/buildfile | 4 ++++ libhello/tests/test/driver.cxx | 11 +++++++++++ libhello/tests/test/test.out | 1 + manifest | 18 ------------------ 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 | 11 ----------- tests/test/test.out | 1 - 39 files changed, 205 insertions(+), 205 deletions(-) delete mode 100644 .gitignore delete mode 100644 INSTALL 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 libhello/.gitignore create mode 100644 libhello/INSTALL create mode 100644 libhello/build/.gitignore create mode 100644 libhello/build/bootstrap.build create mode 100644 libhello/build/export.build create mode 100644 libhello/build/root.build delete mode 100644 libhello/export.hxx delete mode 100644 libhello/hello.cxx delete mode 100644 libhello/hello.hxx create mode 100644 libhello/libhello/buildfile create mode 100644 libhello/libhello/export.hxx create mode 100644 libhello/libhello/hello.cxx create mode 100644 libhello/libhello/hello.hxx create mode 100644 libhello/manifest create mode 100644 libhello/tests/.gitignore create mode 100644 libhello/tests/build/.gitignore create mode 100644 libhello/tests/build/bootstrap.build create mode 100644 libhello/tests/build/root.build create mode 100644 libhello/tests/buildfile create mode 100644 libhello/tests/test/buildfile create mode 100644 libhello/tests/test/driver.cxx create mode 100644 libhello/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/INSTALL b/INSTALL deleted file mode 100644 index 485b10f..0000000 --- a/INSTALL +++ /dev/null @@ -1 +0,0 @@ -Just use build2, bro. 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 1ff153d..0000000 --- a/build/bootstrap.build +++ /dev/null @@ -1,7 +0,0 @@ -project = libhello - -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 0151425..0000000 --- a/build/export.build +++ /dev/null @@ -1,6 +0,0 @@ -$out_root/: -{ - include libhello/ -} - -export $out_root/libhello/lib{hello} 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 b3ad7e3..0000000 --- a/buildfile +++ /dev/null @@ -1,9 +0,0 @@ -./: libhello/ tests/ doc{INSTALL version} file{manifest} - -doc{version}: file{manifest} # Generated by the version module. -doc{version}: dist = true - -# Don't install tests or the INSTALL file. -# -dir{tests/}: install = false -doc{INSTALL}@./: install = false diff --git a/libhello/.gitignore b/libhello/.gitignore new file mode 100644 index 0000000..a887fdd --- /dev/null +++ b/libhello/.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/libhello/INSTALL b/libhello/INSTALL new file mode 100644 index 0000000..485b10f --- /dev/null +++ b/libhello/INSTALL @@ -0,0 +1 @@ +Just use build2, bro. diff --git a/libhello/build/.gitignore b/libhello/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/libhello/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/libhello/build/bootstrap.build b/libhello/build/bootstrap.build new file mode 100644 index 0000000..1ff153d --- /dev/null +++ b/libhello/build/bootstrap.build @@ -0,0 +1,7 @@ +project = libhello + +using version +using config +using dist +using test +using install diff --git a/libhello/build/export.build b/libhello/build/export.build new file mode 100644 index 0000000..0151425 --- /dev/null +++ b/libhello/build/export.build @@ -0,0 +1,6 @@ +$out_root/: +{ + include libhello/ +} + +export $out_root/libhello/lib{hello} diff --git a/libhello/build/root.build b/libhello/build/root.build new file mode 100644 index 0000000..8ceadfa --- /dev/null +++ b/libhello/build/root.build @@ -0,0 +1,6 @@ +cxx.std = 11 + +using cxx + +hxx{*}: extension = hxx +cxx{*}: extension = cxx diff --git a/libhello/buildfile b/libhello/buildfile index e65edde..b3ad7e3 100644 --- a/libhello/buildfile +++ b/libhello/buildfile @@ -1,26 +1,9 @@ -import int_libs = libformat%lib{format} -import imp_libs = libprint%lib{print} +./: libhello/ tests/ doc{INSTALL version} file{manifest} -lib{hello}: {hxx cxx}{hello} hxx{export} $imp_libs $int_libs +doc{version}: file{manifest} # Generated by the version module. +doc{version}: dist = true -# For pre-releases use the complete version to make sure they cannot be used -# in place of another pre-release or the final version. +# Don't install tests or the INSTALL file. # -if $version.pre_release - lib{hello}: bin.lib.version = @"-$version.project_id" -else - lib{hello}: bin.lib.version = @"-$version.major.$version.minor" - -cxx.poptions =+ "-I$out_root" "-I$src_root" -obja{*}: cxx.poptions += -DLIBHELLO_STATIC_BUILD -objs{*}: cxx.poptions += -DLIBHELLO_SHARED_BUILD - -lib{hello}: cxx.export.poptions = "-I$out_root" "-I$src_root" -liba{hello}: cxx.export.poptions += -DLIBHELLO_STATIC -libs{hello}: cxx.export.poptions += -DLIBHELLO_SHARED - -lib{hello}: cxx.export.libs = $int_libs - -# Install into the libhello/ subdirectory of, say, /usr/include/. -# -install.include = $install.include/libhello/ +dir{tests/}: install = false +doc{INSTALL}@./: install = false diff --git a/libhello/export.hxx b/libhello/export.hxx deleted file mode 100644 index e6c723e..0000000 --- a/libhello/export.hxx +++ /dev/null @@ -1,36 +0,0 @@ -// file: libhello/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(LIBHELLO_STATIC) // Using static. -# define LIBHELLO_EXPORT -#elif defined(LIBHELLO_STATIC_BUILD) // Building static. -# define LIBHELLO_EXPORT -#elif defined(LIBHELLO_SHARED) // Using shared. -# ifdef _WIN32 -# define LIBHELLO_EXPORT __declspec(dllimport) -# else -# define LIBHELLO_EXPORT -# endif -#elif defined(LIBHELLO_SHARED_BUILD) // Building shared. -# ifdef _WIN32 -# define LIBHELLO_EXPORT __declspec(dllexport) -# else -# define LIBHELLO_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 LIBHELLO_EXPORT // Using static or shared. -#endif diff --git a/libhello/hello.cxx b/libhello/hello.cxx deleted file mode 100644 index f7e3b7f..0000000 --- a/libhello/hello.cxx +++ /dev/null @@ -1,16 +0,0 @@ -// file: libhello/hello.cxx -*- C++ -*- - -#include - -#include - -using namespace std; - -namespace hello -{ - void - say_formatted (const string& m) - { - print (m); - } -} diff --git a/libhello/hello.hxx b/libhello/hello.hxx deleted file mode 100644 index ccc43c2..0000000 --- a/libhello/hello.hxx +++ /dev/null @@ -1,28 +0,0 @@ -// file: libhello/hello.hxx -*- C++ -*- - -#pragma once - -#include - -#include - -#include - -namespace hello -{ - // If you compare this interface to version 1.0, then you will notice that - // while it is API/source-compatible (the signature of say() is unchanged) - // it is not ABI/binary-compatible (say() is now inline). - // - // Notice also that inline say() calls format() which means libformat is an - // interface dependency of libhello. - - LIBHELLO_EXPORT void - say_formatted (const std::string& message); - - inline void - say (const std::string& name) - { - say_formatted (format ("Hello", name)); - } -} diff --git a/libhello/libhello/buildfile b/libhello/libhello/buildfile new file mode 100644 index 0000000..e65edde --- /dev/null +++ b/libhello/libhello/buildfile @@ -0,0 +1,26 @@ +import int_libs = libformat%lib{format} +import imp_libs = libprint%lib{print} + +lib{hello}: {hxx cxx}{hello} hxx{export} $imp_libs $int_libs + +# 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{hello}: bin.lib.version = @"-$version.project_id" +else + lib{hello}: bin.lib.version = @"-$version.major.$version.minor" + +cxx.poptions =+ "-I$out_root" "-I$src_root" +obja{*}: cxx.poptions += -DLIBHELLO_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBHELLO_SHARED_BUILD + +lib{hello}: cxx.export.poptions = "-I$out_root" "-I$src_root" +liba{hello}: cxx.export.poptions += -DLIBHELLO_STATIC +libs{hello}: cxx.export.poptions += -DLIBHELLO_SHARED + +lib{hello}: cxx.export.libs = $int_libs + +# Install into the libhello/ subdirectory of, say, /usr/include/. +# +install.include = $install.include/libhello/ diff --git a/libhello/libhello/export.hxx b/libhello/libhello/export.hxx new file mode 100644 index 0000000..e6c723e --- /dev/null +++ b/libhello/libhello/export.hxx @@ -0,0 +1,36 @@ +// file: libhello/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(LIBHELLO_STATIC) // Using static. +# define LIBHELLO_EXPORT +#elif defined(LIBHELLO_STATIC_BUILD) // Building static. +# define LIBHELLO_EXPORT +#elif defined(LIBHELLO_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBHELLO_EXPORT __declspec(dllimport) +# else +# define LIBHELLO_EXPORT +# endif +#elif defined(LIBHELLO_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBHELLO_EXPORT __declspec(dllexport) +# else +# define LIBHELLO_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 LIBHELLO_EXPORT // Using static or shared. +#endif diff --git a/libhello/libhello/hello.cxx b/libhello/libhello/hello.cxx new file mode 100644 index 0000000..f7e3b7f --- /dev/null +++ b/libhello/libhello/hello.cxx @@ -0,0 +1,16 @@ +// file: libhello/hello.cxx -*- C++ -*- + +#include + +#include + +using namespace std; + +namespace hello +{ + void + say_formatted (const string& m) + { + print (m); + } +} diff --git a/libhello/libhello/hello.hxx b/libhello/libhello/hello.hxx new file mode 100644 index 0000000..ccc43c2 --- /dev/null +++ b/libhello/libhello/hello.hxx @@ -0,0 +1,28 @@ +// file: libhello/hello.hxx -*- C++ -*- + +#pragma once + +#include + +#include + +#include + +namespace hello +{ + // If you compare this interface to version 1.0, then you will notice that + // while it is API/source-compatible (the signature of say() is unchanged) + // it is not ABI/binary-compatible (say() is now inline). + // + // Notice also that inline say() calls format() which means libformat is an + // interface dependency of libhello. + + LIBHELLO_EXPORT void + say_formatted (const std::string& message); + + inline void + say (const std::string& name) + { + say_formatted (format ("Hello", name)); + } +} diff --git a/libhello/manifest b/libhello/manifest new file mode 100644 index 0000000..fee9ce7 --- /dev/null +++ b/libhello/manifest @@ -0,0 +1,18 @@ +: 1 +name: libhello +version: 1.1.0 +summary: The "Hello World" example library +license: MIT +tags: c++, hello, world, example +description: \ +A simple library that implements the "Hello World" example in C++. Its primary +goal is to show a canonical build2/bpkg project/package. +\ +url: http://www.example.org/libhello +email: hello-users@example.org +build-email: builds@build2.org +requires: c++11 +depends: * build2 >= 0.5.0- +depends: * bpkg >= 0.5.0- +depends: libformat [1.0.0 2.0.0-); compatible with libformat-1.X.Y +depends: libprint [1.0.0 2.0.0-); compatible with libprint-1.X.Y diff --git a/libhello/tests/.gitignore b/libhello/tests/.gitignore new file mode 100644 index 0000000..e54525b --- /dev/null +++ b/libhello/tests/.gitignore @@ -0,0 +1 @@ +driver diff --git a/libhello/tests/build/.gitignore b/libhello/tests/build/.gitignore new file mode 100644 index 0000000..225c27f --- /dev/null +++ b/libhello/tests/build/.gitignore @@ -0,0 +1 @@ +config.build diff --git a/libhello/tests/build/bootstrap.build b/libhello/tests/build/bootstrap.build new file mode 100644 index 0000000..2c2de24 --- /dev/null +++ b/libhello/tests/build/bootstrap.build @@ -0,0 +1,5 @@ +project = # Unnamed subproject. + +using config +using dist +using test diff --git a/libhello/tests/build/root.build b/libhello/tests/build/root.build new file mode 100644 index 0000000..a2ee38a --- /dev/null +++ b/libhello/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/libhello/tests/buildfile b/libhello/tests/buildfile new file mode 100644 index 0000000..1a8bcc9 --- /dev/null +++ b/libhello/tests/buildfile @@ -0,0 +1 @@ +./: test/ diff --git a/libhello/tests/test/buildfile b/libhello/tests/test/buildfile new file mode 100644 index 0000000..a46969d --- /dev/null +++ b/libhello/tests/test/buildfile @@ -0,0 +1,4 @@ +import libs = libhello%lib{hello} + +exe{driver}: cxx{driver} $libs +exe{driver}: test.output = test.out diff --git a/libhello/tests/test/driver.cxx b/libhello/tests/test/driver.cxx new file mode 100644 index 0000000..38937f0 --- /dev/null +++ b/libhello/tests/test/driver.cxx @@ -0,0 +1,11 @@ +// file: tests/test/driver.cxx -*- C++ -*- + +#include + +int +main () +{ + using hello::say; + + say ("World"); +} diff --git a/libhello/tests/test/test.out b/libhello/tests/test/test.out new file mode 100644 index 0000000..8ab686e --- /dev/null +++ b/libhello/tests/test/test.out @@ -0,0 +1 @@ +Hello, World! diff --git a/manifest b/manifest deleted file mode 100644 index fee9ce7..0000000 --- a/manifest +++ /dev/null @@ -1,18 +0,0 @@ -: 1 -name: libhello -version: 1.1.0 -summary: The "Hello World" example library -license: MIT -tags: c++, hello, world, example -description: \ -A simple library that implements the "Hello World" example in C++. Its primary -goal is to show a canonical build2/bpkg project/package. -\ -url: http://www.example.org/libhello -email: hello-users@example.org -build-email: builds@build2.org -requires: c++11 -depends: * build2 >= 0.5.0- -depends: * bpkg >= 0.5.0- -depends: libformat [1.0.0 2.0.0-); compatible with libformat-1.X.Y -depends: libprint [1.0.0 2.0.0-); compatible with libprint-1.X.Y 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 a46969d..0000000 --- a/tests/test/buildfile +++ /dev/null @@ -1,4 +0,0 @@ -import libs = libhello%lib{hello} - -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 38937f0..0000000 --- a/tests/test/driver.cxx +++ /dev/null @@ -1,11 +0,0 @@ -// file: tests/test/driver.cxx -*- C++ -*- - -#include - -int -main () -{ - using hello::say; - - say ("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