qskinny icon indicating copy to clipboard operation
qskinny copied to clipboard

Centralize QSkinny version

Open rick-vogel opened this issue 1 year ago • 3 comments

In order to improve and centralize version checks here are some suggestions:

  • provide QSK_MAJOR/MINOR/PATCH_VERSION macros for finer version granularity
    • use CMake's PROJECT_VERSION_MAJOR variables
  • generate QskVersion.h either in build directory or source directory
    • at least install it
  • replace/remove QSK_VERSION* from QskGlobal.h

Currently

#define QSK_VERSION 0x000001

⚠️ different from the CMake project's version

see: QskGlobal.h:18

#define QSK_VERSION_STR "0.0.1"

⚠️ different from the CMake project's version

see: QskGlobal.h:19

Suggestion

Input: QskVersion.h.in

/******************************************************************************
 * QSkinny - Copyright (C) 2016 Uwe Rathmann
 *           SPDX-License-Identifier: BSD-3-Clause
 *****************************************************************************/

#ifndef QSK_VERSION_H
#define QSK_VERSION_H

#define QSK_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define QSK_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define QSK_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define QSK_VERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
#define QSK_VERSION ( QSK_VERSION_MAJOR << 16 | QSK_VERSION_MINOR << 8 | QSK_VERSION_PATCH )

#endif

Output: QskVersion.h

/******************************************************************************
 * QSkinny - Copyright (C) 2016 Uwe Rathmann
 *           SPDX-License-Identifier: BSD-3-Clause
 *****************************************************************************/

#ifndef QSK_VERSION_H
#define QSK_VERSION_H

#define QSK_VERSION_MAJOR 0
#define QSK_VERSION_MINOR 8
#define QSK_VERSION_PATCH 0
#define QSK_VERSION_STR "0.8.0"
#define QSK_VERSION ( QSK_VERSION_MAJOR << 16 | QSK_VERSION_MINOR << 8 | QSK_VERSION_PATCH )

#endif

CMakeLists.txt

configure_file(
    QskVersion.h.in
    QskVersion.h
    @ONLY)

# TODO add to target's public sources

rick-vogel avatar Aug 02 '23 10:08 rick-vogel

The version number also appears as PROJECT_NUMBER in the Doxyfile.

uwerat avatar Aug 03 '23 06:08 uwerat

Increasing the version number is something, that will be done by the project management - usually together with other steps like creating git branches. Having a tool that does all the required steps would be helpful, but I'm wondering if cmake - as a build tool - is the right type of tool.

IMO such a tool does not need to be cross platform and a specific shell script - using sed, awk and friends - running on UNIXoid systems might be a better choice ?

uwerat avatar Aug 03 '23 07:08 uwerat

I think the issue has multiple goals:

  • Currently our local fork is incrementally being updated to upstream QSkinny, but there are source incompatibilities. Therefore local patching needs to be done but both the local and upstream QSkinny version are 0.0.1 and I can't do differentiations like the following. Increasing the local QSkinny version also feels unintuitive since upstream progresses / increases.
#if QSK_VERSION_MINOR == 1
// make local patch
#else
// use upstream code
#endif
  • Next is the granularity of the provided QSK_VERSION_* macros. Adding the major, minor and patch macros would provide more comfort since one does not need to bit shift the version integer. Besides that it would improve the example above and would fit to what one is used from other framworks.

  • CMake is in my oppinion the topmost tools of the current QSkinny framework toolstack and therefore one solution to define the version centralized. The overall goal should be to have it defined in one place and propagate it down the tool stack. The separation of documentation from the build system might be the exception. Although using configure_file(Doxyfile.in Doxyfile) with PROJECT_NUMBER = @QSK_VERSION@ would be an easy solution for this problem.

rick-vogel avatar Aug 03 '23 08:08 rick-vogel