Skip to content

Commit ff590e9

Browse files
fix(cmake): fix include paths for local WebKit (#25815)
### What does this PR do? Without this change, building with `-DWEBKIT_LOCAL=ON` fails with: ``` /work/bun/src/bun.js/bindings/BunObject.cpp:12:10: fatal error: 'JavaScriptCore/JSBase.h' file not found 12 | #include <JavaScriptCore/JSBase.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ``` The reason for this is because the directory structure differs between downloaded and local WebKit. Downloaded WebKit: ``` build/debug/cache/webkit-6d0f3aac0b817cc0/ └── include/ └── JavaScriptCore/ └── JSBase.h ← Direct path ``` Local WebKit: ``` vendor/WebKit/WebKitBuild/Debug/ └── JavaScriptCore/Headers/ └── JavaScriptCore/ └── JSBase.h ← Nested path ``` The include paths are thus configured differently for each build type. For Remote WebKit (when WEBKIT_LOCAL=OFF): - SetupWebKit.cmake line 22 sets: WEBKIT_INCLUDE_PATH = ${WEBKIT_PATH}/include - BuildBun.cmake line 1253 adds: include_directories(${WEBKIT_INCLUDE_PATH}) - This resolves to: build/debug/cache/webkit-6d0f3aac0b817cc0/include/ - So #include <JavaScriptCore/JSBase.h> finds the file at include/JavaScriptCore/JSBase.h ✅ For Local WebKit (when WEBKIT_LOCAL=ON): - The original code only added: ${WEBKIT_PATH}/JavaScriptCore/Headers/JavaScriptCore - This resolves to: vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/Headers/JavaScriptCore/ - So #include <JavaScriptCore/JSBase.h> fails because there's no JavaScriptCore/ subdirectory at that level ❌ - The fix adds: ${WEBKIT_PATH}/JavaScriptCore/Headers - Now the include path includes: vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/Headers/ - So #include <JavaScriptCore/JSBase.h> finds the file at Headers/JavaScriptCore/JSBase.h ✅ ### How did you verify your code works? Built locally. Co-authored-by: Carl Smedstad <[email protected]>
1 parent 18f242d commit ff590e9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cmake/tools/SetupWebKit.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if(WEBKIT_LOCAL)
2828
# make jsc-compile-debug jsc-copy-headers
2929
include_directories(
3030
${WEBKIT_PATH}
31+
${WEBKIT_PATH}/JavaScriptCore/Headers
3132
${WEBKIT_PATH}/JavaScriptCore/Headers/JavaScriptCore
3233
${WEBKIT_PATH}/JavaScriptCore/PrivateHeaders
3334
${WEBKIT_PATH}/bmalloc/Headers

0 commit comments

Comments
 (0)