Explorar el Código

AtomicNET Linux support, including Xamarin Studio integration

Josh Engebretson hace 9 años
padre
commit
a047841f3b

+ 12 - 0
Build/Scripts/BuildLinux.js

@@ -1,5 +1,6 @@
 var fs = require('fs-extra');
 var path = require("path");
+var spawnSync = require('child_process').spawnSync
 var host = require("./Host");
 var atomicRoot = host.atomicRoot;
 
@@ -21,6 +22,8 @@ namespace('build', function() {
             common.cleanCreateDir(host.getGenScriptRootDir("LINUX"));
         }
 
+        var buildAtomicNET = spawnSync("which", ["xbuild"]).status == 1 ? false : true;
+
         process.chdir(buildDir);
 
         var cmds = [];
@@ -28,6 +31,9 @@ namespace('build', function() {
         cmds.push("cmake ../../../ -DATOMIC_DEV_BUILD=0 -DCMAKE_BUILD_TYPE=Release");
         cmds.push("make -j2")
 
+        if (buildAtomicNET)
+          cmds.push(host.atomicTool + " net compile " + atomicRoot + "Script/AtomicNET/AtomicNETProject.json LINUX Release");
+
         jake.exec(cmds, function() {
 
             // Copy the Editor binaries
@@ -53,6 +59,12 @@ namespace('build', function() {
             fs.copySync(buildDir +  "Source/AtomicPlayer/Application/AtomicPlayer",
             editorAppFolder + "Resources/ToolData/Deployment/Linux/AtomicPlayer");
 
+            // AtomicNET
+
+            if (buildAtomicNET) {
+              fs.copySync(atomicRoot + "Artifacts/AtomicNET/Release",
+                 editorAppFolder + "Resources/ToolData/AtomicNET/Release");
+            }
 
             var binaryFiles = ["chrome-sandbox", "libcef.so", "natives_blob.bin", "snapshot_blob.bin"];
 

+ 5 - 0
Source/AtomicEditor/EditorMode/AEEditorMode.cpp

@@ -193,7 +193,12 @@ bool EditorMode::PlayProject(String addArgs, bool debug)
     if (managed)
     {
         vargs.Insert(0, playerBinary);
+
+#ifdef ATOMIC_PLATFORM_OSX
         playerBinary = tenv->GetMonoExecutableDir() + "mono64";
+#else
+        playerBinary = "mono";
+#endif
     }
 
 #endif

+ 8 - 1
Source/AtomicNET/NETNative/CMakeLists.txt

@@ -19,7 +19,14 @@ add_library(AtomicNETNative SHARED ${SOURCE_FILES}  ${CSHARP_BINDINGS_SOURCE})
 
 add_dependencies(AtomicNETNative AtomicToolCheckScripts)
 
-target_link_libraries(AtomicNETNative AtomicNETScriptBindings AtomicNETScript AtomicJS AtomicPlayerLib AtomicPlayerJS AtomicApp ${ATOMIC_LINK_LIBRARIES})
+target_link_libraries(AtomicNETNative AtomicApp AtomicNETScriptBindings AtomicNETScript AtomicJS AtomicPlayerLib AtomicPlayerJS ${ATOMIC_LINK_LIBRARIES})
+
+if (LINUX)
+
+#https://github.com/nothings/stb/issues/280
+target_link_libraries(AtomicNETNative gcc_s gcc)
+
+endif()
 
 if (APPLE)
 

+ 4 - 0
Source/ToolCore/NETTools/AtomicNETService.cpp

@@ -68,6 +68,10 @@ namespace ToolCore
         execPath = tenv->GetMonoExecutableDir() + "mono64";
         args.Push(tenv->GetAtomicNETCoreAssemblyDir() + "AtomicNETService.exe");
 
+#elif defined ATOMIC_PLATFORM_LINUX
+
+        execPath = "/usr/bin/mono";
+        args.Push(tenv->GetAtomicNETCoreAssemblyDir() + "AtomicNETService.exe");
 #endif
 
         FileSystem* fileSystem = GetSubsystem<FileSystem>();

+ 4 - 0
Source/ToolCore/NETTools/NETBuildSystem.cpp

@@ -294,7 +294,11 @@ namespace ToolCore
 
             if (requiresNuGet)
             {
+#ifdef ATOMIC_PLATFORM_OSX
                 compile += ToString("\"%s\" restore \"%s\" && ", nugetBinary.CString(), solutionPath.CString());
+#else
+                compile += ToString("mono \"%s\" restore \"%s\" && ", nugetBinary.CString(), solutionPath.CString());
+#endif
             }
 
             compile += ToString("\"%s\" \"%s\" /p:Configuration=%s /p:Platform=\"Any CPU\"", xbuildBinary.CString(), solutionPath.CString(), configuration.CString());

+ 13 - 0
Source/ToolCore/NETTools/NETProjectSystem.cpp

@@ -135,6 +135,10 @@ namespace ToolCore
                 args.push_back("-a");
                 args.push_back(idePath_.CString());
 
+#elif defined ATOMIC_PLATFORM_LINUX
+
+                args.push_back(idePath_.CString());
+
 #endif
                 args.push_back(sourceFilePath.CString());
                 Poco::Process::launch(command.CString(), args);
@@ -394,6 +398,15 @@ namespace ToolCore
             idePath_ = "/Applications/Xamarin Studio.app/Contents/MacOS/XamarinStudio";
         }
 
+#elif defined ATOMIC_PLATFORM_LINUX
+
+        FileSystem* fileSystem = GetSubsystem<FileSystem>();
+
+        if (fileSystem->FileExists("/usr/bin/monodevelop"))
+        {
+            idePath_ = "/usr/bin/monodevelop";
+        }
+
 #endif
 
     }

+ 1 - 1
Source/ToolCore/ToolEnvironment.cpp

@@ -187,7 +187,7 @@ void ToolEnvironment::SetRootSourceDir(const String& sourceDir)
     atomicNETManagedPlayerBinary_ = atomicNETCoreAssemblyDir_ + "AtomicPlayer.exe";
     atomicNETManagedIPCPlayerBinary_ = atomicNETCoreAssemblyDir_ + "AtomicIPCPlayer.exe";
 
-#ifdef ATOMIC_PLATFORM_WINDOWS
+#if defined ATOMIC_PLATFORM_WINDOWS || defined ATOMIC_PLATFORM_LINUX
     atomicNETNuGetBinary_ = ToString("%sBuild/Managed/nuget/nuget.exe", rootSourceDir_.CString());
 #endif