aboutsummaryrefslogtreecommitdiff
path: root/include/Conf.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/Conf.hpp')
-rw-r--r--include/Conf.hpp139
1 files changed, 2 insertions, 137 deletions
diff --git a/include/Conf.hpp b/include/Conf.hpp
index bae0153..a60bc36 100644
--- a/include/Conf.hpp
+++ b/include/Conf.hpp
@@ -138,181 +138,47 @@ namespace sibs
Language language;
std::string filepath;
};
-
- const StringView CONFIGS[] = {
- "config.win",
- "config.win.static.debug",
- "config.win.static.release",
-
- "config.linux",
- "config.linux.static.debug",
- "config.linux.static.release",
-
- "config.macos",
- "config.macos.static.debug",
- "config.macos.static.release",
-
- "config.bsd",
- "config.bsd.static.debug",
- "config.bsd.static.release",
-
- "config.openbsd",
- "config.openbsd.static.debug",
- "config.openbsd.static.release",
-
- "config.haiku",
- "config.haiku.static.debug",
- "config.haiku.static.release",
-
- "config.win32",
- "config.win32.static.debug",
- "config.win32.static.release",
-
- "config.win64",
- "config.win64.static.debug",
- "config.win64.static.release",
-
- "config.linux32",
- "config.linux32.static.debug",
- "config.linux32.static.release",
-
- "config.linux64",
- "config.linux64.static.debug",
- "config.linux64.static.release",
-
- "config.macos32",
- "config.macos32.static.debug",
- "config.macos32.static.release"
-
- "config.macos64",
- "config.macos64.static.debug",
- "config.macos64.static.release",
-
- "config.openbsd32",
- "config.openbsd32.static.debug",
- "config.openbsd32.static.release",
-
- "config.openbsd64",
- "config.openbsd64.static.debug",
- "config.openbsd64.static.release",
-
- "config.haiku32",
- "config.haiku32.static.debug",
- "config.haiku32.static.release",
-
- "config.haiku64",
- "config.haiku64.static.debug",
- "config.haiku64.static.release"
- };
- const int NUM_CONFIGS = 3 * 16;
- const int CONFIGS_GENERIC_OFFSET = 3 * 6;
#if OS_TYPE == OS_TYPE_WINDOWS
#ifdef SIBS_ENV_32BIT
const Platform SYSTEM_PLATFORM = PLATFORM_WIN32;
- #define SYSTEM_PLATFORM_NAME L"win32"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 0
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 1
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 2
#else
const Platform SYSTEM_PLATFORM = PLATFORM_WIN64;
- #define SYSTEM_PLATFORM_NAME L"win64"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 3
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 4
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 5
#endif
#define CONFIG_STATIC_LIB_FILE_EXTENSION L"lib"
#define CONFIG_DYNAMIC_LIB_FILE_EXTENSION L"dll"
-
- #define SYSTEM_GENERIC_PLATFORM_NAME "win"
- #define CONFIG_GENERIC_SYSTEM_PLATFORM 0
- #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 1
- #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 2
#elif OS_TYPE == OS_TYPE_LINUX
#ifdef SIBS_ENV_32BIT
const Platform SYSTEM_PLATFORM = PLATFORM_LINUX32;
- #define SYSTEM_PLATFORM_NAME "linux32"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 6
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 7
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 8
#else
const Platform SYSTEM_PLATFORM = PLATFORM_LINUX64;
- #define SYSTEM_PLATFORM_NAME "linux64"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 9
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 10
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 11
#endif
#define CONFIG_STATIC_LIB_FILE_EXTENSION "a"
#define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "so"
-
- #define SYSTEM_GENERIC_PLATFORM_NAME "linux"
- #define CONFIG_GENERIC_SYSTEM_PLATFORM 3
- #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 4
- #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 5
#elif OS_TYPE == OS_TYPE_APPLE
#ifdef SIBS_ENV_32BIT
const Platform SYSTEM_PLATFORM = PLATFORM_MACOS32;
- #define SYSTEM_PLATFORM_NAME "macos32"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 12
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 13
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 14
#else
const Platform SYSTEM_PLATFORM = PLATFORM_MACOS64;
- #define SYSTEM_PLATFORM_NAME "macos64"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 15
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 16
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 17
#endif
#define CONFIG_STATIC_LIB_FILE_EXTENSION "a"
#define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "dylib"
-
- #define SYSTEM_GENERIC_PLATFORM_NAME "macos"
- #define CONFIG_GENERIC_SYSTEM_PLATFORM 6
- #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 7
- #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 8
#elif OS_TYPE == OS_TYPE_OPENBSD
#ifdef SIBS_ENV_32BIT
const Platform SYSTEM_PLATFORM = PLATFORM_OPENBSD32;
- #define SYSTEM_PLATFORM_NAME "openbsd32"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 18
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 19
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 20
#else
const Platform SYSTEM_PLATFORM = PLATFORM_OPENBSD64;
- #define SYSTEM_PLATFORM_NAME "openbsd64"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 21
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 22
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 23
#endif
#define CONFIG_STATIC_LIB_FILE_EXTENSION "a"
#define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "so"
-
- // TODO: Also add "bsd" platform
- #define SYSTEM_GENERIC_PLATFORM_NAME "openbsd"
- #define CONFIG_GENERIC_SYSTEM_PLATFORM 12
- #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 13
- #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 14
#elif OS_TYPE == OS_TYPE_HAIKU
#ifdef SIBS_ENV_32BIT
const Platform SYSTEM_PLATFORM = PLATFORM_HAIKU32;
- #define SYSTEM_PLATFORM_NAME "haiku32"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 24
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 25
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 26
#else
const Platform SYSTEM_PLATFORM = PLATFORM_HAIKU64;
- #define SYSTEM_PLATFORM_NAME "haiku64"
- #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 27
- #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 28
- #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 29
#endif
#define CONFIG_STATIC_LIB_FILE_EXTENSION "a"
#define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "so"
-
- #define SYSTEM_GENERIC_PLATFORM_NAME "haiku"
- #define CONFIG_GENERIC_SYSTEM_PLATFORM 15
- #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 16
- #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 17
#endif
const char* asString(OptimizationLevel optLevel);
@@ -365,13 +231,11 @@ namespace sibs
virtual const std::string& getPackageName() const
{
- assert(finishedProcessing);
return packageName;
}
virtual PackageType getPackageType() const
{
- assert(finishedProcessing);
return packageType;
}
@@ -543,6 +407,7 @@ namespace sibs
protected:
virtual void processObject(StringView name) override;
virtual void processField(StringView name, const ConfigValue &value) override;
+ void parseConfig(const StringView &name, const ConfigValue &value);
void parseDependencies(const StringView &name, const ConfigValue &value);
virtual void finished() override;
void failInvalidFieldUnderObject(const StringView &fieldName) const;
@@ -550,7 +415,7 @@ namespace sibs
private:
void parseCLang(const StringView &fieldName, const ConfigValue &fieldValue);
void parseCppLang(const StringView &fieldName, const ConfigValue &fieldValue);
- void parsePlatformBuildTypeConfigs(const StringView &fieldName, const ConfigValue &fieldValue);
+ void parsePlatformConfig(const StringView &fieldName, const ConfigValue &fieldValue);
std::string parsePlatformConfigStatic(const StringView &fieldName, const ConfigValue &fieldValue);
void parsePlatformConfigStaticDebug(const StringView &fieldName, const ConfigValue &fieldValue);
void parsePlatformConfigStaticRelease(const StringView &fieldName, const ConfigValue &fieldValue);