Skip to content

Commit

Permalink
updated cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
ReferenceType committed Apr 8, 2024
1 parent 4c4a41c commit 945f2d1
Show file tree
Hide file tree
Showing 17 changed files with 213 additions and 25 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("OpenH264Wrapper2")

# Include sub-projects.
add_subdirectory ("H264SharpNative")
121 changes: 121 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x86-release",
"displayName": "x86 Release",
"inherits": "x86-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "linux-debug",
"displayName": "Linux Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
},
{
"name": "linux-release",
"displayName": "Linux Release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
},
{
"name": "macos-debug",
"displayName": "macOS Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
}
]
}
8 changes: 1 addition & 7 deletions CrossPlatformTest/CrossPlatformTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\H264Sharp\H264Sharp.csproj" />
<PackageReference Include="H264Sharp-linux" Version="1.3.0" />
</ItemGroup>

<ItemGroup>
<None Update="H264SharpNative-linux64.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="H264SharpNative-win64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="libopenh264-2.4.1-linux64.7.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="openh264-2.4.1-win64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Binary file removed CrossPlatformTest/H264SharpNative-linux64.so
Binary file not shown.
Binary file removed CrossPlatformTest/H264SharpNative-win64.dll
Binary file not shown.
Binary file removed CrossPlatformTest/libopenh264-2.4.1-linux64.7.so
Binary file not shown.
Binary file removed CrossPlatformTest/openh264-2.4.1-win64.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions H264Sharp/Defines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class Defines
public const string WrapperDllName64bit = "H264SharpNative-win64.dll";
public const string WrapperDllName32bit = "H264SharpNative-win32.dll";
#elif OS_LINUX
public static string CiscoDllName64bit = "libopenh264-2.4.1-linux64.7.so";
public static string CiscoDllName32bit = "libopenh264-2.4.1-linux32.7.so";
public static string CiscoDllName64bit = "./libopenh264-2.4.1-linux64.7.so";
public static string CiscoDllName32bit = "./libopenh264-2.4.1-linux32.7.so";

public const string WrapperDllName64bit = "H264SharpNative-linux64.so";
public const string WrapperDllName32bit = "H264SharpNative-linux32.so";
Expand Down
78 changes: 66 additions & 12 deletions H264Sharp/H264Sharp.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<!--<Target Name="AfterBuild">
<ItemGroup>
<_ContentFiles Include="$(MSBuildThisFileDirectory)..\contentFiles\any\any\**\*.so" />
</ItemGroup>
<Copy SourceFiles="@(_ContentFiles)" DestinationFolder="$(OutDir)\%(RecursiveDir)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" />
</Target>-->
<Target Name="AfterBuild">
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\runtimes\linux64\native\H264SharpNative-linux64.so">
<Link>H264SharpNative-linux64.so</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Target>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>H264Sharp</Title>
<Version>1.2.1</Version>
<Title>H264Sharp-linux</Title>
<Version>1.3.0</Version>
<PackageProjectUrl>https://github.com/ReferenceType/H264Sharp</PackageProjectUrl>
<Authors>ReferenceType</Authors>
<RepositoryUrl>https://github.com/ReferenceType/H264Sharp</RepositoryUrl>
<PackageTags>h264;openh264;transcoder;h264sharp</PackageTags>
<PackageReleaseNotes>https://github.com/ReferenceType/H264Sharp/releases/</PackageReleaseNotes>
<PackageId>H264Sharp</PackageId>
<PackageId>H264Sharp-linux</PackageId>
<Description>Cisco's OpenH264 wrapper for .Net with SIMD color model conversion support</Description>

<Copyright></Copyright>
Expand All @@ -24,18 +39,56 @@

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);OS_WINDOWS</DefineConstants>
</PropertyGroup>



<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<DefineConstants>OS_WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<DefineConstants>OS_LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('FreeBSD'))">
<DefineConstants>OS_FREEBSD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<DefineConstants>OS_MAC</DefineConstants>
</PropertyGroup>


<ItemGroup>
<Content Include="runtimes\win-x64\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
<Content Include="runtimes\linux64\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />

<Content Include="runtimes\win-x86\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
<Content Include="runtimes\linux86\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
<Content Include="runtimes\win-x64\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\netstandard2.0" />
<Content Include="runtimes\win-x64\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\net8.0" />
<Content Include="runtimes\linux64\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="/contentFiles/any/any/" />
<None Include="runtimes\linux64\native\H264SharpNative-linux64.so">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<PackageFlatten>true</PackageFlatten>
<PackagePath>contentFiles\any\asset;content\any\asset</PackagePath>
</None>
<None Include="runtimes\linux64\native\libopenh264-2.4.1-linux64.7.so">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<PackageFlatten>true</PackageFlatten>
<PackagePath>contentFiles\any\asset;content\any\asset</PackagePath>
</None>
<Content Include="runtimes\win-x86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\netstandard2.0" />
<Content Include="runtimes\win-x86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\net8.0" />
<Content Include="runtimes\linux86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="/contentFiles/any/any/" />
<!--<Content Include="runtimes\linux86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\net8.0" />-->
</ItemGroup>


<ItemGroup>
<Content Remove="runtimes\linux64\native\H264SharpNative-linux64.so" />
<Content Remove="runtimes\linux64\native\libopenh264-2.4.1-linux64.7.so" />
</ItemGroup>

<ItemGroup>
<None Include="..\Resources\Licence.txt">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
Expand All @@ -48,3 +101,4 @@


</Project>

Binary file removed H264Sharp/Publish.zip
Binary file not shown.
Binary file modified H264Sharp/runtimes/linux64/native/H264SharpNative-linux64.so
Binary file not shown.
Binary file modified H264Sharp/runtimes/win-x64/native/H264SharpNative-win64.dll
Binary file not shown.
Binary file modified H264Sharp/runtimes/win-x86/native/H264SharpNative-win32.dll
Binary file not shown.
7 changes: 6 additions & 1 deletion H264SharpNative/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ else()
set(CMAKE_CXX_COMPILER "clang-cl")
endif()

#H264SharpNative-linux64.so

# Add source to this project's executable.
#add_executable (CMakeProject1 "CMakeProject1.cpp" "CMakeProject1.h")
add_library (CMakeProject1 SHARED
Expand All @@ -52,5 +54,8 @@ add_library (CMakeProject1 SHARED
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET CMakeProject1 PROPERTY CXX_STANDARD 20)
endif()

set_target_properties(CMakeProject1 PROPERTIES PREFIX "")
set_target_properties(CMakeProject1 PROPERTIES OUTPUT_NAME "H264SharpNative-linux64")
set_target_properties(CMakeProject1 PROPERTIES SUFFIX ".so")
#set_target_properties(CMakeProject1 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
# TODO: Add tests and install targets if needed.
1 change: 0 additions & 1 deletion H264SharpNative/ConverterLocal.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef CONVERTER_LOCAL
#define CONVERTER_LOCAL
#include <cmath>
#include<stdint.h>
#ifndef __arm__
#include <emmintrin.h>
Expand Down
4 changes: 2 additions & 2 deletions H264SharpNative/H264SharpNative.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;H264SHARPNATIVE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
Expand All @@ -170,7 +170,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;H264SHARPNATIVE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<Optimization>Full</Optimization>
Expand Down
File renamed without changes.

0 comments on commit 945f2d1

Please sign in to comment.