Skip to content

Commit 3f4aba8

Browse files
shelhamerzarvox
authored andcommitted
fakenect: add fakenect helper script
Add a shell script to call libfreenect applications with fakenect. Simplifies the use of fakenect by not requiring users to know or specify environment variables and the like. Usage: fakenect <database> <application> <args> Signed-off-by: Evan Shelhamer <[email protected]> Signed-off-by: Drew Fisher <[email protected]>
1 parent 8755990 commit 3f4aba8

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

fakenect/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ install (TARGETS fakenect
1515
add_executable(record record.c)
1616
target_link_libraries(record freenect m)
1717
install (TARGETS record
18-
DESTINATION bin)
18+
DESTINATION bin)
19+
20+
CONFIGURE_FILE("fakenect.sh.in"
21+
"fakenect.sh"
22+
IMMEDIATE @ONLY)
23+
install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fakenect.sh
24+
DESTINATION bin
25+
RENAME fakenect)

fakenect/fakenect.sh.in

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# This file is part of the OpenKinect Project. http://www.openkinect.org
4+
#
5+
# Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
6+
# for details.
7+
#
8+
# This code is licensed to you under the terms of the Apache License, version
9+
# 2.0, or, at your option, the terms of the GNU General Public License,
10+
# version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
11+
# or the following URLs:
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
# http://www.gnu.org/licenses/gpl-2.0.txt
14+
#
15+
# If you redistribute this file in source form, modified or unmodified,
16+
# you may:
17+
# 1) Leave this header intact and distribute it under the same terms,
18+
# accompanying it with the APACHE20 and GPL20 files, or
19+
# 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
20+
# 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
21+
# In all cases you must keep the copyright notice intact and include a copy
22+
# of the CONTRIB file.
23+
# Binary distributions must follow the binary distribution requirements of
24+
# either License.
25+
26+
# fakenect wrapper script:
27+
# simplifies calling libfreenect applications under fakenect
28+
# by taking the fakenect database, app to run, and its args
29+
# then filling out the necessary environment variables and calling the app
30+
# usage: fakenect /path/to/fakenect/dump app --arg=value
31+
32+
# catch bad args
33+
if [ $# -lt 2 ]
34+
then
35+
echo "Usage: $0 <database> <application> <args>"
36+
exit -1
37+
fi
38+
39+
# set path to fakenect database
40+
export FAKENECT_PATH=$1
41+
42+
# set link path (LD_LIBRARY_PATH for Linux, DYLIB_LIBRARY_PATH for OS X)
43+
if [ `uname` == "Darwin" ];
44+
then
45+
export DYLD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@PROJECT_LIBRARY_INSTALL_DIR@/fakenect/:${LD_LIBRARY_PATH}"
46+
else
47+
export LD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@PROJECT_LIBRARY_INSTALL_DIR@/fakenect/:${LD_LIBRARY_PATH}"
48+
fi
49+
50+
# run desired app w/ args, now that environment is configured
51+
"${@:2}"

0 commit comments

Comments
 (0)