react-nitro-hermes 0.0.1-alpha.8 → 0.0.1-alpha.9
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/hermes/CMakeLists.txt +874 -0
- package/hermes/android/HostObjectJniTest.cpp +178 -0
- package/hermes/android/build-logic/build.gradle.kts +31 -0
- package/hermes/android/build-logic/settings.gradle.kts +17 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/helpers/internal/SerializeHermesCompilerPackageJson.kt +33 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/plugins/internal/TestUtilsPlugin.kt +80 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/tasks/internal/CustomExecTask.kt +46 -0
- package/hermes/android/build-logic/src/main/kotlin/publish.gradle.kts +82 -0
- package/hermes/android/build.gradle.kts +332 -0
- package/hermes/android/cppruntime/build.gradle +72 -0
- package/hermes/android/cppruntime/src/main/AndroidManifest.xml +2 -0
- package/hermes/android/cppruntime/src/main/cpp/CMakeLists.txt +8 -0
- package/hermes/android/cppruntime/src/main/cpp/stub.cpp +12 -0
- package/hermes/android/cross-compile/swift-libicu.patch +13 -0
- package/hermes/android/cross-compile/toolchain-android-arm-api13-gnustl.cmake +13 -0
- package/hermes/android/cross-compile/toolchain-android-arm-api15-gnustl.cmake +14 -0
- package/hermes/android/gradle/libs.versions.toml +30 -0
- package/hermes/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/hermes/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/hermes/android/gradle.properties +3 -0
- package/hermes/android/gradlew +248 -0
- package/hermes/android/gradlew.bat +93 -0
- package/hermes/android/intltest/build.gradle +147 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/CMakeLists.txt +45 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.cpp +68 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.h +44 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.java +45 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogueTestData.java +32 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesInstrumentationTest.java +150 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlAndroidTest.java +147 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlTest262.java +470 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesRuntimeFactory.cpp +73 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.cpp +90 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.h +62 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.java +155 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.cpp +48 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.h +36 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoad.cpp +13 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoadEpilogue.cpp +13 -0
- package/hermes/android/intltest/src/main/AndroidManifest.xml +2 -0
- package/hermes/android/ios-artifacts/build.gradle.kts +65 -0
- package/hermes/android/settings.gradle.kts +27 -0
- package/hermes/cmake/modules/Hermes.cmake +481 -0
- package/hermes/cmake/modules/Lit.cmake +96 -0
- package/hermes/doc/Branches.md +38 -0
- package/hermes/doc/BuildingAndRunning.md +121 -0
- package/hermes/doc/CodingStandards.md +112 -0
- package/hermes/doc/CrossCompilation.md +79 -0
- package/hermes/doc/Design.md +217 -0
- package/hermes/doc/Emscripten.md +156 -0
- package/hermes/doc/Features.md +143 -0
- package/hermes/doc/GCSafeCoding.md +563 -0
- package/hermes/doc/GenGC.md +300 -0
- package/hermes/doc/Hades.md +344 -0
- package/hermes/doc/HighLevelOptimizations.md +37 -0
- package/hermes/doc/IR.md +1306 -0
- package/hermes/doc/IntlAPIs.md +196 -0
- package/hermes/doc/JIT.md +999 -0
- package/hermes/doc/LazyEvalCompilation.md +84 -0
- package/hermes/doc/MemoryProfilers.md +316 -0
- package/hermes/doc/Modules.md +144 -0
- package/hermes/doc/Optimizer.md +83 -0
- package/hermes/doc/PerfProfiling.md +29 -0
- package/hermes/doc/ProhibitInvoke.md +329 -0
- package/hermes/doc/ReactNative.md +40 -0
- package/hermes/doc/ReactNativeIntegration.md +94 -0
- package/hermes/doc/RegExp.md +24 -0
- package/hermes/doc/SpecIncompat.md +85 -0
- package/hermes/doc/Strings.md +140 -0
- package/hermes/doc/TypedLanguage.md +432 -0
- package/hermes/doc/VM.md +174 -0
- package/hermes/doc/blog/2024-11-09-octane-benchmark-jit-progress.md +17 -0
- package/hermes/doc/blog/2024-12-19-static-hermes-update-dec-2024.md +47 -0
- package/hermes/doc/blog/2024-12-23-compiling-javascript-to-wasm.md +267 -0
- package/hermes/doc/blog/2025-06-09-jsi-runtime-data-apis.md +23 -0
- package/hermes/doc/blog/2025-07-15-static-h-performance-june-2025.md +18 -0
- package/hermes/doc/blog/2025-11-02-hermes-compilation-runtime-modes.md +23 -0
- package/hermes/doc/blog/2025-11-06-hermes-memory-modes.md +35 -0
- package/hermes/doc/blog/2025-11-24-json-parsing-performance.md +17 -0
- package/hermes/doc/blog/2025-12-02-iserialization.md +11 -0
- package/hermes/doc/blog/2025-12-12-new-way-to-contribute.md +68 -0
- package/hermes/doc/blog/2026-06-05-new-hermes-stable-release.md +51 -0
- package/hermes/doc/blog/README.md +25 -0
- package/hermes/doc/blog/images/2024-11-09-octane-pi3.jpeg +0 -0
- package/hermes/doc/blog/images/2024-11-09-octane-pi5.jpeg +0 -0
- package/hermes/doc/blog/images/2025-07-15-perf-hv32-interpreter.jpeg +0 -0
- package/hermes/doc/blog/images/2025-07-15-perf-hv32-jit.jpeg +0 -0
- package/hermes/doc/icu_license.txt +420 -0
- package/hermes/doc/img/heap_snapshot_retainers.png +0 -0
- package/hermes/doc/img/logo.svg +1 -0
- package/hermes/doc/img/object_captured_by_environment.png +0 -0
- package/hermes/doc/img/root_categories.png +0 -0
- package/hermes/doc/plans/ir-type/flow-type-system.md +324 -0
- package/hermes/doc/plans/ir-type/ir-type-system-v2-design.md +652 -0
- package/hermes/doc/plans/ir-type/ir-type-system.md +220 -0
- package/hermes/doc/plans/ir-type/ir-type-v2-implementation.md +1187 -0
- package/hermes/doc/plans/ir-type/memory.md +48 -0
- package/hermes/doc/plans/ir-type/phase1-steps.md +512 -0
- package/hermes/doc/plans/ir-type/progress.md +239 -0
- package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-design.md +203 -0
- package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-results.md +71 -0
- package/hermes/doc/superpowers/plans/2026-07-28-worker-arraybuffer-input.md +597 -0
- package/hermes/doc/superpowers/plans/2026-08-18-jitemitter-split.md +1149 -0
- package/hermes/doc/superpowers/plans/2026-08-20-jit-type-asserts.md +969 -0
- package/hermes/doc/superpowers/plans/2026-08-23-jit-shared-compiler-driver.md +478 -0
- package/hermes/doc/superpowers/plans/2026-08-23-x86-64-jit-skeleton.md +797 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-arith.md +444 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-calls.md +261 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-props.md +240 -0
- package/hermes/doc/superpowers/plans/2026-10-26-regexp-bytecode-sharing.md +2197 -0
- package/hermes/doc/superpowers/plans/2026-10-28-regexp-start-filter-and-exec-fast-paths.md +3981 -0
- package/hermes/doc/superpowers/specs/2026-07-28-worker-arraybuffer-input-design.md +206 -0
- package/hermes/doc/superpowers/specs/2026-08-18-jitemitter-split-design.md +530 -0
- package/hermes/doc/superpowers/specs/2026-08-20-jit-type-asserts-design.md +360 -0
- package/hermes/doc/superpowers/specs/2026-08-23-x86-64-jit-design.md +246 -0
- package/hermes/doc/superpowers/specs/2026-08-26-icu-free-normalize-design.md +355 -0
- package/hermes/doc/superpowers/specs/2026-08-27-icu-free-convert-to-case-design.md +305 -0
- package/hermes/doc/superpowers/specs/2026-08-27-icu-free-locale-compare-design.md +429 -0
- package/hermes/doc/superpowers/specs/2026-08-29-icu-free-date-format-design.md +297 -0
- package/hermes/doc/superpowers/specs/2026-10-26-regexp-bytecode-sharing-design.md +605 -0
- package/hermes/doc/superpowers/specs/2026-10-28-regexp-start-filter-and-exec-fast-paths-design.md +551 -0
- package/hermes/doc/typescript-stripping.md +90 -0
- package/hermes/external/CMakeLists.txt +20 -0
- package/hermes/utils/IntlGen/IntlGen.java +531 -0
- package/hermes/utils/bench_with_stats.py +827 -0
- package/hermes/utils/build-apple-framework.sh +323 -0
- package/hermes/utils/chrome_snapshot_parser.py +210 -0
- package/hermes/utils/cmake-dev-build.sh +18 -0
- package/hermes/utils/commons.sh +55 -0
- package/hermes/utils/dump-cpp-funcs.sh +3 -0
- package/hermes/utils/es5objects.js +198 -0
- package/hermes/utils/format.sh +145 -0
- package/hermes/utils/gen-promise-internal-bc.sh +66 -0
- package/hermes/utils/genUnicodeTable.py +2503 -0
- package/hermes/utils/hermes-lit/CMakeLists.txt +22 -0
- package/hermes/utils/hermes-lit/hermes-lit.in +15 -0
- package/hermes/utils/jit/README.md +134 -0
- package/hermes/utils/jit/jit-diff.sh +160 -0
- package/hermes/utils/jit/jit-dump.sh +193 -0
- package/hermes/utils/lit-expect-gen/generate.py +217 -0
- package/hermes/utils/promise/index.js +15 -0
- package/hermes/utils/promise/package.json +13 -0
- package/hermes/utils/promise/rollup.config.js +19 -0
- package/hermes/utils/promise/yarn.lock +247 -0
- package/hermes/utils/scripts/hermes/consts.js +26 -0
- package/hermes/utils/scripts/hermes/create-tarball.js +75 -0
- package/hermes/utils/scripts/hermes/get-hermes-version.js +57 -0
- package/hermes/utils/scripts/hermes/hermes-utils.js +122 -0
- package/hermes/utils/scripts/hermes/package.json +6 -0
- package/hermes/utils/scripts/hermes/prepare-artifacts.js +113 -0
- package/hermes/utils/scripts/hermes/publish-artifacts.js +109 -0
- package/hermes/utils/scripts/hermes/publish-npm.js +96 -0
- package/hermes/utils/scripts/hermes/scm-utils.js +41 -0
- package/hermes/utils/scripts/hermes/set-artifacts-version.js +64 -0
- package/hermes/utils/scripts/hermes/version-utils.js +98 -0
- package/hermes/utils/scripts/hermes/yarn.lock +240 -0
- package/hermes/utils/summarize_sizes.py +184 -0
- package/hermes/utils/symbolicate-nativecall-stats.py +112 -0
- package/hermes/utils/test_runner.py +13 -0
- package/hermes/utils/testsuite/README.facebook +3 -0
- package/hermes/utils/testsuite/README.md +69 -0
- package/hermes/utils/testsuite/cli.py +547 -0
- package/hermes/utils/testsuite/es_ast.py +337 -0
- package/hermes/utils/testsuite/external/LICENSE +28 -0
- package/hermes/utils/testsuite/external/README.facebook +8 -0
- package/hermes/utils/testsuite/external/__init__.py +0 -0
- package/hermes/utils/testsuite/external/_monkeyYaml.py +164 -0
- package/hermes/utils/testsuite/external/parse_test262.py +141 -0
- package/hermes/utils/testsuite/hermes.py +522 -0
- package/hermes/utils/testsuite/preprocess.py +365 -0
- package/hermes/utils/testsuite/progress.py +377 -0
- package/hermes/utils/testsuite/skiplist.json +4356 -0
- package/hermes/utils/testsuite/skiplist.py +270 -0
- package/hermes/utils/testsuite/test_run_defs.py +435 -0
- package/hermes/utils/testsuite/typing_defs.py +52 -0
- package/hermes/utils/testsuite/utils.py +214 -0
- package/hermes/utils/tidy.sh +22 -0
- package/hermes/utils/update-fbcode-hermes.sh +53 -0
- package/hermes/utils/updateErrorTest.py +193 -0
- package/hermes/utils/wasm-compile.sh +65 -0
- package/package.json +1 -1
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.21.0)
|
|
7
|
+
|
|
8
|
+
# Set LTO policy
|
|
9
|
+
if(POLICY CMP0069)
|
|
10
|
+
cmake_policy(SET CMP0069 NEW)
|
|
11
|
+
endif()
|
|
12
|
+
|
|
13
|
+
# Set the VERSION variables based on the project command
|
|
14
|
+
if (POLICY CMP0048)
|
|
15
|
+
cmake_policy(SET CMP0048 NEW)
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
# find_package uses <PackageName>_ROOT variables.
|
|
19
|
+
if (POLICY CMP0074)
|
|
20
|
+
cmake_policy(SET CMP0074 NEW)
|
|
21
|
+
endif()
|
|
22
|
+
# Include file check macros honor CMAKE_REQUIRED_LIBRARIES.
|
|
23
|
+
if (POLICY CMP0075)
|
|
24
|
+
cmake_policy(SET CMP0075 NEW)
|
|
25
|
+
endif()
|
|
26
|
+
|
|
27
|
+
# Only interpret if() arguments as variables or keywords when unquoted.
|
|
28
|
+
# CMake emits a warning if this is not set.
|
|
29
|
+
if (POLICY CMP0054)
|
|
30
|
+
cmake_policy(SET CMP0054 NEW)
|
|
31
|
+
endif()
|
|
32
|
+
|
|
33
|
+
# Pick up a workaround for a CMake problem from LLVM r282552.
|
|
34
|
+
if(POLICY CMP0057)
|
|
35
|
+
cmake_policy(SET CMP0057 NEW)
|
|
36
|
+
endif()
|
|
37
|
+
|
|
38
|
+
# Enable transitive library dependencies
|
|
39
|
+
if(POLICY CMP0022)
|
|
40
|
+
cmake_policy(SET CMP0022 NEW)
|
|
41
|
+
endif()
|
|
42
|
+
|
|
43
|
+
# Require a build type
|
|
44
|
+
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
|
45
|
+
if ((NOT IS_MULTI_CONFIG) AND (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL ""))
|
|
46
|
+
message(FATAL_ERROR "Please set CMAKE_BUILD_TYPE")
|
|
47
|
+
endif()
|
|
48
|
+
|
|
49
|
+
# Has to be set before `project` as per documentation
|
|
50
|
+
# https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html
|
|
51
|
+
set(CMAKE_OSX_SYSROOT ${HERMES_APPLE_TARGET_PLATFORM})
|
|
52
|
+
|
|
53
|
+
if(HERMES_APPLE_TARGET_PLATFORM MATCHES "catalyst")
|
|
54
|
+
set(CMAKE_OSX_SYSROOT "macosx")
|
|
55
|
+
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
|
56
|
+
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
|
57
|
+
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
|
58
|
+
set(CMAKE_USE_PTHREADS_INIT 1)
|
|
59
|
+
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
60
|
+
endif()
|
|
61
|
+
|
|
62
|
+
if (WIN32)
|
|
63
|
+
add_definitions(-D_WINDOWS)
|
|
64
|
+
endif()
|
|
65
|
+
|
|
66
|
+
# This must be consistent with the release_version in:
|
|
67
|
+
# - android/build.gradle
|
|
68
|
+
# - npm/package.json
|
|
69
|
+
# - hermes-engine.podspec
|
|
70
|
+
project(Hermes
|
|
71
|
+
VERSION 1.0.0
|
|
72
|
+
LANGUAGES C CXX)
|
|
73
|
+
|
|
74
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
|
|
75
|
+
|
|
76
|
+
set(LLVH_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/llvh)
|
|
77
|
+
|
|
78
|
+
include(Hermes)
|
|
79
|
+
include(Lit)
|
|
80
|
+
|
|
81
|
+
# This is not a cache variable so that it is recomputed when the project
|
|
82
|
+
# version is updated.
|
|
83
|
+
if(NOT DEFINED HERMES_RELEASE_VERSION)
|
|
84
|
+
set(HERMES_RELEASE_VERSION ${PROJECT_VERSION})
|
|
85
|
+
endif()
|
|
86
|
+
|
|
87
|
+
find_package(Python COMPONENTS Interpreter)
|
|
88
|
+
if (NOT Python_Interpreter_FOUND)
|
|
89
|
+
message(FATAL_ERROR "Unable to find Python interpreter, required for builds and testing.
|
|
90
|
+
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
|
|
91
|
+
endif()
|
|
92
|
+
|
|
93
|
+
# Project options.
|
|
94
|
+
|
|
95
|
+
set(HERMES_ENABLE_NAPI ON CACHE BOOL
|
|
96
|
+
"Build Node-API support")
|
|
97
|
+
|
|
98
|
+
set(HERMES_IS_ANDROID OFF CACHE BOOL
|
|
99
|
+
"Building for Android")
|
|
100
|
+
|
|
101
|
+
if(HERMES_IS_ANDROID OR HERMES_APPLE_TARGET_PLATFORM MATCHES "iphone|appletv")
|
|
102
|
+
set(_HERMES_IS_MOBILE_BUILD_DEFAULT ON)
|
|
103
|
+
else()
|
|
104
|
+
set(_HERMES_IS_MOBILE_BUILD_DEFAULT OFF)
|
|
105
|
+
endif()
|
|
106
|
+
|
|
107
|
+
set(HERMES_IS_MOBILE_BUILD ${_HERMES_IS_MOBILE_BUILD_DEFAULT} CACHE BOOL
|
|
108
|
+
"Building for a mobile device")
|
|
109
|
+
|
|
110
|
+
set(HERMESVM_GCKIND HADES
|
|
111
|
+
CACHE STRING
|
|
112
|
+
"HermesVM GC type: MALLOC, HADES")
|
|
113
|
+
|
|
114
|
+
# Hermes VM opcode stats profiling
|
|
115
|
+
set(HERMESVM_PROFILER_OPCODE OFF CACHE BOOL
|
|
116
|
+
"Enable opcode stats profiling in hermes VM")
|
|
117
|
+
|
|
118
|
+
# Hermes VM basic block profiling
|
|
119
|
+
set(HERMESVM_PROFILER_BB OFF CACHE BOOL
|
|
120
|
+
"Enable basic block profiling in hermes VM")
|
|
121
|
+
|
|
122
|
+
# Hermes VM JS Function profiling
|
|
123
|
+
set(HERMESVM_PROFILER_JSFUNCTION OFF CACHE BOOL
|
|
124
|
+
"Enable JS Function profiling in hermes VM")
|
|
125
|
+
|
|
126
|
+
# Hermes VM native call profiling
|
|
127
|
+
set(HERMESVM_PROFILER_NATIVECALL OFF CACHE BOOL
|
|
128
|
+
"Enable native call profiling in hermes VM")
|
|
129
|
+
|
|
130
|
+
CHECK_CXX_SOURCE_COMPILES(
|
|
131
|
+
"int main() { void *p = &&label; goto *p; label: return 0; }"
|
|
132
|
+
HAVE_COMPUTED_GOTO)
|
|
133
|
+
if(HAVE_COMPUTED_GOTO)
|
|
134
|
+
set(DEFAULT_INTERPRETER_THREADING ON)
|
|
135
|
+
else()
|
|
136
|
+
set(DEFAULT_INTERPRETER_THREADING OFF)
|
|
137
|
+
endif()
|
|
138
|
+
|
|
139
|
+
set(HERMESVM_INDIRECT_THREADING ${DEFAULT_INTERPRETER_THREADING} CACHE BOOL
|
|
140
|
+
"Enable the indirect threaded interpreter")
|
|
141
|
+
|
|
142
|
+
# Determine how HermesValue-s are encoded in the heap.
|
|
143
|
+
# - HEAP_HV_64: the default 64-bit encoding
|
|
144
|
+
# - HEAP_HV_PREFER32: on 32-bit systems use 32-bit encoding and boxed doubles.
|
|
145
|
+
# On 64-bit systems, if the GC supports it, use 32-bit encoding with
|
|
146
|
+
# compressed pointers and boxed doubles. Otherwise fall back to HEAP_HV_64.
|
|
147
|
+
# - HEAP_HV_BOXED: the encoding is either 32 or 64-bit depending on the system,
|
|
148
|
+
# but always box doubles. This is used for testing that all paths can deal
|
|
149
|
+
# with potential allocation of boxed doubles.
|
|
150
|
+
set(HERMESVM_HEAP_HV_MODE HEAP_HV_64 CACHE STRING
|
|
151
|
+
"Heap HV mode: HEAP_HV_64, HEAP_HV_PREFER32, HEAP_HV_BOXED")
|
|
152
|
+
|
|
153
|
+
if(APPLE)
|
|
154
|
+
set(DEFAULT_CONTIGUOUS_HEAP OFF)
|
|
155
|
+
else()
|
|
156
|
+
set(DEFAULT_CONTIGUOUS_HEAP ON)
|
|
157
|
+
endif()
|
|
158
|
+
|
|
159
|
+
set(HERMESVM_ALLOW_CONTIGUOUS_HEAP ${DEFAULT_CONTIGUOUS_HEAP} CACHE BOOL
|
|
160
|
+
"If this is on and compressed pointers are used, the heap will be allocated in a contiguous 4GB region.")
|
|
161
|
+
|
|
162
|
+
set(HERMESVM_ALLOW_HUGE_PAGES OFF CACHE BOOL
|
|
163
|
+
"Enable huge pages to back the GC managed heap. Only useful on Linux.")
|
|
164
|
+
|
|
165
|
+
# Note that smaller heap segments will lower the maximum number of properties
|
|
166
|
+
# that can be stored in an object.
|
|
167
|
+
set(HERMESVM_LOG_HEAP_SEGMENT_SIZE 22
|
|
168
|
+
CACHE STRING
|
|
169
|
+
"Base 2 log of the size of segments in the GC managed heap in bytes.")
|
|
170
|
+
|
|
171
|
+
set(HERMESVM_ALLOW_CONCURRENT_GC ON CACHE BOOL
|
|
172
|
+
"Enable concurrency in the GC for 64-bit builds.")
|
|
173
|
+
|
|
174
|
+
set(HERMESVM_ALLOW_INLINE_ASM ON CACHE BOOL
|
|
175
|
+
"Allow the use of inline assembly in VM code.")
|
|
176
|
+
|
|
177
|
+
set(HERMESVM_API_TRACE_ANDROID_REPLAY OFF CACHE BOOL
|
|
178
|
+
"Simulate Android config on Linux in API tracing.")
|
|
179
|
+
|
|
180
|
+
# Hermes VM Handle sanitization (moving the heap after every alloc)
|
|
181
|
+
set(HERMESVM_SANITIZE_HANDLES OFF CACHE BOOL
|
|
182
|
+
"Enable Handle sanitization")
|
|
183
|
+
|
|
184
|
+
set(HERMESVM_CRASH_TRACE OFF CACHE BOOL
|
|
185
|
+
"Enable recording of instructions for crash debugging depending on VMExperiments")
|
|
186
|
+
|
|
187
|
+
# Enable Address Sanitizer
|
|
188
|
+
set(HERMES_ENABLE_ADDRESS_SANITIZER OFF CACHE BOOL
|
|
189
|
+
"Enable -fsanitize=address")
|
|
190
|
+
|
|
191
|
+
# Enable Undefined Behavior Sanitizer
|
|
192
|
+
set(HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER OFF CACHE BOOL
|
|
193
|
+
"Enable -fsanitize=undefined")
|
|
194
|
+
|
|
195
|
+
# Enable Thread Sanitizer
|
|
196
|
+
set(HERMES_ENABLE_THREAD_SANITIZER OFF CACHE BOOL
|
|
197
|
+
"Enable -fsanitize=thread")
|
|
198
|
+
|
|
199
|
+
# Enable Trace PC Guard
|
|
200
|
+
set(HERMES_ENABLE_TRACE_PC_GUARD OFF CACHE BOOL
|
|
201
|
+
"Enable -fsanitize-coverage=trace-pc-guard")
|
|
202
|
+
|
|
203
|
+
set(HERMES_ENABLE_CODE_COVERAGE OFF CACHE BOOL
|
|
204
|
+
"Enables code coverage to be collected from binaries. Coverage output will be placed in a subdirectory called \"coverage\" of the build directory.")
|
|
205
|
+
|
|
206
|
+
set(HERMES_ENABLE_LIBFUZZER OFF CACHE BOOL
|
|
207
|
+
"Enable libfuzzer")
|
|
208
|
+
|
|
209
|
+
set(HERMES_ENABLE_FUZZILLI OFF CACHE BOOL
|
|
210
|
+
"Enable fuzzilli")
|
|
211
|
+
|
|
212
|
+
set(HERMES_ENABLE_TOOLS ON CACHE BOOL
|
|
213
|
+
"Enable CLI tools")
|
|
214
|
+
|
|
215
|
+
# Set linker flag for building the fuzzer
|
|
216
|
+
set(HERMES_FUZZING_FLAG "-fsanitize=fuzzer" CACHE STRING
|
|
217
|
+
"Linker argument to link fuzz targets against a given fuzzer.")
|
|
218
|
+
|
|
219
|
+
# Build with -DHERMES_SLOW_DEBUG for debug builds
|
|
220
|
+
# This does not affect release builds
|
|
221
|
+
set(HERMES_SLOW_DEBUG ON CACHE BOOL
|
|
222
|
+
"Enable slow checks in Debug builds")
|
|
223
|
+
|
|
224
|
+
# Build with -DHERMES_HARDENED for hardened builds
|
|
225
|
+
set(HERMES_HARDENED OFF CACHE BOOL
|
|
226
|
+
"Enable compile-time security mitigations")
|
|
227
|
+
|
|
228
|
+
# On CentOS:
|
|
229
|
+
# sudo yum install zlib-static glibc-static ncurses-static readline-static
|
|
230
|
+
set(HERMES_STATIC_LINK OFF CACHE BOOL
|
|
231
|
+
"Link Hermes statically. May only work on GNU/Linux.")
|
|
232
|
+
|
|
233
|
+
set(HERMES_UNICODE_LITE OFF CACHE BOOL
|
|
234
|
+
"Enable to use internal no-op unicode functionality instead of relying on underlying system libraries")
|
|
235
|
+
|
|
236
|
+
set(HERMES_CHECK_NATIVE_STACK ON CACHE BOOL
|
|
237
|
+
"Check the native stack for stack overflow")
|
|
238
|
+
|
|
239
|
+
set(HERMES_ENABLE_DEBUGGER OFF CACHE BOOL
|
|
240
|
+
"Build with debugger support")
|
|
241
|
+
|
|
242
|
+
set(HERMES_MEMORY_INSTRUMENTATION ${HERMES_ENABLE_DEBUGGER} CACHE BOOL
|
|
243
|
+
"Build with memory instrumentation support")
|
|
244
|
+
|
|
245
|
+
set(HERMES_FACEBOOK_BUILD OFF CACHE BOOL
|
|
246
|
+
"Build Facebook (rather than open-source) version of Hermes")
|
|
247
|
+
|
|
248
|
+
set(HERMES_ENABLE_CORE_EXTENSIONS ON CACHE BOOL
|
|
249
|
+
"Include core JSI extensions (TextEncoder, etc.)")
|
|
250
|
+
|
|
251
|
+
set(HERMES_ENABLE_CONTRIB_EXTENSIONS ON CACHE BOOL
|
|
252
|
+
"Include community-contributed extensions (can be disabled for critical deployments)")
|
|
253
|
+
|
|
254
|
+
# Contrib extensions require core extensions.
|
|
255
|
+
if(NOT HERMES_ENABLE_CORE_EXTENSIONS AND HERMES_ENABLE_CONTRIB_EXTENSIONS)
|
|
256
|
+
message(STATUS "HERMES_ENABLE_CONTRIB_EXTENSIONS forced OFF because HERMES_ENABLE_CORE_EXTENSIONS is OFF")
|
|
257
|
+
set(HERMES_ENABLE_CONTRIB_EXTENSIONS OFF)
|
|
258
|
+
endif()
|
|
259
|
+
|
|
260
|
+
set(HERMESVM_EXCEPTION_ON_OOM OFF CACHE BOOL
|
|
261
|
+
"GC Out-of-memory raises an exception, rather than causing a crash")
|
|
262
|
+
|
|
263
|
+
set(HERMESVM_PLATFORM_LOGGING OFF CACHE BOOL
|
|
264
|
+
"hermesLog(...) is enabled, using the platform's logging mechanism")
|
|
265
|
+
|
|
266
|
+
set(HERMES_ENABLE_WERROR OFF CACHE BOOL
|
|
267
|
+
"Whether the build should have -Werror enabled")
|
|
268
|
+
|
|
269
|
+
set(HERMES_THREAD_SAFETY_ANALYSIS OFF CACHE BOOL
|
|
270
|
+
"Whether to compile with clang's -Wthread-safety")
|
|
271
|
+
|
|
272
|
+
set(HERMES_GITHUB_RESOURCE_DIR "" CACHE STRING
|
|
273
|
+
"A directory with additional files to bundle in the GitHub release")
|
|
274
|
+
|
|
275
|
+
set(ANDROID_LINUX_PERF_PATH ""
|
|
276
|
+
CACHE STRING
|
|
277
|
+
"If buildling for Android, full path to <linux/perf_events.h>")
|
|
278
|
+
|
|
279
|
+
set(HERMES_MSVC_MP ON CACHE STRING
|
|
280
|
+
"Enable /MP in MSVC for parallel builds")
|
|
281
|
+
|
|
282
|
+
set(HERMES_ENABLE_INTL OFF CACHE BOOL
|
|
283
|
+
"Enable JS Intl support (WIP)")
|
|
284
|
+
|
|
285
|
+
set(HERMES_ENABLE_UNICODE_REGEXP_PROPERTY_ESCAPES ON CACHE BOOL
|
|
286
|
+
"Enable RegExp Unicode Property Escapes support")
|
|
287
|
+
|
|
288
|
+
set(HERMES_ENABLE_TEST_SUITE ON CACHE BOOL
|
|
289
|
+
"Enable the test suite")
|
|
290
|
+
|
|
291
|
+
set(HERMES_BUILD_APPLE_FRAMEWORK OFF CACHE BOOL
|
|
292
|
+
"Whether to build the libhermes target as a framework bundle or dylib on Apple platforms")
|
|
293
|
+
|
|
294
|
+
set(HERMES_BUILD_LEAN_LIBHERMES OFF CACHE BOOL "Exclude the Hermes compiler from libhermes.")
|
|
295
|
+
|
|
296
|
+
set(HERMES_BUILD_SHARED_JSI OFF CACHE BOOL "Build JSI as a shared library.")
|
|
297
|
+
|
|
298
|
+
set(IMPORT_HOST_COMPILERS "" CACHE FILEPATH
|
|
299
|
+
"Import the shermes and hermesc compiler from another build using the given CMake file.")
|
|
300
|
+
|
|
301
|
+
set(HERMESVM_INTERNAL_JAVASCRIPT_NATIVE OFF CACHE BOOL
|
|
302
|
+
"Use natively compiled InternalJavaScript. Set OFF to use bytecode version")
|
|
303
|
+
|
|
304
|
+
# 0: JIT is disabled
|
|
305
|
+
# 1: JIT is enabled if supported by the platform
|
|
306
|
+
# 2: JIT is enabled
|
|
307
|
+
set(HERMESVM_ALLOW_JIT 0 CACHE STRING "JIT mode: 0 (off), 1 (auto) or 2 (force on)")
|
|
308
|
+
|
|
309
|
+
set(HERMES_ALLOW_BOOST_CONTEXT 1 CACHE STRING
|
|
310
|
+
"Use Boost.Context fibers: 0 (off), 1 (auto) or 2 (force on)")
|
|
311
|
+
|
|
312
|
+
# Used in the compiler, for various compilation statistics.
|
|
313
|
+
set(LLVM_FORCE_ENABLE_STATS OFF CACHE BOOL
|
|
314
|
+
"Enable gathering, printing of Statistics.")
|
|
315
|
+
|
|
316
|
+
set(QEMU_RUN_PREFIX "" CACHE STRING
|
|
317
|
+
"Command prefix for invoking cross-compiled binaries with QEMU.")
|
|
318
|
+
|
|
319
|
+
set(JSI_UNSTABLE OFF CACHE BOOL "Enable the JSI unstable APIs.")
|
|
320
|
+
|
|
321
|
+
# Build the VM for the wasm2c-based sandbox in API/hermes_sandbox. This compiles
|
|
322
|
+
# out the setjmp/longjmp that shermes-compiled code and the JIT use for
|
|
323
|
+
# exceptions, since neither can run in the sandbox.
|
|
324
|
+
set(HERMES_SANDBOX_WASM OFF CACHE BOOL
|
|
325
|
+
"Build the VM for the sandbox in API/hermes_sandbox.")
|
|
326
|
+
|
|
327
|
+
if (NOT QEMU_RUN_PREFIX STREQUAL "")
|
|
328
|
+
add_definitions(-DQEMU_MODE)
|
|
329
|
+
endif()
|
|
330
|
+
|
|
331
|
+
# Used to force enable slow statistics even in release builds.
|
|
332
|
+
set(HERMES_FORCE_SLOW_STATS OFF CACHE BOOL
|
|
333
|
+
"Force enable HERMES_SLOW_STATISTIC even when HERMES_SLOW_DEBUG is off.")
|
|
334
|
+
|
|
335
|
+
if(HERMES_FORCE_SLOW_STATS)
|
|
336
|
+
# Also enable regular statistics when slow stats are forced on
|
|
337
|
+
set(LLVM_FORCE_ENABLE_STATS ON)
|
|
338
|
+
endif()
|
|
339
|
+
|
|
340
|
+
# This definition is used by source that must be kept identical between Hermes and
|
|
341
|
+
# Static Hermes, but needs to behave differently in each case.
|
|
342
|
+
add_definitions(-DSTATIC_HERMES)
|
|
343
|
+
|
|
344
|
+
if (HERMES_UNICODE_LITE)
|
|
345
|
+
add_definitions(-DHERMES_PLATFORM_UNICODE=HERMES_PLATFORM_UNICODE_LITE)
|
|
346
|
+
endif()
|
|
347
|
+
|
|
348
|
+
if(HERMES_CHECK_NATIVE_STACK)
|
|
349
|
+
add_definitions(-DHERMES_CHECK_NATIVE_STACK)
|
|
350
|
+
endif()
|
|
351
|
+
|
|
352
|
+
if (HERMES_IS_MOBILE_BUILD)
|
|
353
|
+
add_definitions(-DHERMES_IS_MOBILE_BUILD)
|
|
354
|
+
endif()
|
|
355
|
+
|
|
356
|
+
if (HERMESVM_INTERNAL_JAVASCRIPT_NATIVE)
|
|
357
|
+
add_definitions(-DHERMESVM_INTERNAL_JAVASCRIPT_NATIVE)
|
|
358
|
+
endif()
|
|
359
|
+
|
|
360
|
+
if (HERMES_SANDBOX_WASM)
|
|
361
|
+
if (NOT EMSCRIPTEN OR HERMESVM_INTERNAL_JAVASCRIPT_NATIVE OR
|
|
362
|
+
NOT HERMESVM_ALLOW_JIT EQUAL 0)
|
|
363
|
+
message(FATAL_ERROR "HERMES_SANDBOX_WASM requires Emscripten, "
|
|
364
|
+
"HERMESVM_INTERNAL_JAVASCRIPT_NATIVE=OFF and HERMESVM_ALLOW_JIT=0")
|
|
365
|
+
endif()
|
|
366
|
+
add_definitions(-DHERMES_SANDBOX_WASM)
|
|
367
|
+
endif()
|
|
368
|
+
|
|
369
|
+
if (HERMES_STATIC_LINK)
|
|
370
|
+
append("-static" CMAKE_EXE_LINKER_FLAGS)
|
|
371
|
+
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
372
|
+
endif()
|
|
373
|
+
|
|
374
|
+
# Check if the linker supports deleting unused sections and ICF.
|
|
375
|
+
# These are GNU ld / lld flags, so skip them for MSVC.
|
|
376
|
+
if(NOT MSVC)
|
|
377
|
+
check_linker_flag(CXX "LINKER:--gc-sections" HAVE_GC_SECTIONS)
|
|
378
|
+
# Only check for -dead_strip on Apple because some linkers may interpret it
|
|
379
|
+
# as "-d -e ad_strip".
|
|
380
|
+
if(APPLE)
|
|
381
|
+
check_linker_flag(CXX "LINKER:-dead_strip" HAVE_DEAD_STRIP)
|
|
382
|
+
endif()
|
|
383
|
+
check_linker_flag(CXX "LINKER:--icf=safe" HAVE_ICF)
|
|
384
|
+
|
|
385
|
+
if(HAVE_GC_SECTIONS)
|
|
386
|
+
add_flag_if_supported("-ffunction-sections" FUNCTION_SECTIONS)
|
|
387
|
+
add_flag_if_supported("-fdata-sections" DATA_SECTIONS)
|
|
388
|
+
list(APPEND HERMES_EXTRA_LINKER_FLAGS "LINKER:--gc-sections")
|
|
389
|
+
elseif(HAVE_DEAD_STRIP)
|
|
390
|
+
# This is similar to the above, but for macOS.
|
|
391
|
+
list(APPEND HERMES_EXTRA_LINKER_FLAGS "LINKER:-dead_strip")
|
|
392
|
+
endif()
|
|
393
|
+
|
|
394
|
+
if(HAVE_ICF)
|
|
395
|
+
add_flag_if_supported("-faddrsig" ADDRSIG)
|
|
396
|
+
list(APPEND HERMES_EXTRA_LINKER_FLAGS "LINKER:--icf=safe")
|
|
397
|
+
endif()
|
|
398
|
+
endif()
|
|
399
|
+
|
|
400
|
+
# Make the HERMES_RELEASE_VERSION accessible for version printing in C++.
|
|
401
|
+
if(HERMES_RELEASE_VERSION)
|
|
402
|
+
add_definitions(-DHERMES_RELEASE_VERSION="${HERMES_RELEASE_VERSION}")
|
|
403
|
+
endif()
|
|
404
|
+
|
|
405
|
+
set(HERMES_PROFILER_MODE_IN_LIT_TEST "NONE")
|
|
406
|
+
if(HERMESVM_PROFILER_OPCODE)
|
|
407
|
+
add_definitions(-DHERMESVM_PROFILER_OPCODE)
|
|
408
|
+
set(HERMES_PROFILER_MODE_IN_LIT_TEST "OPCODE")
|
|
409
|
+
endif()
|
|
410
|
+
if(HERMESVM_PROFILER_BB)
|
|
411
|
+
add_definitions(-DHERMESVM_PROFILER_BB)
|
|
412
|
+
set(HERMES_PROFILER_MODE_IN_LIT_TEST "BB")
|
|
413
|
+
endif()
|
|
414
|
+
if(HERMESVM_PROFILER_JSFUNCTION)
|
|
415
|
+
add_definitions(-DHERMESVM_PROFILER_JSFUNCTION)
|
|
416
|
+
set(HERMES_PROFILER_MODE_IN_LIT_TEST "SAMPLING")
|
|
417
|
+
endif()
|
|
418
|
+
if(HERMESVM_PROFILER_NATIVECALL)
|
|
419
|
+
add_definitions(-DHERMESVM_PROFILER_NATIVECALL)
|
|
420
|
+
set(HERMES_PROFILER_MODE_IN_LIT_TEST "EXTERN")
|
|
421
|
+
endif()
|
|
422
|
+
if(HERMESVM_INDIRECT_THREADING)
|
|
423
|
+
add_definitions(-DHERMESVM_INDIRECT_THREADING)
|
|
424
|
+
endif()
|
|
425
|
+
|
|
426
|
+
# Configure HERMESVM_COMPRESSED_POINTERS and HERMESVM_BOXED_DOUBLES. There are
|
|
427
|
+
# only three valid states:
|
|
428
|
+
# COMPRESSED=false BOXED=false => Heap uses 64-bit HV
|
|
429
|
+
# COMPRESSED=true BOXED=true => 64-bit native ptr, heap uses 32-bit HV with
|
|
430
|
+
# compressed pointers
|
|
431
|
+
# COMPRESSED=false BOXED=true => Heap uses native-ptr size HV
|
|
432
|
+
#
|
|
433
|
+
# Additionally, only with COMPRESSED=true, if allowed, HERMESVM_CONTIGUOUS_HEAP
|
|
434
|
+
# is set.
|
|
435
|
+
set(HERMESVM_COMPRESSED_POINTERS OFF)
|
|
436
|
+
set(HERMESVM_BOXED_DOUBLES OFF)
|
|
437
|
+
set(HERMESVM_CONTIGUOUS_HEAP OFF)
|
|
438
|
+
if(HERMESVM_HEAP_HV_MODE STREQUAL "HEAP_HV_64")
|
|
439
|
+
# Do nothing.
|
|
440
|
+
elseif(HERMESVM_HEAP_HV_MODE STREQUAL "HEAP_HV_PREFER32")
|
|
441
|
+
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
442
|
+
# Box doubles on 32-bit systems.
|
|
443
|
+
set(HERMESVM_BOXED_DOUBLES ON)
|
|
444
|
+
else()
|
|
445
|
+
# Compressed pointers are only enabled on 64 bit systems with Hades GC.
|
|
446
|
+
if (HERMESVM_GCKIND MATCHES HADES)
|
|
447
|
+
set(HERMESVM_COMPRESSED_POINTERS ON)
|
|
448
|
+
set(HERMESVM_BOXED_DOUBLES ON)
|
|
449
|
+
if(HERMESVM_ALLOW_CONTIGUOUS_HEAP)
|
|
450
|
+
set(HERMESVM_CONTIGUOUS_HEAP ON)
|
|
451
|
+
endif()
|
|
452
|
+
endif()
|
|
453
|
+
endif()
|
|
454
|
+
elseif(HERMESVM_HEAP_HV_MODE STREQUAL "HEAP_HV_BOXED")
|
|
455
|
+
set(HERMESVM_BOXED_DOUBLES ON)
|
|
456
|
+
else()
|
|
457
|
+
message(SEND_ERROR "Invalid HERMESVM_HEAP_HV_MODE: ${HERMESVM_HEAP_HV_MODE}")
|
|
458
|
+
endif()
|
|
459
|
+
if (HERMESVM_COMPRESSED_POINTERS)
|
|
460
|
+
add_definitions(-DHERMESVM_COMPRESSED_POINTERS)
|
|
461
|
+
endif()
|
|
462
|
+
if (HERMESVM_BOXED_DOUBLES)
|
|
463
|
+
add_definitions(-DHERMESVM_BOXED_DOUBLES)
|
|
464
|
+
endif()
|
|
465
|
+
if (HERMESVM_CONTIGUOUS_HEAP)
|
|
466
|
+
add_definitions(-DHERMESVM_CONTIGUOUS_HEAP)
|
|
467
|
+
endif()
|
|
468
|
+
|
|
469
|
+
if(HERMESVM_ALLOW_HUGE_PAGES)
|
|
470
|
+
add_definitions(-DHERMESVM_ALLOW_HUGE_PAGES)
|
|
471
|
+
endif()
|
|
472
|
+
add_definitions(-DHERMESVM_LOG_HEAP_SEGMENT_SIZE=${HERMESVM_LOG_HEAP_SEGMENT_SIZE})
|
|
473
|
+
if(HERMESVM_ALLOW_CONCURRENT_GC)
|
|
474
|
+
add_definitions(-DHERMESVM_ALLOW_CONCURRENT_GC)
|
|
475
|
+
endif()
|
|
476
|
+
if(HERMESVM_ALLOW_INLINE_ASM)
|
|
477
|
+
add_definitions(-DHERMESVM_ALLOW_INLINE_ASM)
|
|
478
|
+
endif()
|
|
479
|
+
if(HERMESVM_API_TRACE_ANDROID_REPLAY)
|
|
480
|
+
add_definitions(-DHERMESVM_API_TRACE_ANDROID_REPLAY)
|
|
481
|
+
endif()
|
|
482
|
+
if(HERMESVM_CRASH_TRACE)
|
|
483
|
+
add_definitions(-DHERMESVM_CRASH_TRACE=1)
|
|
484
|
+
endif()
|
|
485
|
+
if (HERMES_ENABLE_ADDRESS_SANITIZER)
|
|
486
|
+
# Leave frame pointers. Allows the fast unwinder to function properly.
|
|
487
|
+
append("-fsanitize=address -fno-omit-frame-pointer" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
|
488
|
+
# MSVC handles ASAN runtime linking automatically when objects compiled with
|
|
489
|
+
# /fsanitize=address are linked. Don't pass the flag to the linker on MSVC.
|
|
490
|
+
if (MSVC)
|
|
491
|
+
# MSVC needs these debug information for ASAN to report errors correctly.
|
|
492
|
+
append("/Zi" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
|
493
|
+
append("/DEBUG" CMAKE_EXE_LINKER_FLAGS)
|
|
494
|
+
# Disable asan sanitization on contaienrs, which causes redefinition error
|
|
495
|
+
# on VS2022 when building llvh.
|
|
496
|
+
add_compile_definitions(_DISABLE_VECTOR_ANNOTATION)
|
|
497
|
+
|
|
498
|
+
get_filename_component(MSVC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
|
499
|
+
# Define the paths to the ASAN Release and Debug DLLs.
|
|
500
|
+
set(ASAN_RELEASE_DLL "${MSVC_BIN_DIR}/clang_rt.asan_dynamic-x86_64.dll")
|
|
501
|
+
set(ASAN_DEBUG_DLL "${MSVC_BIN_DIR}/clang_rt.asan_dbg_dynamic-x86_64.dll")
|
|
502
|
+
else()
|
|
503
|
+
append("-fsanitize=address" CMAKE_EXE_LINKER_FLAGS)
|
|
504
|
+
# GCC does not automatically link libpthread when using ASAN
|
|
505
|
+
append("-lpthread" CMAKE_EXE_LINKER_FLAGS)
|
|
506
|
+
endif()
|
|
507
|
+
endif()
|
|
508
|
+
if (HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER)
|
|
509
|
+
# MSVC does not support UBSan
|
|
510
|
+
if (MSVC)
|
|
511
|
+
message(WARNING "Undefined Behavior Sanitizer is not supported on MSVC, ignoring HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER")
|
|
512
|
+
else()
|
|
513
|
+
add_definitions(-DHERMES_UBSAN)
|
|
514
|
+
# Do not enable the vptr sanitizer, as it requires RTTI.
|
|
515
|
+
append("-fsanitize=undefined -fno-sanitize=vptr -fno-sanitize-recover=undefined" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
|
|
516
|
+
# Function signature sanitization produces false positives on Apple platforms.
|
|
517
|
+
# https://github.com/llvm/llvm-project/issues/109074
|
|
518
|
+
if (APPLE)
|
|
519
|
+
add_flag_if_supported("-fno-sanitize=function" APPLE_NO_SANITIZE_FUNCTION)
|
|
520
|
+
endif()
|
|
521
|
+
endif()
|
|
522
|
+
endif()
|
|
523
|
+
if (HERMES_ENABLE_THREAD_SANITIZER)
|
|
524
|
+
# MSVC does not support TSan.
|
|
525
|
+
if (MSVC)
|
|
526
|
+
message(WARNING "Thread Sanitizer is not supported on MSVC, ignoring HERMES_ENABLE_THREAD_SANITIZER")
|
|
527
|
+
else()
|
|
528
|
+
append("-fsanitize=thread" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
|
|
529
|
+
endif()
|
|
530
|
+
endif()
|
|
531
|
+
if (HERMES_ENABLE_TRACE_PC_GUARD)
|
|
532
|
+
append("-fsanitize-coverage=trace-pc-guard" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
|
|
533
|
+
endif()
|
|
534
|
+
if (HERMES_ENABLE_CODE_COVERAGE)
|
|
535
|
+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
536
|
+
append("-fprofile-instr-generate -fcoverage-mapping" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
|
537
|
+
else()
|
|
538
|
+
message(FATAL_ERROR "Code coverage flags not defined for this compiler: ${CMAKE_CXX_COMPILER_ID}")
|
|
539
|
+
endif()
|
|
540
|
+
endif()
|
|
541
|
+
if(HERMES_FACEBOOK_BUILD)
|
|
542
|
+
add_definitions(-DHERMES_FACEBOOK_BUILD)
|
|
543
|
+
endif()
|
|
544
|
+
if(HERMESVM_EXCEPTION_ON_OOM)
|
|
545
|
+
set(HERMES_ENABLE_EH ON)
|
|
546
|
+
add_definitions(-DHERMESVM_EXCEPTION_ON_OOM)
|
|
547
|
+
endif()
|
|
548
|
+
if(HERMESVM_PLATFORM_LOGGING)
|
|
549
|
+
add_definitions(-DHERMESVM_PLATFORM_LOGGING)
|
|
550
|
+
endif()
|
|
551
|
+
if (NOT (ANDROID_LINUX_PERF_PATH STREQUAL ""))
|
|
552
|
+
add_definitions(-DANDROID_LINUX_PERF_PATH="${ANDROID_LINUX_PERF_PATH}")
|
|
553
|
+
endif()
|
|
554
|
+
|
|
555
|
+
if (HERMES_ENABLE_INTL)
|
|
556
|
+
add_definitions(-DHERMES_ENABLE_INTL)
|
|
557
|
+
endif()
|
|
558
|
+
|
|
559
|
+
if (HERMES_ENABLE_UNICODE_REGEXP_PROPERTY_ESCAPES)
|
|
560
|
+
add_definitions(-DHERMES_ENABLE_UNICODE_REGEXP_PROPERTY_ESCAPES)
|
|
561
|
+
endif()
|
|
562
|
+
|
|
563
|
+
if (HERMES_ENABLE_WERROR)
|
|
564
|
+
# Turn all warnings into errors on GCC-compatible compilers.
|
|
565
|
+
if (GCC_COMPATIBLE)
|
|
566
|
+
append("-Werror" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
|
567
|
+
endif()
|
|
568
|
+
endif()
|
|
569
|
+
|
|
570
|
+
# Collect all header files and add them to the IDE.
|
|
571
|
+
file(GLOB_RECURSE ALL_HEADER_FILES "*.h")
|
|
572
|
+
|
|
573
|
+
if(HERMES_SLOW_DEBUG)
|
|
574
|
+
# Enable HERMES_SLOW_DEBUG in Debug mode
|
|
575
|
+
set_property(DIRECTORY APPEND PROPERTY
|
|
576
|
+
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:HERMES_SLOW_DEBUG>)
|
|
577
|
+
endif()
|
|
578
|
+
|
|
579
|
+
if (HERMES_HARDENED)
|
|
580
|
+
add_definitions(-DHERMES_HARDENED)
|
|
581
|
+
endif()
|
|
582
|
+
|
|
583
|
+
if (HERMES_ALLOW_BOOST_CONTEXT EQUAL 0)
|
|
584
|
+
set(HERMES_USE_BOOST_CONTEXT 0)
|
|
585
|
+
elseif (HERMES_ALLOW_BOOST_CONTEXT EQUAL 2)
|
|
586
|
+
set(HERMES_USE_BOOST_CONTEXT 1)
|
|
587
|
+
elseif (HERMES_ALLOW_BOOST_CONTEXT EQUAL 1)
|
|
588
|
+
if (HERMES_ENABLE_ADDRESS_SANITIZER OR EMSCRIPTEN)
|
|
589
|
+
set(HERMES_USE_BOOST_CONTEXT 0)
|
|
590
|
+
else()
|
|
591
|
+
set(HERMES_USE_BOOST_CONTEXT 1)
|
|
592
|
+
endif()
|
|
593
|
+
else ()
|
|
594
|
+
message(FATAL_ERROR "Invalid HERMES_ALLOW_BOOST_CONTEXT value ${HERMES_ALLOW_BOOST_CONTEXT}")
|
|
595
|
+
endif ()
|
|
596
|
+
# Use BOOST_CONTEXT_LIB to rever to boost_context as a dependency, regardless of
|
|
597
|
+
# whether it is enabled.
|
|
598
|
+
if (HERMES_USE_BOOST_CONTEXT)
|
|
599
|
+
set(BOOST_CONTEXT_LIB boost_context)
|
|
600
|
+
else()
|
|
601
|
+
set(BOOST_CONTEXT_LIB )
|
|
602
|
+
endif()
|
|
603
|
+
add_definitions(-DHERMES_USE_BOOST_CONTEXT=${HERMES_USE_BOOST_CONTEXT})
|
|
604
|
+
|
|
605
|
+
if(HERMES_FORCE_SLOW_STATS)
|
|
606
|
+
add_definitions(-DHERMES_FORCE_SLOW_STATS)
|
|
607
|
+
endif()
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
if (GCC_COMPATIBLE)
|
|
611
|
+
# Don't export symbols unless we explicitly say so
|
|
612
|
+
append("-fvisibility=hidden" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
|
613
|
+
# We depend on reading/writing certain properties in C++ objects in generated
|
|
614
|
+
# C code through C structs that mirror those C++ objects. This means that
|
|
615
|
+
# unrelated types may alias in our code, and we must disable strict aliasing.
|
|
616
|
+
# We would also like to avoid arbitrary UB on signed integer and pointer
|
|
617
|
+
# overflow, so disable strict overflow as well.
|
|
618
|
+
append("-fno-strict-aliasing -fno-strict-overflow" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
|
619
|
+
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
|
|
620
|
+
# C4068 unknown pragma
|
|
621
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4068")
|
|
622
|
+
# C4200 nonstandard extension used: zero-sized array in struct/union
|
|
623
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4200")
|
|
624
|
+
# C4201 nonstandard extension used: nameless struct/union
|
|
625
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4201")
|
|
626
|
+
# C4530 C++ exception handler used, but unwind semantics are not enabled
|
|
627
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4530")
|
|
628
|
+
# Parallelize build
|
|
629
|
+
if (HERMES_MSVC_MP)
|
|
630
|
+
add_definitions( /MP )
|
|
631
|
+
endif()
|
|
632
|
+
# MSVC does not have strict aliasing so there is no need to support it.
|
|
633
|
+
# Similar to GCC/Clang above, disable strict signed integer overflow.
|
|
634
|
+
# TODO: Investigate disabling strict signed integer overflow for MSVC
|
|
635
|
+
# append("/d2UndefIntOverflow-" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
|
636
|
+
endif()
|
|
637
|
+
|
|
638
|
+
# Export a JSON file with the compilation commands that external tools can use
|
|
639
|
+
# to analyze the source code of the project.
|
|
640
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
if (APPLE)
|
|
644
|
+
find_library(CORE_FOUNDATION CoreFoundation)
|
|
645
|
+
find_library(FOUNDATION Foundation)
|
|
646
|
+
else()
|
|
647
|
+
set(CORE_FOUNDATION "")
|
|
648
|
+
set(FOUNDATION "")
|
|
649
|
+
endif()
|
|
650
|
+
|
|
651
|
+
if (HERMES_ENABLE_DEBUGGER)
|
|
652
|
+
add_definitions(-DHERMES_ENABLE_DEBUGGER)
|
|
653
|
+
endif()
|
|
654
|
+
|
|
655
|
+
if (HERMES_MEMORY_INSTRUMENTATION)
|
|
656
|
+
add_definitions(-DHERMES_MEMORY_INSTRUMENTATION)
|
|
657
|
+
endif()
|
|
658
|
+
|
|
659
|
+
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
|
|
660
|
+
|
|
661
|
+
if (JSI_UNSTABLE)
|
|
662
|
+
add_definitions(-DJSI_UNSTABLE)
|
|
663
|
+
endif()
|
|
664
|
+
# JSI_DIR has always priority over other folders.
|
|
665
|
+
# It's used by React Native when building Hermes from source so
|
|
666
|
+
# the copy of JSI inside `react-native/ReactCommon/jsi` can be used.
|
|
667
|
+
if(JSI_DIR)
|
|
668
|
+
if(EXISTS ${JSI_DIR})
|
|
669
|
+
set(HERMES_JSI_DIR ${JSI_DIR})
|
|
670
|
+
else()
|
|
671
|
+
message(FATAL_ERROR "You specified a JSI directory with -DJSI_DIR but JSI can't be found there.")
|
|
672
|
+
endif()
|
|
673
|
+
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/API/jsi)
|
|
674
|
+
set(HERMES_JSI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/API/jsi)
|
|
675
|
+
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../jsi)
|
|
676
|
+
set(HERMES_JSI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../jsi)
|
|
677
|
+
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../jsi)
|
|
678
|
+
set(HERMES_JSI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../jsi)
|
|
679
|
+
else()
|
|
680
|
+
message(FATAL_ERROR "Unable to find jsi.")
|
|
681
|
+
endif()
|
|
682
|
+
|
|
683
|
+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../hermes_common)
|
|
684
|
+
set(HERMES_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../hermes_common)
|
|
685
|
+
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../hermes_common)
|
|
686
|
+
set(HERMES_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../hermes_common)
|
|
687
|
+
else()
|
|
688
|
+
set(HERMES_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
689
|
+
endif()
|
|
690
|
+
|
|
691
|
+
include_directories(
|
|
692
|
+
external/llvh/include
|
|
693
|
+
external/llvh/gen/include
|
|
694
|
+
${CMAKE_CURRENT_BINARY_DIR}/external/llvh/include
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
include_directories(BEFORE
|
|
698
|
+
${CMAKE_CURRENT_BINARY_DIR}/lib/config
|
|
699
|
+
${CMAKE_CURRENT_BINARY_DIR}/include
|
|
700
|
+
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
701
|
+
${CMAKE_CURRENT_SOURCE_DIR}/external
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
if(HERMES_IS_ANDROID)
|
|
705
|
+
find_package(fbjni REQUIRED CONFIG)
|
|
706
|
+
endif()
|
|
707
|
+
|
|
708
|
+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
|
|
709
|
+
# MSVC requires c++20, because of the use of designated initializers in the codebase.
|
|
710
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
711
|
+
else()
|
|
712
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
713
|
+
endif()
|
|
714
|
+
|
|
715
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
716
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
717
|
+
|
|
718
|
+
add_subdirectory(external)
|
|
719
|
+
add_subdirectory(utils/hermes-lit)
|
|
720
|
+
add_subdirectory(lib)
|
|
721
|
+
add_subdirectory(public)
|
|
722
|
+
add_subdirectory(API)
|
|
723
|
+
add_subdirectory(android/intltest/java/com/facebook/hermes/test)
|
|
724
|
+
|
|
725
|
+
if(HERMES_ENABLE_TOOLS)
|
|
726
|
+
add_subdirectory(tools)
|
|
727
|
+
endif()
|
|
728
|
+
|
|
729
|
+
# Make sure JSI is compiled with PIC
|
|
730
|
+
set(save_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
|
731
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
732
|
+
set(save_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
|
733
|
+
set(BUILD_SHARED_LIBS ${HERMES_BUILD_SHARED_JSI})
|
|
734
|
+
add_subdirectory(${HERMES_JSI_DIR}/jsi ${CMAKE_CURRENT_BINARY_DIR}/jsi)
|
|
735
|
+
set(BUILD_SHARED_LIBS ${save_BUILD_SHARED_LIBS})
|
|
736
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ${save_CMAKE_POSITION_INDEPENDENT_CODE})
|
|
737
|
+
|
|
738
|
+
# Configure the test suites
|
|
739
|
+
#
|
|
740
|
+
if(HERMES_ENABLE_TEST_SUITE)
|
|
741
|
+
if(NOT HERMES_ENABLE_TOOLS)
|
|
742
|
+
message(FATAL_ERROR, "Running the test-suite requires the CLI tools to be built.")
|
|
743
|
+
endif()
|
|
744
|
+
|
|
745
|
+
add_subdirectory(unittests)
|
|
746
|
+
add_subdirectory(test/static_asserts)
|
|
747
|
+
|
|
748
|
+
list(APPEND HERMES_TEST_DEPS
|
|
749
|
+
HermesUnitTests
|
|
750
|
+
hermes
|
|
751
|
+
hermesc
|
|
752
|
+
hvm
|
|
753
|
+
interp-dispatch-bench
|
|
754
|
+
hdb
|
|
755
|
+
hbcdump
|
|
756
|
+
hbc-attribute
|
|
757
|
+
hbc-deltaprep
|
|
758
|
+
hbc-diff
|
|
759
|
+
dependency-extractor
|
|
760
|
+
shermes-dep
|
|
761
|
+
compileJS
|
|
762
|
+
emhermesc
|
|
763
|
+
hermes-jsi
|
|
764
|
+
hermes-jsi-lean
|
|
765
|
+
hermes-jsi-shared
|
|
766
|
+
hermes-jsi-lean-shared
|
|
767
|
+
)
|
|
768
|
+
|
|
769
|
+
if(HERMES_ENABLE_NAPI)
|
|
770
|
+
list(APPEND HERMES_TEST_DEPS
|
|
771
|
+
napi-runner
|
|
772
|
+
)
|
|
773
|
+
if(NOT WIN32)
|
|
774
|
+
list(APPEND HERMES_TEST_DEPS
|
|
775
|
+
napi_test_addon
|
|
776
|
+
napi_ref_addon
|
|
777
|
+
napi_text_encoder_addon
|
|
778
|
+
napi_async_work_addon
|
|
779
|
+
)
|
|
780
|
+
endif()
|
|
781
|
+
endif()
|
|
782
|
+
|
|
783
|
+
set(coverage_directory "")
|
|
784
|
+
if (HERMES_ENABLE_CODE_COVERAGE)
|
|
785
|
+
set(coverage_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/coverage)
|
|
786
|
+
endif()
|
|
787
|
+
|
|
788
|
+
set(HERMES_LIT_TEST_PARAMS_BASE
|
|
789
|
+
test_exec_root=${CMAKE_CURRENT_BINARY_DIR}/test
|
|
790
|
+
unittests_dir=${CMAKE_CURRENT_BINARY_DIR}/unittests
|
|
791
|
+
debugger_enabled=${HERMES_ENABLE_DEBUGGER}
|
|
792
|
+
jit_enabled=${HERMESVM_ALLOW_JIT}
|
|
793
|
+
jit_arch=${CMAKE_SYSTEM_PROCESSOR}
|
|
794
|
+
intl_enabled=${HERMES_ENABLE_INTL}
|
|
795
|
+
regexp_unicode_properties_enabled=${HERMES_ENABLE_UNICODE_REGEXP_PROPERTY_ESCAPES}
|
|
796
|
+
hbc_deltaprep=${HERMES_TOOLS_OUTPUT_DIR}/hbc-deltaprep
|
|
797
|
+
dependency_extractor=${HERMES_TOOLS_OUTPUT_DIR}/dependency-extractor
|
|
798
|
+
FileCheck=${HERMES_TOOLS_OUTPUT_DIR}/FileCheck
|
|
799
|
+
hermes=${HERMES_TOOLS_OUTPUT_DIR}/hermes
|
|
800
|
+
hermesc=${HERMES_TOOLS_OUTPUT_DIR}/hermesc
|
|
801
|
+
hdb=${HERMES_TOOLS_OUTPUT_DIR}/hdb
|
|
802
|
+
hbcdump=${HERMES_TOOLS_OUTPUT_DIR}/hbcdump
|
|
803
|
+
hbc-deltaprep=${HERMES_TOOLS_OUTPUT_DIR}/hbc-deltaprep
|
|
804
|
+
hbc_diff=${HERMES_TOOLS_OUTPUT_DIR}/hbc-diff
|
|
805
|
+
slow_debug=$<IF:$<CONFIG:Debug>,${HERMES_SLOW_DEBUG},OFF>
|
|
806
|
+
debug_options=$<IF:$<CONFIG:Debug>,ON,OFF>
|
|
807
|
+
exception_on_oom_enabled=${HERMESVM_EXCEPTION_ON_OOM}
|
|
808
|
+
profiler=${HERMES_PROFILER_MODE_IN_LIT_TEST}
|
|
809
|
+
gc=${HERMESVM_GCKIND}
|
|
810
|
+
ubsan=${HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER}
|
|
811
|
+
asan=${HERMES_ENABLE_ADDRESS_SANITIZER}
|
|
812
|
+
coverage=${coverage_directory}
|
|
813
|
+
shermes=${HERMES_TOOLS_OUTPUT_DIR}/shermes
|
|
814
|
+
check_native_stack=${HERMES_CHECK_NATIVE_STACK}
|
|
815
|
+
unicode_lite=${HERMES_UNICODE_LITE}
|
|
816
|
+
core_extensions_enabled=${HERMES_ENABLE_CORE_EXTENSIONS}
|
|
817
|
+
contrib_extensions_enabled=${HERMES_ENABLE_CONTRIB_EXTENSIONS}
|
|
818
|
+
jsi_unstable=${JSI_UNSTABLE}
|
|
819
|
+
qemu_run_prefix=${QEMU_RUN_PREFIX}
|
|
820
|
+
napi_enabled=${HERMES_ENABLE_NAPI}
|
|
821
|
+
python=${Python_EXECUTABLE}
|
|
822
|
+
)
|
|
823
|
+
|
|
824
|
+
if(HERMES_ENABLE_NAPI)
|
|
825
|
+
list(APPEND HERMES_LIT_TEST_PARAMS_BASE
|
|
826
|
+
napi_runner=${HERMES_TOOLS_OUTPUT_DIR}/napi-runner
|
|
827
|
+
napi_addon_dir=${CMAKE_CURRENT_BINARY_DIR}/unittests/napi
|
|
828
|
+
)
|
|
829
|
+
endif()
|
|
830
|
+
|
|
831
|
+
set(HERMES_LIT_TEST_PARAMS
|
|
832
|
+
${HERMES_LIT_TEST_PARAMS_BASE}
|
|
833
|
+
FileCheckOrRegen=${HERMES_TOOLS_OUTPUT_DIR}/FileCheck
|
|
834
|
+
)
|
|
835
|
+
|
|
836
|
+
set(HERMES_LIT_UPDATE_PARAMS
|
|
837
|
+
${HERMES_LIT_TEST_PARAMS_BASE}
|
|
838
|
+
"FileCheckOrRegen=${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/lit-expect-gen/generate.py"
|
|
839
|
+
)
|
|
840
|
+
|
|
841
|
+
set(LLVH_LIT_ARGS "-sv")
|
|
842
|
+
|
|
843
|
+
add_lit_testsuite(check-hermes "Running the Hermes regression tests"
|
|
844
|
+
${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
845
|
+
${CMAKE_CURRENT_SOURCE_DIR}/unittests
|
|
846
|
+
PARAMS ${HERMES_LIT_TEST_PARAMS}
|
|
847
|
+
DEPENDS ${HERMES_TEST_DEPS}
|
|
848
|
+
ARGS ${HERMES_TEST_EXTRA_ARGS}
|
|
849
|
+
)
|
|
850
|
+
set_target_properties(check-hermes PROPERTIES FOLDER "Hermes regression tests")
|
|
851
|
+
if(HERMES_ENABLE_NAPI)
|
|
852
|
+
add_dependencies(check-hermes check-napi)
|
|
853
|
+
endif()
|
|
854
|
+
|
|
855
|
+
list(APPEND SHERMES_TEST_DEPS shermes-dep)
|
|
856
|
+
add_lit_testsuite(check-shermes "Running the Static Hermes regression tests"
|
|
857
|
+
${CMAKE_CURRENT_SOURCE_DIR}/test/shermes
|
|
858
|
+
PARAMS ${HERMES_LIT_TEST_PARAMS}
|
|
859
|
+
DEPENDS ${SHERMES_TEST_DEPS}
|
|
860
|
+
ARGS ${HERMES_TEST_EXTRA_ARGS}
|
|
861
|
+
)
|
|
862
|
+
set_target_properties(check-shermes PROPERTIES FOLDER "Static Hermes regression tests")
|
|
863
|
+
|
|
864
|
+
# update-lit will regenerate the expectations for all tests that are verified with FileCheckOrRegen.
|
|
865
|
+
# All other tests are run normally.
|
|
866
|
+
add_lit_testsuite(update-lit "Running the Hermes regression tests, and updating auto-generated expectations."
|
|
867
|
+
${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
868
|
+
${CMAKE_CURRENT_SOURCE_DIR}/unittests
|
|
869
|
+
PARAMS ${HERMES_LIT_UPDATE_PARAMS}
|
|
870
|
+
DEPENDS ${HERMES_TEST_DEPS}
|
|
871
|
+
ARGS ${HERMES_TEST_EXTRA_ARGS}
|
|
872
|
+
)
|
|
873
|
+
set_target_properties(update-lit PROPERTIES FOLDER "Hermes regression tests")
|
|
874
|
+
endif()
|