summaryrefslogtreecommitdiff
path: root/libcppbuild.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-06-20 20:21:58 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-06-20 20:21:58 +0200
commitc53e622b648635539e4870fd0c9159c5d8c3be4a (patch)
treea154de97d62e2aad99ccb5498ca7c297ee93623e /libcppbuild.h
parent4bc1ac3fe2fe3ae96ba0e5aa4d19fa4885a16c83 (diff)
Introduction of configuration generation for controlling tool-chain.
Diffstat (limited to 'libcppbuild.h')
-rw-r--r--libcppbuild.h39
1 files changed, 32 insertions, 7 deletions
diff --git a/libcppbuild.h b/libcppbuild.h
index 2aba987..81e7a9e 100644
--- a/libcppbuild.h
+++ b/libcppbuild.h
@@ -3,25 +3,45 @@
#include <string>
#include <vector>
-//#include <source_location>
+#include <map>
enum class TargetType
{
- Auto, // Default - deduce from target name
+ Auto, // Default - deduce from target name and sources extensions
+
Executable,
StaticLibrary,
DynamicLibrary,
+ Object,
+};
+
+enum class Language
+{
+ Auto, // Default - deduce language from source extensions
+
+ C,
+ Cpp,
+ Asm,
+};
+
+enum class OutputSystem
+{
+ Target, // Output for the target system
+ BuildHost, // Internal tool during cross-compilation
};
struct BuildConfiguration
{
TargetType type{TargetType::Auto};
+ Language language{Language::Auto};
+ OutputSystem system{OutputSystem::Target};
std::string target;
- std::vector<std::string> sources;
- std::vector<std::string> depends;
- std::vector<std::string> cxxflags;
- std::vector<std::string> cflags;
- std::vector<std::string> ldflags;
+ std::vector<std::string> sources; // source list
+ std::vector<std::string> depends; // internal dependencies
+ std::vector<std::string> cxxflags; // flags for c++ compiler
+ std::vector<std::string> cflags; // flags for c compiler
+ std::vector<std::string> ldflags; // flags for linker
+ std::vector<std::string> asmflags; // flags for asm translator
};
using BuildConfigurations = std::vector<BuildConfiguration>;
@@ -33,3 +53,8 @@ int reg(const char* location, BuildConfigurations (*cb)());
#define CONCAT_INNER(a, b) a ## b
#define UNIQUE_NAME(base) CONCAT(base, __LINE__)
#define REG(cb) namespace { int UNIQUE_NAME(unique) = reg(__FILE__, cb); }
+
+const std::map<std::string, std::string>& configuration();
+bool hasConfiguration(const std::string& key);
+const std::string& getConfiguration(const std::string& key,
+ const std::string& defaultValue = {});