Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/runtime_src/core/common/detail/windows/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@
#include "core/common/trace.h"
#include <memory>
#include <windows.h>
#include <TraceLoggingProvider.h>
#ifdef __MINGW32__
// MinGW has no TraceLoggingProvider.h (Windows ETW); stub the API to no-ops.
# define TRACELOGGING_DECLARE_PROVIDER(...)
# define TRACELOGGING_DEFINE_PROVIDER(...)
# define TraceLoggingRegister(...)
# define TraceLoggingUnregister(...)
# define TraceLoggingWrite(...)
# define TraceLoggingValue(...)
#else
# include <TraceLoggingProvider.h>
#endif

// Forward declare the logging provider object. The provider
// is defined in a single compilation unit (core/common/trace.cpp).
Expand Down
5 changes: 5 additions & 0 deletions src/runtime_src/core/common/detail/windows/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ sys_dep_get_last_err_msg()
inline std::string
getenv(const char* name)
{
#ifdef _MSC_VER
char* value = nullptr;
size_t len = 0;

Expand All @@ -62,6 +63,10 @@ getenv(const char* name)
// Use unique_ptr to ensure memory is freed even if string constructor throws
std::unique_ptr<char, decltype(&std::free)> guard(value, &std::free);
return std::string(guard.get());
#else
const char* value = std::getenv(name);
return value ? std::string(value) : std::string{};
#endif
Comment on lines 55 to +69

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear that these changes check for MinGW, please adjust, e.g. maybe #ifdef __MINGW32__ / #else .
Also changes seem a little haphazardly, for example, I don't believe strerror_s works with MinGW, so why wasn't this fixed? Is this PR even needed, it is a concerted effort to build XRT with MinGW, or is just change a little here and there?

}

inline std::string
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/common/smi/smi.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct basic_option {
std::string m_type;
};

class option : public basic_option {
class XRT_CORE_COMMON_EXPORT option : public basic_option {
Comment thread
stsoe marked this conversation as resolved.
Outdated
std::string m_alias;
std::string m_default_value;
std::string m_value_type;
Expand Down Expand Up @@ -76,7 +76,7 @@ class option : public basic_option {
// This class is used to represent an option with a multiline description.
// For example, --run can have multiple test names as its description.
// These subnames are also queried using the generic API get_list
class listable_description_option : public option {
class XRT_CORE_COMMON_EXPORT listable_description_option : public option {
Comment thread
stsoe marked this conversation as resolved.
Outdated
std::vector<basic_option> m_description_array;
public:
listable_description_option(std::string name,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime_src/core/include/xrt/detail/windows/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <stdint.h>

#ifndef __GNU__
#ifndef __GNUC__
typedef int64_t ssize_t;
typedef int pid_t;
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2018-2022 Xilinx, Inc. All rights Reserved.
# Copyright (C) 2022-2026 Advanced Micro Devices, Inc. All rights Reserved.
if(NOT WIN32)
if(NOT MSVC)
add_compile_options(-Wextra -fvisibility=default)
else()
add_compile_options(/wd4244 /wd4267 /wd4477 /wd4245)
Comment on lines +4 to 7

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverse, /wd* are MSVC specific

Expand Down
Loading