From 1df42c314669f30fe1d82f02fdfeeff19f92964e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 3 Jan 2023 12:57:31 +0200 Subject: [PATCH] Add visibility decorations to the library and plugins --- plugins/android/androidplugin.cpp | 10 +++++++++- plugins/base/baseplugin.cpp | 10 +++++++++- plugins/clang/clangplugin.cpp | 10 +++++++++- plugins/datafile/datafileplugin.cpp | 10 +++++++++- plugins/gnu/gnuplugin.cpp | 10 +++++++++- plugins/msvc/msvcplugin.cpp | 10 +++++++++- source/lib/architecture.h | 3 ++- source/lib/binary.h | 3 ++- source/lib/binarycomponent.h | 3 ++- source/lib/binarypackage.h | 3 ++- source/lib/builder.h | 3 ++- source/lib/buildgraph.h | 3 ++- source/lib/buildinfo.h | 7 ++++--- source/lib/buildtype.h | 3 ++- source/lib/cache.h | 3 ++- source/lib/chainedtask.h | 3 ++- source/lib/component.h | 5 +++-- source/lib/conditionalloader.h | 7 ++++--- source/lib/config.h | 5 +++-- source/lib/csourcefile.h | 3 ++- source/lib/customizedtool.h | 3 ++- source/lib/executable.h | 3 ++- source/lib/exportdefinitions.h | 3 ++- source/lib/externaltask.h | 3 ++- source/lib/file.h | 3 ++- source/lib/filetarget.h | 3 ++- source/lib/importlibrary.h | 3 ++- source/lib/installcomponent.h | 3 ++- source/lib/installedfile.h | 5 +++-- source/lib/installmap.h | 3 ++- source/lib/internaltask.h | 5 +++-- source/lib/libbuilder_api.h | 16 ++++++++++++++++ source/lib/logger.h | 3 ++- source/lib/objcsourcefile.h | 3 ++- source/lib/objectfile.h | 3 ++- source/lib/package.h | 3 ++- source/lib/packagemanager.h | 3 ++- source/lib/pattern.h | 3 ++- source/lib/plugin.h | 4 +++- source/lib/sharedlibrary.h | 3 ++- source/lib/sourcearchivecomponent.h | 3 ++- source/lib/sourcefile.h | 3 ++- source/lib/sourcepackage.h | 3 ++- source/lib/staticlibrary.h | 3 ++- source/lib/sysutils.cpp | 2 +- source/lib/sysutils.h | 5 +++-- source/lib/target.h | 3 ++- source/lib/task.h | 3 ++- source/lib/templatefile.h | 3 ++- source/lib/tool.h | 3 ++- source/lib/toolchain.h | 3 ++- source/lib/virtualfilesystem.h | 3 ++- source/lib/virtualtarget.h | 3 ++- 53 files changed, 171 insertions(+), 61 deletions(-) create mode 100644 source/lib/libbuilder_api.h diff --git a/plugins/android/androidplugin.cpp b/plugins/android/androidplugin.cpp index 609d5cd..055a0d8 100644 --- a/plugins/android/androidplugin.cpp +++ b/plugins/android/androidplugin.cpp @@ -17,8 +17,16 @@ void AndroidPlugin::add_tools(Toolchain &toolchain, const Architecture &arch) co } +#if defined(_WIN32) +#define ANDROIDTOOLS_API __declspec(dllexport) +#elif defined(__GNUC__) +#define ANDROIDTOOLS_API __attribute__((visibility("default"))) +#else +#define ANDROIDTOOLS_API +#endif + extern "C" -Plugin *create_plugin(Builder &builder) +ANDROIDTOOLS_API Plugin *create_plugin(Builder &builder) { return new AndroidPlugin(builder); } diff --git a/plugins/base/baseplugin.cpp b/plugins/base/baseplugin.cpp index 96ce2fa..0da610c 100644 --- a/plugins/base/baseplugin.cpp +++ b/plugins/base/baseplugin.cpp @@ -24,8 +24,16 @@ void BasePlugin::create_targets(SourcePackage &spkg) const } +#if defined(_WIN32) +#define BASETOOLS_API __declspec(dllexport) +#elif defined(__GNUC__) +#define BASETOOLS_API __attribute__((visibility("default"))) +#else +#define BASETOOLS_API +#endif + extern "C" -Plugin *create_plugin(Builder &builder) +BASETOOLS_API Plugin *create_plugin(Builder &builder) { return new BasePlugin(builder); } diff --git a/plugins/clang/clangplugin.cpp b/plugins/clang/clangplugin.cpp index a6b3bbb..eecbdc6 100644 --- a/plugins/clang/clangplugin.cpp +++ b/plugins/clang/clangplugin.cpp @@ -7,8 +7,16 @@ void ClangPlugin::add_tools(Toolchain &toolchain, const Architecture &arch) cons } +#if defined(_WIN32) +#define CLANGTOOLS_API __declspec(dllexport) +#elif defined(__GNUC__) +#define CLANGTOOLS_API __attribute__((visibility("default"))) +#else +#define CLANGTOOLS_API +#endif + extern "C" -Plugin *create_plugin(Builder &builder) +CLANGTOOLS_API Plugin *create_plugin(Builder &builder) { return new ClangPlugin(builder); } diff --git a/plugins/datafile/datafileplugin.cpp b/plugins/datafile/datafileplugin.cpp index a085724..134ec0e 100644 --- a/plugins/datafile/datafileplugin.cpp +++ b/plugins/datafile/datafileplugin.cpp @@ -15,8 +15,16 @@ void DataFilePlugin::add_tools(Toolchain &toolchain, const Architecture &) const } +#if defined(_WIN32) +#define DATATOOLS_API __declspec(dllexport) +#elif defined(__GNUC__) +#define DATATOOLS_API __attribute__((visibility("default"))) +#else +#define DATATOOLS_API +#endif + extern "C" -Plugin *create_plugin(Builder &builder) +DATATOOLS_API Plugin *create_plugin(Builder &builder) { return new DataFilePlugin(builder); } diff --git a/plugins/gnu/gnuplugin.cpp b/plugins/gnu/gnuplugin.cpp index a758b9a..db8c300 100644 --- a/plugins/gnu/gnuplugin.cpp +++ b/plugins/gnu/gnuplugin.cpp @@ -7,8 +7,16 @@ void GnuPlugin::add_tools(Toolchain &toolchain, const Architecture &arch) const } +#if defined(_WIN32) +#define GNUTOOLS_API __declspec(dllexport) +#elif defined(__GNUC__) +#define GNUTOOLS_API __attribute__((visibility("default"))) +#else +#define GNUTOOLS_API +#endif + extern "C" -Plugin *create_plugin(Builder &builder) +GNUTOOLS_API Plugin *create_plugin(Builder &builder) { return new GnuPlugin(builder); } diff --git a/plugins/msvc/msvcplugin.cpp b/plugins/msvc/msvcplugin.cpp index 9ebf24a..bf1e26e 100644 --- a/plugins/msvc/msvcplugin.cpp +++ b/plugins/msvc/msvcplugin.cpp @@ -23,8 +23,16 @@ void MsvcPlugin::create_targets(SourcePackage &spkg) const } +#if defined(_WIN32) +#define MSVCTOOLS_API __declspec(dllexport) +#elif defined(__GNUC__) +#define MSVCTOOLS_API __attribute__((visibility("default"))) +#else +#define MSVCTOOLS_API +#endif + extern "C" -Plugin *create_plugin(Builder &builder) +MSVCTOOLS_API Plugin *create_plugin(Builder &builder) { return new MsvcPlugin(builder); } diff --git a/source/lib/architecture.h b/source/lib/architecture.h index 2cf4fa2..8f3cdc7 100644 --- a/source/lib/architecture.h +++ b/source/lib/architecture.h @@ -4,6 +4,7 @@ #include #include #include "buildinfo.h" +#include "libbuilder_api.h" #include "pattern.h" class Builder; @@ -12,7 +13,7 @@ class Builder; Stores information about an architecture. This includes CPU type, model and bitness and operating system. */ -class Architecture +class LIBBUILDER_API Architecture { public: class Loader: public Msp::DataFile::ObjectLoader diff --git a/source/lib/binary.h b/source/lib/binary.h index ac5a855..143835c 100644 --- a/source/lib/binary.h +++ b/source/lib/binary.h @@ -3,6 +3,7 @@ #include "buildinfo.h" #include "filetarget.h" +#include "libbuilder_api.h" class Component; class ObjectFile; @@ -11,7 +12,7 @@ class ObjectFile; Produces a binary file, which may be either a standalone executable or a shared library. */ -class Binary: public FileTarget +class LIBBUILDER_API Binary: public FileTarget { private: BuildInfo static_binfo; diff --git a/source/lib/binarycomponent.h b/source/lib/binarycomponent.h index eaa123c..c7abe57 100644 --- a/source/lib/binarycomponent.h +++ b/source/lib/binarycomponent.h @@ -2,12 +2,13 @@ #define BINARYCOMPONENT_H_ #include "component.h" +#include "libbuilder_api.h" class FileTarget; class Target; class Tool; -class BinaryComponent: public Component +class LIBBUILDER_API BinaryComponent: public Component { public: class Loader: public Msp::DataFile::DerivedObjectLoader diff --git a/source/lib/binarypackage.h b/source/lib/binarypackage.h index 62a8acf..b7d3294 100644 --- a/source/lib/binarypackage.h +++ b/source/lib/binarypackage.h @@ -1,13 +1,14 @@ #ifndef BINARYPACKAGE_H_ #define BINARYPACKAGE_H_ +#include "libbuilder_api.h" #include "package.h" /** Represents a package that is installed on the system, but can't be built by Builder. */ -class BinaryPackage: public Package +class LIBBUILDER_API BinaryPackage: public Package { public: class Loader: public Msp::DataFile::DerivedObjectLoader diff --git a/source/lib/builder.h b/source/lib/builder.h index 62fc214..9845226 100644 --- a/source/lib/builder.h +++ b/source/lib/builder.h @@ -10,6 +10,7 @@ #include "buildgraph.h" #include "buildtype.h" #include "config.h" +#include "libbuilder_api.h" #include "logger.h" #include "packagemanager.h" #include "sourcepackage.h" @@ -24,7 +25,7 @@ class Plugin; This class ties everything else together. It also contains code for loading build files and supervising the build process. */ -class Builder +class LIBBUILDER_API Builder { private: class Loader: public Msp::DataFile::ObjectLoader diff --git a/source/lib/buildgraph.h b/source/lib/buildgraph.h index 371b544..9092532 100644 --- a/source/lib/buildgraph.h +++ b/source/lib/buildgraph.h @@ -3,6 +3,7 @@ #include #include +#include "libbuilder_api.h" class Builder; class Target; @@ -10,7 +11,7 @@ class Target; /** Manages a graph of targets. */ -class BuildGraph +class LIBBUILDER_API BuildGraph { private: Builder &builder; diff --git a/source/lib/buildinfo.h b/source/lib/buildinfo.h index 26afabf..0bb1605 100644 --- a/source/lib/buildinfo.h +++ b/source/lib/buildinfo.h @@ -5,12 +5,13 @@ #include #include #include +#include "libbuilder_api.h" /** Stores information about compiler command line parameters in a more abstract form. Allows combining with other BuildInfos to support package dependencies. */ -class BuildInfo +class LIBBUILDER_API BuildInfo { public: enum LibraryMode @@ -28,7 +29,7 @@ public: ABSOLUTE //< Record absolute rpath in binaries }; - class Loader: public Msp::DataFile::ObjectLoader + class LIBBUILDER_API Loader: public Msp::DataFile::ObjectLoader { public: Loader(BuildInfo &); @@ -51,7 +52,7 @@ public: CHAINED //< Include only compilation options }; - struct LanguageStandard + struct LIBBUILDER_API LanguageStandard { std::string type; unsigned year = 0; diff --git a/source/lib/buildtype.h b/source/lib/buildtype.h index c16e8f9..43df567 100644 --- a/source/lib/buildtype.h +++ b/source/lib/buildtype.h @@ -4,8 +4,9 @@ #include #include #include "buildinfo.h" +#include "libbuilder_api.h" -class BuildType +class LIBBUILDER_API BuildType { public: class Loader: public Msp::DataFile::ObjectLoader diff --git a/source/lib/cache.h b/source/lib/cache.h index 9193dac..6b735b2 100644 --- a/source/lib/cache.h +++ b/source/lib/cache.h @@ -5,6 +5,7 @@ #include #include #include +#include "libbuilder_api.h" class SourcePackage; class Target; @@ -17,7 +18,7 @@ Data is stored as lists of strings and keyed to target and an arbitrary identifier. Any kind of strings can be stored, even ones that contain unprintable characters or nuls. */ -class Cache +class LIBBUILDER_API Cache { public: using Values = std::vector; diff --git a/source/lib/chainedtask.h b/source/lib/chainedtask.h index 30a3b3e..4363ffa 100644 --- a/source/lib/chainedtask.h +++ b/source/lib/chainedtask.h @@ -2,13 +2,14 @@ #define CHAINEDTASK_H_ #include +#include "libbuilder_api.h" #include "task.h" /** Runs multiple tasks as one unit, one after the other. Execution of the chain will stop if any of the component tasks terminates with an error. */ -class ChainedTask: public Task +class LIBBUILDER_API ChainedTask: public Task { private: std::vector tasks; diff --git a/source/lib/component.h b/source/lib/component.h index 816d2c1..7d9aa1a 100644 --- a/source/lib/component.h +++ b/source/lib/component.h @@ -7,6 +7,7 @@ #include "buildinfo.h" #include "conditionalloader.h" #include "installmap.h" +#include "libbuilder_api.h" #include "package.h" class SourcePackage; @@ -17,10 +18,10 @@ may also build none), as well as install a bunch of headers. Components inherit dependencies and build info from the package they belong to, and may also add their own. */ -class Component +class LIBBUILDER_API Component { public: - class Loader: public Msp::DataFile::ObjectLoader, public ConditionalLoader + class LIBBUILDER_API Loader: public Msp::DataFile::ObjectLoader, public ConditionalLoader { public: Loader(Component &); diff --git a/source/lib/conditionalloader.h b/source/lib/conditionalloader.h index 5184fac..1d496ab 100644 --- a/source/lib/conditionalloader.h +++ b/source/lib/conditionalloader.h @@ -3,11 +3,12 @@ #include #include +#include "libbuilder_api.h" class Builder; class SourcePackage; -class ArchitectureConditional: virtual public Msp::DataFile::Loader +class LIBBUILDER_API ArchitectureConditional: virtual public Msp::DataFile::Loader { private: const Builder &builder; @@ -21,7 +22,7 @@ private: }; -class FeatureConditional: virtual public Msp::DataFile::Loader +class LIBBUILDER_API FeatureConditional: virtual public Msp::DataFile::Loader { private: const SourcePackage &package; @@ -34,7 +35,7 @@ protected: }; -class ConditionalLoader: public ArchitectureConditional, FeatureConditional +class LIBBUILDER_API ConditionalLoader: public ArchitectureConditional, FeatureConditional { protected: ConditionalLoader(const SourcePackage &, const std::string &); diff --git a/source/lib/config.h b/source/lib/config.h index ba8416b..1c6a9e8 100644 --- a/source/lib/config.h +++ b/source/lib/config.h @@ -7,6 +7,7 @@ #include #include #include "feature.h" +#include "libbuilder_api.h" class SourcePackage; @@ -14,11 +15,11 @@ class SourcePackage; Manages configuration for a package. A configuration may have an arbitary amount of options, as well as a modification time (mtime). */ -class Config +class LIBBUILDER_API Config { public: /** A single configuration option. */ - struct Option: public Feature + struct LIBBUILDER_API Option: public Feature { std::string value; diff --git a/source/lib/csourcefile.h b/source/lib/csourcefile.h index c57654a..4d5664d 100644 --- a/source/lib/csourcefile.h +++ b/source/lib/csourcefile.h @@ -2,12 +2,13 @@ #define CSOURCEFILE_H_ #include +#include "libbuilder_api.h" #include "sourcefile.h" /** Represents a C or C++ source file. */ -class CSourceFile: public SourceFile +class LIBBUILDER_API CSourceFile: public SourceFile { protected: std::vector includes; diff --git a/source/lib/customizedtool.h b/source/lib/customizedtool.h index 55c4c6a..cd58edb 100644 --- a/source/lib/customizedtool.h +++ b/source/lib/customizedtool.h @@ -1,9 +1,10 @@ #ifndef CUSTOMIZEDTOOL_H_ #define CUSTOMIZEDTOOL_H_ +#include "libbuilder_api.h" #include "tool.h" -class CustomizedTool: public Tool +class LIBBUILDER_API CustomizedTool: public Tool { protected: Tool &parent; diff --git a/source/lib/executable.h b/source/lib/executable.h index 5728e2f..a8311fe 100644 --- a/source/lib/executable.h +++ b/source/lib/executable.h @@ -2,8 +2,9 @@ #define EXECUTABLE_H_ #include "binary.h" +#include "libbuilder_api.h" -class Executable: public Binary +class LIBBUILDER_API Executable: public Binary { public: Executable(Builder &b, const Msp::FS::Path &p): Binary(b, p) { } diff --git a/source/lib/exportdefinitions.h b/source/lib/exportdefinitions.h index b8631ee..0535d63 100644 --- a/source/lib/exportdefinitions.h +++ b/source/lib/exportdefinitions.h @@ -2,13 +2,14 @@ #define EXPORTDEFINITIONS_H_ #include "filetarget.h" +#include "libbuilder_api.h" class ObjectFile; /** An export definition file for a shared library. Only used on Windows. */ -class ExportDefinitions: public FileTarget +class LIBBUILDER_API ExportDefinitions: public FileTarget { public: ExportDefinitions(Builder &, const Component &, const std::vector &); diff --git a/source/lib/externaltask.h b/source/lib/externaltask.h index 4a78920..8dbdb86 100644 --- a/source/lib/externaltask.h +++ b/source/lib/externaltask.h @@ -6,6 +6,7 @@ #include #include #include +#include "libbuilder_api.h" #include "task.h" /** @@ -13,7 +14,7 @@ Runs an external command. A zero exit status is translated to a SUCCESS status for the task, and anything else is treated as an error. Output can optionally be captured. */ -class ExternalTask: public Task +class LIBBUILDER_API ExternalTask: public Task { public: enum StreamAction diff --git a/source/lib/file.h b/source/lib/file.h index 42d73b8..0cbf8ca 100644 --- a/source/lib/file.h +++ b/source/lib/file.h @@ -2,11 +2,12 @@ #define FILE_H_ #include "filetarget.h" +#include "libbuilder_api.h" /** Just an arbitrary file. No special meaning attached. */ -class File: public FileTarget +class LIBBUILDER_API File: public FileTarget { public: File(Builder &b, const Msp::FS::Path &t): FileTarget(b, t) { } diff --git a/source/lib/filetarget.h b/source/lib/filetarget.h index d2ed719..124b3c5 100644 --- a/source/lib/filetarget.h +++ b/source/lib/filetarget.h @@ -2,13 +2,14 @@ #define FILETARGET_H_ #include +#include "libbuilder_api.h" #include "target.h" /** An intermediate base class for targets that represent files. Almost all target classes are derived from this. */ -class FileTarget: public Target +class LIBBUILDER_API FileTarget: public Target { protected: Msp::FS::Path path; diff --git a/source/lib/importlibrary.h b/source/lib/importlibrary.h index ac2de26..fbcd98e 100644 --- a/source/lib/importlibrary.h +++ b/source/lib/importlibrary.h @@ -2,6 +2,7 @@ #define IMPORTLIBRARY_H_ #include "filetarget.h" +#include "libbuilder_api.h" class ExportDefinitions; class SharedLibrary; @@ -10,7 +11,7 @@ class SharedLibrary; A special case of static library which pulls in a shared library. Used on platforms with no true dynamic linking support. */ -class ImportLibrary: public FileTarget +class LIBBUILDER_API ImportLibrary: public FileTarget { private: SharedLibrary *shared_lib = 0; diff --git a/source/lib/installcomponent.h b/source/lib/installcomponent.h index 457256d..69441c8 100644 --- a/source/lib/installcomponent.h +++ b/source/lib/installcomponent.h @@ -2,8 +2,9 @@ #define INSTALLCOMPONENT_H_ #include "component.h" +#include "libbuilder_api.h" -class InstallComponent: public Component +class LIBBUILDER_API InstallComponent: public Component { public: InstallComponent(SourcePackage &p, const std::string &n): Component(p, n) { } diff --git a/source/lib/installedfile.h b/source/lib/installedfile.h index 0dd671f..e9dfe17 100644 --- a/source/lib/installedfile.h +++ b/source/lib/installedfile.h @@ -1,13 +1,14 @@ #ifndef INSTALLEDFILE_H_ #define INSTALLEDFILE_H_ -#include "sourcepackage.h" #include "filetarget.h" +#include "libbuilder_api.h" +#include "sourcepackage.h" /** Represents the installation of a file. */ -class InstalledFile: public FileTarget +class LIBBUILDER_API InstalledFile: public FileTarget { private: FileTarget &source; diff --git a/source/lib/installmap.h b/source/lib/installmap.h index 49211d7..6d9501c 100644 --- a/source/lib/installmap.h +++ b/source/lib/installmap.h @@ -4,6 +4,7 @@ #include #include #include +#include "libbuilder_api.h" class FileTarget; @@ -14,7 +15,7 @@ location are mapped if their default install location shares a common prefix with the mapped install location. The remainder of the source location is appended to the mapped install location to form the final install location. */ -class InstallMap +class LIBBUILDER_API InstallMap { public: class Loader: public Msp::DataFile::ObjectLoader diff --git a/source/lib/internaltask.h b/source/lib/internaltask.h index 608ea96..9e553e7 100644 --- a/source/lib/internaltask.h +++ b/source/lib/internaltask.h @@ -3,6 +3,7 @@ #include #include +#include "libbuilder_api.h" #include "task.h" /** @@ -10,10 +11,10 @@ Runs a worker thread. Tools should derive a thread class from InternalTask::Worker. The worker thread must set its status to either SUCCESS or ERROR before terminating. */ -class InternalTask: public Task +class LIBBUILDER_API InternalTask: public Task { private: - class Worker: public Msp::Thread + class LIBBUILDER_API Worker: public Msp::Thread { friend class InternalTask; diff --git a/source/lib/libbuilder_api.h b/source/lib/libbuilder_api.h new file mode 100644 index 0000000..319b27b --- /dev/null +++ b/source/lib/libbuilder_api.h @@ -0,0 +1,16 @@ +#ifndef LIBBUILDER_API_H_ +#define LIBBUILDER_API_H_ + +#if defined(_WIN32) +#if defined(LIBBUILDER_BUILD) +#define LIBBUILDER_API __declspec(dllexport) +#elif defined(LIBBUILDER_IMPORT) +#define LIBBUILDER_API __declspec(dllimport) +#else +#define LIBBUILDER_API +#endif +#elif defined(__GNUC__) +#define LIBBUILDER_API __attribute__((visibility("default"))) +#endif + +#endif diff --git a/source/lib/logger.h b/source/lib/logger.h index 3a10f0e..91bda23 100644 --- a/source/lib/logger.h +++ b/source/lib/logger.h @@ -4,8 +4,9 @@ #include #include #include +#include "libbuilder_api.h" -class Logger +class LIBBUILDER_API Logger { private: std::vector enabled_channels; diff --git a/source/lib/objcsourcefile.h b/source/lib/objcsourcefile.h index 37f79a3..3feb058 100644 --- a/source/lib/objcsourcefile.h +++ b/source/lib/objcsourcefile.h @@ -2,11 +2,12 @@ #define OBJCSOURCEFILE_H_ #include "csourcefile.h" +#include "libbuilder_api.h" /** Represents an Objective-C source file. */ -class ObjCSourceFile: public CSourceFile +class LIBBUILDER_API ObjCSourceFile: public CSourceFile { public: using CSourceFile::CSourceFile; diff --git a/source/lib/objectfile.h b/source/lib/objectfile.h index 9e3ff90..27c9b33 100644 --- a/source/lib/objectfile.h +++ b/source/lib/objectfile.h @@ -2,13 +2,14 @@ #define OBJECTFILE_H_ #include "filetarget.h" +#include "libbuilder_api.h" class SourceFile; /** Object files are compiled from source files. */ -class ObjectFile: public FileTarget +class LIBBUILDER_API ObjectFile: public FileTarget { private: SourceFile &source; diff --git a/source/lib/package.h b/source/lib/package.h index 9a10991..e64c698 100644 --- a/source/lib/package.h +++ b/source/lib/package.h @@ -7,6 +7,7 @@ #include "buildinfo.h" #include "conditionalloader.h" #include "config.h" +#include "libbuilder_api.h" class Builder; @@ -15,7 +16,7 @@ A package is a distributable piece of software. Package information may be obtained in several ways: Build files of source packages, pkg-config for binary packages and the builderrc file for binary packages with no pkg-config support. */ -class Package +class LIBBUILDER_API Package { public: class Loader: public Msp::DataFile::ObjectLoader, public ArchitectureConditional diff --git a/source/lib/packagemanager.h b/source/lib/packagemanager.h index fc0aa98..4f90d8b 100644 --- a/source/lib/packagemanager.h +++ b/source/lib/packagemanager.h @@ -6,6 +6,7 @@ #include #include #include +#include "libbuilder_api.h" class Builder; class Package; @@ -14,7 +15,7 @@ class Package; Keeps track of packages. Also responsible for locating previously unknown packages by name. */ -class PackageManager +class LIBBUILDER_API PackageManager { private: Builder &builder; diff --git a/source/lib/pattern.h b/source/lib/pattern.h index 5da52eb..bfaee77 100644 --- a/source/lib/pattern.h +++ b/source/lib/pattern.h @@ -3,13 +3,14 @@ #include #include +#include "libbuilder_api.h" /** Stores a filename pattern. A pattern consists of a prefix and a suffix, and can be applied to a body to form a complete filename. Either or both of the prefix and suffix may be empty. */ -class Pattern +class LIBBUILDER_API Pattern { private: std::string prefix; diff --git a/source/lib/plugin.h b/source/lib/plugin.h index 35cdb32..1e79fca 100644 --- a/source/lib/plugin.h +++ b/source/lib/plugin.h @@ -1,12 +1,14 @@ #ifndef PLUGIN_H_ #define PLUGIN_H_ +#include "libbuilder_api.h" + class Architecture; class Builder; class SourcePackage; class Toolchain; -class Plugin +class LIBBUILDER_API Plugin { protected: Builder &builder; diff --git a/source/lib/sharedlibrary.h b/source/lib/sharedlibrary.h index 564b210..363c6ab 100644 --- a/source/lib/sharedlibrary.h +++ b/source/lib/sharedlibrary.h @@ -2,6 +2,7 @@ #define SHAREDLIB_H_ #include "binary.h" +#include "libbuilder_api.h" class ImportLibrary; @@ -14,7 +15,7 @@ no version, soname will be empty. A SharedLibrary can also store a pointer to the associated ImportLibrary, for platforms that need one. */ -class SharedLibrary: public Binary +class LIBBUILDER_API SharedLibrary: public Binary { private: std::string libname; diff --git a/source/lib/sourcearchivecomponent.h b/source/lib/sourcearchivecomponent.h index 94c1bc5..5c48ffe 100644 --- a/source/lib/sourcearchivecomponent.h +++ b/source/lib/sourcearchivecomponent.h @@ -2,8 +2,9 @@ #define TARBALLCOMPONENT_H_ #include "component.h" +#include "libbuilder_api.h" -class SourceArchiveComponent: public Component +class LIBBUILDER_API SourceArchiveComponent: public Component { public: SourceArchiveComponent(SourcePackage &); diff --git a/source/lib/sourcefile.h b/source/lib/sourcefile.h index 16521a5..dd7ca9d 100644 --- a/source/lib/sourcefile.h +++ b/source/lib/sourcefile.h @@ -2,8 +2,9 @@ #define SOURCEFILE_H_ #include "filetarget.h" +#include "libbuilder_api.h" -class SourceFile: public FileTarget +class LIBBUILDER_API SourceFile: public FileTarget { protected: SourceFile(Builder &b, const Msp::FS::Path &p): FileTarget(b, p) { } diff --git a/source/lib/sourcepackage.h b/source/lib/sourcepackage.h index d458c90..6644262 100644 --- a/source/lib/sourcepackage.h +++ b/source/lib/sourcepackage.h @@ -11,6 +11,7 @@ #include "conditionalloader.h" #include "config.h" #include "feature.h" +#include "libbuilder_api.h" #include "package.h" #include "toolchain.h" @@ -21,7 +22,7 @@ class SourceArchiveComponent; /** A package that can be built by Builder. */ -class SourcePackage: public Package +class LIBBUILDER_API SourcePackage: public Package { public: class Loader: public Msp::DataFile::DerivedObjectLoader, public FeatureConditional diff --git a/source/lib/staticlibrary.h b/source/lib/staticlibrary.h index 98d2990..aa26411 100644 --- a/source/lib/staticlibrary.h +++ b/source/lib/staticlibrary.h @@ -2,6 +2,7 @@ #define STATICLIBRARY_H_ #include "filetarget.h" +#include "libbuilder_api.h" class Component; class ObjectFile; @@ -9,7 +10,7 @@ class ObjectFile; /** A static library target. */ -class StaticLibrary: public FileTarget +class LIBBUILDER_API StaticLibrary: public FileTarget { private: /* TODO this really belongs in a Component, but some refactoring is required diff --git a/source/lib/sysutils.cpp b/source/lib/sysutils.cpp index 95867b7..b9b35e9 100644 --- a/source/lib/sysutils.cpp +++ b/source/lib/sysutils.cpp @@ -62,7 +62,7 @@ FS::Path get_program_files_x86_dir() } template<> -string get_registry_value(const string &path) +LIBBUILDER_API string get_registry_value(const string &path) { #ifdef _WIN32 string::size_type first_sep = path.find('\\'); diff --git a/source/lib/sysutils.h b/source/lib/sysutils.h index 7300869..789f5d4 100644 --- a/source/lib/sysutils.h +++ b/source/lib/sysutils.h @@ -3,9 +3,10 @@ #include #include +#include "libbuilder_api.h" -std::string get_system_type(); -Msp::FS::Path get_program_files_x86_dir(); +LIBBUILDER_API std::string get_system_type(); +LIBBUILDER_API Msp::FS::Path get_program_files_x86_dir(); template T get_registry_value(const std::string &); diff --git a/source/lib/target.h b/source/lib/target.h index 6ef6457..0ba38f8 100644 --- a/source/lib/target.h +++ b/source/lib/target.h @@ -7,6 +7,7 @@ #include #include #include +#include "libbuilder_api.h" class Builder; class BuildInfo; @@ -24,7 +25,7 @@ normal and transitive. Normal dependencies will need to be built before the target itself, and will cause the target to be rebuilt if modified. Transitive dependencies can be used by other targets further down the chain. */ -class Target +class LIBBUILDER_API Target { public: using Dependencies = std::vector; diff --git a/source/lib/task.h b/source/lib/task.h index 915ffe1..b0f56f4 100644 --- a/source/lib/task.h +++ b/source/lib/task.h @@ -4,13 +4,14 @@ #include #include #include +#include "libbuilder_api.h" /** Tasks are used to manage other programs and worker threads involved in the build process. They are run asynchronously by default, but a wait() method is provided should it be necessary to wait for a task to finish. */ -class Task +class LIBBUILDER_API Task { public: enum Status diff --git a/source/lib/templatefile.h b/source/lib/templatefile.h index 0912025..a67e0bf 100644 --- a/source/lib/templatefile.h +++ b/source/lib/templatefile.h @@ -1,12 +1,13 @@ #ifndef TEMPLATEFILE_H_ #define TEMPLATEFILE_H_ +#include "libbuilder_api.h" #include "sourcefile.h" /** Input file for SourceGenerator. */ -class TemplateFile: public SourceFile +class LIBBUILDER_API TemplateFile: public SourceFile { public: TemplateFile(Builder &b, const Component &c, const Msp::FS::Path &p): SourceFile(b, c, p) { } diff --git a/source/lib/tool.h b/source/lib/tool.h index a6bd322..5921c2d 100644 --- a/source/lib/tool.h +++ b/source/lib/tool.h @@ -8,6 +8,7 @@ #include "buildinfo.h" #include "externaltask.h" #include "internaltask.h" +#include "libbuilder_api.h" #include "sourcepackage.h" #include "target.h" #include "virtualfilesystem.h" @@ -31,7 +32,7 @@ public: Base class for tools. Tools are used to turn targets into other targets. Examples include compilers and linkers. */ -class Tool: protected ToolData +class LIBBUILDER_API Tool: protected ToolData { public: enum ProcessingUnit diff --git a/source/lib/toolchain.h b/source/lib/toolchain.h index 34fc0a2..b3738c6 100644 --- a/source/lib/toolchain.h +++ b/source/lib/toolchain.h @@ -4,13 +4,14 @@ #include #include #include +#include "libbuilder_api.h" class Tool; /** A container for tools. Performs lookup based on tag or filename extension. */ -class Toolchain +class LIBBUILDER_API Toolchain { private: std::string name; diff --git a/source/lib/virtualfilesystem.h b/source/lib/virtualfilesystem.h index 60e198a..1a1c9ef 100644 --- a/source/lib/virtualfilesystem.h +++ b/source/lib/virtualfilesystem.h @@ -6,6 +6,7 @@ #include #include #include "buildinfo.h" +#include "libbuilder_api.h" class Builder; class FileTarget; @@ -17,7 +18,7 @@ Provides access to the filesystem in a way that takes known targets into account. Thus, targets may be returned for files that do not exist yet if it's possible to build them. */ -class VirtualFileSystem +class LIBBUILDER_API VirtualFileSystem { public: using SearchPath = std::vector; diff --git a/source/lib/virtualtarget.h b/source/lib/virtualtarget.h index 5151826..088c02c 100644 --- a/source/lib/virtualtarget.h +++ b/source/lib/virtualtarget.h @@ -1,12 +1,13 @@ #ifndef VIRTUALTARGET_H_ #define VIRTUALTARGET_H_ +#include "libbuilder_api.h" #include "target.h" /** A target that is not associated with any file. */ -class VirtualTarget: public Target +class LIBBUILDER_API VirtualTarget: public Target { public: VirtualTarget(Builder &b, const std::string &n): Target(b, n) { } -- 2.45.2