Skip to content

Commit f72ffd5

Browse files
authored
Merge pull request #1024 from NativeScript/bektchiev/libffi-fix-to-release
Merge fix from #1002 to release
2 parents 328e091 + 4909562 commit f72ffd5

File tree

9 files changed

+308
-200
lines changed

9 files changed

+308
-200
lines changed

build/scripts/build-step-libffi.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ function build {
66
local ARCH=$1
77
local BINARY_DIR="build_$PLATFORM_NAME-$ARCH-$CONFIGURATION"
88

9-
if [ -f "$BINARY_DIR/.libs/libffi.a" ]; then
10-
return 0
11-
fi
129

1310
local TRIPLE
1411
if [ "$ARCH" == "i386" ]; then
@@ -24,7 +21,9 @@ function build {
2421
exit 1
2522
fi
2623

27-
autoreconf -i
24+
if [ ! -e ./configure ]; then
25+
autoreconf -i
26+
fi
2827

2928
mkdir -p "$BINARY_DIR" && pushd "$_"
3029

@@ -40,7 +39,10 @@ function build {
4039
CFLAGS="$CFLAGS -g"
4140
fi
4241

43-
./../configure --disable-shared --host="$TRIPLE"
42+
if [ ! -e Makefile ]; then
43+
./../configure --disable-shared --host="$TRIPLE"
44+
fi
45+
4446
make
4547
)
4648

tests/TestFixtures/Marshalling/TNSRecords.h

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Copyright (c) 2014 Jason Zhekov. All rights reserved.
77
//
88

9+
#import <SceneKit/SceneKit.h>
910
#import <simd/simd.h>
1011

1112
typedef struct TNSSimpleStruct {
@@ -181,3 +182,11 @@ TNSStructWith2Floats getStructWith2Floats();
181182
TNSStructWith4Doubles getStructWith4Doubles();
182183
TNSStructWith3Doubles getStructWith3Doubles();
183184
TNSStructWith2Doubles getStructWith2Doubles();
185+
186+
simd_float3 _SCNVector3ToFloat3(SCNVector3 v);
187+
simd_float4 _SCNVector4ToFloat4(SCNVector4 v);
188+
simd_float4x4 _SCNMatrix4ToMat4(SCNMatrix4 m);
189+
190+
SCNVector3 _SCNVector3FromFloat3(simd_float3 v);
191+
SCNVector4 _SCNVector4FromFloat4(simd_float4 v);
192+
SCNMatrix4 _SCNMatrix4FromMat4(simd_float4x4 m);

tests/TestFixtures/Marshalling/TNSRecords.m

+25
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,28 @@ StructWithVectorAndDouble getStructWithVectorAndDouble() {
348348
str.dbl = 1.67;
349349
return str;
350350
}
351+
352+
simd_float3 _SCNVector3ToFloat3(SCNVector3 v) {
353+
return SCNVector3ToFloat3(v);
354+
}
355+
356+
simd_float4 _SCNVector4ToFloat4(SCNVector4 v) {
357+
return SCNVector4ToFloat4(v);
358+
}
359+
360+
simd_float4x4 _SCNMatrix4ToMat4(SCNMatrix4 m) {
361+
return SCNMatrix4ToMat4(m);
362+
}
363+
364+
SCNVector3 _SCNVector3FromFloat3(simd_float3 v) {
365+
return SCNVector3FromFloat3(v);
366+
}
367+
368+
SCNVector4 _SCNVector4FromFloat4(simd_float4 v) {
369+
return SCNVector4FromFloat4(v);
370+
}
371+
372+
SCNMatrix4 _SCNMatrix4FromMat4(simd_float4x4 m) {
373+
return SCNMatrix4FromMat4(m);
374+
}
375+

tests/TestFixtures/exported-symbols.txt

+6
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,9 @@ _incrementDouble4
155155
_incrementFloat2
156156
_incrementFloat3
157157
_incrementFloat4
158+
__SCNVector3ToFloat3
159+
__SCNVector4ToFloat4
160+
__SCNMatrix4ToMat4
161+
__SCNVector3FromFloat3
162+
__SCNVector4FromFloat4
163+
__SCNMatrix4FromMat4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
describe(module.id, function () {
2+
it("simd_float4x4Matrix", function(){
3+
var simdMatrix = getMatrixFloat4x4();
4+
for (var i = 0; i < 16; i++) {
5+
expect(simdMatrix.columns[i%4][Math.floor(i/4)].toFixed(4)).toBe((i*3.1415).toFixed(4));
6+
}
7+
});
8+
9+
it("simd_float4x3Matrix", function(){
10+
var simdMatrix = getMatrixFloat4x3();
11+
for (var i = 0; i < 12; i++) {
12+
expect(simdMatrix.columns[i%4][Math.floor(i/4)].toFixed(4)).toBe((i*3.1415).toFixed(4));
13+
}
14+
});
15+
16+
it("simd_float4x2Matrix", function(){
17+
var simdMatrix = getMatrixFloat4x2();
18+
for (var i = 0; i < 8; i++) {
19+
expect(simdMatrix.columns[i%4][Math.floor(i/4)].toFixed(4)).toBe((i*3.1415).toFixed(4));
20+
}
21+
});
22+
23+
it("simd_float3x4Matrix", function(){
24+
var simdMatrix = getMatrixFloat3x4();
25+
for (var i = 0; i < 12; i++) {
26+
expect(simdMatrix.columns[i%3][Math.floor(i/3)].toFixed(4)).toBe((i*3.1415).toFixed(4));
27+
}
28+
});
29+
30+
it("simd_float3x3Matrix", function(){
31+
var simdMatrix = getMatrixFloat3x3();
32+
for (var i = 0; i < 9; i++) {
33+
expect(simdMatrix.columns[i%3][Math.floor(i/3)].toFixed(4)).toBe((i*3.1415).toFixed(4));
34+
}
35+
});
36+
37+
it("simd_float3x2Matrix", function(){
38+
var simdMatrix = getMatrixFloat3x2();
39+
for (var i = 0; i < 6; i++) {
40+
expect(simdMatrix.columns[i%3][Math.floor(i/3)].toFixed(4)).toBe((i*3.1415).toFixed(4));
41+
}
42+
});
43+
44+
it("simd_float2x4Matrix", function(){
45+
var simdMatrix = getMatrixFloat2x4();
46+
for (var i = 0; i < 8; i++) {
47+
expect(simdMatrix.columns[i%2][Math.floor(i/2)].toFixed(4)).toBe((i*3.1415).toFixed(4));
48+
}
49+
});
50+
51+
it("simd_float2x3Matrix", function(){
52+
var simdMatrix = getMatrixFloat2x3();
53+
for (var i = 0; i < 6; i++) {
54+
expect(simdMatrix.columns[i%2][Math.floor(i/2)].toFixed(4)).toBe((i*3.1415).toFixed(4));
55+
}
56+
});
57+
58+
it("simd_float2x2Matrix", function(){
59+
var simdMatrix = getMatrixFloat2x2();
60+
for (var i = 0; i < 4; i++) {
61+
expect(simdMatrix.columns[i%2][Math.floor(i/2)].toFixed(4)).toBe((i*3.1415).toFixed(4));
62+
}
63+
});
64+
65+
it("simd_double4x4Matrix", function(){
66+
var simdMatrix = getMatrixDouble4x4();
67+
for (var i = 0; i < 16; i++) {
68+
expect(simdMatrix.columns[i%4][Math.floor(i/4)].toFixed(4)).toBe((i*3.1415).toFixed(4));
69+
}
70+
});
71+
72+
it("simd_double4x3Matrix", function(){
73+
var simdMatrix = getMatrixDouble4x3();
74+
for (var i = 0; i < 12; i++) {
75+
expect(simdMatrix.columns[i%4][Math.floor(i/4)].toFixed(4)).toBe((i*3.1415).toFixed(4));
76+
}
77+
});
78+
79+
it("simd_double4x2Matrix", function(){
80+
var simdMatrix = getMatrixDouble4x2();
81+
for (var i = 0; i < 8; i++) {
82+
expect(simdMatrix.columns[i%4][Math.floor(i/4)].toFixed(4)).toBe((i*3.1415).toFixed(4));
83+
}
84+
});
85+
86+
it("simd_double3x4Matrix", function(){
87+
var simdMatrix = getMatrixDouble3x4();
88+
for (var i = 0; i < 12; i++) {
89+
expect(simdMatrix.columns[i%3][Math.floor(i/3)].toFixed(4)).toBe((i*3.1415).toFixed(4));
90+
}
91+
});
92+
93+
it("simd_double3x3Matrix", function(){
94+
var simdMatrix = getMatrixDouble3x3();
95+
for (var i = 0; i < 9; i++) {
96+
expect(simdMatrix.columns[i%3][Math.floor(i/3)].toFixed(4)).toBe((i*3.1415).toFixed(4));
97+
}
98+
});
99+
100+
it("simd_double3x2Matrix", function(){
101+
var simdMatrix = getMatrixDouble3x2();
102+
for (var i = 0; i < 6; i++) {
103+
expect(simdMatrix.columns[i%3][Math.floor(i/3)].toFixed(4)).toBe((i*3.1415).toFixed(4));
104+
}
105+
});
106+
107+
it("simd_double2x4Matrix", function(){
108+
var simdMatrix = getMatrixDouble2x4();
109+
for (var i = 0; i < 8; i++) {
110+
expect(simdMatrix.columns[i%2][Math.floor(i/2)].toFixed(4)).toBe((i*3.1415).toFixed(4));
111+
}
112+
});
113+
114+
it("simd_double2x3Matrix", function(){
115+
var simdMatrix = getMatrixDouble2x3();
116+
for (var i = 0; i < 6; i++) {
117+
expect(simdMatrix.columns[i%2][Math.floor(i/2)].toFixed(4)).toBe((i*3.1415).toFixed(4));
118+
}
119+
});
120+
121+
it("simd_double2x2Matrix", function(){
122+
var simdMatrix = getMatrixDouble2x2();
123+
for (var i = 0; i < 4; i++) {
124+
expect(simdMatrix.columns[i%2][Math.floor(i/2)].toFixed(4)).toBe((i*3.1415).toFixed(4));
125+
}
126+
});
127+
128+
it("SCNMatrix4FromMat4", function() {
129+
const m1 = getMatrixFloat4x4();
130+
const m2 = _SCNMatrix4FromMat4(m1);
131+
132+
for (let col = 0; col < 4; col++) {
133+
for (let row = 0; row < 4; row++) {
134+
expect(m2[`m${col+1}${row+1}`].toFixed(4)).toBe((m1.columns[col][row]).toFixed(4));
135+
}
136+
}
137+
});
138+
139+
it("SCNMatrix4ToMat4", function() {
140+
const m1 = {};
141+
for (let col = 0; col < 4; col++) {
142+
for (let row = 0; row < 4; row++) {
143+
m1[`m${col+1}${row+1}`] = 3.1415*(row*4 + col);
144+
}
145+
}
146+
147+
const m2 = _SCNMatrix4ToMat4(m1);
148+
149+
for (let col = 0; col < 4; col++) {
150+
for (let row = 0; row < 4; row++) {
151+
expect((m2.columns[col][row]).toFixed(4)).toBe(m1[`m${col+1}${row+1}`].toFixed(4));
152+
}
153+
}
154+
});
155+
});

0 commit comments

Comments
 (0)