mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Split Sutbstitutes into cpp and header to make it possible to use unity build
This commit is contained in:
parent
99742e8062
commit
be23df1398
4
ThirdParty/custom-opm-common/CMakeLists.txt
vendored
4
ThirdParty/custom-opm-common/CMakeLists.txt
vendored
@ -63,6 +63,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND opm-common_SOURCES opm-common/cross-platform/windows/Substitutes.cpp )
|
||||
endif(MSVC)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
STATIC
|
||||
${opm_parser_source_files_long_path}
|
||||
|
31
ThirdParty/custom-opm-common/opm-common/cross-platform/windows/Substitutes.cpp
vendored
Normal file
31
ThirdParty/custom-opm-common/opm-common/cross-platform/windows/Substitutes.cpp
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "Substitutes.hpp"
|
||||
|
||||
int
|
||||
fnmatch(const char* pattern, const char* string, int flags)
|
||||
{
|
||||
if (flags != 0) {
|
||||
std::cerr << __FUNCTION__ << "Warning: flags other than 0 are not supported in Windows.";
|
||||
}
|
||||
wchar_t pszFile[1024];
|
||||
wchar_t pszSpec[1024];
|
||||
|
||||
size_t outsize;
|
||||
mbstowcs_s(&outsize, pszFile, string, strlen(string) + 1);
|
||||
mbstowcs_s(&outsize, pszSpec, pattern, strlen(pattern) + 1);
|
||||
|
||||
return (!PathMatchSpecW(pszFile, pszSpec));
|
||||
}
|
||||
|
||||
struct tm*
|
||||
gmtime_r(const time_t* timer, struct tm* buf)
|
||||
{
|
||||
if (gmtime_s(buf, timer) == 0) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <Shlwapi.h>
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#undef NOMINMAX
|
||||
// IGNORE is used in InputErrorAction.hpp, as an enum value,
|
||||
// IGNORE is used in InputErrorAction.hpp, as an enum value,
|
||||
// but is defined as a #def in WinBase.h which is included by Shlwapi.h.
|
||||
// It is not required here, so we can undefine it.
|
||||
#undef IGNORE
|
||||
@ -15,31 +16,8 @@
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
|
||||
int fnmatch(const char* pattern, const char* string, int flags)
|
||||
{
|
||||
if (flags != 0) {
|
||||
std::cerr << __FUNCTION__ << "Warning: flags other than 0 are not supported in Windows.";
|
||||
}
|
||||
wchar_t pszFile[1024];
|
||||
wchar_t pszSpec[1024];
|
||||
int fnmatch(const char* pattern, const char* string, int flags);
|
||||
|
||||
size_t outsize;
|
||||
mbstowcs_s(&outsize, pszFile, string, strlen(string) + 1);
|
||||
mbstowcs_s(&outsize, pszSpec, pattern, strlen(pattern) + 1);
|
||||
|
||||
return (!PathMatchSpecW(pszFile, pszSpec));
|
||||
}
|
||||
|
||||
struct tm* gmtime_r(const time_t* timer, struct tm* buf)
|
||||
{
|
||||
if (gmtime_s(buf, timer) == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
struct tm* gmtime_r(const time_t* timer, struct tm* buf);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user