CMake, Nix: add VERSION file

This commit is contained in:
Mihai Fufezan 2024-07-18 21:03:42 +03:00
parent a6f1ad1560
commit 949f105f53
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
3 changed files with 6 additions and 2 deletions

View file

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
set(AQUAMARINE_VERSION "0.1.0") file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
string(STRIP ${VER_RAW} AQUAMARINE_VERSION)
add_compile_definitions(AQUAMARINE_VERSION="${AQUAMARINE_VERSION}") add_compile_definitions(AQUAMARINE_VERSION="${AQUAMARINE_VERSION}")
project(aquamarine project(aquamarine

1
VERSION Normal file
View file

@ -0,0 +1 @@
0.1.0

View file

@ -36,6 +36,7 @@
(builtins.substring 4 2 longDate) (builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate) (builtins.substring 6 2 longDate)
]); ]);
version = lib.removeSuffix "\n" (builtins.readFile ./VERSION);
in { in {
overlays = { overlays = {
default = self.overlays.aquamarine; default = self.overlays.aquamarine;
@ -47,7 +48,7 @@
(final: prev: { (final: prev: {
aquamarine = final.callPackage ./nix/default.nix { aquamarine = final.callPackage ./nix/default.nix {
stdenv = final.gcc13Stdenv; stdenv = final.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
}; };
aquamarine-with-tests = final.aquamarine.override {doCheck = true;}; aquamarine-with-tests = final.aquamarine.override {doCheck = true;};
}) })