diff --git a/Build/Build-Mono.bat b/Build/Build-Mono.bat deleted file mode 100644 index 7b7a939f..00000000 --- a/Build/Build-Mono.bat +++ /dev/null @@ -1,4 +0,0 @@ -cd.. -Build\Prebuild.exe /target nant /file Prebuild.xml -NAnt.exe -t:mono-2.0 -Build\PostBuild.bat \ No newline at end of file diff --git a/Build/Build-Net.bat b/Build/Build-Net.bat deleted file mode 100644 index a5ccf255..00000000 --- a/Build/Build-Net.bat +++ /dev/null @@ -1,4 +0,0 @@ -cd.. -Build\Prebuild.exe /target nant /file Prebuild.xml -NAnt.exe -t:net-2.0 -Build\PostBuild.bat \ No newline at end of file diff --git a/Build/Clean.bat b/Build/Clean.bat deleted file mode 100644 index 74e36e2a..00000000 --- a/Build/Clean.bat +++ /dev/null @@ -1,4 +0,0 @@ -cd .. -Build\Prebuild /clean /yes /removedir obj /file Prebuild.xml -rd Binaries /S /Q -pause \ No newline at end of file diff --git a/Build/Help.bat b/Build/Help.bat deleted file mode 100644 index 1ca7a4c3..00000000 --- a/Build/Help.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -Build\Prebuild /usage /pause \ No newline at end of file diff --git a/Build/MonoDevelop.sh b/Build/MonoDevelop.sh deleted file mode 100644 index 3a965e18..00000000 --- a/Build/MonoDevelop.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./prebuild /target monodev /file ../Prebuild.xml /pause diff --git a/Build/PostBuild.bat b/Build/PostBuild.bat deleted file mode 100644 index 1a471325..00000000 --- a/Build/PostBuild.bat +++ /dev/null @@ -1,20 +0,0 @@ -rem Copying files to output directory - -xcopy Source\OpenGL\Bind\bin\Release\*.exe Binaries\Release\Exe\*.* /Q /Y -xcopy Source\OpenGL\OpenGL\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y -xcopy Source\OpenGL\OpenGL\*.config Binaries\Release\Libraries\*.* /Q /Y - -xcopy Source\Platform\Windows\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y -xcopy Source\Platform\X11\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y - -xcopy Source\Framework\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y - -xcopy Source\Examples\OpenGL\Basic\Lesson01\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y -xcopy Source\Examples\OpenGL\Basic\DisplayLists\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y -xcopy Source\Examples\OpenGL\Basic\NoFramework\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y -xcopy Source\Examples\OpenGL\Basic\QueryDisplayModes\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y -xcopy Source\Examples\OpenGL\GLSL\Lesson01\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y - -xcopy Binaries\Release\Libraries\*.* Binaries\Release\Examples\*.* /Q /Y - -pause \ No newline at end of file diff --git a/Build/Prebuild.exe b/Build/Prebuild.exe deleted file mode 100644 index f8da22b6..00000000 Binary files a/Build/Prebuild.exe and /dev/null differ diff --git a/Build/PrepareRelease.bat b/Build/PrepareRelease.bat deleted file mode 100644 index d482244a..00000000 --- a/Build/PrepareRelease.bat +++ /dev/null @@ -1,5 +0,0 @@ -cd.. -dir /s /b /ad | find ".svn" > del.txt -for /F "delims='" %%f in (del.txt) do rmdir /q /s "%%f" -del del.txt -cd Build \ No newline at end of file diff --git a/Build/SharpDevelop2.bat b/Build/SharpDevelop2.bat deleted file mode 100644 index a8d0d735..00000000 --- a/Build/SharpDevelop2.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a combine (.cmbx) and a set of project files (.prjx) -@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx) -cd .. -Build\Prebuild /target sharpdev2 /file Prebuild.xml /pause diff --git a/Build/VS2005.bat b/Build/VS2005.bat deleted file mode 100644 index 6274771d..00000000 --- a/Build/VS2005.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) -@rem for Microsoft Visual Studio .NET 2005 -cd .. -Build\Prebuild.exe /target vs2005 /file Prebuild.xml /pause diff --git a/Build/nant.bat b/Build/nant.bat deleted file mode 100644 index c187392f..00000000 --- a/Build/nant.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -Build\Prebuild /target nant /file Prebuild.xml diff --git a/Build/nant.sh b/Build/nant.sh deleted file mode 100644 index 2569c273..00000000 --- a/Build/nant.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./prebuild /target nant /file ../Prebuild.xml /pause diff --git a/Changelog.txt b/Changelog.txt index b0757591..2e67acce 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,13 @@ +OpenTK 0.3.6 -> 0.3.7 + ++ OpenTK.Build + + Added new, (more) cross-platform build system, written on C#. This takes the place of the scripts and batch files used to compile OpenTK up till now. + + Removed all build scripts. + ++ OpenTK.Framework + + Now builds under Linux. + + OpenTK 0.3.5 -> 0.3.6 + OpenTK.OpenGL.Bind diff --git a/Prebuild.xml b/Prebuild.xml index 4fe1c37d..cfeaf24e 100644 --- a/Prebuild.xml +++ b/Prebuild.xml @@ -28,6 +28,28 @@ .\License.txt .\Instructions.txt + + + + + + ..\..\Build + + + + + + ..\..\Build + + + + + + + + + + diff --git a/Source/Build/Build.cs b/Source/Build/Build.cs new file mode 100644 index 00000000..60086e3a --- /dev/null +++ b/Source/Build/Build.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace OpenTK.Build +{ + class Project + { + static string RootPath; + static string ToolPath = "Build\\"; + static string PrebuildPath = ToolPath + "Prebuild.exe"; + static string BinPath = "Binaries\\"; + //string ObjPath + + static string PrebuildXml = RootPath + "Prebuild.xml"; + + enum BuildMode + { + Default = 0, + Release = 0, + Debug + } + + enum BuildTarget + { + Default = 0, + Net = 0, + Mono, + VS2005, + SharpDevelop, + MonoDevelop, + Clean, + DistClean, + SVNClean + } + + static BuildMode mode = BuildMode.Default; + static BuildTarget target = BuildTarget.Default; + + static void Main(string[] args) + { + RootPath = Directory.GetCurrentDirectory(); + RootPath = RootPath.Substring( + 0, + Directory.GetCurrentDirectory().LastIndexOf("Build")); + Directory.SetCurrentDirectory(RootPath); + + // Workaroung for nant on x64 windows (safe for other platforms too, as this affects + // only the current process). + Environment.SetEnvironmentVariable("CommonProgramFiles(x86)", String.Empty, EnvironmentVariableTarget.Process); + Environment.SetEnvironmentVariable("ProgramFiles(x86)", String.Empty, EnvironmentVariableTarget.Process); + + if (args.Length == 0) + { + Console.WriteLine("Usage: OpenTK.Build.exe BuildMode BuildTarget"); + Console.WriteLine("\tBuildMode: debug/release"); + Console.WriteLine("\tBuildTarget: mono/net/monodev/sharpdev/vs2005 or clean/distclean/svnclean"); + } + else + { + foreach (string s in args) + { + string arg = s.ToLower(); + switch (arg) + { + case "debug": + case "d": + mode = BuildMode.Debug; + break; + + case "release": + case "r": + mode = BuildMode.Release; + break; + + case "mono": + target = BuildTarget.Mono; + break; + + case "net": + target = BuildTarget.Net; + break; + + case "monodev": + case "monodevelop": + case "md": + target = BuildTarget.MonoDevelop; + break; + + case "sharpdev": + case "sharpdevelop": + case "sd": + target = BuildTarget.SharpDevelop; + break; + + case "vs2005": + case "vs": + target = BuildTarget.VS2005; + break; + + case "clean": + target = BuildTarget.Clean; + break; + + case "svnclean": + target = BuildTarget.SVNClean; + break; + + case "distclean": + target = BuildTarget.DistClean; + break; + + default: + Console.WriteLine("Unknown command: {0}", s); + break; + } + } + + switch (target) + { + case BuildTarget.Mono: + Console.WriteLine("Building OpenTK using Mono."); + ExecuteProcess(PrebuildPath, "/target nant /file " + PrebuildXml); + ExecuteProcess("nant", "-t:mono-2.0"); + break; + + case BuildTarget.Net: + Console.WriteLine("Building OpenTK using .Net"); + ExecuteProcess(PrebuildPath, "/target nant /file " + PrebuildXml); + ExecuteProcess("nant", "-t:net-2.0"); + break; + + case BuildTarget.MonoDevelop: + Console.WriteLine("Creating MonoDevelop project files"); + ExecuteProcess(PrebuildPath, "/target monodev /file " + PrebuildXml); + break; + + case BuildTarget.SharpDevelop: + Console.WriteLine("Creating SharpDevelop project files"); + ExecuteProcess(PrebuildPath, "/target monodev /file " + PrebuildXml); + break; + + case BuildTarget.VS2005: + Console.WriteLine("Creating VS2005 project files"); + ExecuteProcess(PrebuildPath, "/target vs2005 /file " + PrebuildXml); + break; + + case BuildTarget.Clean: + Console.WriteLine("Cleaning intermediate object files."); + ExecuteProcess(PrebuildPath, "/clean /yes /file " + PrebuildXml); + DeleteDirectories(RootPath, "obj"); + break; + + case BuildTarget.DistClean: + Console.WriteLine("Cleaning intermediate and final object files."); + ExecuteProcess(PrebuildPath, "/clean /yes /file " + PrebuildXml); + DeleteDirectories(RootPath, "obj"); + DeleteDirectories(RootPath, "bin"); + Directory.Delete(RootPath + "Binaries", true); + break; + + case BuildTarget.SVNClean: + Console.WriteLine("Deleting svn directories."); + DeleteDirectories(RootPath, ".svn"); + break; + + default: + Console.WriteLine("Unknown target."); + break; + } + + Console.WriteLine("Press any key to continue..."); + Console.ReadKey(true); + } + } + + static void DeleteDirectories(string root_path, string search) + { + Console.WriteLine("Deleting {0} directories", search); + List matches = new List(); + DirectorySearch(root_path, search, matches); + foreach (string m in matches) + { + Directory.Delete(m, true); + } + } + + static void DirectorySearch(string directory, string search, List matches) + { + try + { + foreach (string d in Directory.GetDirectories(directory)) + { + foreach (string f in Directory.GetDirectories(d, search)) + { + matches.Add(f); + } + DirectorySearch(d, search, matches); + } + } + catch (System.Exception e) + { + Console.WriteLine(e.Message); + } + } + + static void ExecuteProcess(string path, string args) + { + Process p = new Process(); + p.StartInfo.FileName = path; + p.StartInfo.Arguments = args; + p.StartInfo.WorkingDirectory = RootPath; + p.StartInfo.CreateNoWindow = true; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.Start(); + Console.Write(p.StandardOutput.ReadToEnd()); + p.WaitForExit(); + } + } +} diff --git a/Source/Framework/Framework.cs b/Source/Framework/Framework.cs index f53592d6..75a992a6 100644 --- a/Source/Framework/Framework.cs +++ b/Source/Framework/Framework.cs @@ -34,7 +34,7 @@ namespace OpenTK #endregion - Application.MessageLoopCallback MessageLoop; + // Application.MessageLoopCallback MessageLoop; #region --- Public Properties ---