diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc9a647ea1..9d16d77e969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ endif() include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) +# This must be consistent with the release_version in +# android/build.gradle and npm/package.json +set(HERMES_RELEASE_VERSION 0.1.0) + # Project options. set(HERMESVM_GCKIND NONCONTIG_GENERATIONAL CACHE STRING @@ -160,6 +164,9 @@ endif() set(DEFAULT_GCCELL_ID $<$:ON>$<$>:OFF>) +# Make the HERMES_RELEASE_VERSION accessible for version printing in C++. +add_definitions(-DHERMES_RELEASE_VERSION="${HERMES_RELEASE_VERSION}") + add_definitions(-DHERMESVM_GC_${HERMESVM_GCKIND}) if(HERMESVM_GC_GENERATIONAL_MARKSWEEPCOMPACT) add_definitions(-DHERMESVM_GC_GENERATIONAL_MARKSWEEPCOMPACT) @@ -500,10 +507,6 @@ set_target_properties(check-hermes PROPERTIES FOLDER "Hermes regression tests") # This is how github release files are built. -# This must be consistent with the release_version in -# android/build.gradle and npm/package.json -set(HERMES_RELEASE_VERSION 0.1.0) - set(HERMES_GITHUB_DIR ${HERMES_BINARY_DIR}/github) string(TOLOWER ${CMAKE_SYSTEM_NAME} HERMES_GITHUB_SYSTEM_NAME) set(HERMES_CLI_GITHUB_FILE hermes-cli-${HERMES_GITHUB_SYSTEM_NAME}-v${HERMES_RELEASE_VERSION}.tar.gz) diff --git a/lib/CompilerDriver/CompilerDriver.cpp b/lib/CompilerDriver/CompilerDriver.cpp index a85326d6f50..6ffc1a16ed2 100644 --- a/lib/CompilerDriver/CompilerDriver.cpp +++ b/lib/CompilerDriver/CompilerDriver.cpp @@ -1664,6 +1664,9 @@ void printHermesVersion( const char *vmStr = "", bool features = true) { s << "Hermes JavaScript compiler" << vmStr << ".\n" +#ifdef HERMES_RELEASE_VERSION + << " Hermes release version: " << HERMES_RELEASE_VERSION << "\n" +#endif << " HBC bytecode version: " << hermes::hbc::BYTECODE_VERSION << "\n" << "\n"; if (features) {