Cleanup, add PKGBUILD
This commit is contained in:
20
PKGBUILD
Normal file
20
PKGBUILD
Normal file
@@ -0,0 +1,20 @@
|
||||
pkgname=fantasize
|
||||
pkgver=0.1.0
|
||||
pkgrel=1
|
||||
pkgdesc='C++ fan control for Linux'
|
||||
url='https://github.com/Tabascl/fantasize.git'
|
||||
source=("$pkgname-$pkgver.tar.gz::https://github.com/Tabascl/fantasize/archive/v$pkgver.tar.gz")
|
||||
backup=("etc/fantasize/fans.json")
|
||||
arch=('x86_64')
|
||||
license=('GPL3')
|
||||
makedepends=('git' 'cmake' 'nlohmann-json' 'boost' 'cuda')
|
||||
sha256sums=('ce998dabe4e88ee6b6a4ab99ad7afbf90fad98f47972fac658e26cc95a17d061')
|
||||
|
||||
build() {
|
||||
cmake -S "$pkgname-$pkgver/app" -B build -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" cmake --install build
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(fantasize)
|
||||
project(fantasize VERSION 0.1.0)
|
||||
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
find_package(nlohmann_json 3.11.2 REQUIRED)
|
||||
find_package(Boost 1.80 COMPONENTS program_options REQUIRED)
|
||||
|
||||
add_executable(app
|
||||
add_executable(${PROJECT_NAME}
|
||||
src/main.cxx
|
||||
src/sensor/LMSensorsFacade.cxx
|
||||
src/sensor/GPUSensorsFacade.cxx
|
||||
@@ -26,7 +26,9 @@ add_executable(app
|
||||
src/App.cxx
|
||||
)
|
||||
|
||||
set_property(TARGET app PROPERTY CXX_STANDARD 20)
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
|
||||
|
||||
target_include_directories(app PUBLIC include /opt/cuda)
|
||||
target_link_libraries(app PUBLIC sensors nvidia-ml nlohmann_json::nlohmann_json tbb)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC include /opt/cuda)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC sensors nvidia-ml nlohmann_json::nlohmann_json tbb ${Boost_LIBRARIES})
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
|
||||
@@ -56,11 +56,6 @@ FanGenerator::FindFans(vector<shared_ptr<Sensor>> rpmSensors,
|
||||
c->pwm(100);
|
||||
}
|
||||
|
||||
cout << "Resetting all fans" << endl;
|
||||
for (auto c : pwmControls) {
|
||||
c->Reset();
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ void HwmonFan::MinPWM(int value) { mMinPWM = value; }
|
||||
void HwmonFan::StartPWM(int value) { mStartPWM = value; }
|
||||
|
||||
void HwmonFan::FindMinPWM() {
|
||||
cout << "Looking for minimal PWM" << endl;
|
||||
int minPWM = 0;
|
||||
mMinPWM = 0;
|
||||
|
||||
|
||||
@@ -1,18 +1,45 @@
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
#include <boost/program_options/value_semantic.hpp>
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
#include <csignal>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <App.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
App app;
|
||||
|
||||
static int doInitialSetup = 0;
|
||||
|
||||
void signal_handler(int s) { app.Shutdown(); }
|
||||
|
||||
int main() {
|
||||
int main(int argc, char **argv) {
|
||||
signal(SIGINT, signal_handler);
|
||||
|
||||
po::options_description desc("Allowed options");
|
||||
desc.add_options()("help", "produce help message")("setup", po::bool_switch(),
|
||||
"run initial setup");
|
||||
|
||||
po::variables_map vm;
|
||||
po::store(po::parse_command_line(argc, argv, desc), vm);
|
||||
po::notify(vm);
|
||||
|
||||
try {
|
||||
app.Init();
|
||||
app.NormalOperation();
|
||||
if (vm.count("help")) {
|
||||
std::cout << desc << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vm.count("setup") && vm["setup"].as<bool>()) {
|
||||
app.InitialSetup();
|
||||
} else {
|
||||
app.Init();
|
||||
app.NormalOperation();
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
std::cout << "An exception was caught: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user