Skip to content

Commit

Permalink
update folder structure to new librhsp naming
Browse files Browse the repository at this point in the history
  • Loading branch information
LandryNorris committed Aug 15, 2023
1 parent 312d5e5 commit 093c121
Show file tree
Hide file tree
Showing 58 changed files with 48 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tsconfig.json
.clang-format

# Ensure we don't accidentally include tarballs produced by npm pack
rev-robotics-rhsplib-*.tgz
rev-robotics-librhsp-*.tgz
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
**/dist
.yarn/
.pnp.*
packages/rhsplib/RHSPlib
packages/librhsp/librhsp
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# node-rhsplib
# node-librhsp

This project enables Node.js applications to control devices that speak the REV Hub Serial Protocol (such as the REV Robotics Expansion Hub).

Expand All @@ -9,7 +9,7 @@ multi-package builds.

We have several packages currently:

1. `rhsplib`: Raw interaction with RHSPLib.
1. `librhsp`: Raw interaction with librhsp.
2. `expansion-hub`: High-level interaction with a REV expansion hub.
3. `sample`: Command line app useful for testing and showing features.

Expand Down
21 changes: 19 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/src/MotorMode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//The order of these should match the RHSPlib documentation. We rely on the
//The order of these should match the librhsp documentation. We rely on the
//numerical value matching.
export enum MotorMode {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/expansion-hub/src/internal/ExpansionHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ export class ExpansionHubInternal implements ExpansionHub {

private createError(e: any): any {
if (e.errorCode == RhspLibErrorCode.GENERAL_ERROR) {
return new RhspLibError("General RHSPlib error");
return new RhspLibError("General librhsp error");
} else if (e.errorCode == RhspLibErrorCode.MSG_NUMBER_MISMATCH) {
return new RhspLibError("Message Number Mismatch");
} else if (e.errorCode == RhspLibErrorCode.NOT_OPENED) {
Expand Down
File renamed without changes.
28 changes: 14 additions & 14 deletions packages/rhsplib/binding.gyp → packages/librhsp/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
'include_dirs': [
'src/',
'RHSPlib/include',
'librhsp/include',
"<!@(node -p \"require('node-addon-api').include\")"
],
'defines': [
Expand All @@ -25,19 +25,19 @@
[
'OS=="win"', {
'libraries': [
'<(module_root_dir)/RHSPlib/build-windows/Release/rhsp.lib',
'<(module_root_dir)/librhsp/build-windows/Release/rhsp.lib',
],
'copies':[
{
'destination': '<(PRODUCT_DIR)',
'files':[
'<(module_root_dir)/RHSPlib/build/Release/rhsp.dll',
'<(module_root_dir)/librhsp/build/Release/rhsp.dll',
],
},
{
'destination': '<(module_root_dir)/prebuilds/win32-<(target_arch)',
'files':[
'<(module_root_dir)/RHSPlib/build/Release/rhsp.dll',
'<(module_root_dir)/librhsp/build/Release/rhsp.dll',
],
},
]
Expand All @@ -47,18 +47,18 @@
'OS=="linux" and target_arch=="x64"', {
'link_settings': {
'libraries': [
'-L<(module_root_dir)/RHSPlib/build-linuxX64/',
'-L<(module_root_dir)/librhsp/build-linuxX64/',
'-lrhsp'
],
'ldflags': [
'-Wl,-rpath,<(module_root_dir)/RHSPlib/build-linuxX64/',
'-Wl,-rpath,<(module_root_dir)/librhsp/build-linuxX64/',
]
},
'copies':[
{
'destination': '<(PRODUCT_DIR)',
'files':[
'<(module_root_dir)/RHSPlib/build-linuxX64/librhsp.so',
'<(module_root_dir)/librhsp/build-linuxX64/librhsp.so',
],
}
],
Expand All @@ -68,18 +68,18 @@
'OS=="linux" and target_arch=="arm64"', {
'link_settings': {
'libraries': [
'-L<(module_root_dir)/RHSPlib/build-linuxArm64/',
'-L<(module_root_dir)/librhsp/build-linuxArm64/',
'-lrhsp'
],
'ldflags': [
'-Wl,-rpath,<(module_root_dir)/RHSPlib/build-linuxArm64/',
'-Wl,-rpath,<(module_root_dir)/librhsp/build-linuxArm64/',
]
},
'copies':[
{
'destination': '<(PRODUCT_DIR)',
'files':[
'<(module_root_dir)/RHSPlib/build-linuxArm64/librhsp.so',
'<(module_root_dir)/librhsp/build-linuxArm64/librhsp.so',
],
}
],
Expand All @@ -96,18 +96,18 @@
},
'link_settings': {
'libraries': [
'-L<(module_root_dir)/RHSPlib/build-darwinX64/',
'-lRHSPlib'
'-L<(module_root_dir)/librhsp/build-darwinX64/',
'-lrhsp'
],
'ldflags': [
'-Wl,-rpath,<(module_root_dir)/RHSPlib/build-darwinX64/',
'-Wl,-rpath,<(module_root_dir)/librhsp/build-darwinX64/',
]
},
'copies':[
{
'destination': '<(PRODUCT_DIR)',
'files':[
'<(module_root_dir)/RHSPlib/build-darwinX64/librhsp.dylib',
'<(module_root_dir)/librhsp/build-darwinX64/librhsp.dylib',
],
}
],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { spawn } from "child_process";
import { platform } from "os";
import { fileURLToPath } from "url";

// This file should be kept in sync with the latest build instructions from the RHSPlib README file.
// This file should be kept in sync with the latest build instructions from the librhsp README file.

const scriptDirPath = path.dirname(fileURLToPath(import.meta.url));
const rhsplibPath = path.join(scriptDirPath, "..", "RHSPlib");
const rhsplibPath = path.join(scriptDirPath, "..", "librhsp");

let configureOptions = [];
let buildOptions = [];
Expand All @@ -31,10 +31,10 @@ fs.mkdirSync(buildPath, { recursive: true });

console.log("Configuring CMake\n");
await runCmakeWithArgs([...configureOptions, ".."]);
console.log("\nBuilding RHSPlib\n");
console.log("\nBuilding librhsp\n");
await runCmakeWithArgs(["--build", ".", ...buildOptions]);

console.log("\nSuccessfully built RHSPlib");
console.log("\nSuccessfully built librhsp");

async function runCmakeWithArgs(args) {
const cmake = spawn("cmake", args, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ if(process.platform !== "linux") {
process.exit(0);
}

// This file should be kept in sync with the latest build instructions from the RHSPlib README file.
// This file should be kept in sync with the latest build instructions from the librhsp README file.

const scriptDirPath = path.dirname(fileURLToPath(import.meta.url));
const rhsplibPath = path.join(scriptDirPath, "..", "RHSPlib");
const rhsplibPath = path.join(scriptDirPath, "..", "librhsp");

const linuxX64BuildPath = path.join(rhsplibPath, "build-linuxX64");
const linuxArm64BuildPath = path.join(rhsplibPath, "build-linuxArm64");
Expand All @@ -38,7 +38,7 @@ await runCmakeWithArgs(["--build", "."], `${baseBuildPath}linuxArm64`);
console.log("Building Windows");
await runCmakeWithArgs([...windowsArgs, ".."], `${baseBuildPath}windows`);
await runCmakeWithArgs(["--build", "."], `${baseBuildPath}windows`);
console.log("Build RHSPlib");
console.log("Build librhsp");
console.log();

console.log("LinuxX64");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ if(process.platform !== "darwin") {
process.exit(0);
}

// This file should be kept in sync with the latest build instructions from the RHSPlib README file.
// This file should be kept in sync with the latest build instructions from the librhsp README file.

const scriptDirPath = path.dirname(fileURLToPath(import.meta.url));
const rhsplibPath = path.join(scriptDirPath, "..", "RHSPlib");
const rhsplibPath = path.join(scriptDirPath, "..", "librhsp");

const darwinX64BuildPath = path.join(rhsplibPath, "build-darwinX64");
const darwinArm64BuildPath = path.join(rhsplibPath, "build-darwinArm64");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 093c121

Please sign in to comment.