Skip to content

Commit 9c83fad

Browse files
committed
Add version
1 parent 9bd1f63 commit 9c83fad

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
- name: Build the Docker image
1414
run: docker build --build-arg cxx=$CXX -t blobdrop .
1515
- name: Format code
16-
run: docker run fftune sh -c 'scripts/format-code.sh'
16+
run: docker run blobdrop sh -c 'scripts/format-code.sh'
1717
- name: Build documentation
18-
run: docker run fftune sh -c 'cd doc && doxygen'
18+
run: docker run blobdrop sh -c 'cd doc && doxygen'

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
project(blobdrop)
1+
cmake_policy(SET CMP0048 NEW)
2+
project(blobdrop VERSION 0.1 DESCRIPTION "Drag and drop files directly out of the terminal")
23
cmake_minimum_required(VERSION 3.21)
34

45
set(CMAKE_CXX_STANDARD 20)
@@ -13,6 +14,7 @@ set(CMAKE_AUTOMOC ON)
1314
set(CMAKE_AUTORCC ON)
1415

1516
include_directories("src" "src/Models")
17+
add_compile_definitions(BLOBDROP_VERSION="${PROJECT_VERSION}")
1618

1719
file(GLOB_RECURSE SRCS "src/*.cpp")
1820
file(GLOB_RECURSE HDRS "src/*.hpp")

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
#include <QQuickStyle>
66

77
#include "getopts.hpp"
8+
#include "version.hpp"
89

910
int main(int argc, char *argv[]) {
1011
QCoreApplication::setOrganizationName("blobdrop");
1112
QCoreApplication::setApplicationName("blobdrop");
13+
QCoreApplication::setApplicationVersion(Version::version_string());
1214
QQuickStyle::setStyle(QLatin1String("Material"));
1315
constexpr const char *materialVariantName = "QT_QUICK_CONTROLS_MATERIAL_VARIANT";
1416
if (!qEnvironmentVariableIsSet(materialVariantName)) {

src/version.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "version.hpp"
2+
3+
namespace Version {
4+
5+
const char *version_string() {
6+
return BLOBDROP_VERSION;
7+
}
8+
9+
}

src/version.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
3+
namespace Version {
4+
5+
#ifndef BLOBDROP_VERSION
6+
// fallback version, if cmake failed to set the version
7+
#define BLOBDROP_VERSION "1.0"
8+
#endif
9+
10+
const char *version_string();
11+
12+
}

0 commit comments

Comments
 (0)