Skip to content

Commit 16bb3d3

Browse files
committed
fetch ELFIO as a dependency
Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
1 parent 3f173a9 commit 16bb3d3

4 files changed

Lines changed: 50 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1414
find_package(argparse QUIET)
1515
find_package(magic_enum QUIET)
1616
find_package(picosha2 QUIET)
17+
find_package(elfio QUIET)
1718
# Check if nix is not providing these dependencies.
1819
if (NOT argparse_FOUND)
1920
include(FetchContent)
@@ -36,12 +37,24 @@ if (NOT argparse_FOUND)
3637
)
3738
FetchContent_MakeAvailable(picosha2)
3839

40+
FetchContent_Declare(
41+
elfio
42+
GIT_REPOSITORY https://github.com/serge1/ELFIO
43+
GIT_TAG Release_3.12
44+
)
45+
FetchContent_MakeAvailable(elfio)
46+
3947
else()
4048
# This is a hack becase picosha2 does not define an install phase in CMakefile.
4149
add_library(picosha2 INTERFACE)
4250
target_include_directories(picosha2 INTERFACE
4351
${CMAKE_PREFIX_PATH}/include
4452
)
53+
# This is a hack becase elfio does not define an install phase in CMakefile.
54+
add_library(elfio INTERFACE)
55+
target_include_directories(elfio INTERFACE
56+
${CMAKE_PREFIX_PATH}/elfio
57+
)
4558
endif()
4659

4760

@@ -53,6 +66,5 @@ add_subdirectory(lib/visuals)
5366

5467
add_executable(ftditool app/main.cc)
5568
target_include_directories(ftditool PUBLIC "./src/lib" "./src/")
56-
target_link_libraries(ftditool PRIVATE visuals picosha2 argparse::argparse flash ftdipp)
69+
target_link_libraries(ftditool PRIVATE visuals picosha2 elfio argparse::argparse flash ftdipp)
5770
install(TARGETS ftditool DESTINATION bin)
58-

doc/img/deps.png

17.1 KB
Loading

nix/elfio.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright lowRISC contributors.
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
{
6+
stdenv,
7+
lib,
8+
fetchFromGitHub,
9+
}:
10+
stdenv.mkDerivation rec {
11+
pname = "elfio";
12+
version = "Release_3.12";
13+
14+
src = fetchFromGitHub {
15+
owner = "serge1";
16+
repo = "ELFIO";
17+
rev = "${version}";
18+
sha256 = "sha256-tDRBscs2L/3gYgLQvb1+8nNxqkr8v1xBkeDXuOqShX4=";
19+
};
20+
21+
dontBuild = true;
22+
23+
installPhase = ''
24+
mkdir -p $out/include
25+
cp -r elfio $out/include
26+
'';
27+
28+
meta = with lib; {
29+
description = "Header-only ELF implementation for C++";
30+
homepage = "https://github.com/serge1/ELFIO";
31+
license = licenses.mit;
32+
platforms = platforms.all;
33+
};
34+
}

nix/ftditool.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
argparse,
1313
magic-enum,
1414
picosha2,
15+
elfio,
1516
libusb1,
1617
systemd,
1718
makeWrapper,
@@ -34,6 +35,7 @@ stdenv.mkDerivation {
3435
argparse
3536
magic-enum
3637
picosha2
38+
elfio
3739
ftd2xx
3840
libusb1
3941
systemd

0 commit comments

Comments
 (0)