Skip to content

Commit

Permalink
Add version information to hermes.dll (facebook#85)
Browse files Browse the repository at this point in the history
We don't currently have version information in the dll, which makes debugging and filtering crash dumps difficult.
  • Loading branch information
tudorms authored Mar 3, 2022
1 parent c0abb52 commit 0c37be8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
10 changes: 9 additions & 1 deletion API/hermes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ add_hermes_library(compileJS STATIC CompileJS.cpp)
set(HERMES_ENABLE_EH ON)
set(HERMES_ENABLE_RTTI ON)

add_library(libhermes SHARED ${api_sources})
set(HERMES_VER_MAJOR ${PROJECT_VERSION_MAJOR})
set(HERMES_VER_MINOR ${PROJECT_VERSION_MINOR})
set(HERMES_VER_BUILD ${PROJECT_VERSION_PATCH})
set(HERMES_VER_REVISION ${VERSION_SUFFIX})

configure_file(version.rc.in version.rc @ONLY)

add_library(libhermes SHARED ${api_sources}
${CMAKE_CURRENT_BINARY_DIR}/version.rc)

# This is configured using a cmake flag instead of a separate target, because
# we need the output to be named "libhermes.so".
Expand Down
33 changes: 33 additions & 0 deletions API/hermes/version.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <verrsrc.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION @HERMES_VER_MAJOR@,@HERMES_VER_MINOR@,@HERMES_VER_BUILD@,0
PRODUCTVERSION @HERMES_VER_MAJOR@,@HERMES_VER_MINOR@,@HERMES_VER_BUILD@,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Hermes JavaScript Engine"
VALUE "FileVersion", "@HERMES_VER_MAJOR@.@HERMES_VER_MINOR@.@HERMES_VER_BUILD@.@HERMES_VER_REVISION@"
VALUE "InternalName", "hermes.dll"
VALUE "OriginalFilename", "hermes.dll"
VALUE "ProductName", "Hermes JavaScript Engine"
VALUE "ProductVersion", "@HERMES_VER_MAJOR@.@HERMES_VER_MINOR@.@HERMES_VER_BUILD@.@HERMES_VER_REVISION@"
VALUE "ProductShortName", "Hermes"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
4 changes: 3 additions & 1 deletion API/inspector/react-native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ if(NOT reactnative_POPULATED)

file(GLOB_RECURSE YARN_FILES ${reactnative_SOURCE_DIR}/yarn.lock ${reactnative_SOURCE_DIR}/**/yarn.lock)
message("Removing unused yarn.lock files: ${YARN_FILES}")
file(REMOVE ${YARN_FILES})
if(YARN_FILES)
file(REMOVE ${YARN_FILES})
endif()
endif()

set(REACT_NATIVE_SOURCE ${reactnative_SOURCE_DIR} PARENT_SCOPE)
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ endif()
project(Hermes
VERSION 0.11.0
LANGUAGES C CXX)
# Optional suffix like "-rc3"
set(VERSION_SUFFIX "")
# Optional suffix like "rc3"
set(VERSION_SUFFIX "ms.3")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")

Expand All @@ -83,7 +83,7 @@ set(LLVH_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/llvh)
include(Hermes)
include(Lit)

set(HERMES_RELEASE_VERSION ${PROJECT_VERSION}${VERSION_SUFFIX})
set(HERMES_RELEASE_VERSION ${PROJECT_VERSION}-${VERSION_SUFFIX})

include(FindPythonInterp)
if (NOT PYTHONINTERP_FOUND)
Expand Down Expand Up @@ -455,7 +455,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4312")
# Parallelize build
if (HERMES_MSVC_MP)
add_definitions( /MP )
add_compile_options( /MP )
endif()
endif()

Expand Down

0 comments on commit 0c37be8

Please sign in to comment.