@auto_js/v8_exports 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +62 -48
- package/package.json +1 -1
- package/{version.h → v8/version.h} +6 -0
- package/v8.cc +1 -13
package/CMakeLists.txt
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# Library name: google_v8, or nodejs_v8
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
set(TARGET_NAME "nodejs_v8")
|
|
5
|
-
elseif(PACKAGE_NAME STREQUAL "@isolated-vm/embedded_v8")
|
|
6
|
-
set(TARGET_NAME "google_v8")
|
|
2
|
+
if(NPM_PACKAGE_NAME STREQUAL @auto_js/isolated_v8_exports)
|
|
3
|
+
set(google_v8 embedded_v8)
|
|
7
4
|
else()
|
|
8
|
-
|
|
5
|
+
set(google_v8 nodejs_v8)
|
|
9
6
|
endif()
|
|
10
|
-
add_library(
|
|
7
|
+
add_library(${google_v8} STATIC)
|
|
8
|
+
set_npm_package_properties(@auto_js/v8_exports google_v8)
|
|
9
|
+
target_compile_features(${google_v8} PUBLIC cxx_std_23)
|
|
11
10
|
|
|
12
|
-
if(
|
|
11
|
+
if(NPM_PACKAGE_NAME STREQUAL @auto_js/isolated_v8_exports)
|
|
13
12
|
# Header files (embedded)
|
|
14
13
|
if(NOT DEFINED V8_INCLUDE_DIR)
|
|
15
14
|
set(V8_INCLUDE_DIR "$ENV{V8_BUNDLE_PATH}/../include")
|
|
@@ -33,6 +32,10 @@ if(TARGET_NAME STREQUAL "google_v8")
|
|
|
33
32
|
message(FATAL_ERROR "Missing v8-gn.h")
|
|
34
33
|
endif()
|
|
35
34
|
message(STATUS "Using v8-gn.h from '${V8_INCLUDE_GN_FILE}'")
|
|
35
|
+
target_compile_options(${google_v8} PRIVATE -include "${V8_INCLUDE_GN_FILE}")
|
|
36
|
+
|
|
37
|
+
# Include deeper v8 headers not provided by nodejs
|
|
38
|
+
target_compile_definitions(${google_v8} PRIVATE INCLUDE_V8_PLATFORM)
|
|
36
39
|
|
|
37
40
|
# v8 pre-built library
|
|
38
41
|
if(NOT DEFINED V8_LIBRARY_PATH)
|
|
@@ -53,68 +56,79 @@ if(TARGET_NAME STREQUAL "google_v8")
|
|
|
53
56
|
message(STATUS "Using v8 library type '${V8_LIBRARY_TYPE}'")
|
|
54
57
|
|
|
55
58
|
# Preprocessor macros which enable dual v8 in the same process
|
|
59
|
+
if(NOT DEFINED V8_TRICKSHOT)
|
|
60
|
+
if(DEFINED ENV{V8_TRICKSHOT})
|
|
61
|
+
set(V8_TRICKSHOT "$ENV{V8_TRICKSHOT}" CACHE STRING "")
|
|
62
|
+
else()
|
|
63
|
+
# nb: For older bundles where it was not defined
|
|
64
|
+
set(V8_TRICKSHOT blam)
|
|
65
|
+
endif()
|
|
66
|
+
endif()
|
|
56
67
|
if(V8_TRICKSHOT)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
v8=z8
|
|
68
|
+
target_compile_definitions(${google_v8} PUBLIC
|
|
69
|
+
cppgc=yppgc
|
|
70
|
+
unibrow=ynibrow
|
|
71
|
+
v8_crdtp=y8_crdtp
|
|
72
|
+
V8_Dcheck=Y8_Dcheck
|
|
73
|
+
V8_Fatal=Y8_Fatal
|
|
74
|
+
v8_inspector=y8_inspector
|
|
75
|
+
v8=y8
|
|
66
76
|
)
|
|
67
77
|
endif()
|
|
68
|
-
else()
|
|
69
|
-
# Header files (nodejs)
|
|
70
|
-
if(NOT DEFINED NODE_DIST_DIR)
|
|
71
|
-
message(FATAL_ERROR "'NODE_DIST_DIR' is not set")
|
|
72
|
-
endif()
|
|
73
|
-
set(V8_INCLUDE_DIR "${NODE_DIST_DIR}/include/node")
|
|
74
|
-
if(NOT EXISTS "${V8_INCLUDE_DIR}/v8.h")
|
|
75
|
-
message(FATAL_ERROR "Missing '${V8_INCLUDE_DIR}/v8.h'")
|
|
76
|
-
endif()
|
|
77
|
-
message(STATUS "Using v8 headers from '${V8_INCLUDE_DIR}'")
|
|
78
|
-
endif()
|
|
79
|
-
|
|
80
|
-
# version.h
|
|
81
|
-
target_include_directories("${TARGET_NAME}" SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
82
|
-
|
|
83
|
-
# v8 headers
|
|
84
|
-
target_include_directories("${TARGET_NAME}" SYSTEM PRIVATE "${V8_INCLUDE_DIR}")
|
|
85
78
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
# P3034R1 workaround for gcc
|
|
80
|
+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
81
|
+
set(v8 y8)
|
|
82
|
+
else()
|
|
83
|
+
set(v8 v8)
|
|
84
|
+
endif()
|
|
92
85
|
|
|
93
86
|
# Link against v8, which is built elsewhere
|
|
94
87
|
if(V8_LIBRARY_TYPE STREQUAL static)
|
|
95
|
-
target_link_directories(
|
|
96
|
-
target_link_libraries(
|
|
88
|
+
target_link_directories(${google_v8} PUBLIC "${V8_LIBRARY_PATH}/obj")
|
|
89
|
+
target_link_libraries(${google_v8} PRIVATE v8_monolith)
|
|
97
90
|
if(WIN32)
|
|
98
|
-
target_link_libraries(
|
|
91
|
+
target_link_libraries(${google_v8} PRIVATE dbghelp)
|
|
99
92
|
endif()
|
|
100
93
|
|
|
101
94
|
# Building v8 against libstdc++ w/ clang requires `-latomic`
|
|
102
95
|
# TODO(?): We would need to record how v8 was compiled, not which toolchain is compiling *this*
|
|
103
96
|
# project.
|
|
104
97
|
# if(GLIBCXX)
|
|
105
|
-
# target_link_libraries(google_v8
|
|
98
|
+
# target_link_libraries(google_v8 PRIVATE atomic)
|
|
106
99
|
# endif()
|
|
107
100
|
elseif(V8_LIBRARY_TYPE STREQUAL shared)
|
|
108
|
-
target_link_directories(
|
|
109
|
-
target_link_libraries(
|
|
101
|
+
target_link_directories(${google_v8} PRIVATE "${V8_LIBRARY_PATH}")
|
|
102
|
+
target_link_libraries(${google_v8} PRIVATE v8 v8_libbase v8_libplatform icuuc)
|
|
110
103
|
else()
|
|
111
104
|
message(FATAL_ERROR "Unknown v8 library type")
|
|
112
105
|
endif()
|
|
106
|
+
else()
|
|
107
|
+
set(v8 v8)
|
|
108
|
+
# Header files (nodejs)
|
|
109
|
+
if(NOT DEFINED NODE_DIST_DIR)
|
|
110
|
+
message(FATAL_ERROR "'NODE_DIST_DIR' is not set")
|
|
111
|
+
endif()
|
|
112
|
+
set(V8_INCLUDE_DIR "${NODE_DIST_DIR}/include/node")
|
|
113
|
+
if(NOT EXISTS "${V8_INCLUDE_DIR}/v8.h")
|
|
114
|
+
message(FATAL_ERROR "Missing '${V8_INCLUDE_DIR}/v8.h'")
|
|
115
|
+
endif()
|
|
116
|
+
message(STATUS "Using v8 headers from '${V8_INCLUDE_DIR}'")
|
|
113
117
|
endif()
|
|
114
118
|
|
|
115
|
-
#
|
|
119
|
+
# These need to be public, for version detection. I was hoping I could do it with constexpr but
|
|
120
|
+
# apparently not:
|
|
121
|
+
# https://github.com/llvm/llvm-project/issues/203372
|
|
122
|
+
|
|
123
|
+
# version.h
|
|
124
|
+
target_include_directories(${google_v8} SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
125
|
+
|
|
126
|
+
# v8 headers
|
|
127
|
+
target_include_directories(${google_v8} SYSTEM PUBLIC "${V8_INCLUDE_DIR}")
|
|
128
|
+
|
|
129
|
+
# Sources which may be preprocessed by `expand_def`
|
|
116
130
|
include(./PreprocessedSources.cmake)
|
|
117
|
-
target_preprocessed_sources(
|
|
131
|
+
target_preprocessed_sources(${google_v8} v8 ${v8}
|
|
118
132
|
PUBLIC FILE_SET CXX_MODULES FILES
|
|
119
133
|
v8.cc
|
|
120
134
|
)
|
package/package.json
CHANGED
|
@@ -9,3 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
// https://github.com/v8/v8/commit/4f8d4447533bc8d119048961c2f103d9875674e0
|
|
11
11
|
#define V8_HAS_NUMERIC V8_AT_LEAST(11, 7, 352)
|
|
12
|
+
|
|
13
|
+
// e1aadd4b3ec
|
|
14
|
+
#define V8_HAS_TAGGED_EXTERNAL V8_AT_LEAST(14, 3, 30)
|
|
15
|
+
|
|
16
|
+
// 7f7b4b9e4c8
|
|
17
|
+
#define V8_HAS_CONTEXT_FREE_FIXED_ARRAY V8_AT_LEAST(14, 4, 111)
|
package/v8.cc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module;
|
|
2
2
|
#include "v8.h"
|
|
3
|
-
#include "version.h"
|
|
3
|
+
#include "v8/version.h"
|
|
4
4
|
#ifdef INCLUDE_V8_PLATFORM
|
|
5
5
|
#include "libplatform/libplatform.h"
|
|
6
6
|
#include "v8-platform.h"
|
|
@@ -140,25 +140,13 @@ using v8::AccessCheckCallback;
|
|
|
140
140
|
using v8::ConstructorBehavior;
|
|
141
141
|
using v8::DictionaryTemplate;
|
|
142
142
|
using v8::FunctionTemplate;
|
|
143
|
-
using v8::GenericNamedPropertyDefinerCallback;
|
|
144
|
-
using v8::GenericNamedPropertyDeleterCallback;
|
|
145
|
-
using v8::GenericNamedPropertyDescriptorCallback;
|
|
146
|
-
using v8::GenericNamedPropertyEnumeratorCallback;
|
|
147
|
-
using v8::GenericNamedPropertyQueryCallback;
|
|
148
|
-
using v8::GenericNamedPropertySetterCallback;
|
|
149
|
-
using v8::IndexedPropertyDefinerCallback;
|
|
150
143
|
using v8::IndexedPropertyDefinerCallbackV2;
|
|
151
|
-
using v8::IndexedPropertyDeleterCallback;
|
|
152
144
|
using v8::IndexedPropertyDeleterCallbackV2;
|
|
153
|
-
using v8::IndexedPropertyDescriptorCallback;
|
|
154
145
|
using v8::IndexedPropertyDescriptorCallbackV2;
|
|
155
146
|
using v8::IndexedPropertyEnumeratorCallback;
|
|
156
|
-
using v8::IndexedPropertyGetterCallback;
|
|
157
147
|
using v8::IndexedPropertyGetterCallbackV2;
|
|
158
148
|
using v8::IndexedPropertyHandlerConfiguration;
|
|
159
|
-
using v8::IndexedPropertyQueryCallback;
|
|
160
149
|
using v8::IndexedPropertyQueryCallbackV2;
|
|
161
|
-
using v8::IndexedPropertySetterCallback;
|
|
162
150
|
using v8::IndexedPropertySetterCallbackV2;
|
|
163
151
|
using v8::Intercepted;
|
|
164
152
|
using v8::NamedPropertyDefinerCallback;
|