Skip to content

Commit

Permalink
xr_3da: add sample run shell script. Install it with binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross authored and eagleivg committed Oct 3, 2018
1 parent 1798bc6 commit 4f57ece
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/xr_3da/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ add_executable(${PROJECT_NAME} ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__IN
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME} xrCore xrAPI xrEngine)
xr_install(${PROJECT_NAME})
if(UNIX) # Yes, we have shell
install(FILES xr_3da.sh DESTINATION "."
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
endif()
30 changes: 30 additions & 0 deletions src/xr_3da/xr_3da.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

SCRIPT_NAME=$(basename "$0")
GAMEROOT=$(dirname -- "$(readlink -f -- "$0")")
if [ -z "$GAMEEXE" ]; then
GAMEEXE=${SCRIPT_NAME%.*} # strip extension(not required, but do anyway)
fi

#determine platform
UNAME=$(uname)
if [ "$UNAME" = "Darwin" ]; then
# prepend our lib path to DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${GAMEROOT}:$DYLD_LIBRARY_PATH
else
# prepend our lib path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${GAMEROOT}:$LD_LIBRARY_PATH
fi

# and launch the game
if ! cd "$GAMEROOT"; then
echo "Failed cd to $GAMEROOT"
exit
fi

STATUS=42
while [ $STATUS -eq 42 ]; do
${DEBUGGER} "${GAMEROOT}"/"${GAMEEXE}" "$@"
STATUS=$?
done
exit $STATUS

0 comments on commit 4f57ece

Please sign in to comment.