Skip to content

Commit 05d9274

Browse files
committed
Merges node-osrm into repository
Build with cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On
1 parent af65ccd commit 05d9274

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4871
-243
lines changed

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Thumbs.db
4646
#######################
4747
/build/
4848
/example/build/
49-
/test/data/monaco*
49+
/test/data/berlin*
50+
/test/bindings/node/data/berlin*
5051
/cmake/postinst
5152

5253
# Eclipse related files #
@@ -86,7 +87,7 @@ stxxl.errlog
8687
/test/cache
8788
/test/speeds.csv
8889
/test/penalties.csv
89-
/test/data/monaco.*
90+
/test/data/berlin.*
9091
node_modules
9192

9293
# Deprecated config file #
@@ -96,4 +97,7 @@ node_modules
9697
*.swp
9798

9899
# local lua debugging file
99-
debug.lua
100+
debug.lua
101+
102+
# node-osrm artifacts
103+
lib/binding

.npmignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*
2+
!README.md
3+
!CHANGELOG.md
4+
!CONTRIBUTING.MD
5+
!LICENCE.TXT
6+
!package.json
7+
!example
8+
!lib/*.js
9+
!profiles/*
10+
!profiles/lib/*

.travis.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ matrix:
5858
apt:
5959
sources: ['ubuntu-toolchain-r-test']
6060
packages: ['libstdc++-5-dev']
61-
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON
61+
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON ENABLE_NODE_BINDINGS=ON
6262

6363
# Release Builds
6464
- os: linux
@@ -67,7 +67,7 @@ matrix:
6767
apt:
6868
sources: ['ubuntu-toolchain-r-test']
6969
packages: ['libstdc++-5-dev']
70-
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
70+
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON ENABLE_NODE_BINDINGS=ON CHECK_HEADERS=yes
7171

7272
- os: linux
7373
compiler: "gcc-6-release"
@@ -81,7 +81,7 @@ matrix:
8181
compiler: "gcc-6-release-i686"
8282
env: >
8383
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
84-
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' CHECK_HEADERS=yes
84+
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
8585
8686
- os: linux
8787
compiler: "gcc-4.9-release"
@@ -142,7 +142,7 @@ before_install:
142142
- echo "Using ${JOBS} jobs"
143143
- source ./scripts/install_node.sh 4
144144
- npm install -g "npm@>=3" # Upgrade to npm >v2 to reduce size of downloaded dependencies
145-
- npm install
145+
- npm install --ignore-scripts
146146
# Bootstrap cmake to be able to run mason
147147
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz"
148148
- CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}"
@@ -173,7 +173,7 @@ install:
173173
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
174174
- mkdir ${OSRM_BUILD_DIR} && pushd ${OSRM_BUILD_DIR}
175175
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
176-
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_MASON=${ENABLE_MASON:-OFF} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} -DBUILD_TOOLS=ON -DENABLE_CCACHE=ON
176+
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_MASON=${ENABLE_MASON:-OFF} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} -DBUILD_TOOLS=ON -DENABLE_CCACHE=ON -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS}
177177
- echo "travis_fold:start:MAKE"
178178
- make --jobs=${JOBS}
179179
- make tests --jobs=${JOBS}
@@ -196,7 +196,7 @@ install:
196196
script:
197197
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
198198
- make -C test/data benchmark
199-
- ./example/build/osrm-example test/data/monaco_CH.osrm
199+
- ./example/build/osrm-example test/data/berlin_CH.osrm
200200
# All tests assume to be run from the build directory
201201
- pushd ${OSRM_BUILD_DIR}
202202
- ./unit_tests/library-tests
@@ -213,3 +213,11 @@ after_success:
213213
if [ -n "${ENABLE_COVERAGE}" ]; then
214214
bash <(curl -s https://codecov.io/bash)
215215
fi
216+
217+
- |
218+
if [ -n "${ENABLE_NODE_BINDINGS}" ]; then
219+
nvm install 4
220+
nvm use 4
221+
source ./scripts/travis/build.sh
222+
./scripts/travis/publish.sh
223+
fi

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 5.7.0
22
- Changes from 5.6
3+
- NodeJs Bindings
4+
- Merged https://github.com/Project-OSRM/node-osrm into repository. Build via `cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On`.
35
- Internals
46
- Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances
57
- Files

CMakeLists.txt

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
2424
option(ENABLE_LTO "Use LTO if available" OFF)
2525
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
2626
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
27+
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
2728

2829
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2930

@@ -800,6 +801,11 @@ add_custom_target(uninstall
800801
add_subdirectory(unit_tests)
801802
add_subdirectory(src/benchmarks)
802803

804+
if (ENABLE_NODE_BINDINGS)
805+
add_subdirectory(src/nodejs)
806+
endif()
807+
808+
803809
if (ENABLE_FUZZING)
804810
# Requires libosrm being built with sanitizers; make configurable and default to ubsan
805811
set(FUZZ_SANITIZER "undefined" CACHE STRING "Sanitizer to be used for Fuzz testing")
@@ -815,18 +821,21 @@ if (ENABLE_FUZZING)
815821
endif ()
816822

817823

818-
## add headers sanity check target that includes all headers independently
819-
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
820-
file(GLOB_RECURSE headers_to_check
821-
${PROJECT_BINARY_DIR}/*.hpp
822-
${PROJECT_SOURCE_DIR}/include/*.hpp)
823-
foreach(header ${headers_to_check})
824-
get_filename_component(filename ${header} NAME_WE)
825-
set(filename "${check_headers_dir}/${filename}.cpp")
826-
if (NOT EXISTS ${filename})
827-
file(WRITE ${filename} "#include \"${header}\"\n")
828-
endif()
829-
list(APPEND sources ${filename})
830-
endforeach()
831-
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
832-
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
824+
# add headers sanity check target that includes all headers independently
825+
# make sure we have all deps for the nodejs sub project's includes (nan, node)
826+
if (ENABLE_NODE_BINDINGS)
827+
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
828+
file(GLOB_RECURSE headers_to_check
829+
${PROJECT_BINARY_DIR}/*.hpp
830+
${PROJECT_SOURCE_DIR}/include/*.hpp)
831+
foreach(header ${headers_to_check})
832+
get_filename_component(filename ${header} NAME_WE)
833+
set(filename "${check_headers_dir}/${filename}.cpp")
834+
if (NOT EXISTS ${filename})
835+
file(WRITE ${filename} "#include \"${header}\"\n")
836+
endif()
837+
list(APPEND sources ${filename})
838+
endforeach()
839+
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
840+
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
841+
endif()

appveyor-build.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ unit_tests\%Configuration%\server-tests.exe
133133
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
134134

135135
ECHO running library-tests.exe ...
136-
SET test_region=monaco
136+
SET test_region=berlin
137137
SET test_osm=%test_region%.osm.pbf
138138
SET test_osm_ch=%test_region%_CH.osm.pbf
139139
SET test_osm_corech=%test_region%_CoreCH.osm.pbf
140140
SET test_osm_mld=%test_region%_MLD.osm.pbf
141-
IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf -OutFile %test_osm%
141+
IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/berlin.osm.pbf -OutFile %test_osm%
142142
COPY %test_osm% %test_osm_ch%
143143
COPY %test_osm% %test_osm_corech%
144144
COPY %test_osm% %test_osm_mld%

0 commit comments

Comments
 (0)