From 0be698965ab1efb1e04ad05b67820224e11bdfaf Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 15 Nov 2012 12:36:23 -0800 Subject: [PATCH] Obey the platform/configuration set in the UI for ffmpeg and fribidi --- aegisub/build/Aegisub/Aegisub.vcxproj | 7 ++- aegisub/build/BuildTasks/BuildTasks.fs | 61 ++++++++------------------ aegisub/build/aegisub.props | 1 + aegisub/build/ffmpeg/ffmpeg.vcxproj | 32 +++++++------- aegisub/build/fribidi/fribidi.vcxproj | 47 +++++++++++--------- aegisub/build/paths.props | 4 +- aegisub/build/tasks.props | 25 +++++++++++ 7 files changed, 95 insertions(+), 82 deletions(-) create mode 100644 aegisub/build/tasks.props diff --git a/aegisub/build/Aegisub/Aegisub.vcxproj b/aegisub/build/Aegisub/Aegisub.vcxproj index 1107f90bd..106bf530b 100644 --- a/aegisub/build/Aegisub/Aegisub.vcxproj +++ b/aegisub/build/Aegisub/Aegisub.vcxproj @@ -45,9 +45,12 @@ - - + diff --git a/aegisub/build/BuildTasks/BuildTasks.fs b/aegisub/build/BuildTasks/BuildTasks.fs index 7d9ebfbd3..0b14a2ce1 100644 --- a/aegisub/build/BuildTasks/BuildTasks.fs +++ b/aegisub/build/BuildTasks/BuildTasks.fs @@ -34,36 +34,26 @@ let propertyMap (be : IBuildEngine) = |> Seq.map (fun x -> (x.Name, x.EvaluatedValue)) |> Map.ofSeq -/// Convert a windows path possibly relative to the Aegisub project file to an -/// absolute msys path -let mungePath projectDir path = +/// Convert an absolute windows path to an msys path +let mungePath path = let matchre pat str = let m = System.Text.RegularExpressions.Regex.Match(str, pat) if m.Success then List.tail [ for g in m.Groups -> g.Value ] else [] - match IO.Path.Combine(projectDir, path) |> matchre "([A-Za-z]):\\\\(.*)" with + match matchre "([A-Za-z]):\\\\(.*)" path with | drive :: path :: [] -> sprintf "/%s/%s" drive (path.Replace('\\', '/')) - | _ -> failwith <| sprintf "Bad path: '%s' '%s'" projectDir path + | _ -> path -type ShellWrapper(props : Map) = +type ShellWrapper(conf : ITaskItem) = inherit ToolTask() - let cwd = function - | null | "" -> props.["AegisubSourceBase"] - | x -> if not <| IO.Directory.Exists x then ignore <| IO.Directory.CreateDirectory(x) - x - member val Arguments = "" with get, set member val WorkingDirectory = "" with get, set - member this.callScript scriptName args = - this.Arguments <- sprintf "%s %s" (mungePath props.["ProjectDir"] scriptName) args - this.Execute() - // ToolTask overrides override val ToolName = "sh.exe" with get - override this.GenerateFullPathToTool() = sprintf "%s\\bin\\sh.exe" props.["MsysBasePath"] + override this.GenerateFullPathToTool() = conf.GetMetadata "Sh" override this.GenerateCommandLineCommands() = this.Arguments override this.GetWorkingDirectory() = this.WorkingDirectory @@ -71,43 +61,33 @@ type ShellWrapper(props : Map) = if this.GenerateFullPathToTool() |> IO.File.Exists |> not then failwith "sh.exe not found. Make sure the MSYS root is set to a correct location." - this.WorkingDirectory <- cwd this.WorkingDirectory + if not <| IO.Directory.Exists this.WorkingDirectory then ignore <| IO.Directory.CreateDirectory this.WorkingDirectory + this.UseCommandProcessor <- false this.StandardOutputImportance <- "High" - this.EnvironmentVariables <- [| - "CC=cl"; - "CPP=cl -E"; - "CFLAGS=-nologo" - "PATH=" + props.["MsysBasePath"] + "\\bin;" + props.["NativeExecutablePath"]; - "INCLUDE=" + props.["AegisubSourceBase"] + "//include;" + props.["IncludePath"]; - "LIB=" + props.["AegisubLibraryDir"] + ";" + props.["LibraryPath"]; - "PKG_CONFIG_PATH=" + (mungePath props.["ProjectDir"] props.["AegisubLibraryDir"]) + "/pkgconfig" - |] - + this.EnvironmentVariables <- [| for x in ["CC"; "CPP"; "CFLAGS"; "PATH"; "INCLUDE"; "LIB"] + -> sprintf "%s=%s" <| x <| conf.GetMetadata x |] base.Execute() type ExecShellScript() = inherit Task() // Task arguments - member val WorkingDirectory = "" with get, set - member val Command = "" with get, set - member val Script = "" with get, set + [] member val WorkingDirectory = "" with get, set + [] member val Command = "" with get, set + [] member val Configuration : ITaskItem = null with get, set member val Arguments = "" with get, set - member private this.realArgs (props : Map) = + member private this.realArgs () = let cleanArgs = this.Arguments.Replace("\r", "").Replace('\n', ' ') - if this.Script.Length > 0 - then sprintf "%s %s" (mungePath props.["ProjectDir"] this.Script) cleanArgs - else sprintf "-c '%s %s'" this.Command cleanArgs + sprintf "-c '%s %s'" (mungePath this.Command) cleanArgs override this.Execute() = try - let props = propertyMap this.BuildEngine - let sw = ShellWrapper(props, + let sw = ShellWrapper(this.Configuration, BuildEngine = this.BuildEngine, HostObject = this.HostObject, - Arguments = this.realArgs props, + Arguments = this.realArgs(), WorkingDirectory = this.WorkingDirectory) sw.Execute() @@ -118,15 +98,12 @@ type ExecShellScript() = type MsysPath() = inherit Task() - member val ProjectDir = "" with get, set member val Path = "" with get, set - - [] - member val Result = "" with get, set + [] member val Result = "" with get, set override this.Execute() = try - this.Result <- mungePath this.ProjectDir this.Path + this.Result <- mungePath this.Path true with Failure(e) -> this.Log.LogError(e) diff --git a/aegisub/build/aegisub.props b/aegisub/build/aegisub.props index ca71c8289..3e9e9af64 100644 --- a/aegisub/build/aegisub.props +++ b/aegisub/build/aegisub.props @@ -33,6 +33,7 @@ + diff --git a/aegisub/build/ffmpeg/ffmpeg.vcxproj b/aegisub/build/ffmpeg/ffmpeg.vcxproj index 7bba8d9ed..2d5a9511b 100644 --- a/aegisub/build/ffmpeg/ffmpeg.vcxproj +++ b/aegisub/build/ffmpeg/ffmpeg.vcxproj @@ -31,10 +31,6 @@ - - - - --enable-debug --disable-stripping --extra-cflags=-MDd --disable-debug --extra-cflags=-MD @@ -63,23 +59,24 @@ --extra-cflags=-D_SYSCRT --extra-cflags=-wd4005 --extra-cflags=-wd4189 - --extra-cflags=-FI$(MSBuildThisFileDirectory)dynamic_msvcrt.h + --extra-cflags=-FIdynamic_msvcrt.h --toolchain=msvc - $(CfgEnableDebug) + $(CfgDebug) + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)$(FfmpegSrcDir)')) - + - - - - + + + + @@ -96,22 +93,23 @@ Inputs="@(ConfigureInput)" Outputs="@(ConfigureOutput)" > - + - + - + @@ -93,6 +98,7 @@ Command="make" Arguments="-j$(NUMBER_OF_PROCESSORS)" WorkingDirectory="$(AegisubObjectDir)" + Configuration="@(ExecShellScript)" /> @@ -104,11 +110,12 @@ - + diff --git a/aegisub/build/paths.props b/aegisub/build/paths.props index 19e0b6e4d..7a9a9432f 100644 --- a/aegisub/build/paths.props +++ b/aegisub/build/paths.props @@ -3,10 +3,10 @@ <_PropertySheetDisplayName>Path definitions - + - $(MSBuildThisFileDirectory)..\ + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\')) $(AegisubSourceBase)..\contrib\ diff --git a/aegisub/build/tasks.props b/aegisub/build/tasks.props new file mode 100644 index 000000000..eb63665d7 --- /dev/null +++ b/aegisub/build/tasks.props @@ -0,0 +1,25 @@ + + + + <_PropertySheetDisplayName>Custom Tasks + + + + + cl + cl -E + -nologo + $(MsysBasePath)\bin;$(NativeExecutablePath) + $(MSBuildProjectDirectory);$(AegisubSourceBase)\include;$(IncludePath) + $(AegisubLibraryDir);$(LibraryPath) + $(Configuration) + $(Platform) + $(MsysBasePath)\bin\sh.exe + + + + + + + +