mirror of
https://github.com/OPM/ResInsight.git
synced 2026-07-29 16:00:00 -05:00
Split Sutbstitutes into cpp and header to make it possible to use unity build
This commit is contained in:
+4
@@ -63,6 +63,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
list(APPEND opm-common_SOURCES opm-common/cross-platform/windows/Substitutes.cpp )
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
STATIC
|
STATIC
|
||||||
${opm_parser_source_files_long_path}
|
${opm_parser_source_files_long_path}
|
||||||
|
|||||||
+31
@@ -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
|
||||||
+3
-25
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
@@ -15,31 +16,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
int fnmatch(const char* pattern, const char* string, int flags)
|
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;
|
struct tm* gmtime_r(const time_t* timer, struct tm* buf);
|
||||||
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
|
#endif
|
||||||
Reference in New Issue
Block a user