diff options
-rw-r--r-- | bootstrap-mingw.bat | 2 | ||||
-rw-r--r-- | bootstrap-msvc.bat | 2 | ||||
-rw-r--r-- | bootstrap.gmake | 2 | ||||
-rwxr-xr-x | bootstrap.sh | 2 | ||||
-rw-r--r-- | build2/b.cxx | 10 | ||||
-rw-r--r-- | build2/buildfile | 5 | ||||
-rw-r--r-- | build2/c/init.cxx | 4 | ||||
-rw-r--r-- | build2/c/target.hxx | 2 | ||||
-rw-r--r-- | build2/cc/init.hxx | 73 | ||||
-rw-r--r-- | build2/cxx/init.cxx | 4 | ||||
-rw-r--r-- | build2/cxx/target.hxx | 2 | ||||
-rw-r--r-- | libbuild2/buildfile | 2 | ||||
-rw-r--r-- | libbuild2/cc/buildfile | 74 | ||||
-rw-r--r-- | libbuild2/cc/common.cxx (renamed from build2/cc/common.cxx) | 6 | ||||
-rw-r--r-- | libbuild2/cc/common.hxx (renamed from build2/cc/common.hxx) | 16 | ||||
-rw-r--r-- | libbuild2/cc/compile-rule.cxx (renamed from build2/cc/compile-rule.cxx) | 12 | ||||
-rw-r--r-- | libbuild2/cc/compile-rule.hxx (renamed from build2/cc/compile-rule.hxx) | 16 | ||||
-rw-r--r-- | libbuild2/cc/export.hxx | 38 | ||||
-rw-r--r-- | libbuild2/cc/gcc.cxx (renamed from build2/cc/gcc.cxx) | 6 | ||||
-rw-r--r-- | libbuild2/cc/guess.cxx (renamed from build2/cc/guess.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/guess.hxx (renamed from build2/cc/guess.hxx) | 10 | ||||
-rw-r--r-- | libbuild2/cc/init.cxx (renamed from build2/cc/init.cxx) | 28 | ||||
-rw-r--r-- | libbuild2/cc/init.hxx | 36 | ||||
-rw-r--r-- | libbuild2/cc/install-rule.cxx (renamed from build2/cc/install-rule.cxx) | 8 | ||||
-rw-r--r-- | libbuild2/cc/install-rule.hxx (renamed from build2/cc/install-rule.hxx) | 21 | ||||
-rw-r--r-- | libbuild2/cc/lexer+char-literal.test.testscript (renamed from build2/cc/lexer+char-literal.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer+comment.test.testscript (renamed from build2/cc/lexer+comment.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer+line.test.testscript (renamed from build2/cc/lexer+line.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer+number.test.testscript (renamed from build2/cc/lexer+number.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer+preprocessor.test.testscript (renamed from build2/cc/lexer+preprocessor.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer+raw-string-literal.test.testscript (renamed from build2/cc/lexer+raw-string-literal.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer+string-literal.test.testscript (renamed from build2/cc/lexer+string-literal.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/lexer.cxx (renamed from build2/cc/lexer.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/lexer.hxx (renamed from build2/cc/lexer.hxx) | 8 | ||||
-rw-r--r-- | libbuild2/cc/lexer.test.cxx (renamed from build2/cc/lexer.test.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/link-rule.cxx (renamed from build2/cc/link-rule.cxx) | 8 | ||||
-rw-r--r-- | libbuild2/cc/link-rule.hxx (renamed from build2/cc/link-rule.hxx) | 16 | ||||
-rw-r--r-- | libbuild2/cc/module.cxx (renamed from build2/cc/module.cxx) | 8 | ||||
-rw-r--r-- | libbuild2/cc/module.hxx (renamed from build2/cc/module.hxx) | 32 | ||||
-rw-r--r-- | libbuild2/cc/msvc.cxx (renamed from build2/cc/msvc.cxx) | 8 | ||||
-rw-r--r-- | libbuild2/cc/parser+module.test.testscript (renamed from build2/cc/parser+module.test.testscript) | 2 | ||||
-rw-r--r-- | libbuild2/cc/parser.cxx (renamed from build2/cc/parser.cxx) | 6 | ||||
-rw-r--r-- | libbuild2/cc/parser.hxx (renamed from build2/cc/parser.hxx) | 10 | ||||
-rw-r--r-- | libbuild2/cc/parser.test.cxx (renamed from build2/cc/parser.test.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/pkgconfig.cxx (renamed from build2/cc/pkgconfig.cxx) | 14 | ||||
-rw-r--r-- | libbuild2/cc/target.cxx (renamed from build2/cc/target.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/target.hxx (renamed from build2/cc/target.hxx) | 22 | ||||
-rw-r--r-- | libbuild2/cc/types.hxx (renamed from build2/cc/types.hxx) | 8 | ||||
-rw-r--r-- | libbuild2/cc/utility.cxx (renamed from build2/cc/utility.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/utility.hxx (renamed from build2/cc/utility.hxx) | 12 | ||||
-rw-r--r-- | libbuild2/cc/utility.ixx (renamed from build2/cc/utility.ixx) | 2 | ||||
-rw-r--r-- | libbuild2/cc/windows-manifest.cxx (renamed from build2/cc/windows-manifest.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/cc/windows-rpath.cxx (renamed from build2/cc/windows-rpath.cxx) | 4 | ||||
-rw-r--r-- | libbuild2/module.cxx | 1 | ||||
-rw-r--r-- | tests/libbuild2/buildfile | 2 | ||||
-rw-r--r-- | tests/libbuild2/driver.cxx | 6 |
56 files changed, 350 insertions, 242 deletions
diff --git a/bootstrap-mingw.bat b/bootstrap-mingw.bat index 7fb8ec3..fc3c9ff 100644 --- a/bootstrap-mingw.bat +++ b/bootstrap-mingw.bat @@ -62,7 +62,6 @@ rem All the source directories. rem set "src=build2" set "src=%src% build2\c" -set "src=%src% build2\cc" set "src=%src% build2\cxx" set "src=%src% libbuild2" @@ -72,6 +71,7 @@ set "src=%src% libbuild2\test" set "src=%src% libbuild2\test\script" set "src=%src% libbuild2\install" set "src=%src% libbuild2\bin" +set "src=%src% libbuild2\cc" set "src=%src% libbuild2\version" set "src=%src% libbuild2\in" diff --git a/bootstrap-msvc.bat b/bootstrap-msvc.bat index 4341098..7526b0c 100644 --- a/bootstrap-msvc.bat +++ b/bootstrap-msvc.bat @@ -93,7 +93,6 @@ rem All the source directories. rem set "src=build2" set "src=%src% build2\c" -set "src=%src% build2\cc" set "src=%src% build2\cxx" set "src=%src% libbuild2" @@ -103,6 +102,7 @@ set "src=%src% libbuild2\test" set "src=%src% libbuild2\test\script" set "src=%src% libbuild2\install" set "src=%src% libbuild2\bin" +set "src=%src% libbuild2\cc" set "src=%src% libbuild2\version" set "src=%src% libbuild2\in" diff --git a/bootstrap.gmake b/bootstrap.gmake index c27a965..0cafedf 100644 --- a/bootstrap.gmake +++ b/bootstrap.gmake @@ -131,7 +131,6 @@ endif # build2_sub := \ c \ -cc \ cxx libbuild2_sub := \ @@ -141,6 +140,7 @@ test/script \ test \ install \ bin \ +cc \ version \ in diff --git a/bootstrap.sh b/bootstrap.sh index 3614e93..f227d82 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -118,7 +118,6 @@ fi src="build2/*.cxx" src="$src build2/c/*.cxx" -src="$src build2/cc/*.cxx" src="$src build2/cxx/*.cxx" src="$src libbuild2/*.cxx" @@ -128,6 +127,7 @@ src="$src libbuild2/test/*.cxx" src="$src libbuild2/test/script/*.cxx" src="$src libbuild2/install/*.cxx" src="$src libbuild2/bin/*.cxx" +src="$src libbuild2/cc/*.cxx" src="$src libbuild2/version/*.cxx" src="$src libbuild2/in/*.cxx" diff --git a/build2/b.cxx b/build2/b.cxx index 78f6248..be67a8c 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -54,6 +54,7 @@ #include <libbuild2/in/init.hxx> #include <libbuild2/bin/init.hxx> +#include <libbuild2/cc/init.hxx> #include <libbuild2/version/init.hxx> #ifndef BUILD2_BOOTSTRAP @@ -63,7 +64,6 @@ #endif #include <build2/c/init.hxx> -#include <build2/cc/init.hxx> #include <build2/cxx/init.hxx> using namespace butl; @@ -520,16 +520,10 @@ main (int argc, char* argv[]) load (&install::build2_install_load); load (&bin::build2_bin_load); + load (&cc::build2_cc_load); load (&version::build2_version_load); load (&in::build2_in_load); - TMP_LOAD (cc_core_vars, "cc.core.vars", cc::core_vars_init); - TMP_LOAD (cc_core_guess, "cc.core.guess", cc::core_guess_init); - TMP_LOAD (cc_core_config, "cc.core.config", cc::core_config_init); - TMP_LOAD (cc_core, "cc.core", cc::core_init); - TMP_LOAD (cc_config, "cc.config", cc::config_init); - TMP_LOAD (cc, "cc", cc::init); - TMP_LOAD (c_guess, "c.guess", c::guess_init); TMP_LOAD (c_config, "c.config", c::config_init); TMP_LOAD (c, "c", c::init); diff --git a/build2/buildfile b/build2/buildfile index 1f956a3..cfc46e5 100644 --- a/build2/buildfile +++ b/build2/buildfile @@ -2,13 +2,12 @@ # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -import libs = libbutl%lib{butl} -import libs += libpkgconf%lib{pkgconf} +import libs = libbutl%lib{butl} include ../libbuild2/ libs += ../libbuild2/lib{build2} -for m: bash bin in version +for m: bash bin cc in version { include ../libbuild2/$m/ libs += ../libbuild2/$m/lib{build2-$m} diff --git a/build2/c/init.cxx b/build2/c/init.cxx index ff9cc58..6d271a7 100644 --- a/build2/c/init.cxx +++ b/build2/c/init.cxx @@ -7,8 +7,8 @@ #include <libbuild2/scope.hxx> #include <libbuild2/diagnostics.hxx> -#include <build2/cc/guess.hxx> -#include <build2/cc/module.hxx> +#include <libbuild2/cc/guess.hxx> +#include <libbuild2/cc/module.hxx> #include <build2/c/target.hxx> diff --git a/build2/c/target.hxx b/build2/c/target.hxx index 486c29c..88e2ef4 100644 --- a/build2/c/target.hxx +++ b/build2/c/target.hxx @@ -8,7 +8,7 @@ #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> -#include <build2/cc/target.hxx> +#include <libbuild2/cc/target.hxx> namespace build2 { diff --git a/build2/cc/init.hxx b/build2/cc/init.hxx deleted file mode 100644 index 98defde..0000000 --- a/build2/cc/init.hxx +++ /dev/null @@ -1,73 +0,0 @@ -// file : build2/cc/init.hxx -*- C++ -*- -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef BUILD2_CC_INIT_HXX -#define BUILD2_CC_INIT_HXX - -#include <libbuild2/types.hxx> -#include <libbuild2/utility.hxx> - -#include <libbuild2/module.hxx> - -namespace build2 -{ - namespace cc - { - bool - core_vars_init (scope&, - scope&, - const location&, - unique_ptr<module_base>&, - bool, - bool, - const variable_map&); - - bool - core_guess_init (scope&, - scope&, - const location&, - unique_ptr<module_base>&, - bool, - bool, - const variable_map&); - - bool - core_config_init (scope&, - scope&, - const location&, - unique_ptr<module_base>&, - bool, - bool, - const variable_map&); - - bool - core_init (scope&, - scope&, - const location&, - unique_ptr<module_base>&, - bool, - bool, - const variable_map&); - - bool - config_init (scope&, - scope&, - const location&, - unique_ptr<module_base>&, - bool, - bool, - const variable_map&); - - bool - init (scope&, - scope&, - const location&, - unique_ptr<module_base>&, - bool, - bool, - const variable_map&); - } -} - -#endif // BUILD2_CC_INIT_HXX diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx index 1ffa098..fefa7b9 100644 --- a/build2/cxx/init.cxx +++ b/build2/cxx/init.cxx @@ -7,8 +7,8 @@ #include <libbuild2/scope.hxx> #include <libbuild2/diagnostics.hxx> -#include <build2/cc/guess.hxx> -#include <build2/cc/module.hxx> +#include <libbuild2/cc/guess.hxx> +#include <libbuild2/cc/module.hxx> #include <build2/cxx/target.hxx> diff --git a/build2/cxx/target.hxx b/build2/cxx/target.hxx index fabd3b6..40dd810 100644 --- a/build2/cxx/target.hxx +++ b/build2/cxx/target.hxx @@ -9,7 +9,7 @@ #include <libbuild2/utility.hxx> #include <libbuild2/target.hxx> -#include <build2/cc/target.hxx> +#include <libbuild2/cc/target.hxx> namespace build2 { diff --git a/libbuild2/buildfile b/libbuild2/buildfile index 57f4895..aad4e78 100644 --- a/libbuild2/buildfile +++ b/libbuild2/buildfile @@ -5,7 +5,7 @@ # NOTE: remember to update bundled_modules in libbuild2/modules.cxx if adding # a new module. # -./: lib{build2} bash/ bin/ in/ version/ +./: lib{build2} bash/ bin/ cc/ in/ version/ import int_libs = libbutl%lib{butl} diff --git a/libbuild2/cc/buildfile b/libbuild2/cc/buildfile new file mode 100644 index 0000000..5b3d8eb --- /dev/null +++ b/libbuild2/cc/buildfile @@ -0,0 +1,74 @@ +# file : libbuild2/cc/buildfile +# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +import int_libs = libbutl%lib{butl} +import imp_libs = libpkgconf%lib{pkgconf} + +include ../ +int_libs += ../lib{build2} + +include ../bin/ +int_libs += ../bin/lib{build2-bin} + +./: lib{build2-cc}: libul{build2-cc}: {hxx ixx txx cxx}{** -**.test...} \ + $imp_libs $int_libs + +# Unit tests. +# +exe{*.test}: +{ + test = true + install = false +} + +for t: cxx{**.test...} +{ + d = $directory($t) + n = $name($t)... + b = $path.base($name($t)) + + ./: $d/exe{$n}: $t $d/{hxx ixx txx}{+$n} $d/testscript{+$n +$b+*.test...} + $d/exe{$n}: libul{build2-cc}: bin.whole = false +} + +# Build options. +# +obja{*}: cxx.poptions += -DLIBBUILD2_CC_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBBUILD2_CC_SHARED_BUILD + +# Export options. +# +lib{build2-cc}: +{ + cxx.export.poptions = "-I$out_root" "-I$src_root" + cxx.export.libs = $int_libs +} + +liba{build2-cc}: cxx.export.poptions += -DLIBBUILD2_CC_STATIC +libs{build2-cc}: cxx.export.poptions += -DLIBBUILD2_CC_SHARED + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. See the version module +# for details on the version.* variable values. +# +# And because this is a build system module, we also embed the same value as +# the interface version (note that we cannot use build.version.interface for +# bundled modules because we could be built with a different version of the +# build system). +# +ver = ($version.pre_release \ + ? "$version.project_id" \ + : "$version.major.$version.minor") + +lib{build2-cc}: bin.lib.version = @"-$ver" +libs{build2-cc}: bin.lib.load_suffix = "-$ver" + +# Install into the libbuild2/cc/ subdirectory of, say, /usr/include/ +# recreating subdirectories. +# +{hxx ixx txx}{*}: +{ + install = include/libbuild2/cc/ + install.subdirs = true +} diff --git a/build2/cc/common.cxx b/libbuild2/cc/common.cxx index 4f5db4c..bfcb00c 100644 --- a/build2/cc/common.cxx +++ b/libbuild2/cc/common.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/common.cxx -*- C++ -*- +// file : libbuild2/cc/common.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/common.hxx> +#include <libbuild2/cc/common.hxx> #include <libbuild2/file.hxx> // import() #include <libbuild2/scope.hxx> @@ -11,7 +11,7 @@ #include <libbuild2/filesystem.hxx> #include <libbuild2/diagnostics.hxx> -#include <build2/cc/utility.hxx> +#include <libbuild2/cc/utility.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/common.hxx b/libbuild2/cc/common.hxx index 527c31a..31219a3 100644 --- a/build2/cc/common.hxx +++ b/libbuild2/cc/common.hxx @@ -2,8 +2,8 @@ // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_COMMON_HXX -#define BUILD2_CC_COMMON_HXX +#ifndef LIBBUILD2_CC_COMMON_HXX +#define LIBBUILD2_CC_COMMON_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> @@ -13,9 +13,11 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/types.hxx> -#include <build2/cc/guess.hxx> // compiler_id -#include <build2/cc/target.hxx> // h{} +#include <libbuild2/cc/types.hxx> +#include <libbuild2/cc/guess.hxx> // compiler_id +#include <libbuild2/cc/target.hxx> // h{} + +#include <libbuild2/cc/export.hxx> namespace build2 { @@ -221,7 +223,7 @@ namespace build2 x_src (src), x_mod (mod), x_hdr (hdr), x_inc (inc) {} }; - class common: public data + class LIBBUILD2_CC_SYMEXPORT common: public data { public: common (data&& d): data (move (d)) {} @@ -353,4 +355,4 @@ namespace build2 } } -#endif // BUILD2_CC_COMMON_HXX +#endif // LIBBUILD2_CC_COMMON_HXX diff --git a/build2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 5d4c838..8cebef0 100644 --- a/build2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/compile-rule.cxx -*- C++ -*- +// file : libbuild2/cc/compile-rule.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/compile-rule.hxx> +#include <libbuild2/cc/compile-rule.hxx> #include <cstdlib> // exit() #include <cstring> // strlen(), strchr() @@ -20,10 +20,10 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/parser.hxx> -#include <build2/cc/target.hxx> // h -#include <build2/cc/module.hxx> -#include <build2/cc/utility.hxx> +#include <libbuild2/cc/parser.hxx> +#include <libbuild2/cc/target.hxx> // h +#include <libbuild2/cc/module.hxx> +#include <libbuild2/cc/utility.hxx> using std::exit; using std::strlen; diff --git a/build2/cc/compile-rule.hxx b/libbuild2/cc/compile-rule.hxx index 62127a7..93972a2 100644 --- a/build2/cc/compile-rule.hxx +++ b/libbuild2/cc/compile-rule.hxx @@ -1,9 +1,9 @@ -// file : build2/cc/compile-rule.hxx -*- C++ -*- +// file : libbuild2/cc/compile-rule.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_COMPILE_RULE_HXX -#define BUILD2_CC_COMPILE_RULE_HXX +#ifndef LIBBUILD2_CC_COMPILE_RULE_HXX +#define LIBBUILD2_CC_COMPILE_RULE_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> @@ -11,8 +11,10 @@ #include <libbuild2/rule.hxx> #include <libbuild2/filesystem.hxx> // auto_rmfile -#include <build2/cc/types.hxx> -#include <build2/cc/common.hxx> +#include <libbuild2/cc/types.hxx> +#include <libbuild2/cc/common.hxx> + +#include <libbuild2/cc/export.hxx> namespace build2 { @@ -35,7 +37,7 @@ namespace build2 size_t copied; // First copied-over bmi*{}, 0 if none. }; - class compile_rule: public rule, virtual common + class LIBBUILD2_CC_SYMEXPORT compile_rule: public rule, virtual common { public: compile_rule (data&&); @@ -184,4 +186,4 @@ namespace build2 } } -#endif // BUILD2_CC_COMPILE_RULE_HXX +#endif // LIBBUILD2_CC_COMPILE_RULE_HXX diff --git a/libbuild2/cc/export.hxx b/libbuild2/cc/export.hxx new file mode 100644 index 0000000..16118d6 --- /dev/null +++ b/libbuild2/cc/export.hxx @@ -0,0 +1,38 @@ +// file : libbuild2/cc/export.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#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 functions being +// used before their inline definition. The workaround is to reorder code. In +// the end it's all trial and error. + +#if defined(LIBBUILD2_CC_STATIC) // Using static. +# define LIBBUILD2_CC_SYMEXPORT +#elif defined(LIBBUILD2_CC_STATIC_BUILD) // Building static. +# define LIBBUILD2_CC_SYMEXPORT +#elif defined(LIBBUILD2_CC_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBBUILD2_CC_SYMEXPORT __declspec(dllimport) +# else +# define LIBBUILD2_CC_SYMEXPORT +# endif +#elif defined(LIBBUILD2_CC_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBBUILD2_CC_SYMEXPORT __declspec(dllexport) +# else +# define LIBBUILD2_CC_SYMEXPORT +# 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 LIBBUILD2_CC_SYMEXPORT // Using static or shared. +#endif diff --git a/build2/cc/gcc.cxx b/libbuild2/cc/gcc.cxx index a979b2d..632805c 100644 --- a/build2/cc/gcc.cxx +++ b/libbuild2/cc/gcc.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/gcc.cxx -*- C++ -*- +// file : libbuild2/cc/gcc.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -10,9 +10,9 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/types.hxx> +#include <libbuild2/cc/types.hxx> -#include <build2/cc/module.hxx> +#include <libbuild2/cc/module.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/guess.cxx b/libbuild2/cc/guess.cxx index c74ccaf..02a2f5a 100644 --- a/build2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/guess.cxx -*- C++ -*- +// file : libbuild2/cc/guess.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/guess.hxx> +#include <libbuild2/cc/guess.hxx> #include <map> #include <cstring> // strlen(), strchr() diff --git a/build2/cc/guess.hxx b/libbuild2/cc/guess.hxx index 1ab6e49..3677cc7 100644 --- a/build2/cc/guess.hxx +++ b/libbuild2/cc/guess.hxx @@ -1,14 +1,14 @@ -// file : build2/cc/guess.hxx -*- C++ -*- +// file : libbuild2/cc/guess.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_GUESS_HXX -#define BUILD2_CC_GUESS_HXX +#ifndef LIBBUILD2_CC_GUESS_HXX +#define LIBBUILD2_CC_GUESS_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> -#include <build2/cc/types.hxx> +#include <libbuild2/cc/types.hxx> namespace build2 { @@ -243,4 +243,4 @@ namespace build2 } } -#endif // BUILD2_CC_GUESS_HXX +#endif // LIBBUILD2_CC_GUESS_HXX diff --git a/build2/cc/init.cxx b/libbuild2/cc/init.cxx index c83d5ed..f45a1bf 100644 --- a/build2/cc/init.cxx +++ b/libbuild2/cc/init.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/init.cxx -*- C++ -*- +// file : libbuild2/cc/init.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/init.hxx> +#include <libbuild2/cc/init.hxx> #include <libbuild2/file.hxx> #include <libbuild2/scope.hxx> @@ -11,8 +11,8 @@ #include <libbuild2/config/utility.hxx> -#include <build2/cc/target.hxx> -#include <build2/cc/utility.hxx> +#include <libbuild2/cc/target.hxx> +#include <libbuild2/cc/utility.hxx> using namespace std; using namespace butl; @@ -469,5 +469,25 @@ namespace build2 "cxx", "cxx.loaded", loc, hints); } + + static const module_functions mod_functions[] = + { + // NOTE: don't forget to also update the documentation in init.hxx if + // changing anything here. + + {"cc.core.vars", nullptr, core_vars_init}, + {"cc.core.guess", nullptr, core_guess_init}, + {"cc.core.config", nullptr, core_config_init}, + {"cc.core", nullptr, core_init}, + {"cc.config", nullptr, config_init}, + {"cc", nullptr, init}, + {nullptr, nullptr, nullptr} + }; + + const module_functions* + build2_cc_load () + { + return mod_functions; + } } } diff --git a/libbuild2/cc/init.hxx b/libbuild2/cc/init.hxx new file mode 100644 index 0000000..b98e816 --- /dev/null +++ b/libbuild2/cc/init.hxx @@ -0,0 +1,36 @@ +// file : libbuild2/cc/init.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef LIBBUILD2_CC_INIT_HXX +#define LIBBUILD2_CC_INIT_HXX + +#include <libbuild2/types.hxx> +#include <libbuild2/utility.hxx> + +#include <libbuild2/module.hxx> + +#include <libbuild2/cc/export.hxx> + +namespace build2 +{ + namespace cc + { + // Module `cc` does not require bootstrapping. + // + // Submodules: + // + // `cc.core.vars` -- registers some variables. + // `cc.core.guess` -- loads cc.core.vars and sets some variables. + // `cc.core.config` -- loads cc.core.guess and sets more variables. + // `cc.core` -- loads cc.core.config and registers target types and + // rules. + // `cc.config` -- loads {c,cxx}.config. + // `cc` -- loads c and cxx. + // + extern "C" LIBBUILD2_CC_SYMEXPORT const module_functions* + build2_cc_load (); + } +} + +#endif // LIBBUILD2_CC_INIT_HXX diff --git a/build2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx index 876e780..670757e 100644 --- a/build2/cc/install-rule.cxx +++ b/libbuild2/cc/install-rule.cxx @@ -1,15 +1,15 @@ -// file : build2/cc/install-rule.cxx -*- C++ -*- +// file : libbuild2/cc/install-rule.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/install-rule.hxx> +#include <libbuild2/cc/install-rule.hxx> #include <libbuild2/algorithm.hxx> #include <libbuild2/bin/target.hxx> -#include <build2/cc/utility.hxx> -#include <build2/cc/link-rule.hxx> // match() +#include <libbuild2/cc/utility.hxx> +#include <libbuild2/cc/link-rule.hxx> // match() using namespace std; diff --git a/build2/cc/install-rule.hxx b/libbuild2/cc/install-rule.hxx index 55f6d2f..6d7ceb8 100644 --- a/build2/cc/install-rule.hxx +++ b/libbuild2/cc/install-rule.hxx @@ -1,17 +1,19 @@ -// file : build2/cc/install-rule.hxx -*- C++ -*- +// file : libbuild2/cc/install-rule.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_INSTALL_RULE_HXX -#define BUILD2_CC_INSTALL_RULE_HXX +#ifndef LIBBUILD2_CC_INSTALL_RULE_HXX +#define LIBBUILD2_CC_INSTALL_RULE_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> #include <libbuild2/install/rule.hxx> -#include <build2/cc/types.hxx> -#include <build2/cc/common.hxx> +#include <libbuild2/cc/types.hxx> +#include <libbuild2/cc/common.hxx> + +#include <libbuild2/cc/export.hxx> namespace build2 { @@ -27,7 +29,8 @@ namespace build2 // // 3. Extra un/installation (e.g., libs{} symlinks). // - class install_rule: public install::file_rule, virtual common + class LIBBUILD2_CC_SYMEXPORT install_rule: public install::file_rule, + virtual common { public: install_rule (data&&, const link_rule&); @@ -57,7 +60,9 @@ namespace build2 // through them in case they depend on stuff that we need to install // (e.g., headers). Note that we use the alias_rule as a base. // - class libux_install_rule: public install::alias_rule, virtual common + class LIBBUILD2_CC_SYMEXPORT libux_install_rule: + public install::alias_rule, + virtual common { public: libux_install_rule (data&&, const link_rule&); @@ -74,4 +79,4 @@ namespace build2 } } -#endif // BUILD2_CC_INSTALL_RULE_HXX +#endif // LIBBUILD2_CC_INSTALL_RULE_HXX diff --git a/build2/cc/lexer+char-literal.test.testscript b/libbuild2/cc/lexer+char-literal.test.testscript index 6a0a036..afd16dd 100644 --- a/build2/cc/lexer+char-literal.test.testscript +++ b/libbuild2/cc/lexer+char-literal.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+char-literal.test.testscript +# file : libbuild2/cc/lexer+char-literal.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer+comment.test.testscript b/libbuild2/cc/lexer+comment.test.testscript index 493c295..bfcc440 100644 --- a/build2/cc/lexer+comment.test.testscript +++ b/libbuild2/cc/lexer+comment.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+comment.test.testscript +# file : libbuild2/cc/lexer+comment.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer+line.test.testscript b/libbuild2/cc/lexer+line.test.testscript index abcc587..560c092 100644 --- a/build2/cc/lexer+line.test.testscript +++ b/libbuild2/cc/lexer+line.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+line.test.testscript +# file : libbuild2/cc/lexer+line.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer+number.test.testscript b/libbuild2/cc/lexer+number.test.testscript index c342818..f361245 100644 --- a/build2/cc/lexer+number.test.testscript +++ b/libbuild2/cc/lexer+number.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+number.test.testscript +# file : libbuild2/cc/lexer+number.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer+preprocessor.test.testscript b/libbuild2/cc/lexer+preprocessor.test.testscript index fc061cb..e33eb90 100644 --- a/build2/cc/lexer+preprocessor.test.testscript +++ b/libbuild2/cc/lexer+preprocessor.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+preprocessor.test.testscript +# file : libbuild2/cc/lexer+preprocessor.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer+raw-string-literal.test.testscript b/libbuild2/cc/lexer+raw-string-literal.test.testscript index e72d77b..93cddc1 100644 --- a/build2/cc/lexer+raw-string-literal.test.testscript +++ b/libbuild2/cc/lexer+raw-string-literal.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+raw-string-literal.test.testscript +# file : libbuild2/cc/lexer+raw-string-literal.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer+string-literal.test.testscript b/libbuild2/cc/lexer+string-literal.test.testscript index c486aa1..a2509c9 100644 --- a/build2/cc/lexer+string-literal.test.testscript +++ b/libbuild2/cc/lexer+string-literal.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/lexer+string-literal.test.testscript +# file : libbuild2/cc/lexer+string-literal.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/lexer.cxx b/libbuild2/cc/lexer.cxx index 7795192..6eba57e 100644 --- a/build2/cc/lexer.cxx +++ b/libbuild2/cc/lexer.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/lexer.cxx -*- C++ -*- +// file : libbuild2/cc/lexer.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/lexer.hxx> +#include <libbuild2/cc/lexer.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/lexer.hxx b/libbuild2/cc/lexer.hxx index 5d5fa60..cb2b3a5 100644 --- a/build2/cc/lexer.hxx +++ b/libbuild2/cc/lexer.hxx @@ -1,9 +1,9 @@ -// file : build2/cc/lexer.hxx -*- C++ -*- +// file : libbuild2/cc/lexer.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_LEXER_HXX -#define BUILD2_CC_LEXER_HXX +#ifndef LIBBUILD2_CC_LEXER_HXX +#define LIBBUILD2_CC_LEXER_HXX #include <libbutl/sha256.mxx> #include <libbutl/char-scanner.mxx> @@ -187,4 +187,4 @@ namespace build2 } } -#endif // BUILD2_CC_LEXER_HXX +#endif // LIBBUILD2_CC_LEXER_HXX diff --git a/build2/cc/lexer.test.cxx b/libbuild2/cc/lexer.test.cxx index 4acc304..0aeadba 100644 --- a/build2/cc/lexer.test.cxx +++ b/libbuild2/cc/lexer.test.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/lexer.test.cxx -*- C++ -*- +// file : libbuild2/cc/lexer.test.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -8,7 +8,7 @@ #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> -#include <build2/cc/lexer.hxx> +#include <libbuild2/cc/lexer.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index adf76d1..110a992 100644 --- a/build2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/link-rule.cxx -*- C++ -*- +// file : libbuild2/cc/link-rule.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/link-rule.hxx> +#include <libbuild2/cc/link-rule.hxx> #include <map> #include <cstdlib> // exit() @@ -20,8 +20,8 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/target.hxx> // c, pc* -#include <build2/cc/utility.hxx> +#include <libbuild2/cc/target.hxx> // c, pc* +#include <libbuild2/cc/utility.hxx> using std::map; using std::exit; diff --git a/build2/cc/link-rule.hxx b/libbuild2/cc/link-rule.hxx index da6181b..2a296a7 100644 --- a/build2/cc/link-rule.hxx +++ b/libbuild2/cc/link-rule.hxx @@ -1,9 +1,9 @@ -// file : build2/cc/link-rule.hxx -*- C++ -*- +// file : libbuild2/cc/link-rule.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_LINK_RULE_HXX -#define BUILD2_CC_LINK_RULE_HXX +#ifndef LIBBUILD2_CC_LINK_RULE_HXX +#define LIBBUILD2_CC_LINK_RULE_HXX #include <set> @@ -12,14 +12,16 @@ #include <libbuild2/rule.hxx> -#include <build2/cc/types.hxx> -#include <build2/cc/common.hxx> +#include <libbuild2/cc/types.hxx> +#include <libbuild2/cc/common.hxx> + +#include <libbuild2/cc/export.hxx> namespace build2 { namespace cc { - class link_rule: public rule, virtual common + class LIBBUILD2_CC_SYMEXPORT link_rule: public rule, virtual common { public: link_rule (data&&); @@ -183,4 +185,4 @@ namespace build2 } } -#endif // BUILD2_CC_LINK_RULE_HXX +#endif // LIBBUILD2_CC_LINK_RULE_HXX diff --git a/build2/cc/module.cxx b/libbuild2/cc/module.cxx index 478cabe..3113b5c 100644 --- a/build2/cc/module.cxx +++ b/libbuild2/cc/module.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/module.cxx -*- C++ -*- +// file : libbuild2/cc/module.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/module.hxx> +#include <libbuild2/cc/module.hxx> #include <iomanip> // left, setw() @@ -11,12 +11,12 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/target.hxx> // pc* +#include <libbuild2/cc/target.hxx> // pc* #include <libbuild2/config/utility.hxx> #include <libbuild2/install/utility.hxx> -#include <build2/cc/guess.hxx> +#include <libbuild2/cc/guess.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/module.hxx b/libbuild2/cc/module.hxx index a7f787f..43670c3 100644 --- a/build2/cc/module.hxx +++ b/libbuild2/cc/module.hxx @@ -1,9 +1,9 @@ -// file : build2/cc/module.hxx -*- C++ -*- +// file : libbuild2/cc/module.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_MODULE_HXX -#define BUILD2_CC_MODULE_HXX +#ifndef LIBBUILD2_CC_MODULE_HXX +#define LIBBUILD2_CC_MODULE_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> @@ -11,11 +11,13 @@ #include <libbuild2/module.hxx> #include <libbuild2/variable.hxx> -#include <build2/cc/common.hxx> +#include <libbuild2/cc/common.hxx> -#include <build2/cc/compile-rule.hxx> -#include <build2/cc/link-rule.hxx> -#include <build2/cc/install-rule.hxx> +#include <libbuild2/cc/compile-rule.hxx> +#include <libbuild2/cc/link-rule.hxx> +#include <libbuild2/cc/install-rule.hxx> + +#include <libbuild2/cc/export.hxx> namespace build2 { @@ -23,7 +25,8 @@ namespace build2 { struct compiler_info; - class config_module: public module_base, public virtual config_data + class LIBBUILD2_CC_SYMEXPORT config_module: public module_base, + public virtual config_data { public: explicit @@ -75,11 +78,12 @@ namespace build2 bool new_; // See guess() and init() for details. }; - class module: public module_base, public virtual common, - link_rule, - compile_rule, - install_rule, - libux_install_rule + class LIBBUILD2_CC_SYMEXPORT module: public module_base, + public virtual common, + link_rule, + compile_rule, + install_rule, + libux_install_rule { public: explicit @@ -96,4 +100,4 @@ namespace build2 } } -#endif // BUILD2_CC_MODULE_HXX +#endif // LIBBUILD2_CC_MODULE_HXX diff --git a/build2/cc/msvc.cxx b/libbuild2/cc/msvc.cxx index 886975a..d802b98 100644 --- a/build2/cc/msvc.cxx +++ b/libbuild2/cc/msvc.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/msvc.cxx -*- C++ -*- +// file : libbuild2/cc/msvc.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -13,10 +13,10 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/types.hxx> +#include <libbuild2/cc/types.hxx> -#include <build2/cc/common.hxx> -#include <build2/cc/module.hxx> +#include <libbuild2/cc/common.hxx> +#include <libbuild2/cc/module.hxx> using std::strcmp; diff --git a/build2/cc/parser+module.test.testscript b/libbuild2/cc/parser+module.test.testscript index dcb2f8b..d51ac0a 100644 --- a/build2/cc/parser+module.test.testscript +++ b/libbuild2/cc/parser+module.test.testscript @@ -1,4 +1,4 @@ -# file : build2/cc/parser+module.test.testscript +# file : libbuild2/cc/parser+module.test.testscript # copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file diff --git a/build2/cc/parser.cxx b/libbuild2/cc/parser.cxx index 2a75597..179043e 100644 --- a/build2/cc/parser.cxx +++ b/libbuild2/cc/parser.cxx @@ -1,10 +1,10 @@ -// file : build2/cc/parser.cxx -*- C++ -*- +// file : libbuild2/cc/parser.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/parser.hxx> +#include <libbuild2/cc/parser.hxx> -#include <build2/cc/lexer.hxx> +#include <libbuild2/cc/lexer.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/parser.hxx b/libbuild2/cc/parser.hxx index 3a588e9..324b62a 100644 --- a/build2/cc/parser.hxx +++ b/libbuild2/cc/parser.hxx @@ -1,16 +1,16 @@ -// file : build2/cc/parser.hxx -*- C++ -*- +// file : libbuild2/cc/parser.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_PARSER_HXX -#define BUILD2_CC_PARSER_HXX +#ifndef LIBBUILD2_CC_PARSER_HXX +#define LIBBUILD2_CC_PARSER_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> #include <libbuild2/diagnostics.hxx> -#include <build2/cc/types.hxx> +#include <libbuild2/cc/types.hxx> namespace build2 { @@ -52,4 +52,4 @@ namespace build2 } } -#endif // BUILD2_CC_PARSER_HXX +#endif // LIBBUILD2_CC_PARSER_HXX diff --git a/build2/cc/parser.test.cxx b/libbuild2/cc/parser.test.cxx index 3b2da57..82c68d1 100644 --- a/build2/cc/parser.test.cxx +++ b/libbuild2/cc/parser.test.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/parser.test.cxx -*- C++ -*- +// file : libbuild2/cc/parser.test.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -8,7 +8,7 @@ #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> -#include <build2/cc/parser.hxx> +#include <libbuild2/cc/parser.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx index 0ebf818..0669b02 100644 --- a/build2/cc/pkgconfig.cxx +++ b/libbuild2/cc/pkgconfig.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/pkgconfig.cxx -*- C++ -*- +// file : libbuild2/cc/pkgconfig.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -21,13 +21,13 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/types.hxx> -#include <build2/cc/target.hxx> // pc -#include <build2/cc/utility.hxx> +#include <libbuild2/cc/types.hxx> +#include <libbuild2/cc/target.hxx> // pc +#include <libbuild2/cc/utility.hxx> -#include <build2/cc/common.hxx> -#include <build2/cc/compile-rule.hxx> -#include <build2/cc/link-rule.hxx> +#include <libbuild2/cc/common.hxx> +#include <libbuild2/cc/compile-rule.hxx> +#include <libbuild2/cc/link-rule.hxx> #ifndef BUILD2_BOOTSTRAP diff --git a/build2/cc/target.cxx b/libbuild2/cc/target.cxx index 89b9391..a438898 100644 --- a/build2/cc/target.cxx +++ b/libbuild2/cc/target.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/target.cxx -*- C++ -*- +// file : libbuild2/cc/target.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/target.hxx> +#include <libbuild2/cc/target.hxx> #include <libbuild2/context.hxx> diff --git a/build2/cc/target.hxx b/libbuild2/cc/target.hxx index fd6f6d5..885bf68 100644 --- a/build2/cc/target.hxx +++ b/libbuild2/cc/target.hxx @@ -1,15 +1,17 @@ -// file : build2/cc/target.hxx -*- C++ -*- +// file : libbuild2/cc/target.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_TARGET_HXX -#define BUILD2_CC_TARGET_HXX +#ifndef LIBBUILD2_CC_TARGET_HXX +#define LIBBUILD2_CC_TARGET_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> #include <libbuild2/target.hxx> +#include <libbuild2/cc/export.hxx> + namespace build2 { namespace cc @@ -19,7 +21,7 @@ namespace build2 // this rule) source/header files that it cannot handle but should not // ignore either. For example, a C link rule that sees a C++ source file. // - class cc: public file + class LIBBUILD2_CC_SYMEXPORT cc: public file { public: using file::file; @@ -32,7 +34,7 @@ namespace build2 // There is hardly a c-family compilation without a C header inclusion. // As a result, this target type is registered for any c-family module. // - class h: public cc + class LIBBUILD2_CC_SYMEXPORT h: public cc { public: using cc::cc; @@ -48,7 +50,7 @@ namespace build2 // also without relaxing things too much (i.e., the user still won't be // able to refer to c{} without loading the c module). // - class c: public cc + class LIBBUILD2_CC_SYMEXPORT c: public cc { public: using cc::cc; @@ -60,7 +62,7 @@ namespace build2 // pkg-config file targets. // - class pc: public file + class LIBBUILD2_CC_SYMEXPORT pc: public file { public: using file::file; @@ -69,7 +71,7 @@ namespace build2 static const target_type static_type; }; - class pca: public pc // .static.pc + class LIBBUILD2_CC_SYMEXPORT pca: public pc // .static.pc { public: using pc::pc; @@ -79,7 +81,7 @@ namespace build2 virtual const target_type& dynamic_type () const {return static_type;} }; - class pcs: public pc // .shared.pc + class LIBBUILD2_CC_SYMEXPORT pcs: public pc // .shared.pc { public: using pc::pc; @@ -91,4 +93,4 @@ namespace build2 } } -#endif // BUILD2_CC_TARGET_HXX +#endif // LIBBUILD2_CC_TARGET_HXX diff --git a/build2/cc/types.hxx b/libbuild2/cc/types.hxx index c297b19..280dcbf 100644 --- a/build2/cc/types.hxx +++ b/libbuild2/cc/types.hxx @@ -1,9 +1,9 @@ -// file : build2/cc/types.hxx -*- C++ -*- +// file : libbuild2/cc/types.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_TYPES_HXX -#define BUILD2_CC_TYPES_HXX +#ifndef LIBBUILD2_CC_TYPES_HXX +#define LIBBUILD2_CC_TYPES_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> @@ -113,4 +113,4 @@ namespace build2 } } -#endif // BUILD2_CC_TYPES_HXX +#endif // LIBBUILD2_CC_TYPES_HXX diff --git a/build2/cc/utility.cxx b/libbuild2/cc/utility.cxx index f17d1b0..07f3b2e 100644 --- a/build2/cc/utility.cxx +++ b/libbuild2/cc/utility.cxx @@ -1,8 +1,8 @@ -// file : build2/cc/utility.cxx -*- C++ -*- +// file : libbuild2/cc/utility.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <build2/cc/utility.hxx> +#include <libbuild2/cc/utility.hxx> #include <libbuild2/file.hxx> #include <libbuild2/variable.hxx> diff --git a/build2/cc/utility.hxx b/libbuild2/cc/utility.hxx index 002dea7..3ee07bd 100644 --- a/build2/cc/utility.hxx +++ b/libbuild2/cc/utility.hxx @@ -1,9 +1,9 @@ -// file : build2/cc/utility.hxx -*- C++ -*- +// file : libbuild2/cc/utility.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#ifndef BUILD2_CC_UTILITY_HXX -#define BUILD2_CC_UTILITY_HXX +#ifndef LIBBUILD2_CC_UTILITY_HXX +#define LIBBUILD2_CC_UTILITY_HXX #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> @@ -11,7 +11,7 @@ #include <libbuild2/target.hxx> #include <libbuild2/bin/target.hxx> -#include <build2/cc/types.hxx> +#include <libbuild2/cc/types.hxx> namespace build2 { @@ -68,6 +68,6 @@ namespace build2 } } -#include <build2/cc/utility.ixx> +#include <libbuild2/cc/utility.ixx> -#endif // BUILD2_CC_UTILITY_HXX +#endif // LIBBUILD2_CC_UTILITY_HXX diff --git a/build2/cc/utility.ixx b/libbuild2/cc/utility.ixx index 609f8de..1509bf2 100644 --- a/build2/cc/utility.ixx +++ b/libbuild2/cc/utility.ixx @@ -1,4 +1,4 @@ -// file : build2/cc/utility.ixx -*- C++ -*- +// file : libbuild2/cc/utility.ixx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file diff --git a/build2/cc/windows-manifest.cxx b/libbuild2/cc/windows-manifest.cxx index 733cae5..8d67f0c 100644 --- a/build2/cc/windows-manifest.cxx +++ b/libbuild2/cc/windows-manifest.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/windows-manifest.cxx -*- C++ -*- +// file : libbuild2/cc/windows-manifest.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -9,7 +9,7 @@ #include <libbuild2/filesystem.hxx> #include <libbuild2/diagnostics.hxx> -#include <build2/cc/link-rule.hxx> +#include <libbuild2/cc/link-rule.hxx> using namespace std; using namespace butl; diff --git a/build2/cc/windows-rpath.cxx b/libbuild2/cc/windows-rpath.cxx index c4ef358..5583315 100644 --- a/build2/cc/windows-rpath.cxx +++ b/libbuild2/cc/windows-rpath.cxx @@ -1,4 +1,4 @@ -// file : build2/cc/windows-rpath.cxx -*- C++ -*- +// file : libbuild2/cc/windows-rpath.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file @@ -13,7 +13,7 @@ #include <libbuild2/bin/target.hxx> -#include <build2/cc/link-rule.hxx> +#include <libbuild2/cc/link-rule.hxx> using namespace std; using namespace butl; diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx index bb7c61d..4e7080a 100644 --- a/libbuild2/module.cxx +++ b/libbuild2/module.cxx @@ -39,6 +39,7 @@ namespace build2 static const char* bundled_modules[] = { "bash", "bin", + "cc", "in", "version" }; diff --git a/tests/libbuild2/buildfile b/tests/libbuild2/buildfile index beb82b2..1a2d594 100644 --- a/tests/libbuild2/buildfile +++ b/tests/libbuild2/buildfile @@ -4,7 +4,7 @@ import libs = build2%lib{build2} -for m: bash bin in version +for m: bash bin cc in version import libs += build2%lib{build2-$m} exe{driver}: {hxx cxx}{*} $libs testscript diff --git a/tests/libbuild2/driver.cxx b/tests/libbuild2/driver.cxx index 93c145a..679b0a4 100644 --- a/tests/libbuild2/driver.cxx +++ b/tests/libbuild2/driver.cxx @@ -10,6 +10,7 @@ #include <libbuild2/in/init.hxx> #include <libbuild2/bin/init.hxx> +#include <libbuild2/cc/init.hxx> #include <libbuild2/bash/init.hxx> #include <libbuild2/version/init.hxx> @@ -23,10 +24,11 @@ main (int, char* argv[]) init_diag (1); init (nullptr, argv[0]); - bash::build2_bash_load (); bin::build2_bin_load (); - in::build2_in_load (); + cc::build2_cc_load (); version::build2_version_load (); + in::build2_in_load (); + bash::build2_bash_load (); scheduler sched (1); // Serial execution. context ctx (sched); |