Skip to content

Commit

Permalink
use sedinplace to replace EMPTY_STRUCT_PLACEHOLDER and add missing mo…
Browse files Browse the repository at this point in the history
…dule-info.java file
  • Loading branch information
barrypitman committed Aug 26, 2024
1 parent 33e1fa4 commit f734c71
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
14 changes: 2 additions & 12 deletions hailort/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,9 @@ cd $PLATFORM
tar -xzvf ../hailort-v$HAILORT_VERSION.tar.gz
cd hailort-$HAILORT_VERSION

sedinplace 's/EMPTY_STRUCT_PLACEHOLDER/uint8_t reserved;/g' hailort/libhailort/include/hailo/hailort.h

case $PLATFORM in
android-arm64)
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config release --target libhailort
mkdir -p ../include ../lib
cp ./build/hailort/libhailort/src/libhailort.so.$HAILORT_VERSION ../lib/
cp hailort/libhailort/include/hailo/*.h ../include/
;;
android-x86_64)
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config release --target libhailort
mkdir -p ../include ../lib
;;
linux-x86_64)
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config release --target libhailort
Expand Down
5 changes: 5 additions & 0 deletions hailort/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>systems</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
27 changes: 17 additions & 10 deletions hailort/src/main/java/org/bytedeco/hailort/presets/hailort.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
"platform.h"
}),
@Platform(value = "windows", include = ""),
/* @Platform(value = "linux",
@Platform(value = "linux",
include = {
// "<unistd.h>",
// "<sys/time.h>",
// "<sys/socket.h>",
"<netinet/in.h>",
// "<netinet/in.h>",
// "<arpa/inet.h>"
},
includepath = {
"hailort/src/test/resources/", // todo remove
"/usr/include/x86_64-linux-gnu/",
"/usr/include/"
// "/usr/include/x86_64-linux-gnu/",
// "/usr/include/"
}
),*/
),

},
target = "org.bytedeco.hailort",
Expand All @@ -45,6 +45,13 @@ public void map(InfoMap infoMap) {
// "/\\* Type to represent a port. \\*/", "/\\* Standard well-known ports. \\*/"
// ));


// types from platform.h
infoMap.put(new Info("socket_t").cast().valueTypes("int").pointerTypes("IntPointer"));
infoMap.put(new Info("port_t").cast().valueTypes("int").pointerTypes("IntPointer"));
infoMap.put(new Info("sockaddr_in").cast().javaNames("org.bytedeco.systems.linux.sockaddr").pointerTypes("Pointer"));
infoMap.put(new Info("INVALID_SOCKET").javaText("public static final int INVALID_SOCKET = (int)(-1);"));

infoMap.put(new Info("hailort.h").linePatterns("#ifdef __cplusplus", "#endif").skip());

// these variables are defined in HailoHelper
Expand Down Expand Up @@ -77,10 +84,10 @@ public void map(InfoMap infoMap) {

// mapping EMPTY_STRUCT_PLACEHOLDER
infoMap.put(new Info("EMPTY_STRUCT_PLACEHOLDER").cast().valueTypes("int").pointerTypes("IntPointer"));
infoMap.put(new Info("hailo_demux_params_t").pointerTypes("hailo_demux_params_t"));
infoMap.put(new Info("hailo_pcie_input_stream_params_t").pointerTypes("hailo_pcie_input_stream_params_t"));
infoMap.put(new Info("hailo_pcie_output_stream_params_t").pointerTypes("hailo_pcie_output_stream_params_t"));
infoMap.put(new Info("hailo_integrated_input_stream_params_t").pointerTypes("hailo_integrated_input_stream_params_t"));
infoMap.put(new Info("hailo_integrated_output_stream_params_t").pointerTypes("hailo_integrated_output_stream_params_t"));
// infoMap.put(new Info("hailo_demux_params_t").pointerTypes("hailo_demux_params_t"));
// infoMap.put(new Info("hailo_pcie_input_stream_params_t").pointerTypes("hailo_pcie_input_stream_params_t"));
// infoMap.put(new Info("hailo_pcie_output_stream_params_t").pointerTypes("hailo_pcie_output_stream_params_t"));
// infoMap.put(new Info("hailo_integrated_input_stream_params_t").pointerTypes("hailo_integrated_input_stream_params_t"));
// infoMap.put(new Info("hailo_integrated_output_stream_params_t").pointerTypes("hailo_integrated_output_stream_params_t"));
}
}
6 changes: 6 additions & 0 deletions hailort/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module org.bytedeco.hailort {
requires transitive org.bytedeco.javacpp;
exports org.bytedeco.hailort.global;
exports org.bytedeco.hailort.presets;
exports org.bytedeco.hailort;
}

0 comments on commit f734c71

Please sign in to comment.