From 084fa1ef21c1fd674f33b46ba5782448ccfaf5c9 Mon Sep 17 00:00:00 2001 From: Aakash Patel Date: Fri, 12 Jul 2019 13:01:05 -0700 Subject: [PATCH] Print HERMES_RELEASE_VERSION in version string. Summary: Add a preprocessor define for the `HERMES_RELEASE_VERSION` string, which the `printHermesVersion` function uses to print the Hermes release version. Reviewed By: willholen Differential Revision: D16224555 fbshipit-source-id: c583cedb88eee1f22957d78c3a8c6793e902c158 --- CMakeLists.txt | 11 +++++++---- lib/CompilerDriver/CompilerDriver.cpp | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) 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) {