Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@
*.ilk
[Bb]in/*
!smp_*
*Caches/
*Caches/
!bin2c.exe
!source2c.exe
!opencl_source2c.props
!opencl_source2c.targets
!opencl_source2c.xml
!cuda_bin2c.props
!cuda_bin2c.targets
!cuda_bin2c.xml
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ FFVS-Project-Generator
[![GitHub issues](https://img.shields.io/github/issues/ShiftMediaProject/FFVS-Project-Generator.svg)](https://github.com/ShiftMediaProject/FFVS-Project-Generator/issues)
[![license](https://img.shields.io/github/license/ShiftMediaProject/FFVS-Project-Generator.svg)](https://github.com/ShiftMediaProject/FFVS-Project-Generator)
[![donate](https://img.shields.io/badge/donate-link-brightgreen.svg)](https://shiftmediaproject.github.io/8-donate/)

## Major Update - Supports FFmpeg 8.x and beyond

**Changes**

- **Adds support for compilations of fftools/resources via bin2c.exe**
(supersedes #83)
- **Adds a `smp_common.props` file**
This is imported by all projects and allows to apply changes easily and in a persistent way - i.e. your modifications do not get lost when regenerating the projects
- **Adds support for libvpl (OneVPL)**
This is the new dispatcher for Intel QSV hardware acceleration, which replaces libmfx
- **Adds support for shaderc dependency**
- **Adds support for shader (.comp) file conversion to C strings**
- **Adds support for OpenCL (.cl) file conversion to C strings**
- **Adds support for CUDA PTX compile via NVCC and conversion to C strings**
(supersedes #82)
- **New option to specify a custom tesseract library name**
(tesseract library naming is messy)
- **Detect artifacts from configure in the ffmpeg tree**
The generator doesn't work properly when configure has been run in the FFmpeg source dir.
Added detection for this case and warning will be shown
- **Adds support for Vulkan (filters) and libplacebo**
A repo will be provided with an adapted libplacebo which can be compiled on Windows without MSYS2


## About

The FFmpeg VS Project Generator is a standalone program that can be used to create a custom Visual Studio project within a FFmpeg source code distribution. This program allows for the created Visual Studio project to be customised using virtually any of the options supported by FFmpegs default configure script. This allows for selecting which dependency libraries and codec/format support should be built into the created project file. With the output project FFmpeg libraries and programs can be built and debugged directly within Visual Studio.
Expand Down Expand Up @@ -107,4 +132,4 @@ https://github.com/ShiftMediaProject/VSYASM/releases/latest

## License

FFVS-Project-Generator itself is released under [LGPLv2](https://www.gnu.org/licenses/lgpl-2.0.html). The generated output project(s) and source can be used with existing FFmpeg source code such that any resultant binaries created by the generated projects will still conform to the license of the FFmpeg source code itself. This means the output binaries are licensed based on the command line specified when generating the projects (i.e. --enable-gpl etc.).
FFVS-Project-Generator itself is released under [LGPLv2](https://www.gnu.org/licenses/lgpl-2.0.html). The generated output project(s) and source can be used with existing FFmpeg source code such that any resultant binaries created by the generated projects will still conform to the license of the FFmpeg source code itself. This means the output binaries are licensed based on the command line specified when generating the projects (i.e. --enable-gpl etc.).
1 change: 1 addition & 0 deletions include/configGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class ConfigGenerator
DefaultValuesList m_replaceList;
DefaultValuesList m_replaceListASM;
bool m_useNASM{true};
string m_tesseractName{"tesseract"};
ConfigList m_cachedConfigLists;

public:
Expand Down
38 changes: 38 additions & 0 deletions include/projectGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ProjectGenerator
StaticList m_subDirs;

map<string, StaticList> m_projectLibs;
bool m_addCustomTesseract{false};

const string m_tempDirectory = "FFVSTemp/";

Expand Down Expand Up @@ -432,6 +433,11 @@ class ProjectGenerator
void outputDefines(const StaticList& definesShared, const StaticList& definesStatic, string& projectTemplate,
bool program = false);

/**
* Comment out preprocessor directives inside macro arguments that MSVC cannot handle.
*/
void sanitizeSourceFiles();

/**
* Output asm tools to project template.
* @remark Either yasm or nasm tools will be used based on current configuration.
Expand All @@ -445,6 +451,38 @@ class ProjectGenerator
*/
void outputCUDATools(string& projectTemplate) const;

/**
* Output OpenCL source2c build customization to project template.
* @remark Copies source2c.exe and opencl_source2c .props/.targets/.xml to the output directory
* and adds the ExtensionSettings/ExtensionTargets import groups.
* @param [in,out] projectTemplate The project template.
*/
void outputOpenCLTools(string& projectTemplate) const;

/**
* Output SPIRV source2c build customization to project template.
* @remark Copies source2c.exe and spirv_source2c .props/.targets/.xml to the output directory
* and adds the ExtensionSettings/ExtensionTargets import groups.
* @param [in,out] projectTemplate The project template.
*/
void outputSPIRVTools(string& projectTemplate) const;

/**
* Output resource source files (HTML/CSS) with custom build steps.
* @param [in,out] fileList The list of resource files to process.
* @param [in,out] projectTemplate The project template.
* @param [in,out] filterTemplate The filter template.
* @param [in,out] foundObjects The list of found object files.
* @param [in,out] foundFilters The set of found filters.
* @param staticOnly True to only include in static builds.
* @param sharedOnly True to only include in shared builds.
* @param bit32Only True to only include in 32-bit builds.
* @param bit64Only True to only include in 64-bit builds.
*/
void outputResourceSourceFiles(StaticList& fileList, string& projectTemplate, string& filterTemplate,
StaticList& foundObjects, set<string>& foundFilters, bool staticOnly = false, bool sharedOnly = false,
bool bit32Only = false, bool bit64Only = false) const;

bool outputDependencyLibs(string& projectTemplate, bool winrt, bool program);

/**
Expand Down
12 changes: 11 additions & 1 deletion project_generate.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 12.0.30501.0
# Visual Studio Version 18
VisualStudioVersion = 18.3.11512.155 d18.3
MinimumVisualStudioVersion = 12.0.30501.0
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "project_generate", "project_generate.vcxproj", "{FA1D2C31-D809-4021-9DE4-7552704175EE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "!Config", "!Config", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
ProjectSection(SolutionItems) = preProject
newtask\OpenCL_Build.md = newtask\OpenCL_Build.md
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -24,4 +31,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5B060291-F0AE-456C-85C4-754764957A2A}
EndGlobalSection
EndGlobal
28 changes: 27 additions & 1 deletion project_generate.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -39,15 +39,37 @@
<ResourceCompile Include="source\Templates.rc" />
</ItemGroup>
<ItemGroup>
<None Include="resources\bin2c.exe" />
<None Include="resources\cuda_bin2c.props" />
<None Include="resources\cuda_bin2c.targets" />
<None Include="resources\opencl_source2c.props" />
<None Include="resources\opencl_source2c.targets" />
<None Include="resources\source2c.exe" />
<None Include="resources\spirv_source2c.props" />
<None Include="resources\spirv_source2c.targets" />
<None Include="templates\smp_common.props" />
<None Include="templates\smp_deps.props" />
<None Include="templates\smp_winrt_deps.props" />
<None Include="templates\templateprogram_in.vcxproj" />
<None Include="templates\templateprogram_in.vcxproj.filters" />
<None Include="templates\template_files.props" />
<None Include="templates\template_in.sln" />
<None Include="templates\template_in.vcxproj" />
<None Include="templates\template_in.vcxproj.filters" />
<None Include="templates\template_in_winrt.sln" />
<None Include="templates\template_in_winrt.vcxproj" />
<None Include="templates\template_with_latest_sdk.bat" />
</ItemGroup>
<ItemGroup>
<Xml Include="resources\cuda_bin2c.xml" />
<Xml Include="resources\opencl_source2c.xml" />
<Xml Include="resources\spirv_source2c.xml" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FA1D2C31-D809-4021-9DE4-7552704175EE}</ProjectGuid>
<RootNamespace>ffmpeg_generate</RootNamespace>
<ProjectName>project_generate</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand All @@ -58,6 +80,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand All @@ -67,6 +90,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand All @@ -77,6 +101,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand All @@ -87,6 +112,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
11 changes: 10 additions & 1 deletion project_generate.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
Expand Down Expand Up @@ -66,6 +66,15 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="bin2c.exe" />
<None Include="source2c.exe" />
<None Include="opencl_source2c.props" />
<None Include="opencl_source2c.targets" />
<None Include="opencl_source2c.xml" />
<None Include="cuda_bin2c.props" />
<None Include="cuda_bin2c.targets" />
<None Include="cuda_bin2c.xml" />
<None Include="templates\smp_common.props" />
<None Include="templates\smp_deps.props">
<Filter>Templates</Filter>
</None>
Expand Down
Binary file added resources/bin2c.exe
Binary file not shown.
19 changes: 19 additions & 0 deletions resources/cuda_bin2c.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<CudaBin2C>
<Outputs>$(IntDir)%(Filename).ptx.c</Outputs>
<TreatOutputAsContent>false</TreatOutputAsContent>
<TrackerLogDirectory>$(TLogLocation)</TrackerLogDirectory>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<VerifyInputsAndOutputsExist>true</VerifyInputsAndOutputsExist>

<LinkObjects Condition="'%(CudaBin2C.LinkObjects)' == ''">true</LinkObjects>
<OutputItemType Condition="'%(CudaBin2C.OutputItemType)' == ''">ClCompile</OutputItemType>
<BuildInParallel Condition="'%(CudaBin2C.BuildInParallel)' == ''">true</BuildInParallel>
<MaxProcesses Condition="'%(CudaBin2C.MaxProcesses)' == ''">0</MaxProcesses>
<MaxItemsInBatch Condition="'%(CudaBin2C.MaxItemsInBatch)' == ''">1</MaxItemsInBatch>
<Command Condition="'%(CudaBin2C.Command)' == ''">"%CUDA_PATH%\bin\nvcc" -gencode arch=compute_60,code=sm_60 -O2 -m64 -ptx -c -o "$(IntDir)%(Filename).ptx" "%(FullPath)" &amp;&amp; "$(ProjectDir)bin2c.exe" "$(IntDir)%(Filename).ptx" "%(Outputs)" %(Filename)_ptx</Command>
</CudaBin2C>
</ItemDefinitionGroup>
</Project>
27 changes: 27 additions & 0 deletions resources/cuda_bin2c.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName Include="CudaBin2C">
<Targets>SelectCudaBin2C</Targets>
</AvailableItemName>
</ItemGroup>

<Target Name="SelectCudaBin2C" BeforeTargets="SelectCustomBuild;ComputeCustomBuildOutput">

<ItemGroup>
<CudaBin2C Update="@(CudaBin2C)">
<Inputs>%(CudaBin2C.FullPath)</Inputs>
<AdditionalInputs>%(CudaBin2C.AdditionalInputs);$(MSBuildProjectFile)</AdditionalInputs>

<Message>Exec CudaBin2C: %(CudaBin2C.FileName)</Message>
<!--<Command>"%CUDA_PATH%\bin\nvcc" -gencode arch=compute_60,code=sm_60 -O2 -m64 -ptx -c -o "$(IntDir)%(CudaBin2C.Filename).ptx" "%(CudaBin2C.FullPath)" &amp;&amp; "$(ProjectDir)bin2c.exe" "$(IntDir)%(CudaBin2C.Filename).ptx" "%(CudaBin2C.Outputs)" %(CudaBin2C.Filename)_ptx</Command>-->
</CudaBin2C>
</ItemGroup>

<ItemGroup>
<CustomBuild Include="@(CudaBin2C)">
</CustomBuild>
</ItemGroup>
</Target>
</Project>
53 changes: 53 additions & 0 deletions resources/cuda_bin2c.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertedRecipeDefinition">
<Rule
Name="CudaBin2C"
PageTemplate="tool"
DisplayName="CUDA PTX Compile to C String"
Order="200">
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="CudaBin2C" />
</Rule.DataSource>
<Rule.Categories>
<Category Name="General" DisplayName="General" Description="General" />
</Rule.Categories>
<StringProperty Name="Command" Category="General" DisplayName="Command Line" Description="Specifies a command line for the custom build tool." F1Keyword="VC.Project.VCCustomBuildTool.Command" >
<StringProperty.ValueEditors>
<ValueEditor EditorType="DefaultCommandPropertyEditor" DisplayName="&lt;Edit...&gt;"/>
</StringProperty.ValueEditors>
</StringProperty>
<StringListProperty Name="Outputs" Category="General" DisplayName="Outputs" Description="Specifies the output files the custom build tool generates." F1Keyword="VC.Project.VCCustomBuildTool.Outputs" />
<StringListProperty Name="AdditionalInputs" Category="General" DisplayName="Additional Dependencies" Description="Specifies any additional input files to use for the custom build tool." F1Keyword="VC.Project.VCCustomBuildTool.AdditionalInputs" />
<BoolProperty Name="LinkObjects" Category="General" DisplayName="Link Objects" F1Keyword="VC.Project.VCCustomBuildTool.LinkObjects"
Description="Specify whether the Inputs and outputs files with specific extensions (.obj, .lib, .res, .rsc) are passed to the linker.">
</BoolProperty>
<DynamicEnumProperty Name="OutputItemType" DisplayName="Add Outputs to Item Type" Category="General"
Description="Specifies Item type to add output files to so they become sources for other build tools."
EnumProvider="ItemTypes"
F1Keyword="VC.Project.VCCustomBuildTool.OutputsItemType">
</DynamicEnumProperty>

<BoolProperty Name="BuildInParallel" Category="General" DisplayName="Build In Parallel" F1Keyword="VC.Project.VCCustomBuildTool.BuildInParallel"
Description="Specifies that this item can be built in parallel with other custom build tool items.">
</BoolProperty>
<IntProperty Name="MaxProcesses" Category="General" DisplayName="Maximum Processes" F1Keyword="VC.Project.VCCustomBuildTool.MaxProcesses"
Description="Maximum number of CPU cores to use for parallel build. A value of 0 utilizes all available processors.">
</IntProperty>
<IntProperty Name="MaxItemsInBatch" Category="General" DisplayName="Maximum Batch Size" F1Keyword="VC.Project.VCCustomBuildTool.MaxProcesses"
Description="Maximum number of items to execute together during parallel build. A value of 0 divides items evenly into parallel batches. A value of 1 disables batching. Larger batches will improve performance if the custom build tool processes items quickly.">
</IntProperty>
</Rule>
<ItemType
Name="CudaBin2C"
DisplayName="CUDA PTX Compile to C String" />
<FileExtension
Name="*.cu"
ContentType="CudaBin2C" />
<ContentType
Name="CudaBin2C"
DisplayName="CUDA PTX Compile to C String"
ItemType="CudaBin2C" />
</ProjectSchemaDefinitions>
19 changes: 19 additions & 0 deletions resources/opencl_source2c.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<OpenCLSource2C>
<Outputs>$(IntDir)%(Filename)_cl.c</Outputs>
<TreatOutputAsContent>false</TreatOutputAsContent>
<TrackerLogDirectory>$(TLogLocation)</TrackerLogDirectory>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<VerifyInputsAndOutputsExist>true</VerifyInputsAndOutputsExist>

<LinkObjects Condition="'%(OpenCLSource2C.LinkObjects)' == ''">true</LinkObjects>
<OutputItemType Condition="'%(OpenCLSource2C.OutputItemType)' == ''">ClCompile</OutputItemType>
<BuildInParallel Condition="'%(OpenCLSource2C.BuildInParallel)' == ''">true</BuildInParallel>
<MaxProcesses Condition="'%(OpenCLSource2C.MaxProcesses)' == ''">0</MaxProcesses>
<MaxItemsInBatch Condition="'%(OpenCLSource2C.MaxItemsInBatch)' == ''">1</MaxItemsInBatch>
<Command Condition="'%(OpenCLSource2C.Command)' == ''">"$(ProjectDir)source2c.exe" "%(FullPath)" "%(Outputs)"</Command>
</OpenCLSource2C>
</ItemDefinitionGroup>
</Project>
Loading