Skip to content

Commit

Permalink
Fix cmake error on windows (#132)
Browse files Browse the repository at this point in the history
# Why

fix #115

# How

the path on windows is not correct:
`C:\DEV\...\node_modules\react-native/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp`.
replace file separators to `/` also on windows
  • Loading branch information
Kudo authored Aug 21, 2022
1 parent 33b343e commit 5a2107f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import groovy.json.JsonSlurper
import org.apache.tools.ant.filters.ReplaceTokens
import org.apache.tools.ant.taskdefs.condition.Os


File findNodePackageDir(String packageName, boolean absolute = true) {
Expand All @@ -23,6 +24,14 @@ File findNodePackageDir(String packageName, boolean absolute = true) {
return absolute ? dir.getAbsoluteFile() : dir
}

String toPlatformFileString(File path) {
def result = path.toString()
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
result = result.replace(File.separatorChar, '/' as char)
}
return result
}

def safeExtGet(prop, fallback) {
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
Expand Down Expand Up @@ -157,7 +166,7 @@ android {
arguments "-DANDROID_STL=c++_shared",
"-DBOOST_VERSION=${BOOST_VERSION}",
"-DBUILD_DIR=${buildDir}",
"-DRN_DIR=${reactNativeDir}",
"-DRN_DIR=${toPlatformFileString(reactNativeDir)}",
"-DREACT_NATIVE_TARGET_VERSION=${rnMinorVersion}",
"-DV8_ANDROID_DIR=${v8AndroidDir}",
"-DSO_DIR=${extractSoDir}"
Expand Down

0 comments on commit 5a2107f

Please sign in to comment.