updated .gitattributes, configured CMake to properly handle SteamAudio DLL

This commit is contained in:
Nyx
2025-05-08 01:13:48 -06:00
parent 319795c4c9
commit 79bdb2254c
27 changed files with 660 additions and 254 deletions

View File

@@ -1,112 +1,70 @@
# Options are listed here:
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AlignTrailingComments: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
AlwaysBreakTemplateDeclarations: Yes
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakStringLiterals: true
ColumnLimit: 100
CompactNamespaces: false
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DeriveLineEnding: false
DerivePointerAlignment: false
EmptyLineBeforeAccessModifier: LogicalBlock
EmptyLineAfterAccessModifier: Never
FixNamespaceComments: false
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
- Regex: '^<.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
- Regex: '^".*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
MaxEmptyLinesToKeep: 1
InsertNewlineAtEOF: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
SpacesInSquareBrackets: false
SpacesInParentheses: false
Standard: c++17
TabWidth: 4
UseCRLF: false
UseTab: Never
...

5
.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
*.jpg filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.dylib filter=lfs diff=lfs merge=lfs -text
*.a filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text

View File

@@ -2,163 +2,193 @@
cmake_minimum_required(VERSION 3.22)
# Opt into the new install-destination normalization behavior
if(POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
endif()
message(STATUS "Using CMake ${CMAKE_VERSION}")
# Require out-of-source builds
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
if(EXISTS "${LOC_PATH}")
message(FATAL_ERROR "You cannot build in the source directory. Please use a build subdirectory.")
endif()
# Add paths to modules
# Add custom CMake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# Turn on link time optimization for everything
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON )
# Enable LTO for release if supported
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output)
if(ipo_supported)
message(STATUS "IPO/LTO supported: enabling interprocedural optimization")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(STATUS "IPO/LTO not supported: skipping LTO flags (${ipo_output})")
endif()
# Output compile commands to compile_commands.json (for debugging CMake issues)
# Output compile commands for editor integration
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Build universal lib on macOS
# Note that CMAKE_OSX_ARCHITECTURES must be set before project().
# Build universal library on macOS
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
endif()
# Main project information
# Project definition
project(SteamAudioGodot
LANGUAGES
CXX
VERSION
0.1.0
VERSION 0.1.0
LANGUAGES CXX
)
# Create our library
# Create the shared library target
add_library(${PROJECT_NAME} SHARED)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_compile_features( ${PROJECT_NAME}
PRIVATE
cxx_std_17
)
# LIB_ARCH is the architecture being built. It is set to the build system's architecture.
# For macOS, we build a universal library (both arm64 and x86_64).
# Determine architecture label
set(LIB_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if(APPLE)
set(LIB_ARCH "universal")
endif()
# LIB_DIR is where the actual library ends up. This is used in both the build directory and the
# install directory and needs to be consistent with the paths in the gdextension file.
# e.g. linux.release.x86_64 = "lib/Linux-x86_64/libGDExtensionTemplate.so"
# Where Godot expects library binaries
set(LIB_DIR "lib/${CMAKE_SYSTEM_NAME}-${LIB_ARCH}")
message(STATUS "Building ${PROJECT_NAME} for ${LIB_ARCH} on ${CMAKE_SYSTEM_NAME}")
# BUILD_OUTPUT_DIR is where we put the resulting library (in the build directory)
# Output directories for built library
set(BUILD_OUTPUT_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/")
set_target_properties( ${PROJECT_NAME}
PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN true
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_DIR}/${LIB_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_DIR}/${LIB_DIR}"
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN TRUE
)
# Append debug postfix if needed
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
set_target_properties( ${PROJECT_NAME}
PROPERTIES
DEBUG_POSTFIX "-d"
)
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "-d")
endif()
# Copy over additional files from the support_files directory
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
# (Optional) Copy support_files icons and templates next to build output
# if you need them in your local addon for testing. Exclude the 'lib' folder to avoid nested structure.
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/support_files"
${BUILD_OUTPUT_DIR}
"${CMAKE_SOURCE_DIR}/support_files/icons"
"${BUILD_OUTPUT_DIR}/icons"
)
# Warnings
include( CompilerWarnings )
# Create and include version info file from git
include( GitVersionInfo )
# Build source files
add_subdirectory(src)
set(STEAMAUDIO_SDK_ROOT "${CMAKE_SOURCE_DIR}/extern/steam-audio")
# ─────────────────────────────────────────────────────────────────────────────
# Stage Steam Audio runtimes alongside the built GDExtension
# ─────────────────────────────────────────────────────────────────────────────
target_include_directories(${PROJECT_NAME}
PRIVATE
${STEAMAUDIO_SDK_ROOT}/include
# Detect platform-specific subdirectories
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_SA_RUNTIME_SUBDIR "windows-x64")
set(_SA_GDE_DIR "Windows-AMD64")
else()
set(_SA_RUNTIME_SUBDIR "windows-x86")
set(_SA_GDE_DIR "Windows-386")
endif()
elseif(APPLE)
set(_SA_RUNTIME_SUBDIR "ios") # switch to "osx" if targeting desktop
set(_SA_GDE_DIR "Darwin")
elseif(ANDROID)
set(_SA_RUNTIME_SUBDIR "${ANDROID_ABI}")
set(_SA_GDE_DIR "${ANDROID_ABI}")
elseif(UNIX)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_SA_RUNTIME_SUBDIR "linux-x64")
set(_SA_GDE_DIR "Linux-x64")
else()
set(_SA_RUNTIME_SUBDIR "linux-x86")
set(_SA_GDE_DIR "Linux-x86")
endif()
else()
message(FATAL_ERROR "Unsupported platform for SteamAudioGodot")
endif()
# Path to prebuilt Steam Audio runtime files
set(_SA_RUNTIME_DIR "${CMAKE_CURRENT_SOURCE_DIR}/support_files/lib/${_SA_RUNTIME_SUBDIR}")
# Where Godot will load the binaries (target output directory already equals build_output/lib/Platform)
set(_SA_OUTPUT_DIR "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
# Copy the runtime files after build
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${_SA_OUTPUT_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${_SA_RUNTIME_DIR}"
"${_SA_OUTPUT_DIR}"
)
# Include paths for Steam Audio SDK and godot-cpp
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/extern/steam-audio/include
${CMAKE_CURRENT_SOURCE_DIR}/extern/godot-cpp/include
${CMAKE_CURRENT_SOURCE_DIR}/src
)
# Install library, extension file, and support files in ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}
set( INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/" )
# Installation setup
set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/install/${PROJECT_NAME}/")
message(STATUS "Install directory: ${INSTALL_DIR}")
install(TARGETS ${PROJECT_NAME}
LIBRARY
DESTINATION ${INSTALL_DIR}/${LIB_DIR}
RUNTIME
DESTINATION ${INSTALL_DIR}/${LIB_DIR}
)
# Copy over support files
install( DIRECTORY "${CMAKE_SOURCE_DIR}/support_files/"
DESTINATION ${INSTALL_DIR}
PATTERN ".*" EXCLUDE
RUNTIME DESTINATION ${INSTALL_DIR}/${LIB_DIR}
LIBRARY DESTINATION ${INSTALL_DIR}/${LIB_DIR}
)
# Install Steam Audio runtime libraries into the addon install folder
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/support_files/lib/${_SA_RUNTIME_SUBDIR}/"
DESTINATION "${INSTALL_DIR}/${LIB_DIR}/"
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so"
PATTERN "*.dylib"
PATTERN "*.a"
)
# Templates subdir
add_subdirectory(templates)
# ccache
# Turns on ccache if found
# ccache integration
include(ccache)
# Formatting
# Adds a custom target to format all the code at once
# Install Steam Audio runtime libraries into the addon install folder
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/support_files/lib/${_SA_RUNTIME_SUBDIR}/"
DESTINATION "${INSTALL_DIR}/${LIB_DIR}/"
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so"
PATTERN "*.dylib"
PATTERN "*.a"
)
# Code formatting
include(ClangFormat)
include(ccache)
# Code formatting
include(ClangFormat)
# godot-cpp
# From here: https://github.com/godotengine/godot-cpp
# godot-cpp bindings
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/extern/godot-cpp/Makefile")
message(
FATAL_ERROR
"[${PROJECT_NAME}] The godot-cpp submodule was not downloaded. Please update submodules: git submodule update --init --recursive."
)
message(FATAL_ERROR "[${PROJECT_NAME}] Missing godot-cpp submodule. Run: git submodule update --init --recursive.")
endif()
set(GODOT_CPP_SYSTEM_HEADERS ON CACHE BOOL "" FORCE)
add_subdirectory(extern/godot-cpp)
set_target_properties(godot-cpp PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties( godot-cpp
PROPERTIES
CXX_VISIBILITY_PRESET hidden # visibility needs to be the same as the main library
# Link against godot-cpp and Steam Audio phonon library
# Add Steam Audio phonon lib search path
target_link_directories(${PROJECT_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/extern/steam-audio/lib/${_SA_RUNTIME_SUBDIR}"
)
target_link_libraries( ${PROJECT_NAME}
PRIVATE
target_link_libraries(${PROJECT_NAME} PRIVATE
godot-cpp
phonon
)
target_link_directories(${PROJECT_NAME}
PRIVATE
${STEAMAUDIO_SDK_ROOT}/lib/windows-x64
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${STEAMAUDIO_SDK_ROOT}/lib/windows-x64/phonon.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)

View File

@@ -13,14 +13,14 @@
"generator": "Ninja",
"hidden": true,
"environment": {
"PROJECT_NAME": "MyGodotExtention"
"PROJECT_NAME": "SteamAudioGodotExtension"
}
},
{
"name": "windows-debug",
"displayName": "64bit Windows Debug",
"inherits": "default",
"binaryDir": "${sourceDir}/../build_${env:PROJECT_NAME}_Windows-AMD64",
"binaryDir": "builds/windows-amd64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -52,7 +52,7 @@
"name": "linux-debug",
"displayName": "64bit Linux Debug",
"inherits": "default",
"binaryDir": "${sourceDir}/../build_${env:PROJECT_NAME}_Linux-x86_64",
"binaryDir": "builds/linux-x86_x64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -76,7 +76,7 @@
"name": "macOS-debug",
"displayName": "64bit macOS Debug",
"inherits": "default",
"binaryDir": "${sourceDir}/../build_${env:PROJECT_NAME}_Darwin-Universal",
"binaryDir": "builds/DARWIN-Universal",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="API Reference" id="API_Reference">
<p>Start typing here...</p>
</topic>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="List API versions" id="List_API_versions">
<api-endpoint openapi-path="../../../openAPIspec.json" method="GET" endpoint="/"/>
</topic>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="Show API version details" id="Show_API_version_details">
<api-endpoint openapi-path="../../../openAPIspec.json" method="GET" endpoint="/v2"/>
</topic>

View File

@@ -0,0 +1,11 @@
[configuration]
entry_symbol = "steam_audio_library_init"
compatibility_minimum = 4.1
[icons]
Example = "icons/Example.svg"
[libraries]
linux.debug.x86_64 = "lib/Linux-x86_64/libSteamAudioGodot-d.so"
macos.debug = "lib/Darwin-Universal/libSteamAudioGodot-d.dylib"
windows.debug.x86_64 = "lib/Windows-AMD64/libSteamAudioGodot-d.dll"

193
openAPIspec.json Normal file
View File

@@ -0,0 +1,193 @@
{
"openapi": "3.0.0",
"info": {
"title": "Simple API overview",
"version": "2.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response",
"content": {
"application/json": {
"examples": {
"foo": {
"value": {
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
},
{
"status": "EXPERIMENTAL",
"updated": "2013-07-23T11:33:21Z",
"id": "v3.0",
"links": [
{
"href": "http://127.0.0.1:8774/v3/",
"rel": "self"
}
]
}
]
}
}
}
}
}
},
"300": {
"description": "300 response",
"content": {
"application/json": {
"examples": {
"foo": {
"value": {
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
},
{
"status": "EXPERIMENTAL",
"updated": "2013-07-23T11:33:21Z",
"id": "v3.0",
"links": [
{
"href": "http://127.0.0.1:8774/v3/",
"rel": "self"
}
]
}
]
}
}
}
}
}
}
}
}
},
"/v2": {
"get": {
"operationId": "getVersionDetailsv2",
"summary": "Show API version details",
"responses": {
"200": {
"description": "200 response",
"content": {
"application/json": {
"examples": {
"foo": {
"value": {
"version": {
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"media-types": [
{
"base": "application/xml",
"type": "application/vnd.openstack.compute+xml;version=2"
},
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2"
}
],
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
"type": "application/pdf",
"rel": "describedby"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby"
}
]
}
}
}
}
}
}
},
"203": {
"description": "203 response",
"content": {
"application/json": {
"examples": {
"foo": {
"value": {
"version": {
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"media-types": [
{
"base": "application/xml",
"type": "application/vnd.openstack.compute+xml;version=2"
},
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2"
}
],
"id": "v2.0",
"links": [
{
"href": "http://23.253.228.211:8774/v2/",
"rel": "self"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
"type": "application/pdf",
"rel": "describedby"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby"
}
]
}
}
}
}
}
}
}
}
}
}
}
}

View File

@@ -4,7 +4,8 @@ target_sources( ${PROJECT_NAME}
PRIVATE
register_types.cpp
register_types.h
steam_audio.cpp
steam_audio.h
)
target_include_directories( ${PROJECT_NAME}

View File

@@ -4,27 +4,28 @@
using namespace godot;
void register_steam_audio_types() {
ClassDB::register_class<SteamAudio>();
void initialize_steam_audio(ModuleInitializationLevel p_level) {
if (p_level!=MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
}
GDREGISTER_CLASS(SteamAudio);
}
void uninitialize_steam_audio(ModuleInitializationLevel p_level) {
if (p_level!=MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
}
extern "C" GDE_EXPORT GDExtensionBool godot_steam_audio_init(
GDExtensionInterfaceGetProcAddress p_get_proc_address,
GDExtensionClassLibraryPtr p_library,
GDExtensionInitialization *p_initialization
) {
// Create the InitObject that drives registration.
GDExtensionBinding::InitObject init_obj{ p_get_proc_address, p_library, p_initialization };
}
// 1) Hook up your initializer
init_obj.register_initializer( register_steam_audio_types );
extern "C" {
// Initialization.
GDExtensionBool GDE_EXPORT steam_audio_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
// 2) Hook up your terminator (must match the expected callback signature)
init_obj.register_terminator( [](ModuleInitializationLevel level) {} );
// 3) Choose the minimum init level (common choices: SCENE, EDITOR, etc.)
init_obj.register_initializer(initialize_steam_audio);
init_obj.register_terminator(uninitialize_steam_audio);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
// 4) Actually perform the registrations
return init_obj.init();
}
}

View File

@@ -3,18 +3,9 @@
//
#pragma once
#include <godot_cpp/godot.hpp>
#include <godot_cpp/core/binder_common.hpp>
#include <godot_cpp/core/class_db.hpp> // for ClassDB
using namespace godot;
// Called by the InitObject below to register your SteamAudio class.
void register_steam_audio_types();
// This is the exact symbol Godot will look up in your DLL.
extern "C" GDE_EXPORT GDExtensionBool godot_steam_audio_init(
GDExtensionInterfaceGetProcAddress p_get_proc_address,
GDExtensionClassLibraryPtr p_library,
GDExtensionInitialization *p_initialization
);
void initialize_steam_audio(ModuleInitializationLevel p_level);
void uninitialize_steam_audio(ModuleInitializationLevel p_level);

View File

@@ -10,14 +10,16 @@ using namespace godot;
{
if (context)
{
steam_audio_release_context(context);
iplContextRelease(&context);
context=nullptr;
}
}
void SteamAudio::_bind_methods()
{
void SteamAudio::_bind_methods() {
ClassDB::bind_method(D_METHOD("initialize"), &SteamAudio::initialize);
}
SteamAudio::SteamAudio() = default;
bool SteamAudio::initialize()
{
IPLContextSettings settings{};

View File

@@ -12,15 +12,16 @@
using namespace godot;
class SteamAudio : RefCounted
class SteamAudio : public RefCounted
{
GDCLASS( SteamAudio,RefCounted );
GDCLASS( SteamAudio,RefCounted ) // NOLINT(readability-use-auto)
private:
IPLContext context = nullptr;
protected:
static void _bind_methods();
public:
SteamAudio();
~SteamAudio();
~SteamAudio() override;
bool initialize();
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
support_files/lib/ios/libphonon.a LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>22G630</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>phonon</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string></string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>14.2</string>
<key>DTSDKBuild</key>
<string>23C53</string>
<key>DTSDKName</key>
<string>macosx14.2</string>
<key>DTXcode</key>
<string>1520</string>
<key>DTXcodeBuild</key>
<string>15C500b</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
</dict>
</plist>

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

View File

@@ -1,5 +1,5 @@
[configuration]
entry_symbol = "GDExtensionInit"
entry_symbol = "steam_audio_library_init"
compatibility_minimum = 4.1
[icons]