diff --git a/.clang-format b/.clang-format index 7692847..4472f00 100644 --- a/.clang-format +++ b/.clang-format @@ -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 -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 +AlwaysBreakTemplateDeclarations: Yes +BraceWrapping: + 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: '.*' +IncludeCategories: + - 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 +... diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..82a3526 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aac251..149faca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,164 +1,194 @@ # SPDX-License-Identifier: Unlicense -cmake_minimum_required( VERSION 3.22 ) +cmake_minimum_required(VERSION 3.22) -message( STATUS "Using CMake ${CMAKE_VERSION}" ) +# 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." ) +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 -list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ) +# 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 ) - -# Output compile commands to compile_commands.json (for debugging CMake issues) -set( CMAKE_EXPORT_COMPILE_COMMANDS ON ) - -# Build universal lib on macOS -# Note that CMAKE_OSX_ARCHITECTURES must be set before project(). -if ( APPLE ) - set( CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "" ) +# 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() -# Main project information -project( SteamAudioGodot - LANGUAGES - CXX - VERSION - 0.1.0 +# Output compile commands for editor integration +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Build universal library on macOS +if(APPLE) + set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "") +endif() + +# Project definition +project(SteamAudioGodot + VERSION 0.1.0 + LANGUAGES CXX ) -# Create our library -add_library( ${PROJECT_NAME} SHARED ) +# 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). -set( LIB_ARCH ${CMAKE_SYSTEM_PROCESSOR} ) -if ( APPLE ) - set( LIB_ARCH "universal" ) +# 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" -set( LIB_DIR "lib/${CMAKE_SYSTEM_NAME}-${LIB_ARCH}" ) +# 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}") -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) -set( BUILD_OUTPUT_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/" ) - -set_target_properties( ${PROJECT_NAME} - PROPERTIES - CXX_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN true +# Output directories for built library +set(BUILD_OUTPUT_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/") +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 ) -if( NOT DEFINED CMAKE_DEBUG_POSTFIX ) - set_target_properties( ${PROJECT_NAME} - PROPERTIES - DEBUG_POSTFIX "-d" - ) +# Append debug postfix if needed +if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + 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 - COMMAND ${CMAKE_COMMAND} -E copy_directory - "${CMAKE_SOURCE_DIR}/support_files" - ${BUILD_OUTPUT_DIR} +# (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/icons" + "${BUILD_OUTPUT_DIR}/icons" ) -# Warnings -include( CompilerWarnings ) +# Build source files +add_subdirectory(src) -# Create and include version info file from git -include( GitVersionInfo ) +# ───────────────────────────────────────────────────────────────────────────── +# Stage Steam Audio runtimes alongside the built GDExtension +# ───────────────────────────────────────────────────────────────────────────── -add_subdirectory( src ) - -set(STEAMAUDIO_SDK_ROOT "${CMAKE_SOURCE_DIR}/extern/steam-audio") - -target_include_directories(${PROJECT_NAME} - PRIVATE - ${STEAMAUDIO_SDK_ROOT}/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}/" ) - -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 -) - -add_subdirectory( templates ) - -# ccache -# Turns on ccache if found -include( ccache ) - -# Formatting -# Adds a custom target to format all the code at once -include( ClangFormat ) - -# godot-cpp -# From here: https://github.com/godotengine/godot-cpp -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." - ) +# 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() -set( GODOT_CPP_SYSTEM_HEADERS ON CACHE BOOL "" FORCE ) +# 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 "$") -add_subdirectory( extern/godot-cpp ) - -set_target_properties( godot-cpp - PROPERTIES - CXX_VISIBILITY_PRESET hidden # visibility needs to be the same as the main library +# 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}" ) -target_link_libraries( ${PROJECT_NAME} - PRIVATE +# 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 +) + +# Installation setup +set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/install/${PROJECT_NAME}/") +message(STATUS "Install directory: ${INSTALL_DIR}") +install(TARGETS ${PROJECT_NAME} + 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 integration +include(ccache) + +# 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 bindings +if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/extern/godot-cpp/Makefile") + 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) + +# 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 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" - "$" -) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 23b36b2..a008be2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -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}", diff --git a/Writerside/topics/openAPIspec/API_Reference.topic b/Writerside/topics/openAPIspec/API_Reference.topic new file mode 100644 index 0000000..586298c --- /dev/null +++ b/Writerside/topics/openAPIspec/API_Reference.topic @@ -0,0 +1,9 @@ + + + + +

Start typing here...

+
\ No newline at end of file diff --git a/Writerside/topics/openAPIspec/List_API_versions.topic b/Writerside/topics/openAPIspec/List_API_versions.topic new file mode 100644 index 0000000..209edc5 --- /dev/null +++ b/Writerside/topics/openAPIspec/List_API_versions.topic @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/Writerside/topics/openAPIspec/Show_API_version_details.topic b/Writerside/topics/openAPIspec/Show_API_version_details.topic new file mode 100644 index 0000000..5bd5d68 --- /dev/null +++ b/Writerside/topics/openAPIspec/Show_API_version_details.topic @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/install/SteamAudioGodot/SteamAudioGodot.gdextension b/install/SteamAudioGodot/SteamAudioGodot.gdextension new file mode 100644 index 0000000..0d737af --- /dev/null +++ b/install/SteamAudioGodot/SteamAudioGodot.gdextension @@ -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" diff --git a/openAPIspec.json b/openAPIspec.json new file mode 100644 index 0000000..4b82072 --- /dev/null +++ b/openAPIspec.json @@ -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" + } + ] + } + } + } + } + } + } + } + } + } + } + } +} + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 33f0f3f..8db3685 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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} diff --git a/src/register_types.cpp b/src/register_types.cpp index 9b73df0..4827a6d 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -4,27 +4,28 @@ using namespace godot; -void register_steam_audio_types() { - ClassDB::register_class(); +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 }; +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); - // 1) Hook up your initializer - init_obj.register_initializer( register_steam_audio_types ); + 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); - // 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.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); - - // 4) Actually perform the registrations - return init_obj.init(); -} + return init_obj.init(); + } +} \ No newline at end of file diff --git a/src/register_types.h b/src/register_types.h index b498ed4..ad76b8b 100644 --- a/src/register_types.h +++ b/src/register_types.h @@ -3,18 +3,9 @@ // #pragma once -#include -#include #include // 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 -); \ No newline at end of file +void initialize_steam_audio(ModuleInitializationLevel p_level); +void uninitialize_steam_audio(ModuleInitializationLevel p_level); \ No newline at end of file diff --git a/src/steam_audio.cpp b/src/steam_audio.cpp index 7cc928f..62a4774 100644 --- a/src/steam_audio.cpp +++ b/src/steam_audio.cpp @@ -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{}; diff --git a/src/steam_audio.h b/src/steam_audio.h index bc4c5f5..2a12657 100644 --- a/src/steam_audio.h +++ b/src/steam_audio.h @@ -7,20 +7,21 @@ #include #include #include -#include -#include +#include +#include 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(); }; \ No newline at end of file diff --git a/support_files/lib/android-armv7/libphonon.so b/support_files/lib/android-armv7/libphonon.so new file mode 100644 index 0000000..f2d57b8 --- /dev/null +++ b/support_files/lib/android-armv7/libphonon.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d27263d048ac69aac629b327c88f13e4d2629a9e7ec31fdfdd42ebf3b052e318 +size 18427692 diff --git a/support_files/lib/android-armv8/libphonon.so b/support_files/lib/android-armv8/libphonon.so new file mode 100644 index 0000000..e251e70 --- /dev/null +++ b/support_files/lib/android-armv8/libphonon.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15204154edb198aa6ebbb19df24e805c335af3c97019ccace67599d51a174f2e +size 20990312 diff --git a/support_files/lib/android-x64/libphonon.so b/support_files/lib/android-x64/libphonon.so new file mode 100644 index 0000000..673c22c --- /dev/null +++ b/support_files/lib/android-x64/libphonon.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94c8abd4bfe3d7689e959ee6bcd8407d9c7b081431f59f7a06f05f39b03ba43d +size 20455128 diff --git a/support_files/lib/android-x86/libphonon.so b/support_files/lib/android-x86/libphonon.so new file mode 100644 index 0000000..6338d66 --- /dev/null +++ b/support_files/lib/android-x86/libphonon.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27561892cd5cd577f32c45bfd40103d6c8f7a9f9b4ee5a44b03ef76734a52542 +size 18245420 diff --git a/support_files/lib/ios/libphonon.a b/support_files/lib/ios/libphonon.a new file mode 100644 index 0000000..04d847b --- /dev/null +++ b/support_files/lib/ios/libphonon.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3fae84e65c316c225968695b8844109d4c3488b16c47fd5a093d5bfc221c725 +size 7327480 diff --git a/support_files/lib/linux-x64/libphonon.so b/support_files/lib/linux-x64/libphonon.so new file mode 100644 index 0000000..e9a573e --- /dev/null +++ b/support_files/lib/linux-x64/libphonon.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2681a885655bb9c75d5d28b4e2ac2a2600bb3382a3aad1e17ac0cfc5ec5b4d2 +size 20858832 diff --git a/support_files/lib/linux-x86/libphonon.so b/support_files/lib/linux-x86/libphonon.so new file mode 100644 index 0000000..19e7000 --- /dev/null +++ b/support_files/lib/linux-x86/libphonon.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2e9a467a802675ae142e31f1dfc4ed8e4fcd433201d495d36c8b7e3543a60bd +size 17566428 diff --git a/support_files/lib/osx/libphonon.dylib b/support_files/lib/osx/libphonon.dylib new file mode 100644 index 0000000..cc6bb60 --- /dev/null +++ b/support_files/lib/osx/libphonon.dylib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b11800f94323aaec6918c4bced0b5366c7c0646a47c4f8ed9e530e4adf3b3e98 +size 27119584 diff --git a/support_files/lib/osx/phonon.bundle/Contents/Info.plist b/support_files/lib/osx/phonon.bundle/Contents/Info.plist new file mode 100644 index 0000000..c7dd686 --- /dev/null +++ b/support_files/lib/osx/phonon.bundle/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + BuildMachineOSBuild + 22G630 + CFBundleDevelopmentRegion + English + CFBundleExecutable + phonon + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CSResourcesFileMapped + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + + DTPlatformName + macosx + DTPlatformVersion + 14.2 + DTSDKBuild + 23C53 + DTSDKName + macosx14.2 + DTXcode + 1520 + DTXcodeBuild + 15C500b + LSMinimumSystemVersion + 10.13 + + diff --git a/support_files/lib/osx/phonon.bundle/Contents/MacOS/phonon b/support_files/lib/osx/phonon.bundle/Contents/MacOS/phonon new file mode 100644 index 0000000..303b52a Binary files /dev/null and b/support_files/lib/osx/phonon.bundle/Contents/MacOS/phonon differ diff --git a/support_files/lib/osx/phonon.bundle/Contents/_CodeSignature/CodeResources b/support_files/lib/osx/phonon.bundle/Contents/_CodeSignature/CodeResources new file mode 100644 index 0000000..d5d0fd7 --- /dev/null +++ b/support_files/lib/osx/phonon.bundle/Contents/_CodeSignature/CodeResources @@ -0,0 +1,115 @@ + + + + + files + + files2 + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/support_files/lib/wasm/libphonon.a b/support_files/lib/wasm/libphonon.a new file mode 100644 index 0000000..0d77871 --- /dev/null +++ b/support_files/lib/wasm/libphonon.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65a0bdf74293a4f1afc7f9e2559ccd255be6760119e411f3fec4a43dadee8417 +size 6992144 diff --git a/templates/template.debug.gdextension.in b/templates/template.debug.gdextension.in index 42c0811..ec98548 100644 --- a/templates/template.debug.gdextension.in +++ b/templates/template.debug.gdextension.in @@ -1,5 +1,5 @@ [configuration] -entry_symbol = "GDExtensionInit" +entry_symbol = "steam_audio_library_init" compatibility_minimum = 4.1 [icons]