}
+#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);
}
}
+#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);
}
}
+#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);
}
}
+#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);
}
}
+#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);
}
}
+#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);
}
#include <typeinfo>
#include <msp/datafile/loader.h>
#include "buildinfo.h"
+#include "libbuilder_api.h"
#include "pattern.h"
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<Architecture>
#include "buildinfo.h"
#include "filetarget.h"
+#include "libbuilder_api.h"
class Component;
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;
#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<BinaryComponent, Component::Loader>
#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<BinaryPackage, Package::Loader>
#include "buildgraph.h"
#include "buildtype.h"
#include "config.h"
+#include "libbuilder_api.h"
#include "logger.h"
#include "packagemanager.h"
#include "sourcepackage.h"
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<Builder>
#include <map>
#include <string>
+#include "libbuilder_api.h"
class Builder;
class Target;
/**
Manages a graph of targets.
*/
-class BuildGraph
+class LIBBUILDER_API BuildGraph
{
private:
Builder &builder;
#include <vector>
#include <msp/datafile/objectloader.h>
#include <msp/fs/path.h>
+#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
ABSOLUTE //< Record absolute rpath in binaries
};
- class Loader: public Msp::DataFile::ObjectLoader<BuildInfo>
+ class LIBBUILDER_API Loader: public Msp::DataFile::ObjectLoader<BuildInfo>
{
public:
Loader(BuildInfo &);
CHAINED //< Include only compilation options
};
- struct LanguageStandard
+ struct LIBBUILDER_API LanguageStandard
{
std::string type;
unsigned year = 0;
#include <string>
#include <msp/datafile/objectloader.h>
#include "buildinfo.h"
+#include "libbuilder_api.h"
-class BuildType
+class LIBBUILDER_API BuildType
{
public:
class Loader: public Msp::DataFile::ObjectLoader<BuildType>
#include <vector>
#include <msp/fs/path.h>
#include <msp/time/timestamp.h>
+#include "libbuilder_api.h"
class SourcePackage;
class Target;
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<std::string>;
#define CHAINEDTASK_H_
#include <vector>
+#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<Task *> tasks;
#include "buildinfo.h"
#include "conditionalloader.h"
#include "installmap.h"
+#include "libbuilder_api.h"
#include "package.h"
class SourcePackage;
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<Component>, public ConditionalLoader
+ class LIBBUILDER_API Loader: public Msp::DataFile::ObjectLoader<Component>, public ConditionalLoader
{
public:
Loader(Component &);
#include <string>
#include <msp/datafile/loader.h>
+#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;
};
-class FeatureConditional: virtual public Msp::DataFile::Loader
+class LIBBUILDER_API FeatureConditional: virtual public Msp::DataFile::Loader
{
private:
const SourcePackage &package;
};
-class ConditionalLoader: public ArchitectureConditional, FeatureConditional
+class LIBBUILDER_API ConditionalLoader: public ArchitectureConditional, FeatureConditional
{
protected:
ConditionalLoader(const SourcePackage &, const std::string &);
#include <msp/fs/path.h>
#include <msp/time/timestamp.h>
#include "feature.h"
+#include "libbuilder_api.h"
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;
#define CSOURCEFILE_H_
#include <msp/io/base.h>
+#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<std::string> includes;
#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;
#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) { }
#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<ObjectFile *> &);
#include <msp/core/process.h>
#include <msp/fs/path.h>
#include <msp/io/pipe.h>
+#include "libbuilder_api.h"
#include "task.h"
/**
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
#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) { }
#define FILETARGET_H_
#include <msp/fs/path.h>
+#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;
#define IMPORTLIBRARY_H_
#include "filetarget.h"
+#include "libbuilder_api.h"
class ExportDefinitions;
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;
#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) { }
#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;
#include <vector>
#include <msp/datafile/objectloader.h>
#include <msp/fs/path.h>
+#include "libbuilder_api.h"
class FileTarget;
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<InstallMap>
#include <functional>
#include <msp/core/thread.h>
+#include "libbuilder_api.h"
#include "task.h"
/**
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;
--- /dev/null
+#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
#include <string>
#include <vector>
#include <msp/strings/format.h>
+#include "libbuilder_api.h"
-class Logger
+class LIBBUILDER_API Logger
{
private:
std::vector<std::string> enabled_channels;
#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;
#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;
#include "buildinfo.h"
#include "conditionalloader.h"
#include "config.h"
+#include "libbuilder_api.h"
class Builder;
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<Package>, public ArchitectureConditional
#include <string>
#include <vector>
#include <msp/fs/path.h>
+#include "libbuilder_api.h"
class Builder;
class Package;
Keeps track of packages. Also responsible for locating previously unknown
packages by name.
*/
-class PackageManager
+class LIBBUILDER_API PackageManager
{
private:
Builder &builder;
#include <string>
#include <vector>
+#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;
#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;
#define SHAREDLIB_H_
#include "binary.h"
+#include "libbuilder_api.h"
class ImportLibrary;
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;
#define TARBALLCOMPONENT_H_
#include "component.h"
+#include "libbuilder_api.h"
-class SourceArchiveComponent: public Component
+class LIBBUILDER_API SourceArchiveComponent: public Component
{
public:
SourceArchiveComponent(SourcePackage &);
#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) { }
#include "conditionalloader.h"
#include "config.h"
#include "feature.h"
+#include "libbuilder_api.h"
#include "package.h"
#include "toolchain.h"
/**
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<SourcePackage, Package::Loader>, public FeatureConditional
#define STATICLIBRARY_H_
#include "filetarget.h"
+#include "libbuilder_api.h"
class Component;
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
}
template<>
-string get_registry_value<string>(const string &path)
+LIBBUILDER_API string get_registry_value<string>(const string &path)
{
#ifdef _WIN32
string::size_type first_sep = path.find('\\');
#include <string>
#include <msp/fs/path.h>
+#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<typename T>
T get_registry_value(const std::string &);
#include <vector>
#include <sigc++/signal.h>
#include <msp/time/timestamp.h>
+#include "libbuilder_api.h"
class Builder;
class BuildInfo;
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<Target *>;
#include <string>
#include <sigc++/signal.h>
#include <msp/fs/path.h>
+#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
#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) { }
#include "buildinfo.h"
#include "externaltask.h"
#include "internaltask.h"
+#include "libbuilder_api.h"
#include "sourcepackage.h"
#include "target.h"
#include "virtualfilesystem.h"
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
#include <map>
#include <string>
#include <vector>
+#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;
#include <vector>
#include <msp/fs/path.h>
#include "buildinfo.h"
+#include "libbuilder_api.h"
class Builder;
class FileTarget;
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<Msp::FS::Path>;
#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) { }