diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-01-02 19:30:52 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-01-02 20:10:53 +0100 |
commit | 8ac9ddf460cc4c1b2972df1069128fb615b31042 (patch) | |
tree | 8fac0b3171f1fb2a39a10af5abff71a304100dc4 /include | |
parent | 87a65f6913429b26e63fdee17cb8cfe93990db35 (diff) |
Fix bug when using config for several platforms in one project
Diffstat (limited to 'include')
-rw-r--r-- | include/Conf.hpp | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/include/Conf.hpp b/include/Conf.hpp index 764b3f9..476e38b 100644 --- a/include/Conf.hpp +++ b/include/Conf.hpp @@ -109,32 +109,55 @@ namespace sibs PLATFORM_WIN32, PLATFORM_WIN64 }; + + const StringView CONFIGS[] = { + "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" + }; + const int NUM_CONFIGS = 12; // TODO: Detect this at runtime? #if OS_TYPE == OS_TYPE_WINDOWS #ifdef SIBS_ENV_32BIT - const Platform SYSTEM_PLATFORM = Platform::PLATFORM_WIN32; - const StringView CONFIG_SYSTEM_PLATFORM = "config.win32"; - const StringView CONFIG_STATIC_DEBUG_PLATFORM = "config.win32.static.debug"; - const StringView CONFIG_STATIC_RELEASE_PLATFORM = "config.win32.static.release"; + #define SYSTEM_PLATFORM Platform::PLATFORM_WIN32 + #define CONFIG_SYSTEM_PLATFORM 0 + #define CONFIG_STATIC_DEBUG_PLATFORM 1 + #define CONFIG_STATIC_RELEASE_PLATFORM 2 #else - const Platform SYSTEM_PLATFORM = Platform::PLATFORM_WIN64; - const StringView CONFIG_SYSTEM_PLATFORM = "config.win64"; - const StringView CONFIG_STATIC_DEBUG_PLATFORM = "config.win64.static.debug"; - const StringView CONFIG_STATIC_RELEASE_PLATFORM = "config.win64.static.release"; + #define SYSTEM_PLATFORM Platform::PLATFORM_WIN64 + #define CONFIG_SYSTEM_PLATFORM 3 + #define CONFIG_STATIC_DEBUG_PLATFORM 4 + #define CONFIG_STATIC_RELEASE_PLATFORM 5 #endif + #define CONFIG_STATIC_LIB_FILE_EXTENSION "lib" + #define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "dll" #elif OS_TYPE == OS_TYPE_LINUX #ifdef SIBS_ENV_32BIT - const Platform SYSTEM_PLATFORM = Platform::PLATFORM_LINUX32; - const StringView CONFIG_SYSTEM_PLATFORM = "config.linux32"; - const StringView CONFIG_STATIC_DEBUG_PLATFORM = "config.linux32.static.debug"; - const StringView CONFIG_STATIC_RELEASE_PLATFORM = "config.linux32.static.release"; + #define SYSTEM_PLATFORM Platform::PLATFORM_LINUX32 + #define CONFIG_SYSTEM_PLATFORM 6 + #define CONFIG_STATIC_DEBUG_PLATFORM 7 + #define CONFIG_STATIC_RELEASE_PLATFORM 8 #else - const Platform SYSTEM_PLATFORM = Platform::PLATFORM_LINUX64; - const StringView CONFIG_SYSTEM_PLATFORM = "config.linux64"; - const StringView CONFIG_STATIC_DEBUG_PLATFORM = "config.linux64.static.debug"; - const StringView CONFIG_STATIC_RELEASE_PLATFORM = "config.linux64.static.release"; + #define SYSTEM_PLATFORM Platform::PLATFORM_LINUX64 + #define CONFIG_SYSTEM_PLATFORM 9 + #define CONFIG_STATIC_DEBUG_PLATFORM 10 + #define CONFIG_STATIC_RELEASE_PLATFORM 11 #endif + #define CONFIG_STATIC_LIB_FILE_EXTENSION "a" + #define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "so" #endif bool containsPlatform(const std::vector<Platform> &platforms, Platform platform); @@ -299,6 +322,10 @@ namespace sibs virtual void finished() override; void failInvalidFieldUnderObject(const StringView &fieldName) const; private: + void parsePlatformConfigs(const StringView &fieldName, const ConfigValue &fieldValue); + void parsePlatformConfig(const StringView &fieldName, const ConfigValue &fieldValue); + void parsePlatformConfigStaticDebug(const StringView &fieldName, const ConfigValue &fieldValue); + void parsePlatformConfigStaticRelease(const StringView &fieldName, const ConfigValue &fieldValue); void parseCmake(const StringView &fieldName, const ConfigValue &fieldValue, std::string &cmakeDir, std::string &cmakeArgs); void validatePackageName() const; protected: |