Sfoglia il codice sorgente

vcmi can be compiled as single app on Linux

TODO: check compilation on Win/Mac using Github Actions
Ivan Savenko 2 anni fa
parent
commit
6463e906d5
4 ha cambiato i file con 11 aggiunte e 6 eliminazioni
  1. 3 1
      AI/EmptyAI/StdInc.h
  2. 6 3
      client/CServerHandler.cpp
  3. 1 1
      lib/VCMIDirs.cpp
  4. 1 1
      server/CVCMIServer.cpp

+ 3 - 1
AI/EmptyAI/StdInc.h

@@ -4,4 +4,6 @@
 
 // This header should be treated as a pre compiled header file(PCH) in the compiler building settings.
 
-// Here you can add specific libraries and macros which are specific to this project.
+// Here you can add specific libraries and macros which are specific to this project.
+
+VCMI_LIB_USING_NAMESPACE

+ 6 - 3
client/CServerHandler.cpp

@@ -25,12 +25,15 @@
 #include "../lib/CAndroidVMHelper.h"
 #elif defined(VCMI_IOS)
 #include "ios/utils.h"
-#include "../server/CVCMIServer.h"
-
 #include <dispatch/dispatch.h>
 #else
 #include "../lib/Interprocess.h"
 #endif
+
+#ifdef SINGLE_PROCESS_APP
+#include "../server/CVCMIServer.h"
+#endif
+
 #include "../lib/CConfigHandler.h"
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/CThreadHelper.h"
@@ -142,7 +145,7 @@ void CServerHandler::resetStateForLobby(const StartInfo::EMode mode, const std::
 	else
 		myNames.push_back(settings["general"]["playerName"].String());
 
-#if !defined(VCMI_ANDROID) && !defined(VCMI_IOS)
+#if !defined(VCMI_ANDROID) && !defined(SINGLE_PROCESS_APP)
 	shm.reset();
 
 	if(!settings["session"]["disable-shm"].Bool())

+ 1 - 1
lib/VCMIDirs.cpp

@@ -367,7 +367,7 @@ class IVCMIDirsUNIX : public IVCMIDirs
 bool IVCMIDirsUNIX::developmentMode() const
 {
 	// We want to be able to run VCMI from single directory. E.g to run from build output directory
-	return bfs::exists("AI") && bfs::exists("config") && bfs::exists("Mods") && bfs::exists("vcmiserver") && bfs::exists("vcmiclient");
+	return bfs::exists("AI") && bfs::exists("config") && bfs::exists("Mods") && bfs::exists("../CMakeCache.txt");
 }
 
 bfs::path IVCMIDirsUNIX::clientPath() const { return binaryPath() / "vcmiclient"; }

+ 1 - 1
server/CVCMIServer.cpp

@@ -1043,7 +1043,7 @@ static void handleCommandOptions(int argc, char * argv[], boost::program_options
 #endif
 int main(int argc, char * argv[])
 {
-#if !defined(VCMI_ANDROID) && !defined(VCMI_IOS)
+#if !defined(VCMI_ANDROID) && !defined(SINGLE_PROCESS_APP)
 	// Correct working dir executable folder (not bundle folder) so we can use executable relative paths
 	boost::filesystem::current_path(boost::filesystem::system_complete(argv[0]).parent_path());
 #endif