Build: use props file for versioning

This commit is contained in:
Mihai Fufezan 2023-01-06 16:21:42 +02:00
parent 98ce867104
commit a54247125f
No known key found for this signature in database
GPG key ID: 5899325F2F120900
4 changed files with 11 additions and 2 deletions

View file

@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.4) cmake_minimum_required(VERSION 3.4)
# Get version
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS)
string(JSON VER GET ${PROPS} version)
project(Hyprland project(Hyprland
DESCRIPTION "A Modern C++ Wayland Compositor" DESCRIPTION "A Modern C++ Wayland Compositor"
VERSION ${VER}
) )
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")

View file

@ -33,6 +33,8 @@
pkgsFor = nixpkgs.legacyPackages; pkgsFor = nixpkgs.legacyPackages;
props = builtins.fromJSON (builtins.readFile ./props.json);
mkDate = longDate: (lib.concatStringsSep "-" [ mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate) (builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate) (builtins.substring 4 2 longDate)
@ -46,7 +48,7 @@
}; };
hyprland = prev.callPackage ./nix/default.nix { hyprland = prev.callPackage ./nix/default.nix {
stdenv = prev.gcc12Stdenv; stdenv = prev.gcc12Stdenv;
version = "0.20.0beta" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); version = props.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
wlroots = wlroots-hyprland; wlroots = wlroots-hyprland;
inherit (inputs) hyprland-protocols; inherit (inputs) hyprland-protocols;
}; };

View file

@ -1,5 +1,5 @@
project('Hyprland', 'cpp', 'c', project('Hyprland', 'cpp', 'c',
version : '0.20.0beta', version : run_command('jq', '-r', '.version', join_paths(meson.source_root(), 'props.json'), check: true).stdout().strip(),
default_options : [ default_options : [
'warning_level=2', 'warning_level=2',
'default_library=static', 'default_library=static',

1
props.json Normal file
View file

@ -0,0 +1 @@
{"version": "0.20.0"}