Skip to content

Commit c06ef3d

Browse files
committed
Initial commit
0 parents  commit c06ef3d

14 files changed

Lines changed: 563 additions & 0 deletions

.clang-format

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
#
2+
# Copyright (c) 2008-2022 the Urho3D project.
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
# THE SOFTWARE.
21+
#
22+
23+
---
24+
Language: Cpp
25+
26+
AccessModifierOffset: -4
27+
AlignAfterOpenBracket: DontAlign
28+
AlignConsecutiveAssignments: false
29+
AlignConsecutiveDeclarations: false
30+
AlignConsecutiveMacros: false
31+
AlignEscapedNewlines: DontAlign
32+
AlignOperands: DontAlign
33+
AlignTrailingComments: false
34+
AllowAllArgumentsOnNextLine: true
35+
AllowAllConstructorInitializersOnNextLine: true
36+
AllowAllParametersOfDeclarationOnNextLine: true
37+
AllowShortBlocksOnASingleLine: Never
38+
AllowShortCaseLabelsOnASingleLine: true
39+
AllowShortEnumsOnASingleLine: true
40+
AllowShortFunctionsOnASingleLine: InlineOnly
41+
AllowShortIfStatementsOnASingleLine: Never
42+
AllowShortLambdasOnASingleLine: All
43+
AllowShortLoopsOnASingleLine: false
44+
AlwaysBreakAfterDefinitionReturnType: None
45+
AlwaysBreakAfterReturnType: None
46+
AlwaysBreakBeforeMultilineStrings: true
47+
AlwaysBreakTemplateDeclarations: MultiLine
48+
BinPackArguments: true
49+
BinPackParameters: true
50+
BraceWrapping:
51+
AfterCaseLabel: true
52+
AfterClass: true
53+
AfterControlStatement: Always
54+
AfterEnum: true
55+
AfterFunction: true
56+
AfterNamespace: true
57+
AfterObjCDeclaration: true
58+
AfterStruct: true
59+
AfterUnion: true
60+
AfterExternBlock: true
61+
BeforeCatch: true
62+
BeforeElse: true
63+
BeforeLambdaBody: true
64+
IndentBraces: false
65+
SplitEmptyFunction: true
66+
SplitEmptyRecord: true
67+
SplitEmptyNamespace: true
68+
BreakAfterJavaFieldAnnotations: false
69+
BreakBeforeBinaryOperators: NonAssignment
70+
BreakBeforeBraces: Custom
71+
BreakBeforeInheritanceComma: false
72+
BreakBeforeTernaryOperators: true
73+
BreakConstructorInitializers: BeforeComma
74+
BreakInheritanceList: BeforeComma
75+
BreakStringLiterals: true
76+
ColumnLimit: 120
77+
CommentPragmas: '^ IWYU pragma:'
78+
CompactNamespaces: false
79+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
80+
ConstructorInitializerIndentWidth: 4
81+
ContinuationIndentWidth: 4
82+
Cpp11BracedListStyle: true
83+
DeriveLineEnding: true
84+
DerivePointerAlignment: false
85+
DisableFormat: false
86+
ExperimentalAutoDetectBinPacking: false
87+
FixNamespaceComments: true
88+
ForEachMacros:
89+
- foreach
90+
- Q_FOREACH
91+
- BOOST_FOREACH
92+
IncludeBlocks: Regroup
93+
IncludeCategories:
94+
# 2. Main header
95+
# 1. Precompiled header
96+
- Regex: '".*\/Precompiled\..*"'
97+
Priority: -1
98+
- Regex: '<Urho3D\/Precompiled\..*>'
99+
Priority: -1
100+
# 3. <Urho3D/Urho3D.h> before anything else.
101+
- Regex: '<Urho3D\/Urho3D\.h>'
102+
Priority: 10
103+
# 7. DebugNew goes last
104+
- Regex: '.*\/DebugNew\.h.*'
105+
Priority: 10000
106+
# 5. Includes for our libraries
107+
- Regex: '<Urho3D\/.*>'
108+
Priority: 100
109+
# 6. Includes for 3rd-party libraries
110+
- Regex: '<EASTL\/.*>'
111+
Priority: 301
112+
- Regex: '<.*\/.*>'
113+
Priority: 299
114+
- Regex: '<.*>'
115+
Priority: 302
116+
# 4. Includes for this target
117+
- Regex: '".*"'
118+
Priority: 11
119+
IncludeIsMainRegex: '$'
120+
IncludeIsMainSourceRegex: ''
121+
IndentCaseLabels: false
122+
IndentGotoLabels: true
123+
IndentPPDirectives: BeforeHash
124+
IndentWidth: 4
125+
IndentWrappedFunctionNames: false
126+
JavaScriptQuotes: Leave
127+
JavaScriptWrapImports: true
128+
KeepEmptyLinesAtTheStartOfBlocks: true
129+
LambdaBodyIndentation: OuterScope
130+
MacroBlockBegin: ''
131+
MacroBlockEnd: ''
132+
MaxEmptyLinesToKeep: 1
133+
NamespaceIndentation: None
134+
ObjCBinPackProtocolList: Auto
135+
ObjCBlockIndentWidth: 2
136+
ObjCSpaceAfterProperty: false
137+
ObjCSpaceBeforeProtocolList: true
138+
PenaltyBreakAssignment: 2
139+
PenaltyBreakBeforeFirstCallParameter: 19
140+
PenaltyBreakComment: 300
141+
PenaltyBreakFirstLessLess: 120
142+
PenaltyBreakString: 1000
143+
PenaltyBreakTemplateDeclaration: 10
144+
PenaltyExcessCharacter: 1000000
145+
PenaltyReturnTypeOnItsOwnLine: 60
146+
PointerAlignment: Left
147+
ReflowComments: true
148+
SortIncludes: true
149+
SortUsingDeclarations: true
150+
SpaceAfterCStyleCast: false
151+
SpaceAfterLogicalNot: false
152+
SpaceAfterTemplateKeyword: true
153+
SpaceBeforeAssignmentOperators: true
154+
SpaceBeforeCpp11BracedList: false
155+
SpaceBeforeCtorInitializerColon: true
156+
SpaceBeforeInheritanceColon: true
157+
SpaceBeforeParens: ControlStatements
158+
SpaceBeforeRangeBasedForLoopColon: true
159+
SpaceBeforeSquareBrackets: false
160+
SpaceInEmptyBlock: false
161+
SpaceInEmptyParentheses: false
162+
SpacesBeforeTrailingComments: 1
163+
SpacesInAngles: false
164+
SpacesInConditionalStatement: false
165+
SpacesInContainerLiterals: true
166+
SpacesInCStyleCastParentheses: false
167+
SpacesInParentheses: false
168+
SpacesInSquareBrackets: false
169+
Standard: c++17
170+
StatementMacros:
171+
- Q_UNUSED
172+
- QT_REQUIRE_VERSION
173+
TabWidth: 4
174+
UseCRLF: true
175+
UseTab: Never
176+
...
177+
178+
# vi: set ts=2 sw=2 expandtab:

.github/workflows/build.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Build
2+
on:
3+
# Build on commits pushed, except when explicitly skipped.
4+
push:
5+
branches-ignore:
6+
- 'no-ci-**'
7+
- 'skip-ci-**'
8+
# Build on pull requests, except drafts.
9+
pull_request:
10+
# Build manually
11+
workflow_dispatch:
12+
# Build on a schedule to keep up with the engine changes.
13+
schedule:
14+
- cron: '0 0 * * 0'
15+
16+
env:
17+
# Common settings.
18+
CMAKE_VERSION: 3.21.x
19+
# Common paths.
20+
ci_source_dir: ${{ github.workspace }}/source-code
21+
ci_build_script: ./source-code/ci_build.sh
22+
ci_build_dir: ${{ github.workspace }}/cmake-build
23+
ci_native_sdk_dir: ${{ github.workspace }}/SDK-native
24+
ci_target_sdk_dir: ${{ github.workspace }}/SDK-target
25+
# Parameters for uploading binaries to GitHub
26+
ci_latest_release_url: https://uploads.github.com/repos/rbfx/Core.SteamAudio/releases/258128822/assets{?name,label}
27+
ci_latest_release_id: 258128822
28+
29+
jobs:
30+
CheckSkipCI:
31+
runs-on: ubuntu-latest
32+
if: |
33+
!contains(github.event.head_commit.message, '[skip ci]') &&
34+
!contains(github.event.pull_request.title, '[skip ci]') &&
35+
!contains(github.event.head_commit.message, '[skip-ci]') &&
36+
!contains(github.event.pull_request.title, '[skip-ci]')
37+
steps:
38+
- run: exit 0
39+
40+
Windows:
41+
if: github.event.pull_request.draft == false
42+
runs-on: windows-2022
43+
needs: [CheckSkipCI]
44+
45+
strategy:
46+
fail-fast: false
47+
48+
env:
49+
ci_platform: windows
50+
ci_target_sdk_name: rebelfork-sdk-Windows-msvc-dll-x64-latest.zip
51+
ci_upload_release: ${{
52+
(github.repository == 'rbfx/Core.SteamAudio') &&
53+
(github.ref == 'refs/heads/master')
54+
}}
55+
56+
steps:
57+
- name: Checkout Plugin
58+
uses: actions/checkout@v3
59+
with:
60+
path: ${{ env.ci_source_dir }}
61+
fetch-depth: 1
62+
submodules: true
63+
64+
- name: Download target SDK
65+
uses: robinraju/release-downloader@v1.8
66+
with:
67+
repository: rbfx/rbfx
68+
tag: latest
69+
fileName: ${{ env.ci_target_sdk_name }}
70+
71+
- name: Unzip target SDK
72+
run: |
73+
cd ${{ github.workspace }}
74+
unzip ${{ env.ci_target_sdk_name }}
75+
mv ./SDK ./SDK-target
76+
77+
- name: Setup cmake
78+
uses: jwlawson/actions-setup-cmake@v1
79+
with:
80+
cmake-version: '${{ env.CMAKE_VERSION }}'
81+
82+
- name: Dependencies
83+
shell: bash
84+
run: ${{ env.ci_build_script }} dependencies
85+
86+
- name: Generate
87+
shell: bash
88+
run: ${{ env.ci_build_script }} generate
89+
90+
- name: Build
91+
shell: bash
92+
run: ${{ env.ci_build_script }} build
93+
94+
- name: Prepare binaries
95+
if: ${{ env.ci_upload_release == 'true' }}
96+
shell: bash
97+
run: ${{ env.ci_build_script }} prepare
98+
99+
- name: Zip binaries
100+
if: ${{ env.ci_upload_release == 'true' }}
101+
uses: TheDoctor0/zip-release@0.7.6
102+
with:
103+
directory: ${{ env.ci_build_dir }}/upload/
104+
filename: ${{ github.workspace }}/upload.zip
105+
path: '.'
106+
107+
- name: Release binaries
108+
if: ${{ env.ci_upload_release == 'true' }}
109+
uses: WebFreak001/deploy-nightly@v3.0.0
110+
with:
111+
upload_url: ${{ env.ci_latest_release_url }}
112+
release_id: ${{ env.ci_latest_release_id }}
113+
asset_path: ${{ github.workspace }}/upload.zip
114+
asset_name: 'Core.SteamAudio-${{ github.job }}-latest.zip'
115+
asset_content_type: application/zip
116+
max_releases: 1

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore generated projects
2+
build/
3+
.vscode/
4+
/cmake-build*
5+
6+
# Ignore C# files
7+
/CSharp/obj/

CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
project (Plugin.Core.SteamAudio)
3+
4+
# Top-level plugin build is not supported yet.
5+
# If the plugin is only built as subdirectory, this snippet is not needed and may be discarded.
6+
if (PROJECT_IS_TOP_LEVEL)
7+
set (CMAKE_CXX_STANDARD 17)
8+
find_package (Urho3D REQUIRED)
9+
endif ()
10+
11+
file (GLOB SOURCE_FILES *.h *.cpp)
12+
add_plugin (${PROJECT_NAME} "${SOURCE_FILES}")
13+
14+
if (URHO3D_CSHARP)
15+
set (DEST_BIN_DIR_CONFIG bin)
16+
set (DEST_LIBRARY_DIR_CONFIG bin)
17+
target_include_directories (${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
18+
csharp_bind_target(
19+
TARGET ${PROJECT_NAME}
20+
SWIG ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.i
21+
CSPROJ ${CMAKE_CURRENT_SOURCE_DIR}/CSharp/Plugin.csproj
22+
NAMESPACE Urho3DNet
23+
)
24+
endif ()
25+
26+
# Generate Visual Studio props file for csproj.
27+
rbfx_configure_cmake_props()

CSharp/Plugin.csproj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<AssemblyName>Plugin.Core.SteamAudio.Net</AssemblyName>
4+
<OutputType>Library</OutputType>
5+
<LangVersion>9.0</LangVersion>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<BindingsSourceCode Include="$(Plugin_Core_SteamAudio_BINARY_DIR)/Plugin.Core.SteamAudioCSharp_$(URHO3D_CSHARP_BIND_CONFIG)/*.cs" />
9+
</ItemGroup>
10+
<Target Name="GatherBuildFiles" BeforeTargets="BeforeCompile">
11+
<CreateItem Include="$([System.IO.Directory]::GetFiles(&quot;$(Plugin_Core_SteamAudio_BINARY_DIR)/Plugin.Core.SteamAudioCSharp_$(URHO3D_CSHARP_BIND_CONFIG)&quot;, &quot;*.cs&quot;))">
12+
<Output TaskParameter="Include" ItemName="Compile" />
13+
</CreateItem>
14+
</Target>
15+
<ItemGroup Condition=" '$(Urho3D_IS_SDK)' == 'ON' ">
16+
<Reference Include="Urho3DNet">
17+
<HintPath>$(Urho3D_PACKAGE_ROOT)/bin/$(Configuration)/Urho3DNet.dll</HintPath>
18+
</Reference>
19+
</ItemGroup>
20+
<ItemGroup Condition=" '$(Urho3D_IS_SDK)' != 'ON' ">
21+
<ProjectReference Include="$(Urho3D_SOURCE_DIR)/CSharp/Urho3DNet.csproj" />
22+
</ItemGroup>
23+
</Project>

CSharp/Plugin.i

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
%module(naturalvar=1) Plugin
2+
%{
3+
#include "SampleComponent.h"
4+
5+
using namespace Urho3D;
6+
#include <Urho3D/CSharp/Native/SWIGHelpers.h>
7+
%}
8+
#define PLUGIN_CORE_STEAMAUDIO_API
9+
%import "Urho3D.i"
10+
%{
11+
#include "SampleComponent.h"
12+
%}
13+
%include "SampleComponent.h"

Directory.Build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project>
2+
<!-- Works when building on windows using cmake-generated VS solution -->
3+
<Import Project="$(SolutionDir)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(SolutionDir)' != '' And Exists('$(SolutionDir)/CMake.props')" />
4+
<!-- Works when building with VSCode, however cmake cache directory should be ./cmake-build -->
5+
<Import Project="./cmake-build/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And Exists('./cmake-build/CMake.props')" />
6+
<!-- When separate .csproj projects are built by make/ninja -->
7+
<Import Project="$(CMAKE_BINARY_DIR)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(CMAKE_BINARY_DIR)' != '' And Exists('$(CMAKE_BINARY_DIR)/CMake.props') " />
8+
<!-- Azure pipelines for some reason have SolutionDir undefined however -->
9+
<Import Project="$(MSBuildStartupDirectory)/CMake.props" Condition=" '$(CMakePropsIncluded)' == '' And '$(SolutionDir)' == '' And Exists('$(MSBuildStartupDirectory)/CMake.props') " />
10+
<Import Project="$(URHO3D_CSHARP_PROPS_FILE)" />
11+
</Project>

0 commit comments

Comments
 (0)