Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows][Hermes] - Working around config.guess and specifying explicit flavor #33785

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions ReactAndroid/hermes-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ task installArchives {
dependsOn("publishAllPublicationsToNpmRepository")
}

def replaceContent = '''elseif(CMAKE_HOST_WIN32)
set (ABI_NORM \"\")
if (ANDROID_ABI STREQUAL \"armeabi-v7a\" )
set (ABI_NORM \"arm\")
elseif(ANDROID_ABI STREQUAL \"arm64-v8a\" )
set (ABI_NORM \"arm64\")
else()
set (ABI_NORM \"\\${ANDROID_ABI}\")
endif()
set( value \"\\${ABI_NORM}-unknown-linux-gnu\" )
else( MSVC )'''
Comment on lines +74 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah .. Here is the PR : facebook/hermes#747


task unzipHermes(dependsOn: downloadHermes, type: Copy) {
from(tarTree(downloadHermes.dest)) {
eachFile { file ->
Expand All @@ -79,19 +91,27 @@ task unzipHermes(dependsOn: downloadHermes, type: Copy) {
if (file.relativePath.segments.size() > 1) {
file.relativePath = new org.gradle.api.file.RelativePath(!file.isDirectory(), file.relativePath.segments.drop(1))
}
if(file.getName() == "GetHostTriple.cmake") {
// LLVM build scripts embedded into hermes tries to guess the target architecture.
// As Hermes doesn't use LLVM JIT, the guessed value is unused
// TODO: Validate the above statement
// TODO2: Move this as a path to Hermes repo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo patch

// This workaround replaces the call to config.guess bash script with windows friendly code.
filter { line -> line.replaceAll('else\\( MSVC \\)', replaceContent) }
}
}
}
into(hermesDir)
}

task configureBuildForHermes(type: Exec) {
workingDir(hermesDir)
commandLine(windowsAwareCommandLine(findCmakePath(cmakeVersion), "-S", ".", "-B", hermesBuildDir.toString(), "-DJSI_DIR=" + jsiDir.absolutePath))
commandLine(windowsAwareCommandLine(findCmakePath(cmakeVersion), "-S", ".", "-B", hermesBuildDir.toString(), "-DJSI_DIR=" + jsiDir.absolutePath, "-DCMAKE_BUILD_TYPE=Release"))
}

task buildHermes(dependsOn: configureBuildForHermes, type: Exec) {
workingDir(hermesDir)
commandLine(windowsAwareCommandLine(findCmakePath(cmakeVersion), "--build", hermesBuildDir.toString(), "--target", "hermesc", "-j", ndkBuildJobs))
commandLine(windowsAwareCommandLine(findCmakePath(cmakeVersion), "--build", hermesBuildDir.toString(), "--target", "hermesc", "-j", ndkBuildJobs, "--config", "Release"))
}

task prepareHeadersForPrefab(type: Copy) {
Expand Down