Cleanup, add PKGBUILD

This commit is contained in:
2022-10-02 13:29:42 +02:00
parent b74f0e87cd
commit 3b19b0436e
5 changed files with 59 additions and 14 deletions

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}