Skip to content

Commit 945f2d1

Browse files
committed
updated cmake
1 parent 4c4a41c commit 945f2d1

17 files changed

+213
-25
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# CMakeList.txt : Top-level CMake project file, do global configuration
2+
# and include sub-projects here.
3+
#
4+
cmake_minimum_required (VERSION 3.8)
5+
6+
# Enable Hot Reload for MSVC compilers if supported.
7+
if (POLICY CMP0141)
8+
cmake_policy(SET CMP0141 NEW)
9+
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
10+
endif()
11+
12+
project ("OpenH264Wrapper2")
13+
14+
# Include sub-projects.
15+
add_subdirectory ("H264SharpNative")

CMakePresets.json

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "windows-base",
6+
"hidden": true,
7+
"generator": "Ninja",
8+
"binaryDir": "${sourceDir}/out/build/${presetName}",
9+
"installDir": "${sourceDir}/out/install/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_C_COMPILER": "cl.exe",
12+
"CMAKE_CXX_COMPILER": "cl.exe"
13+
},
14+
"condition": {
15+
"type": "equals",
16+
"lhs": "${hostSystemName}",
17+
"rhs": "Windows"
18+
}
19+
},
20+
{
21+
"name": "x64-debug",
22+
"displayName": "x64 Debug",
23+
"inherits": "windows-base",
24+
"architecture": {
25+
"value": "x64",
26+
"strategy": "external"
27+
},
28+
"cacheVariables": {
29+
"CMAKE_BUILD_TYPE": "Debug"
30+
}
31+
},
32+
{
33+
"name": "x64-release",
34+
"displayName": "x64 Release",
35+
"inherits": "x64-debug",
36+
"cacheVariables": {
37+
"CMAKE_BUILD_TYPE": "Release"
38+
}
39+
},
40+
{
41+
"name": "x86-debug",
42+
"displayName": "x86 Debug",
43+
"inherits": "windows-base",
44+
"architecture": {
45+
"value": "x86",
46+
"strategy": "external"
47+
},
48+
"cacheVariables": {
49+
"CMAKE_BUILD_TYPE": "Debug"
50+
}
51+
},
52+
{
53+
"name": "x86-release",
54+
"displayName": "x86 Release",
55+
"inherits": "x86-debug",
56+
"cacheVariables": {
57+
"CMAKE_BUILD_TYPE": "Release"
58+
}
59+
},
60+
{
61+
"name": "linux-debug",
62+
"displayName": "Linux Debug",
63+
"generator": "Ninja",
64+
"binaryDir": "${sourceDir}/out/build/${presetName}",
65+
"installDir": "${sourceDir}/out/install/${presetName}",
66+
"cacheVariables": {
67+
"CMAKE_BUILD_TYPE": "Debug"
68+
},
69+
"condition": {
70+
"type": "equals",
71+
"lhs": "${hostSystemName}",
72+
"rhs": "Linux"
73+
},
74+
"vendor": {
75+
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
76+
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
77+
}
78+
}
79+
},
80+
{
81+
"name": "linux-release",
82+
"displayName": "Linux Release",
83+
"generator": "Ninja",
84+
"binaryDir": "${sourceDir}/out/build/${presetName}",
85+
"installDir": "${sourceDir}/out/install/${presetName}",
86+
"cacheVariables": {
87+
"CMAKE_BUILD_TYPE": "Release"
88+
},
89+
"condition": {
90+
"type": "equals",
91+
"lhs": "${hostSystemName}",
92+
"rhs": "Linux"
93+
},
94+
"vendor": {
95+
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
96+
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
97+
}
98+
}
99+
},
100+
{
101+
"name": "macos-debug",
102+
"displayName": "macOS Debug",
103+
"generator": "Ninja",
104+
"binaryDir": "${sourceDir}/out/build/${presetName}",
105+
"installDir": "${sourceDir}/out/install/${presetName}",
106+
"cacheVariables": {
107+
"CMAKE_BUILD_TYPE": "Debug"
108+
},
109+
"condition": {
110+
"type": "equals",
111+
"lhs": "${hostSystemName}",
112+
"rhs": "Darwin"
113+
},
114+
"vendor": {
115+
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
116+
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
117+
}
118+
}
119+
}
120+
]
121+
}

CrossPlatformTest/CrossPlatformTest.csproj

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="..\H264Sharp\H264Sharp.csproj" />
12+
<PackageReference Include="H264Sharp-linux" Version="1.3.0" />
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<None Update="H264SharpNative-linux64.so">
17-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
18-
</None>
1916
<None Update="H264SharpNative-win64.dll">
2017
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2118
</None>
22-
<None Update="libopenh264-2.4.1-linux64.7.so">
23-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
24-
</None>
2519
<None Update="openh264-2.4.1-win64.dll">
2620
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2721
</None>
-112 KB
Binary file not shown.
-192 KB
Binary file not shown.
-1.65 MB
Binary file not shown.
-952 KB
Binary file not shown.

H264Sharp/Defines.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class Defines
1111
public const string WrapperDllName64bit = "H264SharpNative-win64.dll";
1212
public const string WrapperDllName32bit = "H264SharpNative-win32.dll";
1313
#elif OS_LINUX
14-
public static string CiscoDllName64bit = "libopenh264-2.4.1-linux64.7.so";
15-
public static string CiscoDllName32bit = "libopenh264-2.4.1-linux32.7.so";
14+
public static string CiscoDllName64bit = "./libopenh264-2.4.1-linux64.7.so";
15+
public static string CiscoDllName32bit = "./libopenh264-2.4.1-linux32.7.so";
1616

1717
public const string WrapperDllName64bit = "H264SharpNative-linux64.so";
1818
public const string WrapperDllName32bit = "H264SharpNative-linux32.so";

H264Sharp/H264Sharp.csproj

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<!--<Target Name="AfterBuild">
4+
<ItemGroup>
5+
<_ContentFiles Include="$(MSBuildThisFileDirectory)..\contentFiles\any\any\**\*.so" />
6+
</ItemGroup>
27
8+
<Copy SourceFiles="@(_ContentFiles)" DestinationFolder="$(OutDir)\%(RecursiveDir)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" />
9+
</Target>-->
10+
<Target Name="AfterBuild">
11+
<ItemGroup>
12+
<None Include="$(MSBuildThisFileDirectory)\runtimes\linux64\native\H264SharpNative-linux64.so">
13+
<Link>H264SharpNative-linux64.so</Link>
14+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
15+
</None>
16+
</ItemGroup>
17+
</Target>
318
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
19+
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
520
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
621
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
7-
<Title>H264Sharp</Title>
8-
<Version>1.2.1</Version>
22+
<Title>H264Sharp-linux</Title>
23+
<Version>1.3.0</Version>
924
<PackageProjectUrl>https://github.com/ReferenceType/H264Sharp</PackageProjectUrl>
1025
<Authors>ReferenceType</Authors>
1126
<RepositoryUrl>https://github.com/ReferenceType/H264Sharp</RepositoryUrl>
1227
<PackageTags>h264;openh264;transcoder;h264sharp</PackageTags>
1328
<PackageReleaseNotes>https://github.com/ReferenceType/H264Sharp/releases/</PackageReleaseNotes>
14-
<PackageId>H264Sharp</PackageId>
29+
<PackageId>H264Sharp-linux</PackageId>
1530
<Description>Cisco's OpenH264 wrapper for .Net with SIMD color model conversion support</Description>
1631

1732
<Copyright></Copyright>
@@ -24,18 +39,56 @@
2439

2540
</PropertyGroup>
2641

27-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
28-
<DefineConstants>$(DefineConstants);OS_WINDOWS</DefineConstants>
29-
</PropertyGroup>
3042

31-
3243

44+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
45+
<DefineConstants>OS_WINDOWS</DefineConstants>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
48+
<DefineConstants>OS_LINUX</DefineConstants>
49+
</PropertyGroup>
50+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('FreeBSD'))">
51+
<DefineConstants>OS_FREEBSD</DefineConstants>
52+
</PropertyGroup>
53+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
54+
<DefineConstants>OS_MAC</DefineConstants>
55+
</PropertyGroup>
56+
57+
3358
<ItemGroup>
34-
<Content Include="runtimes\win-x64\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
35-
<Content Include="runtimes\linux64\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
3659

37-
<Content Include="runtimes\win-x86\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
38-
<Content Include="runtimes\linux86\native\*" CopyToOutputDirectory="Always" Pack="true" PackagePath="\lib\$(TargetFramework)" />
60+
<Content Include="runtimes\win-x64\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\netstandard2.0" />
61+
<Content Include="runtimes\win-x64\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\net8.0" />
62+
<Content Include="runtimes\linux64\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="/contentFiles/any/any/" />
63+
<None Include="runtimes\linux64\native\H264SharpNative-linux64.so">
64+
<Pack>true</Pack>
65+
<PackageCopyToOutput>true</PackageCopyToOutput>
66+
<PackageFlatten>true</PackageFlatten>
67+
<PackagePath>contentFiles\any\asset;content\any\asset</PackagePath>
68+
</None>
69+
<None Include="runtimes\linux64\native\libopenh264-2.4.1-linux64.7.so">
70+
<Pack>true</Pack>
71+
<PackageCopyToOutput>true</PackageCopyToOutput>
72+
<PackageFlatten>true</PackageFlatten>
73+
<PackagePath>contentFiles\any\asset;content\any\asset</PackagePath>
74+
</None>
75+
<Content Include="runtimes\win-x86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\netstandard2.0" />
76+
<Content Include="runtimes\win-x86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\net8.0" />
77+
<Content Include="runtimes\linux86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="/contentFiles/any/any/" />
78+
<!--<Content Include="runtimes\linux86\native\*" CopyToOutputDirectory="Always" PackageCopyToOutput="true" Pack="true" PackagePath="\lib\net8.0" />-->
79+
</ItemGroup>
80+
81+
82+
<ItemGroup>
83+
<Content Remove="runtimes\linux64\native\H264SharpNative-linux64.so" />
84+
<Content Remove="runtimes\linux64\native\libopenh264-2.4.1-linux64.7.so" />
85+
</ItemGroup>
86+
87+
<ItemGroup>
88+
<None Include="..\Resources\Licence.txt">
89+
<Pack>True</Pack>
90+
<PackagePath>\</PackagePath>
91+
</None>
3992
</ItemGroup>
4093

4194
<ItemGroup>
@@ -48,3 +101,4 @@
48101

49102

50103
</Project>
104+

H264Sharp/Publish.zip

-869 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

H264SharpNative/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ else()
2727
set(CMAKE_CXX_COMPILER "clang-cl")
2828
endif()
2929

30+
#H264SharpNative-linux64.so
31+
3032
# Add source to this project's executable.
3133
#add_executable (CMakeProject1 "CMakeProject1.cpp" "CMakeProject1.h")
3234
add_library (CMakeProject1 SHARED
@@ -52,5 +54,8 @@ add_library (CMakeProject1 SHARED
5254
if (CMAKE_VERSION VERSION_GREATER 3.12)
5355
set_property(TARGET CMakeProject1 PROPERTY CXX_STANDARD 20)
5456
endif()
55-
57+
set_target_properties(CMakeProject1 PROPERTIES PREFIX "")
58+
set_target_properties(CMakeProject1 PROPERTIES OUTPUT_NAME "H264SharpNative-linux64")
59+
set_target_properties(CMakeProject1 PROPERTIES SUFFIX ".so")
60+
#set_target_properties(CMakeProject1 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
5661
# TODO: Add tests and install targets if needed.

H264SharpNative/ConverterLocal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifndef CONVERTER_LOCAL
22
#define CONVERTER_LOCAL
3-
#include <cmath>
43
#include<stdint.h>
54
#ifndef __arm__
65
#include <emmintrin.h>

H264SharpNative/H264SharpNative.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<SDLCheck>true</SDLCheck>
154154
<PreprocessorDefinitions>WIN32;_DEBUG;H264SHARPNATIVE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
155155
<ConformanceMode>true</ConformanceMode>
156-
<PrecompiledHeader>Use</PrecompiledHeader>
156+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
157157
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
158158
</ClCompile>
159159
<Link>
@@ -170,7 +170,7 @@
170170
<SDLCheck>true</SDLCheck>
171171
<PreprocessorDefinitions>WIN32;NDEBUG;H264SHARPNATIVE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
172172
<ConformanceMode>true</ConformanceMode>
173-
<PrecompiledHeader>Use</PrecompiledHeader>
173+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
174174
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
175175
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
176176
<Optimization>Full</Optimization>
File renamed without changes.

0 commit comments

Comments
 (0)