Skip to content

Commit 91d7f0f

Browse files
committed
Make nix the source of truth for the version
Signed-off-by: Douglas Reis <doreis@lowrisc.org>
1 parent ccb4bbd commit 91d7f0f

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ else()
5858
)
5959
endif()
6060

61+
if(NOT DEFINED FTDITOOL_VERSION)
62+
set(FTDITOOL_VERSION "dev")
63+
endif()
6164

6265

6366
add_subdirectory(lib/embeddedpp)
@@ -67,5 +70,6 @@ add_subdirectory(lib/visuals)
6770

6871
add_executable(ftditool app/main.cc)
6972
target_include_directories(ftditool PUBLIC "./src/lib" "./src/")
73+
target_compile_definitions(ftditool PRIVATE FTDITOOL_VERSION="${FTDITOOL_VERSION}")
7074
target_link_libraries(ftditool PRIVATE visuals picosha2 elfio argparse::argparse flash ftdipp)
7175
install(TARGETS ftditool DESTINATION bin)

app/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ handle_gpio_command(std::unique_ptr<argparse::ArgumentParser>& cmd, uint16_t pid
9999
int main(int argc, char* argv[]) {
100100
std::map<std::string, Action> commands;
101101

102-
argparse::ArgumentParser program("ftditool");
102+
argparse::ArgumentParser program("ftditool", FTDITOOL_VERSION);
103103
program.add_argument("--pid")
104104
.default_value(std::uint16_t{0x6010})
105105
.help(

nix/ftditool.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
systemd,
1818
makeWrapper,
1919
}:
20-
stdenv.mkDerivation {
20+
stdenv.mkDerivation rec {
2121
pname = "ftditool";
2222
version = "0.4.0";
2323
src = ../.;
@@ -43,6 +43,7 @@ stdenv.mkDerivation {
4343

4444
cmakeFlags = [
4545
"-DCMAKE_BUILD_TYPE=Release"
46+
"-DFTDITOOL_VERSION=${version}"
4647
];
4748

4849
postInstall = ''

0 commit comments

Comments
 (0)