Skip to content

Commit

Permalink
Run macos CI with V8_ENABLE_SANDBOX option (#199)
Browse files Browse the repository at this point in the history
* add `V8_ENABLE_SANDBOX=0` CMake option to use with v8 includes explicitly as a preprocessor define
* macos CI run with `V8_ENABLE_SANDBOX=1` because v8 library in brew has this option turned on
  • Loading branch information
pmed authored Oct 16, 2023
1 parent fa7f72a commit c07e195
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ jobs:
build_type: [ Release ]
shared_lib: [ false, true ]
header_only: [ false, true ]
v8_compress_pointers: [ false, true ]
exclude:
include:
- os: ubuntu-latest
v8_compress_pointers: true
- os: macos-latest
v8_compress_pointers: false
v8_enable_sandbox: false
- os: macos-latest
v8_compress_pointers: true
v8_enable_sandbox: true
- os: windows-latest
v8_compress_pointers: false
v8_compress_pointers: true
v8_enable_sandbox: false

runs-on: ${{matrix.os}}

name: '${{matrix.os}} ${{matrix.build_type}} shared_lib=${{matrix.shared_lib}} header_only=${{matrix.header_only}} v8_compress_pointers=${{matrix.v8_compress_pointers}}'
name: '${{matrix.os}} ${{matrix.build_type}} shared_lib=${{matrix.shared_lib}} header_only=${{matrix.header_only}} v8_compress_pointers=${{matrix.v8_compress_pointers}} v8_enable_sandbox=${{matrix.v8_enable_sandbox}}'

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -47,7 +49,7 @@ jobs:
uses: seanmiddleditch/gha-setup-ninja@v3

- name: Configure CMake
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=${{matrix.shared_lib}} -DV8PP_HEADER_ONLY=${{matrix.header_only}} -DV8_COMPRESS_POINTERS=${{matrix.v8_compress_pointers}}
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_TESTING=TRUE -DBUILD_SHARED_LIBS=${{matrix.shared_lib}} -DV8PP_HEADER_ONLY=${{matrix.header_only}} -DV8_COMPRESS_POINTERS=${{matrix.v8_compress_pointers}} -DV8_ENABLE_SANDBOX=${{matrix.v8_enable_sandbox}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(V8PP_ISOLATE_DATA_SLOT 0 CACHE STRING "v8::Isolate data slot number, used in
set(V8PP_PLUGIN_INIT_PROC_NAME "v8pp_module_init" CACHE STRING "v8pp plugin initialization procedure name")
set(V8PP_PLUGIN_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX} CACHE STRING "v8pp plugin filename suffix")
set(V8_COMPRESS_POINTERS 1 CACHE BOOL "Use new V8 ABI with V8_COMPRESS_POINTERS and V8_31BIT_SMIS_ON_64BIT_ARCH")
set(V8_ENABLE_SANDBOX 0 CACHE BOOL "Enable sandoxing in V8")

if(BUILD_SHARED_LIBS AND WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true)
Expand Down
6 changes: 5 additions & 1 deletion v8pp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ endif()
configure_file(config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/config.hpp)

if(V8_COMPRESS_POINTERS)
set(V8PP_DEFINES V8_COMPRESS_POINTERS V8_31BIT_SMIS_ON_64BIT_ARCH)
list(APPEND V8PP_DEFINES V8_COMPRESS_POINTERS V8_31BIT_SMIS_ON_64BIT_ARCH)
endif()

if (V8_ENABLE_SANDBOX)
list(APPEND V8PP_DEFINES V8_ENABLE_SANDBOX)
endif()

set(V8PP_HEADERS
Expand Down
3 changes: 3 additions & 0 deletions v8pp/version.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ V8PP_IMPL char const* build_options()
#endif
#ifdef V8_COMPRESS_POINTERS
STR(V8_COMPRESS_POINTERS)
#endif
#ifdef V8_ENABLE_SANDBOX
STR(V8_ENABLE_SANDBOX)
#endif
;
#undef STR
Expand Down

0 comments on commit c07e195

Please sign in to comment.