public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PostBuild(plugin, buildOptions); string archName = buildOptions.Architecture == Architecture.ARMv7 ? "armeabi-v7a" : "x86"; string assetFile = CombinePath( AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder), "Android", archName, string.Format("lib{0}.so", plugin.Name)); PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter; if (pluginImporter != null) { SetPluginBaseInfo(plugin, buildOptions, pluginImporter); pluginImporter.SetCompatibleWithAnyPlatform(false); pluginImporter.SetCompatibleWithPlatform(BuildTarget.Android, true); pluginImporter.SetEditorData("CPU", buildOptions.Architecture.ToString()); pluginImporter.SetEditorData("ANDROID_SDK_VERSION", buildOptions.AndroidSdkVersion.ToString()); pluginImporter.SaveAndReimport(); } }
public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PostBuild(plugin, buildOptions); string assetFile = CombinePath( AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder), "Linux", buildOptions.Architecture.ToString(), string.Format("lib{0}.so", plugin.Name)); PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter; if (pluginImporter != null) { SetPluginBaseInfo(plugin, buildOptions, pluginImporter); pluginImporter.SetCompatibleWithAnyPlatform(false); pluginImporter.SetCompatibleWithEditor(true); pluginImporter.SetEditorData("OS", "Linux"); pluginImporter.SetEditorData("CPU", buildOptions.Architecture.ToString()); if (buildOptions.Architecture == Architecture.x86) { pluginImporter.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, true); } else { pluginImporter.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, true); } pluginImporter.SaveAndReimport(); } }
public override BackgroundProcess Build(NativePlugin plugin, NativeBuildOptions buildOptions) { StringBuilder cmakeArgs = GetBasePluginCMakeArgs(plugin); BuildType buildType; if (buildOptions.BuildType == BuildType.Default) { buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; } else { buildType = buildOptions.BuildType; } AddCmakeArg(cmakeArgs, "CMAKE_BUILD_TYPE", buildType.ToString()); AddCmakeArg(cmakeArgs, "OSX", "ON", "BOOL"); cmakeArgs.AppendFormat("-B{0} ", "OSX"); buildOptions.OutputDirectory = CombineFullPath(plugin.buildFolder, "OSX"); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = CMakeHelper.CMakeLocation; startInfo.Arguments = cmakeArgs.ToString(); startInfo.WorkingDirectory = plugin.buildFolder; BackgroundProcess backgroundProcess = new BackgroundProcess(startInfo); backgroundProcess.Name = string.Format("Building \"{0}\" for {1}", plugin.Name, "OSX"); return(backgroundProcess); }
void OnGuiPlugins() { EditorGUILayout.Space(); PluginsFoldoutAnimator.target = EditorGUILayout.Foldout(PluginsFoldoutAnimator.target, string.Format("Plugins ({0})", NativePluginSettings.plugins.Count), true, foldoutBold); if (EditorGUILayout.BeginFadeGroup(PluginsFoldoutAnimator.faded)) { EditorGUI.indentLevel++; if (NativePluginSettings.plugins.Count == 0) { EditorGUILayout.HelpBox("You have no plugins yet. Start by creating a new one.", MessageType.Info); } else { for (int i = 0; i < NativePluginSettings.plugins.Count; i++) { if (BeginSettingsBox(i, new GUIContent(NativePluginSettings.plugins[i].Name), NativePluginSettings.plugins[i])) { NativePlugin plugin = NativePluginSettings.plugins[i]; OnGuiNativePlugin(plugin); OnGuiMisc(plugin); OnGuiBuildOptions(plugin.buildOptions); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUI.enabled = !EditorApplication.isUpdating && !EditorApplication.isUpdating; if (GUILayout.Button("Build", GUILayout.Width(110))) { plugin.Build(); } GUI.enabled = true; if (GUILayout.Button("Clean", GUILayout.Width(110))) { plugin.Clean(); } if (GUILayout.Button("Remove", GUILayout.Width(110))) { if (EditorUtility.DisplayDialog("Remove " + plugin.Name + "?", "This will remove the plugin and all the build options from the builder. Source files will not be deleted.", "Remove", "Cancel")) { NativePluginSettings.plugins.Remove(plugin); i--; AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(plugin)); } } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } EndSettingsBox(); } } EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); EditorGUILayout.Space(); }
void OnGuiMisc(NativePlugin plugin) { EditorGUI.indentLevel--; EditorGUILayout.LabelField("Misc", EditorStyles.boldLabel); EditorGUI.indentLevel++; plugin.includePluginAPI = EditorGUILayout.Toggle(new GUIContent("Include Plugin API", "Include the headers folder from Unity to create low level rendering plugins."), plugin.includePluginAPI); OnGuiDictionnary(plugin.Definitions); EditorGUILayout.Space(); }
public override BackgroundProcess Build(NativePlugin plugin, NativeBuildOptions buildOptions) { StringBuilder cmakeArgs = GetBasePluginCMakeArgs(plugin); AddCmakeArg(cmakeArgs, "CMAKE_CONFIGURATION_TYPES", "Debug;Release"); BuildType buildType; if (buildOptions.BuildType == BuildType.Default) { buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; } else { buildType = buildOptions.BuildType; } AddCmakeArg(cmakeArgs, "CMAKE_BUILD_TYPE", buildType.ToString()); AddCmakeArg(cmakeArgs, "UWP", "ON", "BOOL"); cmakeArgs.AppendFormat("-B{0}/{1} ", "UWP", buildOptions.Architecture.ToString()); AddCmakeArg(cmakeArgs, "ARCH", buildOptions.Architecture.ToString(), "STRING"); AddCmakeArg(cmakeArgs, "CMAKE_SYSTEM_NAME", "WindowsStore"); AddCmakeArg(cmakeArgs, "CMAKE_SYSTEM_VERSION", "10.0"); int vsVersion = WindowsBuilder.VisualStudioVersion; if (vsVersion == -1) { vsVersion = WindowsBuilder.InstalledVisualStudios.Last <int>(); } cmakeArgs.AppendFormat("-G \"{0} {1}\" ", "Visual Studio", vsVersion); //Default is x86 if (buildOptions.Architecture == Architecture.x86_64) { AddCmakeArg(cmakeArgs, "CMAKE_GENERATOR_PLATFORM", "x64", "STRING"); } else if (buildOptions.Architecture == Architecture.ARM) { AddCmakeArg(cmakeArgs, "CMAKE_GENERATOR_PLATFORM", "ARM", "STRING"); } buildOptions.OutputDirectory = CombineFullPath(plugin.buildFolder, "UWP", buildOptions.Architecture.ToString()); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = CMakeHelper.CMakeLocation; startInfo.Arguments = cmakeArgs.ToString(); startInfo.WorkingDirectory = plugin.buildFolder; BackgroundProcess backgroundProcess = new BackgroundProcess(startInfo); backgroundProcess.Name = string.Format("Building \"{0}\" for {1} ({2})", plugin.Name, "Universal Windows", buildOptions.Architecture.ToString()); return(backgroundProcess); }
public virtual void PreBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { if (string.IsNullOrEmpty(CMakeHelper.cmakeVersion)) { throw new ArgumentNullException("CMake is not set. please check the settings."); } if (!Directory.Exists(plugin.buildFolder)) { Directory.CreateDirectory(plugin.buildFolder); } }
public override void PreBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PreBuild(plugin, buildOptions); if (buildOptions.BuildPlatform != BuildPlatform.Linux) { throw new System.ArgumentException(string.Format( "BuildPlatform mismatch: expected:\"{0}\", current:\"{1}\"", BuildPlatform.Linux, buildOptions.BuildPlatform)); } ArchtectureCheck(buildOptions); }
public override BackgroundProcess Build(NativePlugin plugin, NativeBuildOptions buildOptions) { StringBuilder cmakeArgs = GetBasePluginCMakeArgs(plugin); BuildType buildType; if (buildOptions.BuildType == BuildType.Default) { buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; } else { buildType = buildOptions.BuildType; } AddCmakeArg(cmakeArgs, "CMAKE_BUILD_TYPE", buildType.ToString()); AddCmakeArg(cmakeArgs, "WEBGL", "ON", "BOOL"); cmakeArgs.AppendFormat("-B{0} ", "WebGL"); if (EditorPlatform == RuntimePlatform.WindowsEditor) { cmakeArgs.AppendFormat(string.Format("-G {0} ", "\"MinGW Makefiles\"")); AddCmakeArg(cmakeArgs, "CMAKE_MAKE_PROGRAM", MinGW32MakeLocation, "FILEPATH"); } else { cmakeArgs.AppendFormat(string.Format("-G {0} ", "\"Unix Makefiles\"")); } //We need our own copy of the toolchain, because we need to pass --em-config to emcc. //args.Add(string.Format("-DCMAKE_TOOLCHAIN_FILE=\"{0}{1}\" ", GetEmscriptenLocation(), "/cmake/Modules/Platform/Emscripten.cmake")); AddCmakeArg(cmakeArgs, "CMAKE_TOOLCHAIN_FILE", CombineFullPath(plugin.buildFolder, "../Emscripten.cmake"), "FILEPATH"); AddCmakeArg(cmakeArgs, "EMSCRIPTEN_ROOT_PATH", GetEmscriptenLocation(), "PATH"); string emconfig = RefreshEmscriptenConfig(plugin.buildFolder); AddCmakeArg(cmakeArgs, "EM_CONFIG", emconfig, "FILEPATH"); buildOptions.OutputDirectory = CombineFullPath(plugin.buildFolder, "WebGL"); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = CMakeHelper.CMakeLocation; startInfo.Arguments = cmakeArgs.ToString(); startInfo.WorkingDirectory = plugin.buildFolder; BackgroundProcess backgroundProcess = new BackgroundProcess(startInfo); backgroundProcess.Name = string.Format("Building \"{0}\" for {1}", plugin.Name, "WebGL"); return(backgroundProcess); }
public override BackgroundProcess Build(NativePlugin plugin, NativeBuildOptions buildOptions) { StringBuilder cmakeArgs = GetBasePluginCMakeArgs(plugin); BuildType buildType; if (buildOptions.BuildType == BuildType.Default) { buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; } else { buildType = buildOptions.BuildType; } AddCmakeArg(cmakeArgs, "CMAKE_BUILD_TYPE", buildType.ToString()); cmakeArgs.AppendFormat("-G {0} ", "\"Unix Makefiles\""); AddCmakeArg(cmakeArgs, "ANDROID", "ON", "BOOL"); string ndkLocation = NDKLocation; AddCmakeArg(cmakeArgs, "ANDROID_NDK", ndkLocation, "PATH"); string toolchain = CombineFullPath(ndkLocation, "build/cmake/android.toolchain.cmake"); AddCmakeArg(cmakeArgs, "CMAKE_TOOLCHAIN_FILE", "\"" + toolchain + "\"", "FILEPATH"); string archName = buildOptions.Architecture == Architecture.ARMv7 ? "armeabi-v7a" : "x86"; AddCmakeArg(cmakeArgs, "ANDROID_ABI", archName); cmakeArgs.AppendFormat("-B{0}/{1} ", "Android", archName); //Do we need to target a specific api? if (buildOptions.AndroidSdkVersion > 0) { AddCmakeArg(cmakeArgs, "ANDROID_PLATFORM", "android-" + buildOptions.AndroidSdkVersion); } buildOptions.OutputDirectory = CombineFullPath(plugin.buildFolder, "Android", archName); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = CMakeHelper.CMakeLocation; startInfo.Arguments = cmakeArgs.ToString(); startInfo.WorkingDirectory = plugin.buildFolder; BackgroundProcess backgroundProcess = new BackgroundProcess(startInfo); backgroundProcess.Name = string.Format("Building \"{0}\" for {1} ({2})", plugin.Name, "Android", archName); return(backgroundProcess); }
private bool BeginSettingsBox(int nr, GUIContent header, NativePlugin plugin) { GUI.changed = false; bool enabled = GUI.enabled; GUI.enabled = true; EditorGUILayout.BeginVertical(categoryBox, new GUILayoutOption[0]); Rect rect = GUILayoutUtility.GetRect(20f, 18f); rect.x += 3f; rect.width += 6f; plugin.IsSelected = GUI.Toggle(rect, plugin.IsSelected, header, GetStyle("IN TitleText")); GUI.enabled = enabled; return(EditorGUILayout.BeginFadeGroup(plugin.sectionAnimator.faded)); }
public override BackgroundProcess Install(NativePlugin plugin, NativeBuildOptions buildOptions) { BackgroundProcess backgroundProcess = base.Install(plugin, buildOptions); BuildType buildType; if (buildOptions.BuildType == BuildType.Default) { buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; } else { buildType = buildOptions.BuildType; } backgroundProcess.Process.StartInfo.Arguments += " --config " + buildType.ToString(); return(backgroundProcess); }
protected static void SetPluginBaseInfo(NativePlugin plugin, NativeBuildOptions buildOptions, PluginImporter pluginImporter) { pluginImporter.SetEditorData("PLUGIN_NAME", plugin.Name); pluginImporter.SetEditorData("PLUGIN_VERSION", plugin.Version); pluginImporter.SetEditorData("PLUGIN_BUILD_NUMBER", plugin.BuildNumber.ToString()); BuildType buildType; if (buildOptions.BuildType == BuildType.Default) { buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; } else { buildType = buildOptions.BuildType; } pluginImporter.SetEditorData("BUILD_TYPE", buildType.ToString()); }
public override void PreBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PreBuild(plugin, buildOptions); if (buildOptions.BuildPlatform != BuildPlatform.UniversalWindows) { throw new System.ArgumentException(string.Format( "BuildPlatform mismatch: expected:\"{0}\", current:\"{1}\"", BuildPlatform.UniversalWindows, buildOptions.BuildPlatform)); } ArchtectureCheck(buildOptions); if (WindowsBuilder.InstalledVisualStudios.Length == 1) { throw new System.InvalidOperationException("Could not find Visual Studio."); } }
public override void PreBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PreBuild(plugin, buildOptions); if (buildOptions.BuildPlatform != BuildPlatform.OSX) { throw new System.ArgumentException(string.Format( "BuildPlatform mismatch: expected:\"{0}\", current:\"{1}\"", BuildPlatform.OSX, buildOptions.BuildPlatform)); } ArchtectureCheck(buildOptions); if (!IsXCodeInstalled) { throw new System.ArgumentException("Xcode not found"); } }
public override void PreBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PreBuild(plugin, buildOptions); if (buildOptions.BuildPlatform != BuildPlatform.Android) { throw new System.ArgumentException(string.Format( "BuildPlatform mismatch: expected:\"{0}\", current:\"{1}\"", BuildPlatform.Android, buildOptions.BuildPlatform)); } ArchtectureCheck(buildOptions); if (!IsValidNDKLocation(NDKLocation)) { throw new System.Exception("Missing Android NDK. Please check the settings."); } }
public void OnPreprocessBuild(UnityEditor.BuildTarget target, string path) { StringBuilder warningStringBuilder = new StringBuilder(); PluginImporter[] pluginImporters = PluginImporter.GetImporters(target); foreach (PluginImporter pluginImporter in pluginImporters) { NativePlugin plugin = GetPluginByName(pluginImporter.GetEditorData("PLUGIN_NAME")); if (plugin != null) { string version = pluginImporter.GetEditorData("PLUGIN_VERSION"); if (plugin.Version != version) { warningStringBuilder.AppendFormat(@"Plugin version number mismatch: ""{0}"" is set to ""{1}"", while ""{2}"" was built with ""{3}""" + '\n', plugin.Name, plugin.Version, target.ToString(), version); } string buildNumberStr = pluginImporter.GetEditorData("PLUGIN_BUILD_NUMBER"); int buildNumber; if (int.TryParse(buildNumberStr, out buildNumber)) { if (plugin.BuildNumber != buildNumber) { warningStringBuilder.AppendFormat(@"Plugin build number mismatch: ""{0}"" is set to ""{1}"", while ""{2}"" was built with ""{3}""" + '\n', plugin.Name, plugin.BuildNumber, target.ToString(), buildNumber); } } string buildTypeStr = pluginImporter.GetEditorData("BUILD_TYPE"); BuildType buildType = (BuildType)Enum.Parse(typeof(BuildType), buildTypeStr, true); if ((EditorUserBuildSettings.development && buildType == BuildType.Release) || (!EditorUserBuildSettings.development && buildType == BuildType.Debug)) { warningStringBuilder.AppendFormat(@"Plugin build type mismatch: current build is set to development=""{0}"", while plugin ""{1}"" for ""{2}"" is ""{3}""." + '\n', EditorUserBuildSettings.development, plugin.Name, target, buildType); } } } string warnings = warningStringBuilder.ToString(); if (!string.IsNullOrEmpty(warnings)) { Debug.LogWarning(warnings); } }
private void OnEnable() { PluginsFoldoutAnimator = new AnimBool(true); PluginsFoldoutAnimator.valueChanged.AddListener(Repaint); NewPluginFoldoutAnimator = new AnimBool(false); NewPluginFoldoutAnimator.valueChanged.AddListener(Repaint); NativePluginSettings.Load(); for (int i = 0; i < NativePluginSettings.plugins.Count; i++) { NativePluginSettings.plugins[i].sectionAnimator.valueChanged.RemoveAllListeners(); NativePluginSettings.plugins[i].sectionAnimator.valueChanged.AddListener(Repaint); foreach (var options in NativePluginSettings.plugins[i].buildOptions) { options.foldoutAnimator.valueChanged.RemoveAllListeners(); options.foldoutAnimator.valueChanged.AddListener(Repaint); } } if (newPlugin == null) { newPlugin = NativePlugin.GetDefault(this); } CMakeHelper.GetCMakeVersion((version) => { cmakeVersion = version; }); backgroundProcessManager = new BackgroundProcessManager(this); List <string> platformStrings = new List <string>(); List <int> platforms = new List <int>(); foreach (BuildPlatform platform in Enum.GetValues(typeof(BuildPlatform))) { if (GetBuilder(platform).IsAvailable) { platforms.Add((int)platform); platformStrings.Add(ObjectNames.NicifyVariableName(Enum.GetName(typeof(BuildPlatform), platform))); } } AvailablePlatformStrings = platformStrings.ToArray(); AvailablePlatformInts = platforms.ToArray(); }
public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PostBuild(plugin, buildOptions); string assetFile = CombinePath( AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder), "WebGL", string.Format("{0}.bc", plugin.Name)); PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter; if (pluginImporter != null) { SetPluginBaseInfo(plugin, buildOptions, pluginImporter); pluginImporter.SaveAndReimport(); } }
public static NativePlugin GetDefault(EditorWindow editorWindow) { NativePlugin plugin = CreateInstance <NativePlugin>(); plugin.Name = "MyPlugin"; plugin.Version = "1.0.0.0"; plugin.BuildNumber = 1; plugin.includePluginAPI = true; plugin.buildOptions = new List <NativeBuildOptions> (); plugin.buildOptions.Add(NativeBuildOptions.GetDefault(editorWindow)); plugin.Definitions = new CustomDefinitions(); plugin.sectionAnimator = new AnimBool(false, editorWindow.Repaint); return(plugin); }
void OnGuiNativePlugin(NativePlugin plugin) { GUI.changed = false; EditorGUILayout.LabelField("Plugin name", plugin.Name); plugin.Version = EditorGUILayout.TextField("Version", plugin.Version); plugin.BuildNumber = EditorGUILayout.IntField("Build Number", plugin.BuildNumber); EditorGUILayout.BeginHorizontal(); plugin.sourceFolder = EditorGUILayout.TextField("Source Folder", plugin.sourceFolder); if (GUILayout.Button("Browse", EditorStyles.miniButton, GUILayout.Width(80))) { string folder = EditorUtility.OpenFolderPanel("Select Source Folder", plugin.sourceFolder, ""); if (!string.IsNullOrEmpty(folder) && System.IO.Directory.Exists(folder)) { plugin.sourceFolder = folder; } } if (GUILayout.Button("Reveal", EditorStyles.miniButton, GUILayout.Width(60))) { EditorUtility.RevealInFinder(plugin.sourceFolder); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); plugin.buildFolder = EditorGUILayout.TextField("Build Folder", plugin.buildFolder); if (GUILayout.Button("Browse", EditorStyles.miniButton, GUILayout.Width(80))) { string folder = EditorUtility.OpenFolderPanel("Select Build Folder", plugin.buildFolder, ""); if (!string.IsNullOrEmpty(folder) && System.IO.Directory.Exists(folder)) { plugin.buildFolder = folder; } } if (GUILayout.Button("Reveal", EditorStyles.miniButton, GUILayout.Width(60))) { EditorUtility.RevealInFinder(plugin.buildFolder); } EditorGUILayout.EndHorizontal(); plugin.pluginBinaryFolder = (DefaultAsset)EditorGUILayout.ObjectField("Plugins folder", plugin.pluginBinaryFolder, typeof(DefaultAsset), false); EditorGUILayout.Space(); }
public virtual BackgroundProcess Install(NativePlugin plugin, NativeBuildOptions buildOptions) { if (string.IsNullOrEmpty(buildOptions.OutputDirectory)) { throw new ArgumentNullException("OutputDirectory not set"); } ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = CMakeHelper.CMakeLocation; startInfo.Arguments = "--build . --target install --clean-first"; startInfo.WorkingDirectory = buildOptions.OutputDirectory; BackgroundProcess backgroundProcess = new BackgroundProcess(startInfo); backgroundProcess.Name = string.Format("Installing \"{0}\" for {1} ({2})", plugin.Name, buildOptions.BuildPlatform.ToString(), buildOptions.Architecture.ToString()); return(backgroundProcess); }
public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PostBuild(plugin, buildOptions); string assetFile = CombinePath( AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder), "iOS", string.Format("lib{0}.a", plugin.Name)); PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter; if (pluginImporter != null) { SetPluginBaseInfo(plugin, buildOptions, pluginImporter); pluginImporter.SetCompatibleWithAnyPlatform(false); pluginImporter.SetCompatibleWithPlatform(BuildTarget.iOS, true); pluginImporter.SaveAndReimport(); } }
protected static StringBuilder GetBasePluginCMakeArgs(NativePlugin plugin) { StringBuilder cmakeArgs = new StringBuilder(); cmakeArgs.AppendFormat("{0} ", "../CMake"); AddCmakeArg(cmakeArgs, "PLUGIN_NAME", plugin.Name, "STRING"); AddCmakeArg(cmakeArgs, "PLUGIN_VERSION", plugin.Version, "STRING"); AddCmakeArg(cmakeArgs, "PLUGIN_BUILD_NUMBER", plugin.BuildNumber.ToString(), "STRING"); AddCmakeArg(cmakeArgs, "SOURCE_FOLDER", plugin.sourceFolder, "PATH"); AddCmakeArg(cmakeArgs, "PLUGIN_BINARY_FOLDER", plugin.pluginBinaryFolderPath, "PATH"); if (plugin.includePluginAPI) { if (Directory.Exists(GetPluginAPILocation())) { AddCmakeArg(cmakeArgs, "INCLUDE_PLUGIN_API", GetPluginAPILocation(), "PATH"); } else { UnityEngine.Debug.LogWarning("Unity plugin API folder was not found. include folder skipped."); } } string definitions = plugin.Definitions.ToDefinitionString("\\;"); if (!string.IsNullOrEmpty(definitions)) { //Because cmake will get rid of "s. definitions = definitions.Replace("\"", "\\\""); AddCmakeArg(cmakeArgs, "CUSTOM_DEFINES", definitions, "STRING"); for (int i = 0; i < plugin.Definitions.Count; i++) { AddCmakeArg(cmakeArgs, plugin.Definitions.GetKey(i), plugin.Definitions.GetValue(i), "STRING"); } } return(cmakeArgs); }
public override void PreBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PreBuild(plugin, buildOptions); if (buildOptions.BuildPlatform != BuildPlatform.WebGL) { throw new ArgumentException(string.Format( "BuildPlatform mismatch: expected:\"{0}\", current:\"{1}\"", BuildPlatform.WebGL, buildOptions.BuildPlatform)); } ArchtectureCheck(buildOptions); //optimization level check if (EditorPlatform == RuntimePlatform.WindowsEditor) { if (!File.Exists(MinGW32MakeLocation)) { throw new ArgumentException("\"mingw32-make.exe\" not found. please check the settings."); } } }
public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { base.PostBuild(plugin, buildOptions); string assetFile = CombinePath( AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder), "WSA", buildOptions.Architecture.ToString(), string.Format("{0}.dll", plugin.Name)); PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter; if (pluginImporter != null) { SetPluginBaseInfo(plugin, buildOptions, pluginImporter); pluginImporter.SetCompatibleWithAnyPlatform(false); pluginImporter.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true); pluginImporter.SetPlatformData(BuildTarget.WSAPlayer, "CPU", buildOptions.Architecture.ToString()); pluginImporter.SaveAndReimport(); } }
void OnGuiNewPlugin() { EditorGUILayout.Space(); NewPluginFoldoutAnimator.target = EditorGUILayout.Foldout(NewPluginFoldoutAnimator.target, "Create new plugin", true, foldoutBold); //Extra block that can be toggled on and off. if (EditorGUILayout.BeginFadeGroup(NewPluginFoldoutAnimator.faded)) { EditorGUI.indentLevel++; GUI.changed = false; newPlugin.Name = EditorGUILayout.TextField("Plugin name", newPlugin.Name); if (GUI.changed) { newPlugin.Name = SanitizeName(newPlugin.Name); } newPlugin.Version = EditorGUILayout.TextField("Version", newPlugin.Version); //Location for the plugin? EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Create", GUILayout.Width(160))) { newPlugin.Create(); NativePluginSettings.plugins.Add(newPlugin); newPlugin = NativePlugin.GetDefault(this); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); EditorGUILayout.Space(); }
public virtual void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions) { AssetDatabase.Refresh(); }
public abstract BackgroundProcess Build(NativePlugin plugin, NativeBuildOptions buildOptions);