Fixed UTF-8 paths support for the config file with Clang compiler on Windows ARM64.
This commit is contained in:
parent
faa3d55123
commit
3ff41f7c94
3 changed files with 9 additions and 9 deletions
|
@ -51,7 +51,7 @@ if (ARM_TARGET AND ARM_TARGET GREATER 6)
|
||||||
|
|
||||||
message(STATUS "Use ARM_TARGET=${ARM_TARGET} (${CMAKE_SYSTEM_PROCESSOR})")
|
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)
|
CHECK_CXX_COMPILER_FLAG(-march=armv8-a+crypto XMRIG_ARM_CRYPTO)
|
||||||
|
|
||||||
if (XMRIG_ARM_CRYPTO)
|
if (XMRIG_ARM_CRYPTO)
|
||||||
|
|
|
@ -84,7 +84,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||||
endif()
|
endif()
|
||||||
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")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) || (defined(__GNUC__) && !defined(__clang__))
|
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||||
static std::wstring toUtf16(const char *str)
|
static std::wstring toUtf16(const char *str)
|
||||||
{
|
{
|
||||||
const int size = static_cast<int>(strlen(str));
|
const int size = static_cast<int>(strlen(str));
|
||||||
|
@ -56,13 +56,13 @@ static std::wstring toUtf16(const char *str)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
|
||||||
# define OPEN_IFS(name) \
|
# 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()) { \
|
if (!ifs.is_open()) { \
|
||||||
return false; \
|
return false; \
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && !defined(__clang__)
|
#elif defined(__GNUC__)
|
||||||
# define OPEN_IFS(name) \
|
# define OPEN_IFS(name) \
|
||||||
const int fd = _wopen(toUtf16(name).c_str(), _O_RDONLY | _O_BINARY); \
|
const int fd = _wopen(toUtf16(name).c_str(), _O_RDONLY | _O_BINARY); \
|
||||||
if (fd == -1) { \
|
if (fd == -1) { \
|
||||||
|
@ -98,12 +98,12 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
constexpr const std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary | std::ios_base::trunc;
|
constexpr const std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary | std::ios_base::trunc;
|
||||||
|
|
||||||
# if defined(_MSC_VER)
|
# if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
|
||||||
std::ofstream ofs(toUtf16(fileName), mode);
|
std::ofstream ofs(toUtf16(fileName).c_str(), mode);
|
||||||
if (!ofs.is_open()) {
|
if (!ofs.is_open()) {
|
||||||
return false;
|
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);
|
const int fd = _wopen(toUtf16(fileName).c_str(), _O_WRONLY | _O_BINARY | _O_CREAT | _O_TRUNC, _S_IWRITE);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue