diff --git a/CMakeLists.txt b/CMakeLists.txt index f0d81e2f..7e102fc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,14 +122,6 @@ elseif (APPLE) src/Mem_unix.cpp src/Platform_mac.cpp ) -elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) - set(SOURCES_OS - src/App_unix.cpp - src/Cpu_unix.cpp - src/Mem_unix.cpp - src/Platform_unix.cpp - ) -set(EXTRA_LIBS pthread kvm) else() set(SOURCES_OS src/App_unix.cpp @@ -141,6 +133,10 @@ else() set(EXTRA_LIBS pthread) endif() +if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) + set(EXTRA_LIBS ${EXTRA_LIBS} kvm) +endif() + add_definitions(/D__STDC_FORMAT_MACROS) add_definitions(/DUNICODE) add_definitions(/DRAPIDJSON_SSE2) diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp index ca1225df..8de98c8c 100644 --- a/src/Cpu_unix.cpp +++ b/src/Cpu_unix.cpp @@ -20,12 +20,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + + #ifdef __FreeBSD__ -#include -#include -#include -#include +# include +# include +# include +# include #endif + + #include #include #include @@ -34,10 +38,12 @@ #include "Cpu.h" + #ifdef __FreeBSD__ typedef cpuset_t cpu_set_t; #endif + void Cpu::init() { # ifdef XMRIG_NO_LIBCPUID @@ -60,9 +66,9 @@ void Cpu::setAffinity(int id, uint64_t mask) } if (id == -1) { - #ifndef __FreeBSD__ +# ifndef __FreeBSD__ sched_setaffinity(0, sizeof(&set), &set); - #endif +# endif } else { pthread_setaffinity_np(pthread_self(), sizeof(&set), &set); } diff --git a/src/Platform_unix.cpp b/src/Platform_unix.cpp index b6d16d6f..ecccc49e 100644 --- a/src/Platform_unix.cpp +++ b/src/Platform_unix.cpp @@ -115,7 +115,7 @@ void Platform::setThreadPriority(int priority) setpriority(PRIO_PROCESS, 0, prio); -#ifdef SCHED_IDLE +# ifdef SCHED_IDLE if (priority == 0) { sched_param param; param.sched_priority = 0; @@ -124,5 +124,5 @@ void Platform::setThreadPriority(int priority) sched_setscheduler(0, SCHED_BATCH, ¶m); } } -#endif +# endif }