Make two separate yoga targets for QE
Summary: Setup QE for yoga perf changes Reviewed By: emilsjolander Differential Revision: D7059278 fbshipit-source-id: dd11b018edc8ea930d5eba09c6c01e349bb8b63c
This commit is contained in:
committed by
Facebook Github Bot
parent
2ff18bc948
commit
b28292e454
14
BUCK
14
BUCK
@@ -32,6 +32,20 @@ cxx_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cxx_library(
|
||||||
|
name = "yogafastmath",
|
||||||
|
srcs = glob(["yoga/*.cpp"]),
|
||||||
|
header_namespace = "",
|
||||||
|
exported_headers = subdir_glob([("", "yoga/*.h")]),
|
||||||
|
compiler_flags = COMPILER_FLAGS + ["-ffast-math"],
|
||||||
|
soname = "libyogafastmathcore.$(ext)",
|
||||||
|
tests = [":YogaTests"],
|
||||||
|
visibility = ["PUBLIC"],
|
||||||
|
deps = [
|
||||||
|
yoga_dep("lib/fb:ndklog"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
cxx_test(
|
cxx_test(
|
||||||
name = "YogaTests",
|
name = "YogaTests",
|
||||||
srcs = glob(["tests/*.cpp"]),
|
srcs = glob(["tests/*.cpp"]),
|
||||||
|
24
java/BUCK
24
java/BUCK
@@ -28,6 +28,29 @@ cxx_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cxx_library(
|
||||||
|
name = "jniFastMath",
|
||||||
|
srcs = glob(["jni/*.cpp"]),
|
||||||
|
header_namespace = "",
|
||||||
|
compiler_flags = [
|
||||||
|
"-fno-omit-frame-pointer",
|
||||||
|
"-fexceptions",
|
||||||
|
"-fPIC",
|
||||||
|
"-Wall",
|
||||||
|
"-Werror",
|
||||||
|
"-O3",
|
||||||
|
"-std=c++11",
|
||||||
|
],
|
||||||
|
platforms = ANDROID,
|
||||||
|
soname = "libyogafastmath.$(ext)",
|
||||||
|
visibility = ["PUBLIC"],
|
||||||
|
deps = [
|
||||||
|
FBJNI_TARGET,
|
||||||
|
JNI_TARGET,
|
||||||
|
yoga_dep(":yogafastmath"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
java_library(
|
java_library(
|
||||||
name = "java",
|
name = "java",
|
||||||
srcs = glob(["com/facebook/yoga/*.java"]),
|
srcs = glob(["com/facebook/yoga/*.java"]),
|
||||||
@@ -40,6 +63,7 @@ java_library(
|
|||||||
visibility = ["PUBLIC"],
|
visibility = ["PUBLIC"],
|
||||||
deps = [
|
deps = [
|
||||||
":jni",
|
":jni",
|
||||||
|
":jniFastMath",
|
||||||
INFER_ANNOTATIONS_TARGET,
|
INFER_ANNOTATIONS_TARGET,
|
||||||
JSR_305_TARGET,
|
JSR_305_TARGET,
|
||||||
PROGRUARD_ANNOTATIONS_TARGET,
|
PROGRUARD_ANNOTATIONS_TARGET,
|
||||||
|
@@ -16,7 +16,11 @@ public class YogaConfig {
|
|||||||
public static int SPACING_TYPE = 1;
|
public static int SPACING_TYPE = 1;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SoLoader.loadLibrary("yoga");
|
if (YogaConstants.shouldUseFastMath) {
|
||||||
|
SoLoader.loadLibrary("yogafastmath");
|
||||||
|
} else {
|
||||||
|
SoLoader.loadLibrary("yoga");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long mNativePointer;
|
long mNativePointer;
|
||||||
|
@@ -11,6 +11,8 @@ public class YogaConstants {
|
|||||||
|
|
||||||
public static final float UNDEFINED = Float.NaN;
|
public static final float UNDEFINED = Float.NaN;
|
||||||
|
|
||||||
|
public static boolean shouldUseFastMath = false;
|
||||||
|
|
||||||
public static boolean isUndefined(float value) {
|
public static boolean isUndefined(float value) {
|
||||||
return Float.compare(value, UNDEFINED) == 0;
|
return Float.compare(value, UNDEFINED) == 0;
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,11 @@ import javax.annotation.Nullable;
|
|||||||
public class YogaNode implements Cloneable {
|
public class YogaNode implements Cloneable {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SoLoader.loadLibrary("yoga");
|
if (YogaConstants.shouldUseFastMath) {
|
||||||
|
SoLoader.loadLibrary("yogafastmath");
|
||||||
|
} else {
|
||||||
|
SoLoader.loadLibrary("yoga");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user