Skip to content

Commit 4f57ece

Browse files
a1batrosseagleivg
authored andcommitted
xr_3da: add sample run shell script. Install it with binaries.
1 parent 1798bc6 commit 4f57ece

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/xr_3da/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ add_executable(${PROJECT_NAME} ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__IN
2020
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
2121
target_link_libraries(${PROJECT_NAME} xrCore xrAPI xrEngine)
2222
xr_install(${PROJECT_NAME})
23+
if(UNIX) # Yes, we have shell
24+
install(FILES xr_3da.sh DESTINATION "."
25+
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
26+
GROUP_READ GROUP_EXECUTE
27+
WORLD_READ WORLD_EXECUTE)
28+
endif()

src/xr_3da/xr_3da.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
SCRIPT_NAME=$(basename "$0")
4+
GAMEROOT=$(dirname -- "$(readlink -f -- "$0")")
5+
if [ -z "$GAMEEXE" ]; then
6+
GAMEEXE=${SCRIPT_NAME%.*} # strip extension(not required, but do anyway)
7+
fi
8+
9+
#determine platform
10+
UNAME=$(uname)
11+
if [ "$UNAME" = "Darwin" ]; then
12+
# prepend our lib path to DYLD_LIBRARY_PATH
13+
export DYLD_LIBRARY_PATH=${GAMEROOT}:$DYLD_LIBRARY_PATH
14+
else
15+
# prepend our lib path to LD_LIBRARY_PATH
16+
export LD_LIBRARY_PATH=${GAMEROOT}:$LD_LIBRARY_PATH
17+
fi
18+
19+
# and launch the game
20+
if ! cd "$GAMEROOT"; then
21+
echo "Failed cd to $GAMEROOT"
22+
exit
23+
fi
24+
25+
STATUS=42
26+
while [ $STATUS -eq 42 ]; do
27+
${DEBUGGER} "${GAMEROOT}"/"${GAMEEXE}" "$@"
28+
STATUS=$?
29+
done
30+
exit $STATUS

0 commit comments

Comments
 (0)