diff --git a/BallanceMMOServer/CMakeLists.txt b/BallanceMMOServer/CMakeLists.txt
index a713189..d5ab7af 100644
--- a/BallanceMMOServer/CMakeLists.txt
+++ b/BallanceMMOServer/CMakeLists.txt
@@ -12,7 +12,7 @@ set(BMMO_LIB_DIR ${PROJECT_BINARY_DIR}/lib)
set(BMMO_RUNTIME_DIR ${PROJECT_BINARY_DIR})
# sets RPATH for *install*ed files
-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:\$ORIGIN:lib") # Note CMake escaping around '$' sign.
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:\$ORIGIN:lib:../lib") # Note CMake escaping around '$' sign.
# *built* files will also use RPATH which has been set before
set(CMAKE_BUILD_WITH_INSTALL_RPATH on)
# if (CMAKE_SYSTEM_NAME MATCHES "Windows")
@@ -107,4 +107,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/postbuild.bat ${CMAKE_CURRENT_BINARY_DIR}/postbuild.bat COPYONLY)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/start_ballancemmo_loop.sh ${BMMO_RUNTIME_DIR}/start_ballancemmo_loop.sh COPYONLY)
+ install(TARGETS BallanceMMOServer BallanceMMOMockClient BallanceMMORecordParser DESTINATION bin)
+ install(TARGETS GameNetworkingSockets yaml-cpp DESTINATION lib)
+endif()
+
+option(BUILD_SERVER_APPIMAGE "Build BallanceMMO Server AppImage" OFF)
+
+if (BUILD_SERVER_APPIMAGE)
+ add_executable(BallanceMMOLaunchSelector appimage/launch_selector.cpp)
+ install(TARGETS BallanceMMOLaunchSelector DESTINATION bin)
endif()
diff --git a/BallanceMMOServer/appimage/BMMOLaunchSelector.desktop b/BallanceMMOServer/appimage/BMMOLaunchSelector.desktop
new file mode 100644
index 0000000..f4a1f88
--- /dev/null
+++ b/BallanceMMOServer/appimage/BMMOLaunchSelector.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=BallanceMMOLaunchSelector
+Comment=BMMO Server
+Exec=BallanceMMOLaunchSelector
+Icon=BallanceMMO
+GenericName=Game Server
+Categories=Game
+Terminal=true
\ No newline at end of file
diff --git a/BallanceMMOServer/appimage/BallanceMMO.svg b/BallanceMMOServer/appimage/BallanceMMO.svg
new file mode 100644
index 0000000..7ac138a
--- /dev/null
+++ b/BallanceMMOServer/appimage/BallanceMMO.svg
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/BallanceMMOServer/appimage/launch_selector.cpp b/BallanceMMOServer/appimage/launch_selector.cpp
new file mode 100644
index 0000000..4026dcc
--- /dev/null
+++ b/BallanceMMOServer/appimage/launch_selector.cpp
@@ -0,0 +1,69 @@
+#include
+#include
+#include
+#include
+
+const char* const available_binaries[] = { "Server", "MockClient", "RecordParser" };
+const char* target;
+
+bool select_target(char* test_name) {
+ for (const char* name: available_binaries) {
+ if (std::strcmp(test_name, name) != 0) continue;
+ target = name;
+ return true;
+ }
+ return false;
+}
+
+int parse_args(int argc, char** argv) {
+ using namespace std;
+ if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
+ printf("Usage: %s [OPTION]...\n", argv[0]);
+ puts("Options:");
+ puts(" -h, --help\t\t Display this help and exit.");
+ puts(" -l, --launch [Target]\t Launch the selected target.");
+ puts("Additional options will be forwarded to the target.");
+ printf("Available targets (default: `%s`):\n", available_binaries[0]);
+ for (const char* name: available_binaries)
+ printf(" %s\n", name);
+ puts("Examples:");
+ printf(" To see the server help:\n\t%s --launch Server --help\n", argv[0]);
+ printf(" To launch a mock client with a custom name:\n\t%s -l MockClient -n Name\n", argv[0]);
+ return 0;
+ }
+ else if (strcmp(argv[1], "-l") == 0 || strcmp(argv[1], "--launch") == 0) {
+ if (argc <= 2) {
+ target = available_binaries[0];
+ return argc;
+ }
+ if (select_target(argv[2])) {
+ return 3;
+ }
+ fprintf(stderr, "Error: target `%s` not found.\n", argv[2]);
+ return -1;
+ }
+ return 0;
+}
+
+int main(int argc, char** argv) {
+ std::string cmd = "$APPDIR/usr/bin/BallanceMMO";
+
+ if (argc < 1) return -1;
+
+ if (argc == 1) {
+ target = available_binaries[0];
+ argc = 0;
+ }
+ else {
+ int index = parse_args(argc, argv);
+ if (index <= 0) return index;
+ argc -= index, argv += index;
+ }
+ cmd += target;
+ for (int i = 0; i < argc; ++i) {
+ cmd += ' ';
+ cmd += argv[i];
+ }
+
+ return std::system(cmd.c_str());
+}