Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ jobs:
# - name: Run node tests
# shell: bash
# run: |
# ./lib/binding/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf
# ./lib/binding_napi_v8/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf

# mkdir -p test/data/ch
# cp test/data/monaco.osrm* test/data/ch/
# ./lib/binding/osrm-contract.exe test/data/ch/monaco.osrm
# ./lib/binding_napi_v8/osrm-contract.exe test/data/ch/monaco.osrm

# ./lib/binding/osrm-datastore.exe test/data/ch/monaco.osrm
# ./lib/binding_napi_v8/osrm-datastore.exe test/data/ch/monaco.osrm
# node test/nodejs/index.js
- name: Build Node package
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ node_modules
debug.lua

# node-osrm artifacts
lib/binding
lib/binding_napi_v8

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased
- Changes from 6.0.0
- Build:
- FIXED: Update Node.js binding path from `lib/binding` to `lib/binding_napi_v8` to match node-pre-gyp versioning conventions [#7272](https://github.com/Project-OSRM/osrm-backend/pull/7272)
- FIXED: Reduce MSVC compiler warnings by suppressing informational warnings while preserving bug-indicating warnings [#7253](https://github.com/Project-OSRM/osrm-backend/issues/7253)
- Misc:
- CHANGED: Add std::format compatibility layer with fallback to fmt::format [#7261](https://github.com/Project-OSRM/osrm-backend/pull/7261)
Expand Down
6 changes: 3 additions & 3 deletions docs/nodejs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

The `OSRM` method is the main constructor for creating an OSRM instance.
An OSRM instance requires a `.osrm.*` dataset(`.osrm.*` because it contains several files), which is prepared by the OSRM toolchain.
You can create such a `.osrm.*` dataset by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default
You can create such a `.osrm.*` dataset by running the OSRM binaries we ship in `node_modules/osrm/lib/binding_napi_v8/` and default
profiles (e.g. for setting speeds and determining road types to route on) in `node_modules/osrm/profiles/`:

node_modules/osrm/lib/binding/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
node_modules/osrm/lib/binding/osrm-contract data.osrm
node_modules/osrm/lib/binding_napi_v8/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
node_modules/osrm/lib/binding_napi_v8/osrm-contract data.osrm

Consult the [osrm-backend](https://github.com/Project-OSRM/osrm-backend) documentation for further details.

Expand Down
Empty file removed lib/binding/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion lib/binding_napi_v8

This file was deleted.

2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const __dirname = path.dirname(__filename);
const require = createRequire(import.meta.url);

// Load native OSRM binding and add version info from package.json
const OSRM = require('./binding/node_osrm.node').OSRM;
const OSRM = require('./binding_napi_v8/node_osrm.node').OSRM;
const packageJson = JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8'));

OSRM.version = packageJson.version;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"clean": "rm -rf test/cache",
"docs": "./scripts/build_api_docs.sh",
"install": "node-pre-gyp install --fallback-to-build=false || ./scripts/node_install.sh",
"nodejs-tests": "make -C test/data && ./lib/binding/osrm-datastore test/data/ch/monaco.osrm && node test/nodejs/index.js | faucet",
"nodejs-tests": "make -C test/data && ./lib/binding_napi_v8/osrm-datastore test/data/ch/monaco.osrm && node test/nodejs/index.js | faucet",
"prepare": "husky"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/node_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo "dumping binary meta..."
# enforce that binary has proper ORIGIN flags so that
# it can portably find libtbb.so in the same directory
if [[ $(uname -s) == 'Linux' ]]; then
readelf -d ./lib/binding/node_osrm.node > readelf-output.txt
readelf -d ./lib/binding_napi_v8/node_osrm.node > readelf-output.txt
if grep -q 'Flags: ORIGIN' readelf-output.txt; then
echo "Found ORIGIN flag in readelf output"
cat readelf-output.txt
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function run_benchmarks_for_folder {
for BENCH in nearest table trip route match; do
echo "Running node $BENCH $ALGORITHM"
START=$(date +%s.%N)
node $SCRIPTS_FOLDER/scripts/ci/bench.js $FOLDER/lib/binding/node_osrm.node $FOLDER/data.osrm $ALGORITHM $BENCH $GPS_TRACES > "$RESULTS_FOLDER/node_${BENCH}_${ALGORITHM}.bench" 5
node $SCRIPTS_FOLDER/scripts/ci/bench.js $FOLDER/lib/binding_napi_v8/node_osrm.node $FOLDER/data.osrm $ALGORITHM $BENCH $GPS_TRACES > "$RESULTS_FOLDER/node_${BENCH}_${ALGORITHM}.bench" 5
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo "Took: ${DIFF}s"
Expand Down
5 changes: 4 additions & 1 deletion src/nodejs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ message(STATUS "Building node_osrm")
set(NAPI_VERSION 8)
add_definitions(-DNAPI_VERSION=${NAPI_VERSION})

set(BINDING_DIR "${PROJECT_SOURCE_DIR}/lib/binding")
set(BINDING_DIR "${PROJECT_SOURCE_DIR}/lib/binding_napi_v8")

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/node_modules/node-cmake")

Expand Down Expand Up @@ -36,6 +36,9 @@ target_link_libraries(node_osrm osrm)
# node_osrm artifacts in ${BINDING_DIR} to depend targets on
set(ARTIFACTS "")

# Create the binding directory if it doesn't exist
file(MAKE_DIRECTORY ${BINDING_DIR})

set(OSRM_BINARIES osrm-extract osrm-contract osrm-routed osrm-datastore osrm-components osrm-partition osrm-customize)
foreach(binary ${OSRM_BINARIES})
add_custom_command(OUTPUT ${BINDING_DIR}/${binary}
Expand Down
6 changes: 3 additions & 3 deletions src/nodejs/node_osrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ Napi::Object Engine::Init(Napi::Env env, Napi::Object exports)
/**
* The `OSRM` method is the main constructor for creating an OSRM instance.
* An OSRM instance requires a `.osrm.*` dataset(`.osrm.*` because it contains several files), which is prepared by the OSRM toolchain.
* You can create such a `.osrm.*` dataset by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default
* You can create such a `.osrm.*` dataset by running the OSRM binaries we ship in `node_modules/osrm/lib/binding_napi_v8/` and default
* profiles (e.g. for setting speeds and determining road types to route on) in `node_modules/osrm/profiles/`:
*
* node_modules/osrm/lib/binding/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
* node_modules/osrm/lib/binding/osrm-contract data.osrm
* node_modules/osrm/lib/binding_napi_v8/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
* node_modules/osrm/lib/binding_napi_v8/osrm-contract data.osrm
*
* Consult the [osrm-backend](https://github.com/Project-OSRM/osrm-backend) documentation for further details.
*
Expand Down
Loading