Bump CMake to 3.30.x and Enable INTERPROCEDURAL_OPTIMIZATION for libhermes.so in OSS

Summary:
PR is here https://github.com/facebook/react-native/pull/50581

This enables INTERPROCEDURAL_OPTIMIZATION for Hermes in OSS, similar to how we did for libreactnative.so
I also had to bump CMake to 3.30.x to unblock the build failure with `-fuse-ld=gold`

Changelog:
[Internal] [Changed] -

Reviewed By: alanleedev

Differential Revision: D72696879

fbshipit-source-id: e842f6cdf41f6936ef4baeb70e4833a1a0c2d19b
This commit is contained in:
Nicola Corti
2025-04-11 03:03:09 -07:00
committed by Facebook GitHub Bot
parent f62bd98a32
commit 5ef68569b3
2 changed files with 8 additions and 5 deletions
@@ -45,7 +45,7 @@ extra["publishing_version"] = project.findProperty("VERSION_NAME")?.toString()!!
// This is the version of CMake we're requesting to the Android SDK to use.
// If missing it will be downloaded automatically. Only CMake versions shipped with the
// Android SDK are supported (you can find them listed in the SDK Manager of Android Studio).
val cmakeVersion = System.getenv("CMAKE_VERSION") ?: "3.22.1"
val cmakeVersion = System.getenv("CMAKE_VERSION") ?: "3.30.5"
extra["cmake_version"] = cmakeVersion
@@ -136,19 +136,22 @@ val configureBuildForHermes by
workingDir(hermesDir)
inputs.dir(hermesDir)
outputs.files(hermesBuildOutputFileTree)
commandLine(
var cmakeCommandLine =
windowsAwareCommandLine(
cmakeBinaryPath,
// Suppress all warnings as this is the Hermes build and we can't fix them.
"--log-level=ERROR",
"-Wno-dev",
if (Os.isFamily(Os.FAMILY_WINDOWS)) "-GNMake Makefiles" else "",
"-S",
".",
"-B",
hermesBuildDir.toString(),
"-DJSI_DIR=" + jsiDir.absolutePath,
))
)
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
cmakeCommandLine = cmakeCommandLine + "-GNMake Makefiles"
}
commandLine(cmakeCommandLine)
standardOutputFile.set(project.file("$buildDir/configure-hermesc.log"))
}
@@ -236,9 +239,9 @@ android {
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
"-DIMPORT_HERMESC=${File(hermesBuildDir, "ImportHermesc.cmake").toString()}",
"-DJSI_DIR=${jsiDir}",
"-DHERMES_SLOW_DEBUG=False",
"-DHERMES_BUILD_SHARED_JSI=True",
"-DHERMES_RELEASE_VERSION=for RN ${version}",
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True",
// We intentionally build Hermes with Intl support only. This is to simplify
// the build setup and to avoid overcomplicating the build-type matrix.
"-DHERMES_ENABLE_INTL=True")