Skip to content

Commit

Permalink
chore: read and use VERSION from DEB_VERSION_UPSTREAM
Browse files Browse the repository at this point in the history
CI scripts or package maintainer can pass `-DVERSION` to CMake
to tell the build system which is the `VERSION` that we need to
use.

Log:
  • Loading branch information
BLumia committed Sep 12, 2023
1 parent 8d6d6bc commit 57e42bc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

cmake_minimum_required(VERSION 3.7)

project(dde-launchpad)
if(NOT DEFINED VERSION)
set(VERSION 0.0.2)
endif()

project(dde-launchpad VERSION ${VERSION})

set(CMAKE_CXX_STANDARD 17) # blurhash requires 17, otherwish we can still use 14
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -85,6 +89,11 @@ add_executable(${BIN_NAME}
${TRANSLATED_FILES}
)

target_compile_definitions(${BIN_NAME}
PRIVATE
DDE_LAUNCHPAD_VERSION=${CMAKE_PROJECT_VERSION}
)

target_link_libraries(${BIN_NAME} PRIVATE
Dtk::Core
Dtk::Gui
Expand Down
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
dh $@ --parallel

override_dh_auto_configure:
dh_auto_configure -- \
-DVERSION=$(DEB_VERSION_UPSTREAM)
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char* argv[])
QGuiApplication app(argc, argv);
QCoreApplication::setOrganizationName("deepin");
QCoreApplication::setApplicationName("dde-launchpad");
QCoreApplication::setApplicationVersion("0.0.1" + QStringLiteral("-technical-preview"));
QCoreApplication::setApplicationVersion(QT_STRINGIFY(DDE_LAUNCHPAD_VERSION) + QStringLiteral("-technical-preview"));
DGuiApplicationHelper::loadTranslator(QStringLiteral("dde-launchpad"), translationDir(), { QLocale() });
bool isOnlyInstance = DGuiApplicationHelper::setSingleInstance(QStringLiteral("dde-launchpad"));

Expand Down

0 comments on commit 57e42bc

Please sign in to comment.