Skip to content

Commit d3fd2b3

Browse files
committed
Add configurable Hermes build type option
Add HERMES_BUILD_TYPE CMake option to allow building Hermes in modes other than Release. This is useful for debugging shermes crashes or optimizer issues. Usage: cmake -B build -DHERMES_BUILD_TYPE=Debug cmake -B build -DHERMES_BUILD_TYPE=RelWithDebInfo Defaults to Release to maintain existing behavior and build performance.
1 parent 41b708b commit d3fd2b3

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,14 @@ Hermes is **automatically** cloned and built as part of the CMake configuration
10301030
```bash
10311031
cmake -B build -DHERMES_GIT_TAG=abc123def
10321032
```
1033-
- **Always Release mode**: Hermes always builds in Release for optimal performance
1033+
- **Build type**: Set via `HERMES_BUILD_TYPE` (default: Release)
1034+
```bash
1035+
# Build Hermes in Debug mode (useful for debugging shermes crashes)
1036+
cmake -B build -DHERMES_BUILD_TYPE=Debug
1037+
1038+
# Or RelWithDebInfo (optimized but with debug symbols)
1039+
cmake -B build -DHERMES_BUILD_TYPE=RelWithDebInfo
1040+
```
10341041
- **Per-config isolation**: Debug and Release builds get separate Hermes clones
10351042

10361043
### Building the Project

cmake/HermesExternal.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,20 @@ else()
7777
CACHE STRING "Hermes git repository URL")
7878
set(HERMES_GIT_TAG "80359d48dbf0a108031d69c8a22bad180cfb4df3"
7979
CACHE STRING "Hermes git tag/commit/branch to build")
80+
set(HERMES_BUILD_TYPE "Release"
81+
CACHE STRING "Hermes build type (Release, Debug, RelWithDebInfo, MinSizeRel)")
8082

8183
# Set Hermes paths - everything in build directory
8284
set(HERMES_SRC "${CMAKE_BINARY_DIR}/hermes-src")
8385
set(HERMES_BUILD "${CMAKE_BINARY_DIR}/hermes")
8486

87+
message(STATUS "Hermes git URL: ${HERMES_GIT_URL}")
88+
message(STATUS "Hermes git tag: ${HERMES_GIT_TAG}")
89+
message(STATUS "Hermes build type: ${HERMES_BUILD_TYPE}")
90+
8591
# Configure Hermes build options
8692
set(HERMES_CMAKE_ARGS
87-
-DCMAKE_BUILD_TYPE=Release
93+
-DCMAKE_BUILD_TYPE=${HERMES_BUILD_TYPE}
8894
-DHERMES_ENABLE_TEST_SUITE=OFF
8995
-DHERMES_BUILD_APPLE_FRAMEWORK=OFF
9096
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}

0 commit comments

Comments
 (0)