Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 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
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,57 @@ jobs:
cxx: clang++
type: static
backend: JavaScriptCore
javascriptcore_version: "4.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=4.0
- os: ubuntu-latest
cc: gcc
cxx: g++
type: static
backend: JavaScriptCore
javascriptcore_version: "4.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=4.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could not use javascriptcore_version to set DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION later.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my latest commit, we could do it like that... but then it ends up being specified (as empty) for non-linux ci runs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, you're right.

Do you prefer to revert then?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean it being empty on non-linux isn't really an issue... since the FindJavaScriptCore.cmake just ignores this on macos anyway. although we might want to check that it's not set and warn otherwise

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any idea why the asan would fail here? i think nothing should have changed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey I already experienced weird stuff with ASAN: https://bugs.webkit.org/show_bug.cgi?id=269791

- os: ubuntu-latest
cc: clang
cxx: clang++
type: shared
backend: JavaScriptCore
javascriptcore_version: "4.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=4.0
- os: ubuntu-latest
cc: gcc
cxx: g++
type: shared
backend: JavaScriptCore
javascriptcore_version: "4.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=4.0
- os: ubuntu-latest
cc: clang
cxx: clang++
type: static
backend: JavaScriptCore
javascriptcore_version: "6.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=6.0
- os: ubuntu-latest
cc: gcc
cxx: g++
type: static
backend: JavaScriptCore
javascriptcore_version: "6.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=6.0
- os: ubuntu-latest
cc: clang
cxx: clang++
type: shared
backend: JavaScriptCore
javascriptcore_version: "6.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=6.0
- os: ubuntu-latest
cc: gcc
cxx: g++
type: shared
backend: JavaScriptCore
javascriptcore_version: "6.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=6.0

# Sanitizers
- os: ubuntu-latest
Expand All @@ -54,12 +90,16 @@ jobs:
type: static
options: -DINCLUDEJS_ADDRESS_SANITIZER:BOOL=ON
backend: JavaScriptCore
javascriptcore_version: "6.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=4.1
- os: ubuntu-latest
cc: clang
cxx: clang++
type: static
options: -DINCLUDEJS_UNDEFINED_SANITIZER:BOOL=ON
backend: JavaScriptCore
javascriptcore_version: "6.0"
options: -DINCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION:STRING=4.1
- os: macos-latest
cc: clang
cxx: clang++
Expand All @@ -82,7 +122,7 @@ jobs:
if: runner.os == 'linux'
run: |
sudo apt-get update --yes
sudo apt-get install --yes clang-format libjavascriptcoregtk-4.0-dev
sudo apt-get install --yes clang-format libjavascriptcoregtk-${{ matrix.platform.javascriptcore_version }}-dev

# See https://github.com/actions/runner-images/issues/8659
- name: Workaround Clang issue (GNU/Linux)
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(CMAKE_CXX_STANDARD 17)

# Options
set(INCLUDEJS_BACKEND "JavaScriptCore" CACHE STRING "The IncludeJS Engine backend")
set(INCLUDEJS_BACKEND_JAVASCRIPTCORE_API_VERSION "" CACHE STRING "Build IncludeJS against a specific version of JavaScriptCore (empty means no preference)")
option(INCLUDEJS_ENGINE "Build the IncludeJS engine library" ON)
option(INCLUDEJS_TESTS "Build the IncludeJS tests" OFF)
option(INCLUDEJS_DOCS "Build the IncludeJS docs" OFF)
Expand Down
1 change: 1 addition & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendorpull https://github.com/sourcemeta/vendorpull 70342aaf458e6cb80baeb5b718901075fc42ede6
noa https://github.com/sourcemeta/noa 9da0f1877859f60e439e31856cd4ef5fd4ca6063
googletest https://github.com/google/googletest 987e225614755fec7253aa95bf959c09e0d380d7
webkitgtk https://github.com/WebKit/WebKit webkitgtk-2.43.4
35 changes: 34 additions & 1 deletion cmake/FindJavaScriptCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@ if(NOT JavaScriptCore_FOUND)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_library(javascript_core INTERFACE IMPORTED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JAVASCRIPTCORE REQUIRED javascriptcoregtk-4.0)

# If find_package(JavaScriptCore [version]) is called we only look for that
# otherwise loop through a list of supported options, pick the first one found
# and error out if there is no match
if(JavaScriptCore_FIND_VERSION)
pkg_check_modules(JAVASCRIPTCORE javascriptcoregtk-${JavaScriptCore_FIND_VERSION} REQUIRED)
else()
set(supported_versions 6.0 4.1 4.0)
foreach(ver ${supported_versions})
pkg_check_modules(JAVASCRIPTCORE javascriptcoregtk-${ver})
if(JAVASCRIPTCORE_FOUND)
set(JavaScriptCore_FIND_VERSION ${ver})
break()
endif()
endforeach()
if(NOT JAVASCRIPTCORE_FOUND)
message(FATAL_ERROR "Required package JavaScriptCore was not found")
endif()
endif()

set_property(TARGET javascript_core PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${JAVASCRIPTCORE_INCLUDE_DIRS})
set_property(TARGET javascript_core PROPERTY
Expand All @@ -17,6 +36,20 @@ if(NOT JavaScriptCore_FOUND)
INTERFACE_LINK_OPTIONS ${JAVASCRIPTCORE_LDFLAGS})
set_property(TARGET javascript_core PROPERTY
INTERFACE_LINK_LIBRARIES ${JAVASCRIPTCORE_LINK_LIBRARIES})

if(JavaScriptCore_FIND_VERSION STREQUAL "6.0")
# NOTE: this is required since WebkitGTK (which includes JavaScriptCore) only
# exposes the GLib headers starting in versions after 4.0
# see: https://github.com/WebKit/WebKit/blob/main/Source/WebKit/gtk/migrating-to-webkitgtk-6.0.md#stop-using-deprecated-apis
FILE(GLOB headers ${PROJECT_SOURCE_DIR}/vendor/webkitgtk/Source/JavaScriptCore/API/*.h)
FOREACH(header ${headers})
cmake_path(GET header FILENAME header_filename)
configure_file("${header}" "${PROJECT_BINARY_DIR}/javascriptcore-headers/JavaScriptCore/${header_filename}" COPYONLY)
ENDFOREACH()
set_property(TARGET javascript_core PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_BINARY_DIR}/javascriptcore-headers")
endif()

add_library(JavaScriptCore::JavaScriptCore ALIAS javascript_core)
set(JavaScriptCore_FOUND ON)
endif()
Expand Down
202 changes: 202 additions & 0 deletions vendor/webkitgtk.mask

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading