Skip to content

Commit 0041916

Browse files
author
amalxloop
committed
Fix CI linker errors: Vulkan undefined symbols, WASM duplicate symbols
- Compile sc_backend_vulkan.h alongside test_gfx.c to provide Vulkan function definitions at link time - Guard _IMPLEMENTATION defines in stock_dashboard.c with SC_NO_IMPLEMENTATION - Set SC_NO_IMPLEMENTATION per-source property for stock_dashboard.c in WASM build, preventing symbol duplication with the unity TU
1 parent e2dd1e1 commit 0041916

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ jobs:
4040
-Wall -Wextra -Wpedantic -Wshadow
4141
- name: Build and run Vulkan headless test
4242
run: |
43-
clang -I include -I tools -DSC_GFX_IMPLEMENTATION \
43+
clang -I include -I tools -I backends \
44+
-DSC_GFX_IMPLEMENTATION \
4445
-DSC_GFX_BACKEND_VULKAN -DSC_BACKEND_VULKAN_IMPLEMENTATION \
4546
-DSC_LAYOUT_IMPLEMENTATION -DSC_WIDGET_IMPLEMENTATION \
4647
-DSC_RUNTIME_IMPLEMENTATION -DSC_FONT_IMPLEMENTATION \
4748
-Wall -Wextra -Wpedantic -Wshadow \
48-
tests/test_gfx.c -lm -lvulkan -o /tmp/test_vk
49+
-x c backends/sc_backend_vulkan.h tests/test_gfx.c \
50+
-lm -lvulkan -o /tmp/test_vk
4951
/tmp/test_vk
5052
5153
wasm:

apps/stock_dashboard/stock_dashboard.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
* stock_dashboard.c -o stock_dashboard -lm
3232
*/
3333

34+
#ifndef SC_NO_IMPLEMENTATION
3435
#define SC_GFX_IMPLEMENTATION
3536
#define SC_LAYOUT_IMPLEMENTATION
3637
#define SC_WIDGET_IMPLEMENTATION
3738
#define SC_RUNTIME_IMPLEMENTATION
3839
#define SC_FONT_IMPLEMENTATION
3940
#define SC_GFX_BACKEND_SOFTWARE
41+
#endif
4042

4143
#include "../../include/sc_types.h"
4244
#include "../../include/sc_math.h"

tools/wasm/CMakeLists.wasm.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ target_include_directories(silvercore_wasm PRIVATE
9696
${CMAKE_SOURCE_DIR}/tools
9797
)
9898

99+
# stock_dashboard.c has its own _IMPLEMENTATION defines; suppress them
100+
# when compiling as part of the unity build to avoid duplicate symbols.
101+
set_source_files_properties(${CMAKE_SOURCE_DIR}/apps/stock_dashboard/stock_dashboard.c
102+
PROPERTIES COMPILE_DEFINITIONS "SC_NO_IMPLEMENTATION"
103+
)
104+
99105
set_target_properties(silvercore_wasm PROPERTIES
100106
OUTPUT_NAME "silvercore"
101107
SUFFIX ".js"

0 commit comments

Comments
 (0)