Skip to content

Commit

Permalink
Support loading dynamic libraries from custom locations on OS X - add…
Browse files Browse the repository at this point in the history
…s to #1965
  • Loading branch information
Dane Springmeyer committed May 20, 2016
1 parent c2e520a commit dd3963d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scripts/timer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ TIMINGS_FILE=/tmp/osrm.timings
NAME=$1
CMD=${@:2}
START=$(date "+%s.%N")
/bin/bash -c "$CMD"
if [[ $(uname -s) == 'Darwin' ]] && [[ ${OSRM_SHARED_LIBRARY_PATH:-false} != false ]]; then
/bin/bash -c "DYLD_LIBRARY_PATH=${OSRM_SHARED_LIBRARY_PATH} $CMD"
else
/bin/bash -c "$CMD"
fi

END=$(date "+%s.%N")
TIME="$(echo "$END - $START" | bc)s"
NEW_ENTRY="$NAME\t$TIME\t$(date -Iseconds)"
Expand Down
7 changes: 6 additions & 1 deletion test/data/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ POLY2REQ:=$(SCRIPT_ROOT)/poly2req.js
TIMER:=$(SCRIPT_ROOT)/timer.sh
PROFILE:=$(PROFILE_ROOT)/car.lua

LOAD_LIBRARIES:=
ifneq ($(OSRM_SHARED_LIBRARY_PATH),)
LOAD_LIBRARIES=DYLD_LIBRARY_PATH=$(OSRM_SHARED_LIBRARY_PATH)
endif

all: $(DATA_NAME).osrm.hsgr

clean:
Expand All @@ -36,7 +41,7 @@ $(DATA_NAME).requests: $(DATA_NAME).poly
$(POLY2REQ) $(DATA_NAME).poly > $(DATA_NAME).requests

osrm-routed.pid: $(DATA_NAME).osrm.hsgr
@/bin/sh -c '$(OSRM_ROUTED) $(DATA_NAME).osrm& echo "$$!" > osrm-routed.pid'
@/bin/sh -c '$(LOAD_LIBRARIES) $(OSRM_ROUTED) $(DATA_NAME).osrm& echo "$$!" > osrm-routed.pid'
sleep 1

benchmark: $(DATA_NAME).requests osrm-routed.pid
Expand Down

0 comments on commit dd3963d

Please sign in to comment.