-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Håvard Sørbø <havard@hsorbo.no>
- Loading branch information
Showing
19 changed files
with
2,104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cppgc_internal_headers = [ | ||
'write-barrier.h', | ||
'gc-info.h', | ||
'persistent-node.h', | ||
'name-trait.h', | ||
'pointer-policies.h', | ||
'logging.h', | ||
'api-constants.h', | ||
'atomic-entry-flag.h', | ||
'member-storage.h', | ||
'compiler-specific.h', | ||
'finalizer-trait.h', | ||
'caged-heap-local-data.h', | ||
'base-page-handle.h', | ||
'caged-heap.h', | ||
] | ||
|
||
install_headers(cppgc_internal_headers, subdir: install_header_subdir / 'cppgc' / 'internal') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cppgc_headers = [ | ||
'testing.h', | ||
'cross-thread-persistent.h', | ||
'name-provider.h', | ||
'persistent.h', | ||
'prefinalizer.h', | ||
'allocation.h', | ||
'process-heap-statistics.h', | ||
'ephemeron-pair.h', | ||
'custom-space.h', | ||
'type-traits.h', | ||
'heap-state.h', | ||
'default-platform.h', | ||
'heap-statistics.h', | ||
'heap-handle.h', | ||
'visitor.h', | ||
'garbage-collected.h', | ||
'trace-trait.h', | ||
'object-size-trait.h', | ||
'common.h', | ||
'heap-consistency.h', | ||
'macros.h', | ||
'heap.h', | ||
'sentinel-pointer.h', | ||
'liveness-broker.h', | ||
'member.h', | ||
'platform.h', | ||
'source-location.h', | ||
'explicit-management.h', | ||
] | ||
|
||
install_headers(cppgc_headers, subdir: install_header_subdir / 'cppgc') | ||
|
||
subdir('internal') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
libplatform_headers = [ | ||
'libplatform-export.h', | ||
'libplatform.h', | ||
'v8-tracing.h', | ||
] | ||
|
||
install_headers(libplatform_headers, subdir: install_header_subdir / 'libplatform') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
install_header_subdir = 'v8-' + api_version | ||
|
||
v8_inspector_js_protocol = files('js_protocol.pdl') | ||
|
||
v8_headers = [ | ||
'v8-array-buffer.h', | ||
'v8-callbacks.h', | ||
'v8-container.h', | ||
'v8-context.h', | ||
'v8-cppgc.h', | ||
'v8-data.h', | ||
'v8-date.h', | ||
'v8-debug.h', | ||
'v8-embedder-heap.h', | ||
'v8-embedder-state-scope.h', | ||
'v8-exception.h', | ||
'v8-extension.h', | ||
'v8-external.h', | ||
'v8-fast-api-calls.h', | ||
'v8-forward.h', | ||
'v8-function-callback.h', | ||
'v8-function.h', | ||
'v8-initialization.h', | ||
'v8-inspector-protocol.h', | ||
'v8-inspector.h', | ||
'v8-internal.h', | ||
'v8-isolate.h', | ||
'v8-json.h', | ||
'v8-local-handle.h', | ||
'v8-locker.h', | ||
'v8-maybe.h', | ||
'v8-memory-span.h', | ||
'v8-message.h', | ||
'v8-metrics.h', | ||
'v8-microtask-queue.h', | ||
'v8-microtask.h', | ||
'v8-object.h', | ||
'v8-persistent-handle.h', | ||
'v8-platform.h', | ||
'v8-primitive-object.h', | ||
'v8-primitive.h', | ||
'v8-profiler.h', | ||
'v8-promise.h', | ||
'v8-proxy.h', | ||
'v8-regexp.h', | ||
'v8-script.h', | ||
'v8-snapshot.h', | ||
'v8-statistics.h', | ||
'v8-template.h', | ||
'v8-traced-handle.h', | ||
'v8-typed-array.h', | ||
'v8-unwinder-state.h', | ||
'v8-unwinder.h', | ||
'v8-util.h', | ||
'v8-value-serializer-version.h', | ||
'v8-value-serializer.h', | ||
'v8-value.h', | ||
'v8-version-string.h', | ||
'v8-version.h', | ||
'v8-wasm-trap-handler-posix.h', | ||
'v8-wasm-trap-handler-win.h', | ||
'v8-wasm.h', | ||
'v8-weak-callback-info.h', | ||
'v8.h', | ||
'v8config.h', | ||
] | ||
|
||
install_headers(v8_headers, subdir: install_header_subdir) | ||
|
||
subdir('cppgc') | ||
subdir('libplatform') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
project('v8', 'c', 'cpp', | ||
version: '10.6.122', | ||
default_options: [ | ||
'cpp_std=gnu++17', | ||
'cpp_eh=none', | ||
'cpp_rtti=false', | ||
], | ||
) | ||
|
||
api_version = '10.0' | ||
|
||
cc = meson.get_compiler('c') | ||
cc_native = meson.get_compiler('c', native: true) | ||
|
||
cpp = meson.get_compiler('cpp') | ||
cpp_options = [ | ||
'cpp_std=gnu++17', | ||
'cpp_eh=none', | ||
'cpp_rtti=false', | ||
] | ||
|
||
build_os = build_machine.system() | ||
host_os = host_machine.system() | ||
|
||
target_conditionals_prefix = '#include <TargetConditionals.h>' | ||
is_macos_src = target_conditionals_prefix + ''' | ||
#if !TARGET_OS_OSX | ||
# error Not macOS | ||
#endif | ||
''' | ||
is_ios_src = target_conditionals_prefix + ''' | ||
#if !TARGET_OS_IOS | ||
# error Not iOS | ||
#endif | ||
''' | ||
|
||
if build_os == 'windows' | ||
build_os = 'win' | ||
elif build_os == 'darwin' | ||
if cc_native.compiles(is_macos_src, name: 'compiling on macOS') | ||
build_os = 'macos' | ||
elif cc_native.compiles(is_ios_src, name: 'compiling on iOS') | ||
build_os = 'ios' | ||
endif | ||
elif build_os == 'linux' and cc_native.has_header('android/api-level.h') | ||
build_os = 'android' | ||
endif | ||
if host_os == 'windows' | ||
host_os = 'win' | ||
elif host_os == 'darwin' | ||
if cc.compiles(is_macos_src, name: 'compiling for macOS') | ||
host_os = 'macos' | ||
elif cc.compiles(is_ios_src, name: 'compiling for iOS') | ||
host_os = 'ios' | ||
endif | ||
elif host_os == 'linux' and cc.has_header('android/api-level.h') | ||
host_os = 'android' | ||
endif | ||
host_os_nick = (host_os == 'macos') ? 'mac' : host_os | ||
|
||
v8_arch_from_cpu_family = { | ||
'x86': 'ia32', | ||
'x86_64': 'x64', | ||
'arm': 'arm', | ||
'aarch64': 'arm64', | ||
} | ||
build_arch = v8_arch_from_cpu_family[build_machine.cpu_family()] | ||
host_arch = v8_arch_from_cpu_family[host_machine.cpu_family()] | ||
host_is_64bit = cc.sizeof('void *') == 8 | ||
|
||
if host_os in ['macos', 'ios'] and host_arch == 'arm64' | ||
have_ptrauth_src = '''#ifdef __clang__ | ||
# if __has_feature (ptrauth_calls) | ||
# define HAVE_PTRAUTH 1 | ||
# endif | ||
#endif | ||
#ifndef HAVE_PTRAUTH | ||
# error Pointer authentication not supported | ||
#endif | ||
''' | ||
have_ptrauth = cc.compiles(have_ptrauth_src, name: 'pointer authentication') | ||
else | ||
have_ptrauth = false | ||
endif | ||
|
||
zlib_dep = dependency('zlib') | ||
zlib_native_dep = dependency('zlib', native: true) | ||
|
||
public_incdirs = include_directories('include') | ||
internal_incdirs = include_directories( | ||
'.', | ||
'src', | ||
'include', | ||
) | ||
|
||
config_args = [ | ||
'-DV8_HAVE_TARGET_OS', | ||
'-DV8_TARGET_OS_' + host_os.to_upper(), | ||
'-DV8_TARGET_ARCH_' + host_arch.to_upper(), | ||
'-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64', | ||
'-DV8_ATOMIC_OBJECT_FIELD_WRITES', | ||
'-DV8_ENABLE_LAZY_SOURCE_POSITIONS', | ||
'-DV8_WIN64_UNWINDING_INFO', | ||
'-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH', | ||
'-DV8_ALLOCATION_FOLDING', | ||
'-DV8_ALLOCATION_SITE_TRACKING', | ||
'-DV8_DEPRECATION_WARNINGS', | ||
'-DV8_IMMINENT_DEPRECATION_WARNINGS', | ||
'-DV8_RUNTIME_CALL_STATS', | ||
'-DV8_DISABLE_TESTS', | ||
'-DDYNAMIC_ANNOTATIONS_ENABLED=0', | ||
'-DOFFICIAL_BUILD', | ||
'-DUSE_SYSTEM_ZLIB', | ||
'-DNVALGRIND', | ||
] | ||
|
||
embedder_string = get_option('embedder_string') | ||
if embedder_string != '' | ||
config_args += f'-DV8_EMBEDDER_STRING="@embedder_string@"' | ||
endif | ||
|
||
if have_ptrauth | ||
config_args += '-DV8_TARGET_PTRAUTH' | ||
endif | ||
|
||
enable_advanced_bigint_algorithms = get_option('advanced_bigint_algorithms').allowed() | ||
if enable_advanced_bigint_algorithms | ||
config_args += '-DV8_ADVANCED_BIGINT_ALGORITHMS' | ||
endif | ||
|
||
if get_option('pointer_compression').auto() | ||
enable_pointer_compression = host_is_64bit | ||
else | ||
enable_pointer_compression = get_option('pointer_compression').allowed() | ||
endif | ||
if enable_pointer_compression | ||
config_args += '-DCPPGC_POINTER_COMPRESSION' | ||
endif | ||
|
||
if get_option('shared_ro_heap').auto() | ||
enable_shared_ro_heap = enable_pointer_compression | ||
else | ||
enable_shared_ro_heap = get_option('shared_ro_heap').allowed() | ||
endif | ||
if enable_shared_ro_heap | ||
config_args += '-DV8_SHARED_RO_HEAP' | ||
endif | ||
|
||
caged_heap_supported = host_is_64bit | ||
if get_option('caged_heap').auto() | ||
enable_caged_heap = caged_heap_supported | ||
elif get_option('caged_heap').enabled() | ||
if not caged_heap_supported | ||
error('CppGC caged heap requires 64bit platforms') | ||
endif | ||
enable_caged_heap = true | ||
else | ||
enable_caged_heap = false | ||
endif | ||
if enable_caged_heap | ||
config_args += [ | ||
'-DCPPGC_CAGED_HEAP', | ||
'-DCPPGC_YOUNG_GENERATION', | ||
] | ||
endif | ||
|
||
enable_i18n = get_option('i18n').allowed() | ||
|
||
if get_option('maglev').auto() | ||
enable_maglev = host_arch == 'x64' and enable_pointer_compression | ||
else | ||
enable_maglev = get_option('maglev').allowed() | ||
endif | ||
|
||
enable_wasm = get_option('wasm').allowed() | ||
if enable_wasm | ||
config_args += '-DV8_ENABLE_WEBASSEMBLY' | ||
endif | ||
|
||
if get_option('system_instrumentation').auto() | ||
enable_system_instrumentation = host_os in ['win', 'macos'] | ||
else | ||
enable_system_instrumentation = get_option('system_instrumentation').allowed() | ||
endif | ||
if enable_system_instrumentation | ||
config_args += '-DV8_ENABLE_SYSTEM_INSTRUMENTATION' | ||
endif | ||
|
||
add_project_arguments( | ||
config_args + cpp.get_supported_arguments([ | ||
'-Wno-non-virtual-dtor', | ||
]), | ||
language: 'cpp' | ||
) | ||
add_project_arguments( | ||
config_args + cpp.get_supported_arguments([ | ||
'-Wno-non-virtual-dtor', | ||
]), | ||
language: 'cpp', | ||
native: true | ||
) | ||
|
||
run_codegen = files('tools' / 'meson-run-codegen.py') | ||
|
||
subdir('include') | ||
subdir('third_party') | ||
subdir('src') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
option('embedder_string', | ||
type: 'string', | ||
value: '', | ||
description: 'Embedder string' | ||
) | ||
|
||
option('advanced_bigint_algorithms', | ||
type: 'feature', | ||
value: 'auto', | ||
description: 'Enable advanced BigInt algorithms, costing about 10-30 KB binary size depending on platform' | ||
) | ||
|
||
option('pointer_compression', | ||
type: 'feature', | ||
value: 'disabled', | ||
description: 'Enable pointer compression' | ||
) | ||
|
||
option('shared_ro_heap', | ||
type: 'feature', | ||
value: 'auto', | ||
description: 'Enable sharing read-only space across isolates' | ||
) | ||
|
||
option('caged_heap', | ||
type: 'feature', | ||
value: 'disabled', | ||
description: 'Enable heap reservation of size 4GB' | ||
) | ||
|
||
option('i18n', | ||
type: 'feature', | ||
value: 'disabled', | ||
description: 'Internationalization support' | ||
) | ||
|
||
option('maglev', | ||
type: 'feature', | ||
value: 'disabled', | ||
description: 'Maglev mid-tier optimizing compiler' | ||
) | ||
|
||
option('wasm', | ||
type: 'feature', | ||
value: 'auto', | ||
description: 'WebAssembly' | ||
) | ||
|
||
option('system_instrumentation', | ||
type: 'feature', | ||
value: 'auto', | ||
description: 'Enable OS-dependent event tracing' | ||
) |
Oops, something went wrong.