Added hwloc stub.

This commit is contained in:
XMRig 2019-07-23 01:18:55 +07:00
parent b02e596853
commit 42460b8805
6 changed files with 145 additions and 5 deletions

View file

@ -29,7 +29,9 @@
#include "backend/cpu/Cpu.h"
#ifdef XMRIG_FEATURE_LIBCPUID
#if defined(XMRIG_FEATURE_HWLOC)
# include "backend/cpu/platform/HwlocCpuInfo.h"
#elif defined(XMRIG_FEATURE_LIBCPUID)
# include "backend/cpu/platform/AdvancedCpuInfo.h"
#else
# include "backend/cpu/platform/BasicCpuInfo.h"
@ -51,7 +53,9 @@ void xmrig::Cpu::init()
{
assert(cpuInfo == nullptr);
# ifdef XMRIG_FEATURE_LIBCPUID
# if defined(XMRIG_FEATURE_HWLOC)
cpuInfo = new HwlocCpuInfo();
# elif defined(XMRIG_FEATURE_LIBCPUID)
cpuInfo = new AdvancedCpuInfo();
# else
cpuInfo = new BasicCpuInfo();

View file

@ -18,16 +18,43 @@ set(SOURCES_BACKEND_CPU
)
if (WITH_LIBCPUID)
if (WITH_HWLOC)
set(WITH_LIBCPUID OFF)
include_directories(${HWLOC_INCLUDE_DIR})
set(CPUID_LIB ${HWLOC_LIBRARY})
remove_definitions(/DXMRIG_FEATURE_LIBCPUID)
add_definitions(/DXMRIG_FEATURE_HWLOC)
set(SOURCES_CPUID
src/backend/cpu/platform/BasicCpuInfo.cpp
src/backend/cpu/platform/BasicCpuInfo.h
src/backend/cpu/platform/HwlocCpuInfo.cpp
src/backend/cpu/platform/HwlocCpuInfo.h
)
elseif (WITH_LIBCPUID)
set(WITH_HWLOC OFF)
add_subdirectory(src/3rdparty/libcpuid)
include_directories(src/3rdparty/libcpuid)
add_definitions(/DXMRIG_FEATURE_LIBCPUID)
remove_definitions(/DXMRIG_FEATURE_HWLOC)
set(CPUID_LIB cpuid)
set(SOURCES_CPUID src/backend/cpu/platform/AdvancedCpuInfo.h src/backend/cpu/platform/AdvancedCpuInfo.cpp src/backend/cpu/Cpu.cpp)
set(SOURCES_CPUID
src/backend/cpu/platform/AdvancedCpuInfo.cpp
src/backend/cpu/platform/AdvancedCpuInfo.h
)
else()
remove_definitions(/DXMRIG_FEATURE_LIBCPUID)
set(SOURCES_CPUID src/backend/cpu/platform/BasicCpuInfo.h src/backend/cpu/Cpu.cpp)
remove_definitions(/DXMRIG_FEATURE_HWLOC)
set(CPUID_LIB "")
set(SOURCES_CPUID
src/backend/cpu/platform/BasicCpuInfo.h
)
if (XMRIG_ARM)
set(SOURCES_CPUID ${SOURCES_CPUID} src/backend/cpu/platform/BasicCpuInfo_arm.cpp)

View file

@ -0,0 +1,34 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <hwloc.h>
#include "backend/cpu/platform/HwlocCpuInfo.h"
xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo()
{
}

View file

@ -0,0 +1,45 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_HWLOCCPUINFO_H
#define XMRIG_HWLOCCPUINFO_H
#include "backend/cpu/platform/BasicCpuInfo.h"
namespace xmrig {
class HwlocCpuInfo : public BasicCpuInfo
{
public:
HwlocCpuInfo();
};
} /* namespace xmrig */
#endif /* XMRIG_HWLOCCPUINFO_H */