git repos / blockattack-game

commit ab86a00f

sago007 · 2017-08-31 19:08
ab86a00f303be6853db62ab5264e6189520e2f45 patch · browse files
parent 2a8dc4d77eee9898356f1286c23b596078e24185

Better standalone support

Changed files

M CMakeLists.txt before
M source/misc/docker/Dockerfile.Ubuntu14.04build_Standalone before
A source/misc/standalone/blockattack_standalone_launcher
M source/misc/standalone/build_standalone.sh before
diff --git a/CMakeLists.txt b/CMakeLists.txt index 408d7d2..821c24f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -35,7 +35,7 @@ SET(GUI_TYPE WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
endif()
-if (NOT WIN32)
+if (NOT WIN32 AND NOT STANDALONE)
#The path to the data dir must be compiled into the binary
add_definitions(-DSHAREDIR=\"${CMAKE_INSTALL_PREFIX}/${INSTALL_DATA_DIR}\")
add_definitions(-DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/${INSTALL_LOCALE_DIR}\")
diff --git a/source/misc/docker/Dockerfile.Ubuntu14.04build_Standalone b/source/misc/docker/Dockerfile.Ubuntu14.04build_Standalone index c7947e9..c734140 100644 --- a/source/misc/docker/Dockerfile.Ubuntu14.04build_Standalone +++ b/source/misc/docker/Dockerfile.Ubuntu14.04build_Standalone
@@ -10,4 +10,4 @@ ENV BLOCKATTACK_VERSION 2.1.0-SNAPSHOT
RUN cd /staging/blockattack-game && \
./packdata.sh && \
-cmake -D Boost_USE_STATIC_LIBS=ON -D INSTALL_DATA_DIR=. -D CMAKE_INSTALL_PREFIX=. . && make
+cmake -D Boost_USE_STATIC_LIBS=ON -D INSTALL_DATA_DIR=. -D CMAKE_INSTALL_PREFIX=. -D STANDALONE=1 . && make
diff --git a/source/misc/standalone/blockattack_standalone_launcher b/source/misc/standalone/blockattack_standalone_launcher new file mode 100644 index 0000000..e08b9ed --- /dev/null +++ b/source/misc/standalone/blockattack_standalone_launcher
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Move to script's directory
+cd "`dirname "$0"`"
+
+# Get the kernel/architecture information
+ARCH=`uname -m`
+
+# Set the libpath and pick the proper binary
+if [ "$ARCH" == "x86_64" ]; then
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./x86_64/
+ ./x86_64/blockattack "$@"
+else
+ echo "Unsupported arch"
+ #export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./x86/
+ #./x86/foobar.x86 $@
+fi
diff --git a/source/misc/standalone/build_standalone.sh b/source/misc/standalone/build_standalone.sh index c1b8769..d8de669 100755 --- a/source/misc/standalone/build_standalone.sh +++ b/source/misc/standalone/build_standalone.sh
@@ -2,12 +2,14 @@
set -e
rm -rf staging
-mkdir staging
+mkdir -p staging/x86_64
+cp blockattack_standalone_launcher staging/blockattack
+chmod +x staging/blockattack
cd ../../..
-docker build -f source/misc/docker/Dockerfile.Ubuntu14.04build . -t blockattack_test
+docker build -f source/misc/docker/Dockerfile.Ubuntu14.04build_Standalone . -t blockattack_test
echo Copying to: $(pwd)/source/misc/standalone/staging/
-docker run -it --rm -v $(pwd)/source/misc/standalone/staging/:/output blockattack_test /bin/bash -c "cp /staging/blockattack-game/Game/blockattack /output/ && cp /staging/blockattack-game/Game/blockattack.data /output/"
+docker run -it --rm -v $(pwd)/source/misc/standalone/staging/:/output blockattack_test /bin/bash -c "cp /staging/blockattack-game/Game/blockattack /output/x86_64/ && cp /staging/blockattack-game/Game/blockattack.data /output/"