浏览代码

Fix compilation with boost 1.86

Ivan Savenko 1 年之前
父节点
当前提交
068c4bfa1e
共有 2 个文件被更改,包括 23 次插入2 次删除
  1. 10 2
      client/ServerRunner.cpp
  2. 13 0
      client/ServerRunner.h

+ 10 - 2
client/ServerRunner.cpp

@@ -15,11 +15,19 @@
 #include "../lib/CThreadHelper.h"
 #include "../server/CVCMIServer.h"
 
-#ifndef VCMI_MOBILE
+#ifdef ENABLE_SERVER_PROCESS
+
+#if BOOST_VERSION >= 108600
+// TODO: upgrade code to use v2 API instead of deprecated v1
+#include <boost/process/v1/child.hpp>
+#include <boost/process/v1/io.hpp>
+#else
 #include <boost/process/child.hpp>
 #include <boost/process/io.hpp>
 #endif
 
+#endif
+
 #include <future>
 
 ServerThreadRunner::ServerThreadRunner() = default;
@@ -66,7 +74,7 @@ int ServerThreadRunner::exitCode()
 	return 0;
 }
 
-#ifndef VCMI_MOBILE
+#ifdef ENABLE_SERVER_PROCESS
 
 ServerProcessRunner::ServerProcessRunner() = default;
 ServerProcessRunner::~ServerProcessRunner() = default;

+ 13 - 0
client/ServerRunner.h

@@ -44,10 +44,23 @@ public:
 };
 
 #ifndef VCMI_MOBILE
+// Enable support for running vcmiserver as separate process. Unavailable on mobile systems
+#define ENABLE_SERVER_PROCESS
+#endif
+
+#ifdef ENABLE_SERVER_PROCESS
 
+#if BOOST_VERSION >= 108600
 namespace boost::process {
+inline namespace v1 {
 class child;
 }
+}
+#else
+namespace boost::process {
+class child;
+}
+#endif
 
 /// Class that runs server instance as a child process
 /// Available only on desktop systems where process management is allowed