Add windows clang to CI (#5537)
- Add windows clang build step - Closes https://github.com/assimp/assimp/issues/5519 Co-authored-by: Kim Kulling <kim.kulling@draeger.com> Co-authored-by: Kim Kulling <kullingk@LDED5178.corp.draeger.global>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -39,42 +39,60 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#pragma once
|
||||
#ifdef _WIN32
|
||||
# ifndef _CRT_NONSTDC_NO_DEPRECATE
|
||||
# define _CRT_NONSTDC_NO_DEPRECATE
|
||||
# endif // _CRT_NONSTDC_NO_DEPRECATE
|
||||
# ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
|
||||
#define TMP_PATH "./"
|
||||
# define TMP_PATH "./"
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define TMP_PATH "/tmp/"
|
||||
# define TMP_PATH "/var/tmp/"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#include <io.h>
|
||||
inline FILE* MakeTmpFile(char* tmplate)
|
||||
{
|
||||
auto pathtemplate = _mktemp(tmplate);
|
||||
inline FILE* MakeTmpFile(char* tmplate, size_t len, std::string &tmpName) {
|
||||
size_t tmpLen = len + 1;
|
||||
char *pathtemplate = new char[tmpLen];
|
||||
strcpy_s(pathtemplate, tmpLen, tmplate);
|
||||
int err_code = _mktemp_s(pathtemplate, tmpLen);
|
||||
EXPECT_EQ(err_code, 0);
|
||||
EXPECT_NE(pathtemplate, nullptr);
|
||||
if(pathtemplate == nullptr)
|
||||
{
|
||||
if(pathtemplate == nullptr) {
|
||||
delete[] pathtemplate;
|
||||
return nullptr;
|
||||
}
|
||||
auto* fs = std::fopen(pathtemplate, "w+");
|
||||
errno_t err;
|
||||
FILE *fs{nullptr};
|
||||
err = fopen_s(&fs, pathtemplate, "w+");
|
||||
EXPECT_EQ(0, err);
|
||||
tmpName = pathtemplate;
|
||||
EXPECT_NE(fs, nullptr);
|
||||
delete[] pathtemplate;
|
||||
|
||||
return fs;
|
||||
}
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
inline FILE* MakeTmpFile(char* tmplate)
|
||||
{
|
||||
inline FILE *MakeTmpFile(char *tmplate, size_t len, std::string &tmpName) {
|
||||
auto fd = mkstemp(tmplate);
|
||||
EXPECT_NE(-1, fd);
|
||||
if(fd == -1)
|
||||
{
|
||||
if(fd == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
auto fs = fdopen(fd, "w+");
|
||||
EXPECT_NE(nullptr, fs);
|
||||
tmpName += tmplate;
|
||||
|
||||
return fs;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user