Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
emcmake cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release
echo "Note: Tests are automatically disabled for Emscripten builds due to testcoe compatibility issues"
echo "Note: Tests disabled for Emscripten due to testcoe/backward-cpp unwind conflicts"
shell: bash

- name: Build WebAssembly artifacts
Expand All @@ -82,14 +82,14 @@ jobs:
# Validate soundcoe library was built
SOUNDCOE_LIB=$(find . -name "libsoundcoe.a" -type f)
if [ -n "$SOUNDCOE_LIB" ]; then
echo "soundcoe library built successfully at: $SOUNDCOE_LIB"
echo "soundcoe library built successfully at: $SOUNDCOE_LIB"
else
echo "soundcoe library missing"
echo "soundcoe library missing"
exit 1
fi

echo "WebAssembly build validation completed"
echo "Note: Tests are disabled for Emscripten due to testcoe compatibility issues"
echo "WebAssembly build validation completed"
echo "Note: Tests disabled for Emscripten due to testcoe/backward-cpp unwind conflicts"
shell: bash


31 changes: 20 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
include(cmake/soundcoe_config.cmake)

message(STATUS "[soundcoe] Fetching OpenAL-Soft from source...")

FetchContent_Declare(
openal
GIT_REPOSITORY https://github.com/kcat/openal-soft.git
GIT_TAG 1.24.3
)

configure_openal()
FetchContent_MakeAvailable(openal)
ignore_external_warnings(OpenAL)
find_package(Threads REQUIRED)

# Configure OpenAL: Use Emscripten's built-in OpenAL or fetch OpenAL-Soft
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
message(STATUS "[soundcoe] Using Emscripten's built-in OpenAL implementation")
# Emscripten provides its own OpenAL implementation via -lopenal linker flag
# No need to fetch or configure OpenAL-Soft
else()
message(STATUS "[soundcoe] Fetching OpenAL-Soft from source...")

FetchContent_Declare(
openal
GIT_REPOSITORY https://github.com/kcat/openal-soft.git
GIT_TAG 1.24.3
)

configure_openal()
FetchContent_MakeAvailable(openal)
ignore_external_warnings(OpenAL)
endif()

message(STATUS "[soundcoe] Fetching logcoe from source...")

Expand Down
16 changes: 1 addition & 15 deletions cmake/openal_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,7 @@ endfunction()

# Configure OpenAL-Soft based on target platform
function(configure_openal_for_platform)
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
# ================================================================
# Emscripten/Web Build - Use Emscripten's built-in OpenAL
# ================================================================
message(STATUS "[soundcoe] Configuring OpenAL-Soft for Emscripten/Web build")

# Disable tests for web builds due to testcoe incompatibility with Emscripten
set(SOUNDCOE_BUILD_TESTS OFF CACHE BOOL "Tests disabled for Emscripten" FORCE)
message(STATUS "[soundcoe] Tests disabled for Emscripten due to testcoe compatibility issues")

# Disable ALL native backends except NULL backend
disable_all_backends_except("NULL")
disable_all_require_flags()

elseif(WIN32)
if(WIN32)
# ================================================================
# Windows Build
# ================================================================
Expand Down
25 changes: 19 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ target_include_directories(soundcoe
${CMAKE_CURRENT_SOURCE_DIR}/../external
)

target_link_libraries(soundcoe
PUBLIC
soundcoe_headers
OpenAL
logcoe
)
# Link libraries based on platform
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
target_link_libraries(soundcoe
PUBLIC
soundcoe_headers
logcoe
Threads::Threads
)
# Link with Emscripten's built-in OpenAL implementation
target_link_options(soundcoe PUBLIC -lopenal)
else()
target_link_libraries(soundcoe
PUBLIC
soundcoe_headers
OpenAL
logcoe
Threads::Threads
)
endif()
Loading