+ 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.
This commit is contained in:
the_fiddler 2007-06-30 06:45:07 +00:00
parent a1b9074cb0
commit 63c7c98f7f
16 changed files with 256 additions and 54 deletions

View file

@ -1,4 +0,0 @@
cd..
Build\Prebuild.exe /target nant /file Prebuild.xml
NAnt.exe -t:mono-2.0
Build\PostBuild.bat

View file

@ -1,4 +0,0 @@
cd..
Build\Prebuild.exe /target nant /file Prebuild.xml
NAnt.exe -t:net-2.0
Build\PostBuild.bat

View file

@ -1,4 +0,0 @@
cd ..
Build\Prebuild /clean /yes /removedir obj /file Prebuild.xml
rd Binaries /S /Q
pause

View file

@ -1,2 +0,0 @@
cd ..
Build\Prebuild /usage /pause

View file

@ -1,2 +0,0 @@
#!/bin/sh
./prebuild /target monodev /file ../Prebuild.xml /pause

View file

@ -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

Binary file not shown.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,2 +0,0 @@
cd ..
Build\Prebuild /target nant /file Prebuild.xml

View file

@ -1,2 +0,0 @@
#!/bin/sh
./prebuild /target nant /file ../Prebuild.xml /pause

View file

@ -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

View file

@ -28,6 +28,28 @@
<File>.\License.txt</File>
<File>.\Instructions.txt</File>
</Files>
<Project name="OpenTK.Build" path=".\Source\Build" language="C#" type="Exe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\Build</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\Build</OutputPath>
</Options>
</Configuration>
<Reference name="System"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Platform.Windows" path=".\Source\Platform\Windows" language="C#" type="Library">

223
Source/Build/Build.cs Normal file
View file

@ -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<string> matches = new List<string>();
DirectorySearch(root_path, search, matches);
foreach (string m in matches)
{
Directory.Delete(m, true);
}
}
static void DirectorySearch(string directory, string search, List<string> 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();
}
}
}

View file

@ -34,7 +34,7 @@ namespace OpenTK
#endregion
Application.MessageLoopCallback MessageLoop;
// Application.MessageLoopCallback MessageLoop;
#region --- Public Properties ---