Fixed UTF-8 paths support for the config file with Clang compiler on Windows ARM64.

This commit is contained in:
XMRig 2025-06-14 15:38:25 +07:00
parent faa3d55123
commit 3ff41f7c94
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 9 additions and 9 deletions

View file

@ -51,7 +51,7 @@ if (ARM_TARGET AND ARM_TARGET GREATER 6)
message(STATUS "Use ARM_TARGET=${ARM_TARGET} (${CMAKE_SYSTEM_PROCESSOR})")
if (ARM_TARGET EQUAL 8)
if (ARM_TARGET EQUAL 8 AND (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang))
CHECK_CXX_COMPILER_FLAG(-march=armv8-a+crypto XMRIG_ARM_CRYPTO)
if (XMRIG_ARM_CRYPTO)

View file

@ -84,7 +84,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
endif()
endif()
if (BUILD_STATIC OR WIN32)
if ((WIN32 AND ARM_TARGET) OR BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
endif()

View file

@ -39,7 +39,7 @@
namespace xmrig {
#if defined(_MSC_VER) || (defined(__GNUC__) && !defined(__clang__))
#if defined(_MSC_VER) || defined(__GNUC__)
static std::wstring toUtf16(const char *str)
{
const int size = static_cast<int>(strlen(str));
@ -56,13 +56,13 @@ static std::wstring toUtf16(const char *str)
#endif
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
# define OPEN_IFS(name) \
std::ifstream ifs(toUtf16(name), std::ios_base::in | std::ios_base::binary); \
std::ifstream ifs(toUtf16(name).c_str(), std::ios_base::in | std::ios_base::binary);\
if (!ifs.is_open()) { \
return false; \
}
#elif defined(__GNUC__) && !defined(__clang__)
#elif defined(__GNUC__)
# define OPEN_IFS(name) \
const int fd = _wopen(toUtf16(name).c_str(), _O_RDONLY | _O_BINARY); \
if (fd == -1) { \
@ -98,12 +98,12 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
using namespace rapidjson;
constexpr const std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary | std::ios_base::trunc;
# if defined(_MSC_VER)
std::ofstream ofs(toUtf16(fileName), mode);
# if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
std::ofstream ofs(toUtf16(fileName).c_str(), mode);
if (!ofs.is_open()) {
return false;
}
# elif defined(__GNUC__) && !defined(__clang__)
# elif defined(__GNUC__)
const int fd = _wopen(toUtf16(fileName).c_str(), _O_WRONLY | _O_BINARY | _O_CREAT | _O_TRUNC, _S_IWRITE);
if (fd == -1) {
return false;