5 Commits

Author SHA1 Message Date
7b0b419a22 Fix crash on startup 2023-01-19 13:32:56 +01:00
ec480f5a17 Remove leftover include statement 2022-11-05 02:50:18 +01:00
0109f66be3 Remove leftover include statement 2022-11-05 02:47:44 +01:00
75d6af4c8b Remove leftover include statement 2022-11-05 02:47:13 +01:00
815b78aa67 Change required version of boost libs 2022-11-05 02:45:12 +01:00
10 changed files with 28 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
pkgname=fantasize
pkgver=0.1.7
pkgver=0.1.8
pkgrel=1
pkgdesc='C++ fan control for Linux'
url='https://github.com/Tabascl/fantasize.git'

View File

@@ -1 +0,0 @@
BasedOnStyle: Google

View File

@@ -1,32 +1,18 @@
cmake_minimum_required(VERSION 3.0)
project(fantasize VERSION 0.1.7)
project(fantasize VERSION 0.1.8)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(nlohmann_json 3.7 REQUIRED)
find_package(Boost 1.80 COMPONENTS program_options log log_setup date_time REQUIRED)
find_library(NVML_LIB nvidia-ml)
set(ADDITIONAL_LIBS)
if (NVML_LIB)
set(HAVE_NVML)
add_library(nvidia-sensor-lib STATIC
src/sensor/NvidiaSensor.cxx
src/sensor/GPUSensorsFacade.cxx)
target_link_libraries(nvidia-sensor-lib PUBLIC NVML_LIB)
list(APPEND ADDITIONAL_LIBS nvidia-sensor-lib)
endif()
find_package(nlohmann_json 3.11.2 REQUIRED)
find_package(Boost 1.74 COMPONENTS program_options log log_setup date_time REQUIRED)
add_executable(${PROJECT_NAME}
src/main.cxx
src/sensor/LMSensorsFacade.cxx
src/sensor/GPUSensorsFacade.cxx
src/sensor/Sensor.cxx
src/sensor/NvidiaSensor.cxx
src/sensor/LMSensor.cxx
src/pwm/PWMControl.cxx
src/pwm/PWMControlFacade.cxx
@@ -44,8 +30,7 @@ add_executable(${PROJECT_NAME}
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
target_include_directories(${PROJECT_NAME} PUBLIC include /opt/cuda)
target_link_libraries(${PROJECT_NAME} PUBLIC sensors nlohmann_json::nlohmann_json tbb ${Boost_LIBRARIES} ${ADDITIONAL_LIBS})
target_link_libraries(${PROJECT_NAME} PUBLIC sensors nvidia-ml nlohmann_json::nlohmann_json tbb ${Boost_LIBRARIES})
install(TARGETS ${PROJECT_NAME} DESTINATION usr/local/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/unit/fantasize.service DESTINATION usr/lib/systemd/system)

View File

@@ -4,8 +4,6 @@
#include <chrono>
#include <memory>
#include <boost/json/object.hpp>
#include <fan/Fan.h>
#include <pwm/PWMControl.h>
#include <sensor/Sensor.h>

View File

@@ -1,7 +1,6 @@
#ifndef PWMCONTROL_H_
#define PWMCONTROL_H_
#include <boost/json/object.hpp>
#include <string>
#include <Printable.h>

View File

@@ -1,8 +1,9 @@
#include <fan/FanCurve.h>
#include <boost/log/attributes/named_scope.hpp>
#include <iostream>
#include <boost/log/trivial.hpp>
#include <sstream>
#include <fan/FanCurve.h>
using namespace std;

View File

@@ -20,7 +20,7 @@
#include <App.h>
#define PROJECT_VERSION "v0.1.6"
#define PROJECT_VERSION "v0.1.8"
namespace po = boost::program_options;
namespace logging = boost::log;

View File

@@ -1,9 +1,6 @@
#ifdef HAVE_NVML
#include <include/nvml.h>
#include <sensor/NvidiaSensor.h>
#include <boost/json/object.hpp>
#include <sensor/NvidiaSensor.h>
using namespace std;
@@ -27,5 +24,3 @@ json NvidiaSensor::toJson() const {
json obj = {"NvidiaSensor", toString()};
return obj;
}
#endif

View File

@@ -3,26 +3,20 @@
using namespace std;
SensorManager::SensorManager()
: mLMSensorsFacade(make_unique<LMSensorsFacade>())
, mGPUSensorsFacade(make_unique<GPUSensorsFacade>())
{
: mLMSensorsFacade(make_unique<LMSensorsFacade>()),
mGPUSensorsFacade(make_unique<GPUSensorsFacade>()) {}
vector<shared_ptr<Sensor>> SensorManager::TemperatureSensors() {
vector<shared_ptr<Sensor>> tempSensors;
tempSensors = mLMSensorsFacade->TemperatureSensors();
auto gpuSensors = mGPUSensorsFacade->TemperatureSensors();
tempSensors.insert(tempSensors.end(), gpuSensors.begin(), gpuSensors.end());
return tempSensors;
}
vector<shared_ptr<Sensor>> SensorManager::TemperatureSensors()
{
vector<shared_ptr<Sensor>> tempSensors;
tempSensors = mLMSensorsFacade->TemperatureSensors();
#ifdef HAVE_NVML
auto gpuSensors = mGPUSensorsFacade->TemperatureSensors();
tempSensors.insert(tempSensors.end(), gpuSensors.begin(), gpuSensors.end());
#endif
return tempSensors;
}
vector<shared_ptr<Sensor>> SensorManager::RPMSensors()
{
return mLMSensorsFacade->RPMSensors();
vector<shared_ptr<Sensor>> SensorManager::RPMSensors() {
return mLMSensorsFacade->RPMSensors();
}

View File

@@ -7,4 +7,4 @@ ExecStart=/usr/local/bin/fantasize
Restart=always
[Install]
WantedBy=multi-user.target
WantedBy=graphical.target