summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Lachnit <stephanlachnit@protonmail.com>2020-11-29 20:52:40 +0100
committerStephan Lachnit <stephanlachnit@protonmail.com>2020-11-29 20:52:40 +0100
commitf9f2a8a9f9eb01f08b39e4758817fc0b1940c249 (patch)
tree384029fa526c93d8c12480426db7002c638be522
parent3c7de668ad882812c626308c3426d8cceb001f2a (diff)
parentc5ab5684e924889b7768d4bb452524185e112afb (diff)
Update upstream source from tag 'upstream/0.6.1'
Update to upstream version '0.6.1' with Debian dir 504880a22abbd47cd5bafaf4ee658a3d74f2563f
-rw-r--r--.github/workflows/build-package.yml60
-rw-r--r--.github/workflows/build-source.yml25
-rw-r--r--README.md8
-rw-r--r--meson.build2
-rw-r--r--src/cpu.cpp45
-rw-r--r--src/cpu.h14
6 files changed, 115 insertions, 39 deletions
diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml
new file mode 100644
index 0000000..b9d31b1
--- /dev/null
+++ b/.github/workflows/build-package.yml
@@ -0,0 +1,60 @@
+name: Build release package
+on:
+ release:
+ types: ["created"]
+ push:
+ tags: ["v*"]
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install build tools
+ run: |
+ sudo apt update
+ sudo apt install gcc-multilib g++-multilib ninja-build python3-setuptools python3-wheel mesa-common-dev libxnvctrl-dev libdbus-1-dev
+ - name: Prepare Artifact Git Info
+ shell: bash
+ run: |
+ echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
+ ARTIFACT_NAME="commit-$(git rev-parse --short "$GITHUB_SHA")"
+ if [ ${{ github.event_name == 'pull_request' }} ]; then
+ echo "##[set-output name=short-sha;]$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")"
+ if [ ! -z "${{ github.event.pull_request.number }}" ]; then
+ ARTIFACT_NAME="pr-${{ github.event.pull_request.number }}-commit-$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")"
+ fi
+ else
+ echo "##[set-output name=short-sha;]$(git rev-parse --short "$GITHUB_SHA")"
+ fi
+ echo "##[set-output name=artifact-metadata;]${ARTIFACT_NAME}"
+ id: git-vars
+ - name: Build release package
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ ./build-source.sh
+ ./build.sh build package release
+ - if: github.event_name == 'release' && github.event.action == 'created'
+ name: Upload release
+ run: |
+ assets=()
+ for asset in ./MangoHud-*-Source*.tar.gz; do
+ assets+=("-a" "$asset")
+ done
+ for asset in ./build/MangoHud-*.tar.gz; do
+ assets+=("-a" "$asset")
+ done
+ tag_name="${GITHUB_REF##*/}"
+ hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ continue-on-error: true
+ with:
+ name: MangoHud-${{steps.git-vars.outputs.artifact-metadata}}
+ path: ${{runner.workspace}}/MangoHud/build/MangoHud-*tar.gz
+ retention-days: 30 \ No newline at end of file
diff --git a/.github/workflows/build-source.yml b/.github/workflows/build-source.yml
new file mode 100644
index 0000000..1b16e32
--- /dev/null
+++ b/.github/workflows/build-source.yml
@@ -0,0 +1,25 @@
+name: Build source tars
+on:
+ release:
+ types: ["published"]
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Run build-source.sh
+ run: |
+ set -x
+ ./build-source.sh
+ assets=()
+ for asset in ./MangoHud-*-Source*.tar.gz; do
+ assets+=("-a" "$asset")
+ done
+ tag_name="${GITHUB_REF##*/}"
+ hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
+
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/README.md b/README.md
index f50ac05..39726e8 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,14 @@ If you are using Fedora, to install the [MangoHud](https://src.fedoraproject.org
sudo dnf install mangohud
```
+#### Solus
+
+If you are using Solus, to install [MangoHud](https://dev.getsol.us/source/mangohud/) simply execute:
+
+```
+sudo eopkg it mangohud
+```
+
#### Flatpak
If you are using Flatpaks, you will have to add the [Flathub repository](https://flatpak.org/setup/) for your specific distribution, and then, to install it, execute:
diff --git a/meson.build b/meson.build
index e3be9da..4280857 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('MangoHud',
['c', 'cpp'],
- version : 'v0.5.1',
+ version : 'v0.6.1',
license : 'MIT',
default_options : ['buildtype=release', 'c_std=c99', 'cpp_std=c++14']
)
diff --git a/src/cpu.cpp b/src/cpu.cpp
index 6d106e5..57b62c8 100644
--- a/src/cpu.cpp
+++ b/src/cpu.cpp
@@ -1,4 +1,5 @@
#include "cpu.h"
+#include <memory>
#include <string>
#include <iostream>
#include <fstream>
@@ -492,15 +493,15 @@ static bool find_power_input(const std::string path, std::string& input, const s
}
CPUPowerData_k10temp* init_cpu_power_data_k10temp(const std::string path) {
- CPUPowerData_k10temp* powerData = new CPUPowerData_k10temp();
+ auto powerData = std::make_unique<CPUPowerData_k10temp>();
std::string coreVoltageInput, coreCurrentInput;
std::string socVoltageInput, socCurrentInput;
- if(!find_voltage_input(path, coreVoltageInput, "Vcore")) goto error;
- if(!find_current_input(path, coreCurrentInput, "Icore")) goto error;
- if(!find_voltage_input(path, socVoltageInput, "Vsoc")) goto error;
- if(!find_current_input(path, socCurrentInput, "Isoc")) goto error;
+ if(!find_voltage_input(path, coreVoltageInput, "Vcore")) return nullptr;
+ if(!find_current_input(path, coreCurrentInput, "Icore")) return nullptr;
+ if(!find_voltage_input(path, socVoltageInput, "Vsoc")) return nullptr;
+ if(!find_current_input(path, socCurrentInput, "Isoc")) return nullptr;
#ifndef NDEBUG
std::cerr << "hwmon: using input: " << coreVoltageInput << std::endl;
@@ -513,23 +514,17 @@ CPUPowerData_k10temp* init_cpu_power_data_k10temp(const std::string path) {
powerData->coreCurrentFile = fopen(coreCurrentInput.c_str(), "r");
powerData->socVoltageFile = fopen(socVoltageInput.c_str(), "r");
powerData->socCurrentFile = fopen(socCurrentInput.c_str(), "r");
- goto success;
-error:
- delete powerData;
- return nullptr;
-
-success:
- return powerData;
+ return powerData.release();
}
CPUPowerData_zenpower* init_cpu_power_data_zenpower(const std::string path) {
- CPUPowerData_zenpower* powerData = new CPUPowerData_zenpower();
+ auto powerData = std::make_unique<CPUPowerData_zenpower>();
std::string corePowerInput, socPowerInput;
- if(!find_power_input(path, corePowerInput, "SVI2_P_Core")) goto error;
- if(!find_power_input(path, socPowerInput, "SVI2_P_SoC")) goto error;
+ if(!find_power_input(path, corePowerInput, "SVI2_P_Core")) return nullptr;
+ if(!find_power_input(path, socPowerInput, "SVI2_P_SoC")) return nullptr;
#ifndef NDEBUG
std::cerr << "hwmon: using input: " << corePowerInput << std::endl;
@@ -538,31 +533,19 @@ CPUPowerData_zenpower* init_cpu_power_data_zenpower(const std::string path) {
powerData->corePowerFile = fopen(corePowerInput.c_str(), "r");
powerData->socPowerFile = fopen(socPowerInput.c_str(), "r");
- goto success;
-
-error:
- delete powerData;
- return nullptr;
-success:
- return powerData;
+ return powerData.release();
}
CPUPowerData_rapl* init_cpu_power_data_rapl(const std::string path) {
- CPUPowerData_rapl* powerData = new CPUPowerData_rapl();
+ auto powerData = std::make_unique<CPUPowerData_rapl>();
std::string energyCounterPath = path + "/energy_uj";
- if (!file_exists(energyCounterPath)) goto error;
+ if (!file_exists(energyCounterPath)) return nullptr;
powerData->energyCounterFile = fopen(energyCounterPath.c_str(), "r");
- goto success;
-
-error:
- delete powerData;
- return nullptr;
-success:
- return powerData;
+ return powerData.release();
}
bool CPUStats::InitCpuPowerData() {
diff --git a/src/cpu.h b/src/cpu.h
index 53943ac..f4b3b2a 100644
--- a/src/cpu.h
+++ b/src/cpu.h
@@ -68,10 +68,10 @@ struct CPUPowerData_k10temp : public CPUPowerData {
fclose(this->socCurrentFile);
};
- FILE* coreVoltageFile;
- FILE* coreCurrentFile;
- FILE* socVoltageFile;
- FILE* socCurrentFile;
+ FILE* coreVoltageFile {nullptr};
+ FILE* coreCurrentFile {nullptr};
+ FILE* socVoltageFile {nullptr};
+ FILE* socCurrentFile {nullptr};
};
struct CPUPowerData_zenpower : public CPUPowerData {
@@ -86,8 +86,8 @@ struct CPUPowerData_zenpower : public CPUPowerData {
fclose(this->socPowerFile);
};
- FILE* corePowerFile;
- FILE* socPowerFile;
+ FILE* corePowerFile {nullptr};
+ FILE* socPowerFile {nullptr};
};
struct CPUPowerData_rapl : public CPUPowerData {
@@ -101,7 +101,7 @@ struct CPUPowerData_rapl : public CPUPowerData {
fclose(this->energyCounterFile);
};
- FILE* energyCounterFile;
+ FILE* energyCounterFile {nullptr};
int lastCounterValue;
Clock::time_point lastCounterValueTime;
};