summaryrefslogtreecommitdiff
path: root/src/libctor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libctor.h')
-rw-r--r--src/libctor.h123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/libctor.h b/src/libctor.h
deleted file mode 100644
index 0af33cb..0000000
--- a/src/libctor.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// -*- c++ -*-
-// Distributed under the BSD 2-Clause License.
-// See accompanying file LICENSE for details.
-#pragma once
-
-#include <source_location>
-#include <string>
-#include <vector>
-#include <map>
-
-enum class TargetType
-{
- Auto, // Default - deduce from target name and sources extensions
-
- Executable,
- StaticLibrary,
- DynamicLibrary,
- Object,
- UnitTest,
-};
-
-enum class Language
-{
- Auto, // Default - deduce language from source extensions
-
- C,
- Cpp,
- Asm,
-};
-
-enum class OutputSystem
-{
- Host, // Output for the target system
- Build, // Internal tool during cross-compilation
-};
-
-struct Source
-{
- Source(const char* file) : file(file) {}
- Source(const std::string& file) : file(file) {}
- Source(const char* file, Language lang) : file(file), language(lang) {}
- Source(const std::string& file, Language lang) : file(file), language(lang) {}
-
- std::string file;
- Language language{Language::Auto};
-};
-
-struct Flags
-{
- 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
-};
-
-struct BuildConfiguration
-{
- std::string name; // Name - used for referring in other configurations.
- TargetType type{TargetType::Auto};
- OutputSystem system{OutputSystem::Host};
- std::string target; // Output target file for this configuration
- std::vector<Source> sources; // source list
- std::vector<std::string> depends; // internal target dependencies
- Flags flags;
- std::vector<std::string> externals; // externals used by this configuration
-};
-
-using BuildConfigurations = std::vector<BuildConfiguration>;
-
-int reg(BuildConfigurations (*cb)(),
- const std::source_location location = std::source_location::current());
-
-
-struct ExternalConfiguration
-{
- std::string name; // Name for configuration
- Flags flags;
- std::vector<std::string> libs; // libraries
-};
-
-using ExternalConfigurations = std::vector<ExternalConfiguration>;
-
-int reg(ExternalConfigurations (*cb)(),
- const std::source_location location = std::source_location::current());
-
-// Convenience macro - ugly but keeps things simple(r)
-#define CONCAT(a, b) CONCAT_INNER(a, b)
-#define CONCAT_INNER(a, b) a ## b
-#define UNIQUE_NAME(base) CONCAT(base, __LINE__)
-#define REG(cb) namespace { int UNIQUE_NAME(unique) = reg(cb); }
-
-// Predefined configuration keys
-namespace cfg
-{
-constexpr auto builddir = "builddir";
-
-constexpr auto host_cc = "host-cc";
-constexpr auto host_cxx = "host-cpp";
-constexpr auto host_ar = "host-ar";
-constexpr auto host_ld = "host-ld";
-
-constexpr auto build_cc = "build-cc";
-constexpr auto build_cxx = "build-cpp";
-constexpr auto build_ar = "build-ar";
-constexpr auto build_ld = "build-ld";
-
-constexpr auto ctor_includedir = "ctor-includedir";
-constexpr auto ctor_libdir = "ctor-libdir";
-}
-
-struct Configuration
-{
- std::vector<std::string> args; // vector of arguments used when last calling configure
- std::map<std::string, std::string> env; // env used when last calling configure
-
- std::map<std::string, std::string> tools; // tools
- std::map<std::string, Flags> externals;
-};
-
-const Configuration& configuration();
-bool hasConfiguration(const std::string& key);
-const std::string& getConfiguration(const std::string& key,
- const std::string& defaultValue = {});