mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Fix build with MinGW
Co-authored-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
This commit is contained in:
parent
25224e0e4a
commit
a6dcac2cb1
@ -66,7 +66,7 @@ std::string Testing::WriteDirPath(const std::string& filename)
|
||||
void Testing::SetEnv(const std::string& var, const std::string& value)
|
||||
{
|
||||
static std::vector<std::pair<std::string, std::string>> envVars{};
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
auto iter = envVars.emplace(envVars.end(), var, value);
|
||||
_putenv_s(iter->first.c_str(), iter->second.c_str());
|
||||
#else
|
||||
@ -76,7 +76,7 @@ void Testing::SetEnv(const std::string& var, const std::string& value)
|
||||
|
||||
void Testing::UnsetEnv(const std::string& var)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
SetEnv(var, "");
|
||||
#else
|
||||
unsetenv(var.c_str());
|
||||
|
@ -49,6 +49,11 @@
|
||||
//compliance
|
||||
#define VTKM_CLANG
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
//Check for MinGW before GCC, since MinGW will be otherwise categorized
|
||||
//as VTKM_GCC
|
||||
#define VTKM_MINGW
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
// Several compilers pretend to be GCC but have minor differences. Try to
|
||||
// compensate for that, by checking for those compilers first
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
@ -42,7 +42,7 @@ std::string Filename(const std::string& filePath)
|
||||
// std::filesystem::path path(filePath);
|
||||
// return path.filename();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
auto lastSlashPos = filePath.rfind(GetWindowsPathSeperator(filePath));
|
||||
#else
|
||||
auto lastSlashPos = filePath.rfind('/');
|
||||
@ -60,7 +60,7 @@ std::string ParentPath(const std::string& filePath)
|
||||
// std::filesystem::path path(filePath);
|
||||
// return path.parent_path();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
auto lastSlashPos = filePath.rfind(GetWindowsPathSeperator(filePath));
|
||||
#else
|
||||
auto lastSlashPos = filePath.rfind('/');
|
||||
@ -88,7 +88,7 @@ bool CreateDirectoriesFromFilePath(const std::string& filePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
auto ret = _mkdir(dir.c_str());
|
||||
#else
|
||||
mode_t mode = 0755;
|
||||
@ -145,7 +145,7 @@ std::string MergePaths(const std::string& filePathPrefix, const std::string& fil
|
||||
return prefix;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
prefixPathSeperator = GetWindowsPathSeperator(prefix);
|
||||
suffixPathSeperator = suffix[0] == '/' || suffix[0] == '\\' ? suffix[0] : prefixPathSeperator;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user