aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Conf.hpp66
-rw-r--r--include/FileUtil.hpp1
-rw-r--r--include/GlobalLib.hpp2
-rw-r--r--include/Linker.hpp1
-rw-r--r--include/env.hpp10
5 files changed, 73 insertions, 7 deletions
diff --git a/include/Conf.hpp b/include/Conf.hpp
index d147fca..2cb387c 100644
--- a/include/Conf.hpp
+++ b/include/Conf.hpp
@@ -99,6 +99,46 @@ namespace sibs
MSVC
};
+ enum Platform
+ {
+ PLATFORM_ANY,
+
+ PLATFORM_LINUX32,
+ PLATFORM_LINUX64,
+
+ PLATFORM_WIN32,
+ PLATFORM_WIN64
+ };
+
+ // 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";
+ #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";
+ #endif
+ #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";
+ #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";
+ #endif
+ #endif
+
+ bool containsPlatform(const std::vector<Platform> &platforms, Platform platform);
+ const char* asString(Platform platform);
const char* asString(OptimizationLevel optLevel);
class SibsConfig : public ConfigCallback
@@ -144,10 +184,30 @@ namespace sibs
return includeDirs;
}
+ virtual const std::vector<std::string>& getGlobalIncludeDirs() const
+ {
+ return exposeIncludeDirs;
+ }
+
+ virtual const std::vector<Platform>& getPlatforms() const
+ {
+ return platforms;
+ }
+
virtual OptimizationLevel getOptimizationLevel() const
{
return optimizationLevel;
}
+
+ const std::vector<std::string>& getDebugStaticLibs() const
+ {
+ return debugStaticLibs;
+ }
+
+ const std::vector<std::string>& getReleaseStaticLibs() const
+ {
+ return releaseStaticLibs;
+ }
void setPackageType(PackageType packageType)
{
@@ -170,15 +230,19 @@ namespace sibs
PackageType packageType;
std::vector<Dependency> dependencies;
std::vector<std::string> includeDirs;
+ std::vector<std::string> exposeIncludeDirs;
+ std::vector<Platform> platforms;
std::unordered_map<std::string, std::string> defines;
OptimizationLevel optimizationLevel;
+ std::vector<std::string> debugStaticLibs;
+ std::vector<std::string> releaseStaticLibs;
bool finishedProcessing;
};
class SibsTestConfig : public SibsConfig
{
public:
- SibsTestConfig(Compiler _compiler, const FileString &_projectPath) : SibsConfig(_compiler, _projectPath)
+ SibsTestConfig(Compiler _compiler, const FileString &_projectPath, OptimizationLevel _optimizationLevel) : SibsConfig(_compiler, _projectPath, _optimizationLevel)
{
packageName = "test";
}
diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp
index 89eaa84..f2679a0 100644
--- a/include/FileUtil.hpp
+++ b/include/FileUtil.hpp
@@ -30,6 +30,7 @@ namespace sibs
FileString utf8To16(const std::string &utf8Str);
FileString toFileString(const std::string &utf8Str);
FileString getLastErrorAsString();
+ void replaceChar(FileString &input, wchar_t charToReplace, wchar_t charToReplaceWith);
#endif
using FileWalkCallbackFunc = std::function<void(tinydir_file*)>;
diff --git a/include/GlobalLib.hpp b/include/GlobalLib.hpp
index 2f4b938..b098543 100644
--- a/include/GlobalLib.hpp
+++ b/include/GlobalLib.hpp
@@ -18,7 +18,7 @@ namespace sibs
};
static Result<bool> validatePackageExists(const FileString &globalLibRootDir, const std::string &name);
- static Result<std::string> getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, const std::string &name, const std::string &version, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc);
+ static Result<bool> getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, const std::string &name, const std::string &version, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback);
static Result<bool> downloadDependency(const Dependency &dependency);
};
}
diff --git a/include/Linker.hpp b/include/Linker.hpp
index 7ea7b48..90bebe2 100644
--- a/include/Linker.hpp
+++ b/include/Linker.hpp
@@ -6,6 +6,7 @@
namespace sibs
{
using LinkerFlagCallbackFunc = std::function<void(const std::string&)>;
+ using GlobalIncludeDirCallbackFunc = std::function<void(const std::string&)>;
}
#endif //SIBS_LINKER_HPP
diff --git a/include/env.hpp b/include/env.hpp
index 51ee2bd..1ea55ca 100644
--- a/include/env.hpp
+++ b/include/env.hpp
@@ -9,9 +9,9 @@
#if defined(_WIN32) || defined(_WIN64)
#if defined(_WIN64)
- #define CISB_ENV_64BIT
+ #define SIBS_ENV_64BIT
#else
- #define CISB_ENV_32BIT
+ #define SIBS_ENV_32BIT
#endif
#define OS_FAMILY OS_FAMILY_WINDOWS
#define OS_TYPE OS_TYPE_WINDOWS
@@ -41,13 +41,13 @@
#if defined(__GNUC__)
#if defined(__x86_64__) || defined(__pc64__)
- #define CISB_ENV_64BIT
+ #define SIBS_ENV_64BIT
#else
- #define CISB_ENV_32BIT
+ #define SIBS_ENV_32BIT
#endif
#endif
-#if !defined(CISB_ENV_32BIT) && !defined(CISB_ENV_64BIT)
+#if !defined(SIBS_ENV_32BIT) && !defined(SIBS_ENV_64BIT)
#error "System is not detected as either 32-bit or 64-bit"
#endif