Browse Source

Initializing CoreCLR and able to execute a managed assembly

Josh Engebretson 10 years ago
parent
commit
903a7e9af1
34 changed files with 974 additions and 11 deletions
  1. 38 0
      Build/AtomicSharp/AtomicEditor/AtomicEditor.csproj
  2. 6 0
      Build/AtomicSharp/AtomicEditor/MyClass.cs
  3. 27 0
      Build/AtomicSharp/AtomicEditor/Properties/AssemblyInfo.cs
  4. 10 1
      Build/AtomicSharp/AtomicEngine.cs
  5. 12 0
      Build/AtomicSharp/AtomicSharp.sln
  6. 27 0
      Build/AtomicSharp/AtomicSharpTest/Program.cs
  7. 47 0
      Build/AtomicSharp/AtomicSharpTool/AtomicSharpTool.csproj
  8. 51 0
      Build/AtomicSharp/AtomicSharpTool/Program.cs
  9. 27 0
      Build/AtomicSharp/AtomicSharpTool/Properties/AssemblyInfo.cs
  10. 2 2
      CMake/Modules/AtomicMac.cmake
  11. 28 0
      Source/AtomicEditor/Application/AEEditorCommon.cpp
  12. 1 1
      Source/AtomicEditor/CMakeLists.txt
  13. 3 0
      Source/AtomicNET/CMakeLists.txt
  14. 13 0
      Source/AtomicNET/NETCore/CMakeLists.txt
  15. 224 0
      Source/AtomicNET/NETCore/NETCore.cpp
  16. 58 0
      Source/AtomicNET/NETCore/NETCore.h
  17. 346 0
      Source/AtomicNET/NETCore/Platforms/Unix/NetCoreUnixCommon.cpp
  18. 46 0
      Source/AtomicNET/NETCore/Platforms/Unix/NetCoreUnixCommon.h
  19. 0 0
      Source/AtomicNET/NETRuntime/AtomicSharp.cpp
  20. 0 0
      Source/AtomicNET/NETRuntime/AtomicSharp.h
  21. 0 0
      Source/AtomicNET/NETRuntime/AtomicSharpAPI.cpp
  22. 0 0
      Source/AtomicNET/NETRuntime/AtomicSharpAPI.h
  23. 0 0
      Source/AtomicNET/NETRuntime/AtomicSharpApp.cpp
  24. 0 0
      Source/AtomicNET/NETRuntime/AtomicSharpApp.h
  25. 4 5
      Source/AtomicNET/NETRuntime/CMakeLists.txt
  26. 0 0
      Source/AtomicNET/NETRuntime/CSComponent.cpp
  27. 0 0
      Source/AtomicNET/NETRuntime/CSComponent.h
  28. 0 0
      Source/AtomicNET/NETRuntime/CSEventHelper.cpp
  29. 0 0
      Source/AtomicNET/NETRuntime/CSEventHelper.h
  30. 0 0
      Source/AtomicNET/NETRuntime/CSScriptObject.cpp
  31. 0 0
      Source/AtomicNET/NETRuntime/CSScriptObject.h
  32. 1 1
      Source/CMakeLists.txt
  33. 2 0
      Source/ToolCore/JSBind/CSharp/CSFunctionWriter.cpp
  34. 1 1
      Source/ToolCore/JSBind/CSharp/CSModuleWriter.cpp

+ 38 - 0
Build/AtomicSharp/AtomicEditor/AtomicEditor.csproj

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{91790BBE-7726-4B21-A746-0A4998F5BC7B}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>AtomicEditor</RootNamespace>
+    <AssemblyName>AtomicEditor</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>full</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MyClass.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>

+ 6 - 0
Build/AtomicSharp/AtomicEditor/MyClass.cs

@@ -0,0 +1,6 @@
+using System;
+
+namespace AtomicEditor
+{
+}
+

+ 27 - 0
Build/AtomicSharp/AtomicEditor/Properties/AssemblyInfo.cs

@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("AtomicEditor")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("")]
+[assembly: AssemblyCopyright ("josh")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion ("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

+ 10 - 1
Build/AtomicSharp/AtomicEngine.cs

@@ -210,5 +210,14 @@ namespace AtomicEngine
 
 
 		
 		
 	}
 	}
-		
+
+	public class InspectorAttribute : Attribute
+	{
+		public InspectorAttribute(string defaultValue = "")
+		{
+			DefaultValue = defaultValue;
+		}
+
+		public string DefaultValue;
+	}		
 }
 }

+ 12 - 0
Build/AtomicSharp/AtomicSharp.sln

@@ -5,6 +5,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtomicSharp", "AtomicSharp.
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtomicSharpTest", "AtomicSharpTest\AtomicSharpTest.csproj", "{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtomicSharpTest", "AtomicSharpTest\AtomicSharpTest.csproj", "{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}"
 EndProject
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtomicSharpTool", "AtomicSharpTool\AtomicSharpTool.csproj", "{BA7825F5-7175-4486-8B06-BB88167246F2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtomicEditor", "AtomicEditor\AtomicEditor.csproj", "{91790BBE-7726-4B21-A746-0A4998F5BC7B}"
+EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +19,14 @@ Global
 		{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}.Release|Any CPU.Build.0 = Release|Any CPU
 		{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{91790BBE-7726-4B21-A746-0A4998F5BC7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{91790BBE-7726-4B21-A746-0A4998F5BC7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{91790BBE-7726-4B21-A746-0A4998F5BC7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{91790BBE-7726-4B21-A746-0A4998F5BC7B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BA7825F5-7175-4486-8B06-BB88167246F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BA7825F5-7175-4486-8B06-BB88167246F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BA7825F5-7175-4486-8B06-BB88167246F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BA7825F5-7175-4486-8B06-BB88167246F2}.Release|Any CPU.Build.0 = Release|Any CPU
 		{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{DBD98CE5-11DE-47F8-BF9A-83BF8576794E}.Release|Any CPU.ActiveCfg = Release|Any CPU

+ 27 - 0
Build/AtomicSharp/AtomicSharpTest/Program.cs

@@ -45,6 +45,7 @@ class BunnyMark : ScriptObject
 		var bunny5 = sheet.GetSprite ("bunny5");
 		var bunny5 = sheet.GetSprite ("bunny5");
 
 
 		bunnyTextures = new Sprite2D[] { bunny1, bunny2, bunny3, bunny4, bunny5 };
 		bunnyTextures = new Sprite2D[] { bunny1, bunny2, bunny3, bunny4, bunny5 };
+
 		bunnyType = 2;
 		bunnyType = 2;
 		currentTexture = bunnyTextures [bunnyType];
 		currentTexture = bunnyTextures [bunnyType];
 
 
@@ -170,6 +171,32 @@ class BunnyMark : ScriptObject
 	float minY;
 	float minY;
 
 
 }
 }
+	
+enum MyEnum
+{
+	Peaceful,
+	Friendly,
+	Aggressive
+}
+
+class Spinner : CSComponent
+{
+	[Inspector]
+	public int MyField = 42;
+
+	[Inspector("Sprites/star.png")]
+	public Sprite2D MySprite;
+
+	[Inspector]
+	public Vector3 Vector3Field = new Vector3(1, 2, 3);
+
+	[Inspector]
+	public MyEnum Attitude = MyEnum.Friendly;
+
+	[Inspector]
+	public Sprite2D[] SpritesField;
+
+}
 
 
 /*
 /*
 class Spinner : CSComponent
 class Spinner : CSComponent

+ 47 - 0
Build/AtomicSharp/AtomicSharpTool/AtomicSharpTool.csproj

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{BA7825F5-7175-4486-8B06-BB88167246F2}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>AtomicSharpTool</RootNamespace>
+    <AssemblyName>AtomicSharpTool</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Externalconsole>true</Externalconsole>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>full</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Externalconsole>true</Externalconsole>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>bin\Debug\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\AtomicSharp.csproj">
+      <Project>{3A4C776B-61D6-412E-B1E9-7A1C84CD6B5B}</Project>
+      <Name>AtomicSharp</Name>
+    </ProjectReference>
+  </ItemGroup>
+</Project>

+ 51 - 0
Build/AtomicSharp/AtomicSharpTool/Program.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Reflection;
+using AtomicEngine;
+
+namespace AtomicSharpTool
+{
+	class MainClass
+	{
+		public static void Main (string[] args)
+		{
+			Assembly assembly = Assembly.LoadFrom("/Users/josh/Dev/atomic/AtomicGameEngineSharp/Build/AtomicSharp/AtomicSharpTest/bin/Debug/AtomicSharpTest.exe");
+
+			Type[] types = assembly.GetTypes ();
+
+			foreach (var type in types) 
+			{
+				if (type.BaseType.Name == "CSComponent") {
+
+					FieldInfo[] fields = type.GetFields ();
+
+					Console.WriteLine (type.Name);
+
+					object instance = null;
+
+					foreach (var field in fields)
+					{
+						foreach (var attribute in field.GetCustomAttributes(true)) {
+
+							if (attribute is InspectorAttribute) {
+
+								if (instance == null)
+									instance = Activator.CreateInstance (type);
+
+								var attr = attribute as InspectorAttribute;
+
+								string defaultValue = attr.DefaultValue;
+								if (defaultValue.Length == 0 && field.GetValue (instance) != null)
+									defaultValue = field.GetValue (instance).ToString ();
+
+							
+								Console.WriteLine ("Inspector Field: {0}, {1}, {2}", field.Name, 
+									field.FieldType.Name, defaultValue);
+								
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+}

+ 27 - 0
Build/AtomicSharp/AtomicSharpTool/Properties/AssemblyInfo.cs

@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("AtomicSharpTool")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("")]
+[assembly: AssemblyCopyright ("josh")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion ("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

+ 2 - 2
CMake/Modules/AtomicMac.cmake

@@ -5,9 +5,9 @@ include(AtomicDesktop)
 set (JAVASCRIPT_BINDINGS_PLATFORM "MACOSX")
 set (JAVASCRIPT_BINDINGS_PLATFORM "MACOSX")
 
 
 # only have 32 bit mono installed, fix this
 # only have 32 bit mono installed, fix this
-set (CMAKE_OSX_ARCHITECTURES i386)
+# set (CMAKE_OSX_ARCHITECTURES i386)
 
 
-add_definitions(-DATOMIC_PLATFORM_OSX -DATOMIC_OPENGL -DKNET_UNIX)
+add_definitions(-DATOMIC_PLATFORM_OSX -DATOMIC_OPENGL -DATOMIC_DOTNET -DKNET_UNIX)
 
 
 if (CMAKE_GENERATOR STREQUAL "Xcode")
 if (CMAKE_GENERATOR STREQUAL "Xcode")
 
 

+ 28 - 0
Source/AtomicEditor/Application/AEEditorCommon.cpp

@@ -15,6 +15,10 @@
 
 
 #include <AtomicJS/Javascript/Javascript.h>
 #include <AtomicJS/Javascript/Javascript.h>
 
 
+#ifdef ATOMIC_DOTNET
+#include <AtomicNET/NETCore/NETCore.h>
+#endif
+
 #include "AEEditorCommon.h"
 #include "AEEditorCommon.h"
 
 
 namespace AtomicEditor
 namespace AtomicEditor
@@ -38,6 +42,21 @@ void AEEditorCommon::Start()
     Javascript* javascript = new Javascript(context_);
     Javascript* javascript = new Javascript(context_);
     context_->RegisterSubsystem(javascript);
     context_->RegisterSubsystem(javascript);
 
 
+#ifdef ATOMIC_DOTNET
+    // Instantiate and register the AtomicNET subsystem
+    SharedPtr<NETCore> netCore (new NETCore(context_));
+    String netCoreErrorMsg;
+    if (!netCore->Initialize("/Users/josh/Desktop/OSX.x64.Debug/", netCoreErrorMsg))
+    {
+        LOGERRORF("NetCore: Unable to initialize! %s", netCoreErrorMsg.CString());
+    }
+    else
+    {
+        context_->RegisterSubsystem(netCore);
+    }
+#endif
+
+
     vm_ = javascript->InstantiateVM("MainVM");
     vm_ = javascript->InstantiateVM("MainVM");
     vm_->InitJSContext();
     vm_->InitJSContext();
 
 
@@ -62,6 +81,15 @@ void AEEditorCommon::Stop()
     // make sure JSVM is really down and no outstanding refs
     // make sure JSVM is really down and no outstanding refs
     // as if not, will hold on engine subsystems, which is bad
     // as if not, will hold on engine subsystems, which is bad
     assert(!JSVM::GetJSVM(0));
     assert(!JSVM::GetJSVM(0));
+
+#ifdef ATOMIC_DOTNET
+    NETCore* netCore = GetSubsystem<NETCore>();
+    if (netCore)
+    {
+        netCore->Shutdown();
+        context_->RemoveSubsystem<NETCore>();
+    }
+#endif
 }
 }
 
 
 }
 }

+ 1 - 1
Source/AtomicEditor/CMakeLists.txt

@@ -53,7 +53,7 @@ target_link_libraries(AtomicEditor ToolCore AtomicJS AtomicPlayerJS ToolCoreJS P
 
 
 if (APPLE)
 if (APPLE)
     set (TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
     set (TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
-    target_link_libraries(AtomicEditor curl)
+    target_link_libraries(AtomicEditor NETCore curl)
 
 
     # compile the editor scripts
     # compile the editor scripts
     add_custom_command (TARGET AtomicEditor POST_BUILD
     add_custom_command (TARGET AtomicEditor POST_BUILD

+ 3 - 0
Source/AtomicNET/CMakeLists.txt

@@ -0,0 +1,3 @@
+
+add_subdirectory(NETCore)
+add_subdirectory(NETRuntime)

+ 13 - 0
Source/AtomicNET/NETCore/CMakeLists.txt

@@ -0,0 +1,13 @@
+
+include_directories (${CMAKE_SOURCE_DIR}/Source/ThirdParty/rapidjson/include
+                     ${CMAKE_SOURCE_DIR}/Source/ThirdParty
+                     ${CMAKE_SOURCE_DIR}/Source/ThirdParty/Assimp/include
+                     ${CMAKE_SOURCE_DIR}/Source/ThirdParty/nativefiledialog)
+
+file (GLOB_RECURSE SOURCE_FILES *.cpp *.h)
+
+if (APPLE)
+    file (GLOB_RECURSE PLATFORM_SOURCE_FILES Platforms/Unix/*.cpp Platforms/Unix/*.h)
+endif()
+
+add_library(NETCore ${SOURCE_FILES} ${PLATFORM_SOURCE_FILES})

+ 224 - 0
Source/AtomicNET/NETCore/NETCore.cpp

@@ -0,0 +1,224 @@
+
+#include <ThirdParty/SDL/include/SDL.h>
+
+#include <Atomic/IO/FileSystem.h>
+#include <Atomic/IO/Log.h>
+#include <Atomic/Core/StringUtils.h>
+
+#include "NETCore.h"
+
+namespace Atomic
+{
+
+#ifdef ATOMIC_PLATFORM_OSX
+static const char * const sCoreClrDll = "libcoreclr.dylib";
+#else
+static const char * const sCoreClrDll = "libcoreclr.so";
+#endif
+
+// Prototype of the coreclr_initialize function from the libcoreclr.so
+typedef int (*InitializeCoreCLRFunction)(
+            const char* exePath,
+            const char* appDomainFriendlyName,
+            int propertyCount,
+            const char** propertyKeys,
+            const char** propertyValues,
+            void** hostHandle,
+            unsigned int* domainId);
+
+// Prototype of the coreclr_shutdown function from the libcoreclr.so
+typedef int (*ShutdownCoreCLRFunction)(
+            void* hostHandle,
+            unsigned int domainId);
+
+// Prototype of the coreclr_execute_assembly function from the libcoreclr.so
+typedef int (*ExecuteAssemblyFunction)(
+            void* hostHandle,
+            unsigned int domainId,
+            int argc,
+            const char** argv,
+            const char* managedAssemblyPath,
+            unsigned int* exitCode);
+
+static InitializeCoreCLRFunction sInitializeCoreCLR = 0;
+static ExecuteAssemblyFunction sExecuteAssembly = 0;
+static ShutdownCoreCLRFunction sShutdownCoreCLR = 0;
+
+NETCore::NETCore(Context* context) :
+    Object(context),
+    coreCLRDLLHandle_(0),
+    hostHandle_(0),
+    domainId_(0)
+{
+
+}
+
+NETCore::~NETCore()
+{
+
+}
+
+void NETCore::GenerateTPAList(String& tpaList)
+{
+    tpaList = String::EMPTY;
+
+    FileSystem* fs = GetSubsystem<FileSystem>();
+    Vector<String> results;
+    fs->ScanDir(results, coreCLRFilesAbsPath_, "*.dll", SCAN_FILES, true);
+
+    Vector<String> trustedAssemblies;
+
+    for (unsigned i = 0; i < results.Size(); i++)
+    {
+        const String& assembly = results[i];
+
+        // TODO: apply filtering if necessary
+        trustedAssemblies.Push(coreCLRFilesAbsPath_ + "/" + assembly);
+    }
+
+    tpaList.Join(trustedAssemblies, ":");
+
+}
+
+void NETCore::Shutdown()
+{
+    if (sShutdownCoreCLR && hostHandle_)
+    {
+        sShutdownCoreCLR(hostHandle_, domainId_);
+    }
+
+    if (coreCLRDLLHandle_)
+    {
+        SDL_UnloadObject(coreCLRDLLHandle_);
+    }
+
+    coreCLRDLLHandle_ = 0;
+    hostHandle_ = 0;
+    domainId_ = 0;
+    sInitializeCoreCLR = 0;
+    sExecuteAssembly = 0;
+    sShutdownCoreCLR = 0;
+
+}
+
+bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
+{
+    coreCLRFilesAbsPath_ = coreCLRFilesAbsPath;
+    String coreClrDllPath = AddTrailingSlash(coreCLRFilesAbsPath) + sCoreClrDll;
+
+    coreCLRDLLHandle_ = SDL_LoadObject(coreClrDllPath.CString());
+
+    if (coreCLRDLLHandle_ == NULL)
+    {
+        errorMsg = ToString("NETCore: Unable to load %s with error %s",
+            coreClrDllPath.CString(),
+            SDL_GetError());
+        return false;
+    }
+
+    sInitializeCoreCLR = (InitializeCoreCLRFunction) SDL_LoadFunction(coreCLRDLLHandle_, "coreclr_initialize");
+
+    if (!sInitializeCoreCLR)
+    {
+        errorMsg = ToString("NETCore: Unable to get coreclr_initialize entry point in %s", coreClrDllPath.CString());
+        return false;
+    }
+
+    sShutdownCoreCLR = (ShutdownCoreCLRFunction) SDL_LoadFunction(coreCLRDLLHandle_, "coreclr_shutdown");
+
+    if (!sShutdownCoreCLR)
+    {
+        errorMsg = ToString("NETCore: Unable to get coreclr_shutdown entry point in %s", coreClrDllPath.CString());
+        return false;
+    }
+
+    sExecuteAssembly = (ExecuteAssemblyFunction) SDL_LoadFunction(coreCLRDLLHandle_, "coreclr_execute_assembly");
+
+    if (!sExecuteAssembly)
+    {
+        errorMsg = ToString("NETCore: Unable to get coreclr_execute_assembly entry point in %s", coreClrDllPath.CString());
+        return false;
+    }
+
+    String tpaList;
+    GenerateTPAList(tpaList);
+
+    // Allowed property names:
+    // APPBASE
+    // - The base path of the application from which the exe and other assemblies will be loaded
+    //
+    // TRUSTED_PLATFORM_ASSEMBLIES
+    // - The list of complete paths to each of the fully trusted assemblies
+    //
+    // APP_PATHS
+    // - The list of paths which will be probed by the assembly loader
+    //
+    // APP_NI_PATHS
+    // - The list of additional paths that the assembly loader will probe for ngen images
+    //
+    // NATIVE_DLL_SEARCH_DIRECTORIES
+    // - The list of paths that will be probed for native DLLs called by PInvoke
+    //
+
+    const char *propertyKeys[] = {
+        "TRUSTED_PLATFORM_ASSEMBLIES",
+        "APP_PATHS",
+        "APP_NI_PATHS",
+        "NATIVE_DLL_SEARCH_DIRECTORIES",
+        "AppDomainCompatSwitch"
+    };
+
+    String appPath = "";
+    Vector<String> nativeSearch;
+    nativeSearch.Push(coreCLRFilesAbsPath_);
+    nativeSearch.Push("/Users/josh/Dev/atomic/AtomicGameEngineSharp-build/Source/AtomicNET/NETRuntime");
+
+    String nativeDllSearchDirs;
+    nativeDllSearchDirs.Join(nativeSearch, ":");
+
+    const char *propertyValues[] = {
+        // TRUSTED_PLATFORM_ASSEMBLIES
+        tpaList.CString(),
+        // APP_PATHS
+        appPath.CString(),
+        // APP_NI_PATHS
+        appPath.CString(),
+        // NATIVE_DLL_SEARCH_DIRECTORIES
+        nativeDllSearchDirs.CString(),
+        // AppDomainCompatSwitch
+        "UseLatestBehaviorWhenTFMNotSpecified"
+    };
+
+    int st = sInitializeCoreCLR(
+                "", // "/Users/josh/Desktop/OSX.x64.Debug/HelloWorld.exe",
+                "NETCore",
+                sizeof(propertyKeys) / sizeof(propertyKeys[0]),
+                propertyKeys,
+                propertyValues,
+                &hostHandle_,
+                &domainId_);
+
+    if (st < 0)
+    {
+        errorMsg = ToString("NETCore: coreclr_initialize failed - status: 0x%08x\n", st);
+        return false;
+    }
+
+    /*
+    unsigned int exitCode;
+
+    st = sExecuteAssembly(
+            hostHandle_,
+            domainId_,
+            0,
+            0,
+            "/Users/josh/Desktop/OSX.x64.Debug/HelloWorld.exe",
+            (unsigned int*)&exitCode);
+    */
+
+    return true;
+
+}
+
+}
+

+ 58 - 0
Source/AtomicNET/NETCore/NETCore.h

@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#pragma once
+
+#include <Atomic/Core/Context.h>
+#include <Atomic/Core/Object.h>
+
+namespace Atomic
+{
+
+class ATOMIC_API NETCore : public Object
+{
+
+    OBJECT(NETCore);
+
+public:
+    /// Construct.
+    NETCore(Context* context);
+    /// Destruct.
+    virtual ~NETCore();
+
+    bool Initialize(const String& coreCLRFilesAbsPath, String &errorMsg);
+
+    void Shutdown();
+
+private:
+
+    void GenerateTPAList(String& tpaList);
+
+    String coreCLRFilesAbsPath_;
+    void* coreCLRDLLHandle_;
+    void* hostHandle_;
+    unsigned domainId_;
+
+
+};
+
+}

+ 346 - 0
Source/AtomicNET/NETCore/Platforms/Unix/NetCoreUnixCommon.cpp

@@ -0,0 +1,346 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+//
+// Code that is used by both the Unix corerun and coreconsole.
+//
+
+#include <cstdlib>
+#include <assert.h>
+#include <dirent.h>
+#include <dlfcn.h>
+#include <limits.h>
+#include <set>
+#include <string>
+#include <string.h>
+#include <sys/stat.h>
+
+// The name of the CoreCLR native runtime DLL
+#if defined(__APPLE__)
+static const char * const coreClrDll = "libcoreclr.dylib";
+#else
+static const char * const coreClrDll = "libcoreclr.so";
+#endif
+
+#define SUCCEEDED(Status) ((Status) >= 0)
+
+// Prototype of the coreclr_initialize function from the libcoreclr.so
+typedef int (*InitializeCoreCLRFunction)(
+            const char* exePath,
+            const char* appDomainFriendlyName,
+            int propertyCount,
+            const char** propertyKeys,
+            const char** propertyValues,
+            void** hostHandle,
+            unsigned int* domainId);
+
+// Prototype of the coreclr_shutdown function from the libcoreclr.so
+typedef int (*ShutdownCoreCLRFunction)(
+            void* hostHandle,
+            unsigned int domainId);
+
+// Prototype of the coreclr_execute_assembly function from the libcoreclr.so
+typedef int (*ExecuteAssemblyFunction)(
+            void* hostHandle,
+            unsigned int domainId,
+            int argc,
+            const char** argv,
+            const char* managedAssemblyPath,
+            unsigned int* exitCode);
+
+bool GetAbsolutePath(const char* path, std::string& absolutePath)
+{
+    bool result = false;
+
+    char realPath[PATH_MAX];
+    if (realpath(path, realPath) != nullptr && realPath[0] != '\0')
+    {
+        absolutePath.assign(realPath);
+        // realpath should return canonicalized path without the trailing slash
+        assert(absolutePath.back() != '/');
+
+        result = true;
+    }
+
+    return result;
+}
+
+bool GetDirectory(const char* absolutePath, std::string& directory)
+{
+    directory.assign(absolutePath);
+    size_t lastSlash = directory.rfind('/');
+    if (lastSlash != std::string::npos)
+    {
+        directory.erase(lastSlash);
+        return true;
+    }
+
+    return false;
+}
+
+bool GetClrFilesAbsolutePath(const char* currentExePath, const char* clrFilesPath, std::string& clrFilesAbsolutePath)
+{
+    std::string clrFilesRelativePath;
+    const char* clrFilesPathLocal = clrFilesPath;
+    if (clrFilesPathLocal == nullptr)
+    {
+        // There was no CLR files path specified, use the folder of the corerun/coreconsole
+        if (!GetDirectory(currentExePath, clrFilesRelativePath))
+        {
+            perror("Failed to get directory from argv[0]");
+            return false;
+        }
+
+        clrFilesPathLocal = clrFilesRelativePath.c_str();
+
+        // TODO: consider using an env variable (if defined) as a fall-back.
+        // The windows version of the corerun uses core_root env variable
+    }
+
+    if (!GetAbsolutePath(clrFilesPathLocal, clrFilesAbsolutePath))
+    {
+        perror("Failed to convert CLR files path to absolute path");
+        return false;
+    }
+
+    return true;
+}
+
+void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList)
+{
+    const char * const tpaExtensions[] = {
+                ".ni.dll",      // Probe for .ni.dll first so that it's preferred if ni and il coexist in the same dir
+                ".dll",
+                ".ni.exe",
+                ".exe",
+                };
+
+    DIR* dir = opendir(directory);
+    if (dir == nullptr)
+    {
+        return;
+    }
+
+    std::set<std::string> addedAssemblies;
+
+    // Walk the directory for each extension separately so that we first get files with .ni.dll extension,
+    // then files with .dll extension, etc.
+    for (int extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++)
+    {
+        const char* ext = tpaExtensions[extIndex];
+        int extLength = strlen(ext);
+
+        struct dirent* entry;
+
+        // For all entries in the directory
+        while ((entry = readdir(dir)) != nullptr)
+        {
+            // We are interested in files only
+            switch (entry->d_type)
+            {
+            case DT_REG:
+                break;
+
+            // Handle symlinks and file systems that do not support d_type
+            case DT_LNK:
+            case DT_UNKNOWN:
+                {
+                    std::string fullFilename;
+
+                    fullFilename.append(directory);
+                    fullFilename.append("/");
+                    fullFilename.append(entry->d_name);
+
+                    struct stat sb;
+                    if (stat(fullFilename.c_str(), &sb) == -1)
+                    {
+                        continue;
+                    }
+
+                    if (!S_ISREG(sb.st_mode))
+                    {
+                        continue;
+                    }
+                }
+                break;
+
+            default:
+                continue;
+            }
+
+            std::string filename(entry->d_name);
+
+            // Check if the extension matches the one we are looking for
+            int extPos = filename.length() - extLength;
+            if ((extPos <= 0) || (filename.compare(extPos, extLength, ext) != 0))
+            {
+                continue;
+            }
+
+            std::string filenameWithoutExt(filename.substr(0, extPos));
+
+            // Make sure if we have an assembly with multiple extensions present,
+            // we insert only one version of it.
+            if (addedAssemblies.find(filenameWithoutExt) == addedAssemblies.end())
+            {
+                addedAssemblies.insert(filenameWithoutExt);
+
+                tpaList.append(directory);
+                tpaList.append("/");
+                tpaList.append(filename);
+                tpaList.append(":");
+            }
+        }
+
+        // Rewind the directory stream to be able to iterate over it for the next extension
+        rewinddir(dir);
+    }
+
+    closedir(dir);
+}
+
+int ExecuteManagedAssembly(
+            const char* currentExeAbsolutePath,
+            const char* clrFilesAbsolutePath,
+            const char* managedAssemblyAbsolutePath,
+            int managedAssemblyArgc,
+            const char** managedAssemblyArgv)
+{
+    // Indicates failure
+    int exitCode = -1;
+
+    std::string coreClrDllPath(clrFilesAbsolutePath);
+    coreClrDllPath.append("/");
+    coreClrDllPath.append(coreClrDll);
+
+    if (coreClrDllPath.length() >= PATH_MAX)
+    {
+        fprintf(stderr, "Absolute path to libcoreclr.so too long\n");
+        return -1;
+    }
+
+    // Get just the path component of the managed assembly path
+    std::string appPath;
+    GetDirectory(managedAssemblyAbsolutePath, appPath);
+
+    std::string nativeDllSearchDirs(appPath);
+    nativeDllSearchDirs.append(":");
+    nativeDllSearchDirs.append(clrFilesAbsolutePath);
+
+    std::string tpaList;
+    AddFilesFromDirectoryToTpaList(clrFilesAbsolutePath, tpaList);
+
+    void* coreclrLib = dlopen(coreClrDllPath.c_str(), RTLD_NOW | RTLD_LOCAL);
+    if (coreclrLib != nullptr)
+    {
+        InitializeCoreCLRFunction initializeCoreCLR = (InitializeCoreCLRFunction)dlsym(coreclrLib, "coreclr_initialize");
+        ExecuteAssemblyFunction executeAssembly = (ExecuteAssemblyFunction)dlsym(coreclrLib, "coreclr_execute_assembly");
+        ShutdownCoreCLRFunction shutdownCoreCLR = (ShutdownCoreCLRFunction)dlsym(coreclrLib, "coreclr_shutdown");
+
+        if (initializeCoreCLR == nullptr)
+        {
+            fprintf(stderr, "Function coreclr_initialize not found in the libcoreclr.so\n");
+        }
+        else if (executeAssembly == nullptr)
+        {
+            fprintf(stderr, "Function coreclr_execute_assembly not found in the libcoreclr.so\n");
+        }
+        else if (shutdownCoreCLR == nullptr)
+        {
+            fprintf(stderr, "Function coreclr_shutdown not found in the libcoreclr.so\n");
+        }
+        else
+        {
+            // Allowed property names:
+            // APPBASE
+            // - The base path of the application from which the exe and other assemblies will be loaded
+            //
+            // TRUSTED_PLATFORM_ASSEMBLIES
+            // - The list of complete paths to each of the fully trusted assemblies
+            //
+            // APP_PATHS
+            // - The list of paths which will be probed by the assembly loader
+            //
+            // APP_NI_PATHS
+            // - The list of additional paths that the assembly loader will probe for ngen images
+            //
+            // NATIVE_DLL_SEARCH_DIRECTORIES
+            // - The list of paths that will be probed for native DLLs called by PInvoke
+            //
+            const char *propertyKeys[] = {
+                "TRUSTED_PLATFORM_ASSEMBLIES",
+                "APP_PATHS",
+                "APP_NI_PATHS",
+                "NATIVE_DLL_SEARCH_DIRECTORIES",
+                "AppDomainCompatSwitch"
+            };
+            const char *propertyValues[] = {
+                // TRUSTED_PLATFORM_ASSEMBLIES
+                tpaList.c_str(),
+                // APP_PATHS
+                appPath.c_str(),
+                // APP_NI_PATHS
+                appPath.c_str(),
+                // NATIVE_DLL_SEARCH_DIRECTORIES
+                nativeDllSearchDirs.c_str(),
+                // AppDomainCompatSwitch
+                "UseLatestBehaviorWhenTFMNotSpecified"
+            };
+
+            void* hostHandle;
+            unsigned int domainId;
+
+            int st = initializeCoreCLR(
+                        currentExeAbsolutePath,
+                        "unixcorerun",
+                        sizeof(propertyKeys) / sizeof(propertyKeys[0]),
+                        propertyKeys,
+                        propertyValues,
+                        &hostHandle,
+                        &domainId);
+
+            if (!SUCCEEDED(st))
+            {
+                fprintf(stderr, "coreclr_initialize failed - status: 0x%08x\n", st);
+                exitCode = -1;
+            }
+            else
+            {
+                st = executeAssembly(
+                        hostHandle,
+                        domainId,
+                        managedAssemblyArgc,
+                        managedAssemblyArgv,
+                        managedAssemblyAbsolutePath,
+                        (unsigned int*)&exitCode);
+
+                if (!SUCCEEDED(st))
+                {
+                    fprintf(stderr, "coreclr_execute_assembly failed - status: 0x%08x\n", st);
+                    exitCode = -1;
+                }
+
+                st = shutdownCoreCLR(hostHandle, domainId);
+                if (!SUCCEEDED(st))
+                {
+                    fprintf(stderr, "coreclr_shutdown failed - status: 0x%08x\n", st);
+                    exitCode = -1;
+                }
+            }
+        }
+
+        if (dlclose(coreclrLib) != 0)
+        {
+            fprintf(stderr, "Warning - dlclose failed\n");
+        }
+    }
+    else
+    {
+        char* error = dlerror();
+        fprintf(stderr, "dlopen failed to open the libcoreclr.so with error %s\n", error);
+    }
+
+    return exitCode;
+}

+ 46 - 0
Source/AtomicNET/NETCore/Platforms/Unix/NetCoreUnixCommon.h

@@ -0,0 +1,46 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+#include <string>
+
+// Get absolute path from the specified path.
+// Return true in case of a success, false otherwise.
+bool GetAbsolutePath(const char* path, std::string& absolutePath);
+
+// Get directory of the specified path.
+// Return true in case of a success, false otherwise.
+bool GetDirectory(const char* absolutePath, std::string& directory);
+
+//
+// Get the absolute path to use to locate libcoreclr.so and the CLR assemblies are stored. If clrFilesPath is provided,
+// this function will return the absolute path to it. Otherwise, the directory of the current executable is used.
+//
+// Return true in case of a success, false otherwise.
+//
+bool GetClrFilesAbsolutePath(const char* currentExePath, const char* clrFilesPath, std::string& clrFilesAbsolutePath);
+
+// Add all *.dll, *.ni.dll, *.exe, and *.ni.exe files from the specified directory to the tpaList string.
+void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList);
+
+//
+// Execute the specified managed assembly.
+//
+// Parameters:
+//  currentExePath          - Path to the current executable
+//  clrFilesAbsolutePath    - Absolute path to the folder where the libcoreclr.so and CLR managed assemblies are stored
+//  managedAssemblyPath     - Path to the managed assembly to execute
+//  managedAssemblyArgc     - Number of arguments passed to the executed assembly
+//  managedAssemblyArgv     - Array of arguments passed to the executed assembly
+//
+// Returns:
+//  ExitCode of the assembly
+//
+int ExecuteManagedAssembly(
+            const char* currentExeAbsolutePath,
+            const char* clrFilesAbsolutePath,
+            const char* managedAssemblyAbsolutePath,
+            int managedAssemblyArgc,
+            const char** managedAssemblyArgv);
+

+ 0 - 0
Source/AtomicSharp/AtomicSharp.cpp → Source/AtomicNET/NETRuntime/AtomicSharp.cpp


+ 0 - 0
Source/AtomicSharp/AtomicSharp.h → Source/AtomicNET/NETRuntime/AtomicSharp.h


+ 0 - 0
Source/AtomicSharp/AtomicSharpAPI.cpp → Source/AtomicNET/NETRuntime/AtomicSharpAPI.cpp


+ 0 - 0
Source/AtomicSharp/AtomicSharpAPI.h → Source/AtomicNET/NETRuntime/AtomicSharpAPI.h


+ 0 - 0
Source/AtomicSharp/AtomicSharpApp.cpp → Source/AtomicNET/NETRuntime/AtomicSharpApp.cpp


+ 0 - 0
Source/AtomicSharp/AtomicSharpApp.h → Source/AtomicNET/NETRuntime/AtomicSharpApp.h


+ 4 - 5
Source/AtomicSharp/CMakeLists.txt → Source/AtomicNET/NETRuntime/CMakeLists.txt

@@ -49,17 +49,16 @@ file (GLOB CSHARPATOMICPLAYER_BINDINGS_SOURCE ${CMAKE_SOURCE_DIR}/Build/Source/G
 
 
 set (SOURCE_FILES ${CSHARP_SOURCES} ${CSHARP_BINDINGS_SOURCE} ${CSHARPATOMICPLAYER_BINDINGS_SOURCE})
 set (SOURCE_FILES ${CSHARP_SOURCES} ${CSHARP_BINDINGS_SOURCE} ${CSHARPATOMICPLAYER_BINDINGS_SOURCE})
 
 
-add_library(AtomicSharp SHARED ${SOURCE_FILES})
+add_library(AtomicNETRuntime SHARED ${SOURCE_FILES})
 
 
-target_link_libraries(AtomicSharp AtomicJS AtomicPlayerLib AtomicPlayerJS ${ATOMIC_LINK_LIBRARIES})
+target_link_libraries(AtomicNETRuntime AtomicJS AtomicPlayerLib AtomicPlayerJS ${ATOMIC_LINK_LIBRARIES})
 
 
 if (APPLE)
 if (APPLE)
 
 
-target_link_libraries(AtomicSharp "-framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices -framework Security")
+target_link_libraries(AtomicNETRuntime "-framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices -framework Security")
 
 
 endif()
 endif()
 
 
 if (NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN)
 if (NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN)
-    add_dependencies(AtomicSharp AtomicTool)
+    add_dependencies(AtomicNETRuntime AtomicTool)
 endif()
 endif()
-

+ 0 - 0
Source/AtomicSharp/CSComponent.cpp → Source/AtomicNET/NETRuntime/CSComponent.cpp


+ 0 - 0
Source/AtomicSharp/CSComponent.h → Source/AtomicNET/NETRuntime/CSComponent.h


+ 0 - 0
Source/AtomicSharp/CSEventHelper.cpp → Source/AtomicNET/NETRuntime/CSEventHelper.cpp


+ 0 - 0
Source/AtomicSharp/CSEventHelper.h → Source/AtomicNET/NETRuntime/CSEventHelper.h


+ 0 - 0
Source/AtomicSharp/CSScriptObject.cpp → Source/AtomicNET/NETRuntime/CSScriptObject.cpp


+ 0 - 0
Source/AtomicSharp/CSScriptObject.h → Source/AtomicNET/NETRuntime/CSScriptObject.h


+ 1 - 1
Source/CMakeLists.txt

@@ -6,10 +6,10 @@ add_subdirectory(AtomicPlayer)
 add_subdirectory(AtomicPlayerJS)
 add_subdirectory(AtomicPlayerJS)
 
 
 if (NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN)
 if (NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN)
-    add_subdirectory(AtomicSharp)
     add_subdirectory(ToolCore)
     add_subdirectory(ToolCore)
     add_subdirectory(ToolCoreJS)
     add_subdirectory(ToolCoreJS)
     add_subdirectory(AtomicEditor)
     add_subdirectory(AtomicEditor)
     add_subdirectory(AtomicTool)
     add_subdirectory(AtomicTool)
     add_subdirectory(Tools)
     add_subdirectory(Tools)
+    add_subdirectory(AtomicNET)
 endif()
 endif()

+ 2 - 0
Source/ToolCore/JSBind/CSharp/CSFunctionWriter.cpp

@@ -714,6 +714,8 @@ void CSFunctionWriter::GenerateManagedSource(String& sourceOut)
 
 
     if (function_->GetDocString().Length())
     if (function_->GetDocString().Length())
     {
     {
+        // monodocer -assembly:AtomicSharp.dll -path:en -pretty
+        // mdoc export-html -o htmldocs en
         source += IndentLine("/// <summary>\n");
         source += IndentLine("/// <summary>\n");
         source += IndentLine("/// " + function_->GetDocString() + "\n");
         source += IndentLine("/// " + function_->GetDocString() + "\n");
         source += IndentLine("/// </summary>\n");
         source += IndentLine("/// </summary>\n");

+ 1 - 1
Source/ToolCore/JSBind/CSharp/CSModuleWriter.cpp

@@ -102,7 +102,7 @@ void CSModuleWriter::GenerateNativeSource()
 
 
     WriteIncludes(source);
     WriteIncludes(source);
 
 
-    source += "\n#include <AtomicSharp/AtomicSharp.h>\n";
+    source += "\n#include <AtomicNET/NETRuntime/AtomicSharp.h>\n";
 
 
     String ns = module_->GetPackage()->GetNamespace();
     String ns = module_->GetPackage()->GetNamespace();