From 47527d48ee19fc55ece8e84618daf19b7037bb34 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 24 Nov 2017 00:23:04 +0300 Subject: [PATCH] Fixed build in termux environment, thanks Imran Yusuff. --- CMakeLists.txt | 7 +++++++ src/Cpu_unix.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0275320f..64d504f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,13 @@ if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) set(EXTRA_LIBS ${EXTRA_LIBS} kvm) endif() +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + EXECUTE_PROCESS(COMMAND uname -o COMMAND tr -d '\n' OUTPUT_VARIABLE OPERATING_SYSTEM) + if (OPERATING_SYSTEM MATCHES "Android") + set(EXTRA_LIBS ${EXTRA_LIBS} log) + endif() +endif() + add_definitions(/D__STDC_FORMAT_MACROS) add_definitions(/DUNICODE) #add_definitions(/DAPP_DEBUG) diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp index 8de98c8c..9a13e7a5 100644 --- a/src/Cpu_unix.cpp +++ b/src/Cpu_unix.cpp @@ -70,6 +70,10 @@ void Cpu::setAffinity(int id, uint64_t mask) sched_setaffinity(0, sizeof(&set), &set); # endif } else { +# ifndef __ANDROID__ pthread_setaffinity_np(pthread_self(), sizeof(&set), &set); +# else + sched_setaffinity(gettid(), sizeof(&set), &set); +# endif } }