From e43c9f66ffda81dcab82f87b6f92bf0f8ea84d8e Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Thu, 22 Dec 2016 08:36:31 -0800 Subject: [PATCH] Add script to build Unity package Summary: Added Bash script and bat file to build a package of Yoga in order to import Yoga for Unity easily. Closes https://github.com/facebook/yoga/pull/288 Reviewed By: emilsjolander Differential Revision: D4344198 Pulled By: splhack fbshipit-source-id: 49ae27dbc513b4a2d161840ca5c5f4c9df2ab227 --- csharp/Unity/.gitignore | 3 +++ csharp/Unity/pack.sh | 53 +++++++++++++++++++++++++++++++++++++++++ csharp/Unity/win.bat | 2 ++ 3 files changed, 58 insertions(+) create mode 100644 csharp/Unity/.gitignore create mode 100755 csharp/Unity/pack.sh create mode 100755 csharp/Unity/win.bat diff --git a/csharp/Unity/.gitignore b/csharp/Unity/.gitignore new file mode 100644 index 00000000..a26b100a --- /dev/null +++ b/csharp/Unity/.gitignore @@ -0,0 +1,3 @@ +Yoga +yoga.dll +yoga.unitypackage diff --git a/csharp/Unity/pack.sh b/csharp/Unity/pack.sh new file mode 100755 index 00000000..402a9632 --- /dev/null +++ b/csharp/Unity/pack.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +cd "$( dirname "$0" )" + +if [ \! -f yoga.dll ]; then + echo "Launch win.bat on Windows and copy yoga.dll to here" + exit 1 +fi + +function build { + buck build $1 + echo "$root/`buck targets --show-output $1|tail -1|awk '{print $2}'`" +} + +function copy { + mkdir -p $3 + cp $1 $3/$2 +} + +rm -rf Yoga yoga.unitypackage + +root=`buck root|tail -f` +mac=$(build '//csharp:yoganet#default,shared') +armv7=$(build '//csharp:yoganet#android-armv7,shared') +ios=$(build '//csharp:yoganet-ios') +win=yoga.dll + +Unity -quit -batchMode -createProject Yoga + +copy $win ${win##*/} Yoga/Assets/Facebook.Yoga/Plugins/x86_64 +copy $mac yoga Yoga/Assets/Facebook.Yoga/Plugins/x86_64/yoga.bundle/Contents/MacOS +armv7path=Assets/Plugins/Android/libs/armeabi-v7a +copy $armv7 ${armv7##*/} Yoga/$armv7path +iospath=Assets/Plugins/iOS +copy $ios ${ios##*/} Yoga/$iospath +libs="$armv7path/${armv7##*/} $iospath/${ios##*/}" + +scripts=Yoga/Assets/Facebook.Yoga/Scripts/Facebook.Yoga +mkdir -p $scripts +(cd ../Facebook.Yoga; tar cf - *.cs)|tar -C $scripts -xf - + +tests=Yoga/Assets/Facebook.Yoga/Editor/Facebook.Yoga.Tests +mkdir -p $tests +(cd ../tests/Facebook.Yoga; tar cf - *.cs)|tar -C $tests -xf - + +Unity -quit -batchMode -projectPath `pwd`/Yoga -exportPackage Assets/Facebook.Yoga $libs `pwd`/yoga.unitypackage + diff --git a/csharp/Unity/win.bat b/csharp/Unity/win.bat new file mode 100755 index 00000000..3f838cd4 --- /dev/null +++ b/csharp/Unity/win.bat @@ -0,0 +1,2 @@ +"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" ..\Yoga\Yoga.vcxproj /p:configuration=Release /property:Platform=x64 +xcopy "..\Yoga\x64\Release\yoga.dll" %~dp0 /s /d /y