Skip to content

Commit ff9398e

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 98fecb4 commit ff9398e

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
@@ -1028,7 +1028,14 @@ Hermes is **automatically** cloned and built as part of the CMake configuration
10281028
```bash
10291029
cmake -B build -DHERMES_GIT_TAG=abc123def
10301030
```
1031-
- **Always Release mode**: Hermes always builds in Release for optimal performance
1031+
- **Build type**: Set via `HERMES_BUILD_TYPE` (default: Release)
1032+
```bash
1033+
# Build Hermes in Debug mode (useful for debugging shermes crashes)
1034+
cmake -B build -DHERMES_BUILD_TYPE=Debug
1035+
1036+
# Or RelWithDebInfo (optimized but with debug symbols)
1037+
cmake -B build -DHERMES_BUILD_TYPE=RelWithDebInfo
1038+
```
10321039
- **Per-config isolation**: Debug and Release builds get separate Hermes clones
10331040

10341041
### 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)