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

Cross-platform build scripts #8

Open
JeroMiya opened this issue Feb 19, 2015 · 5 comments
Open

Cross-platform build scripts #8

JeroMiya opened this issue Feb 19, 2015 · 5 comments
Labels

Comments

@JeroMiya
Copy link
Contributor

build-unity-packages.cmd and prep-package.cmd only work on Windows, of course, but there may be contributors running Linux or Mac. Cross-platform build scripts would be useful for these folks. As long as it doesn't involve installing cygwin/mingw or running in bash shell on windows.

Options might be things like build scripts written in JavaScript and run via node.

Or, since this is a .net repo, maybe a .net build script:
https://github.com/cake-build/cake
http://fsharp.github.io/FAKE/

Or just provide both .sh scripts for Mac/Linux and .cmd for windows, since the scripts are so small.

@rpavlik
Copy link
Member

rpavlik commented Feb 20, 2015

Yeah, those two scripts you mention are primarily for the sake of the CI that's generating the binary snapshots with .unitypackage file and some subset of the source for those who want to tinker.

@ChristophHaag
Copy link

Since there's a native unity editor for linux it would be nice if people could experiment with this. But the automated builds still only contain the windows plugins.

"Manually" building Managed-OSVR doesn't work on linux because the csproject files don't work with xbuild. I.e. you get the error

ClientKit/ClientKit.csproj: error : /home/chris/OSVR-Unity/Managed-OSVR/ClientKit/ClientKit.csproj: Can not evaluate " !$(DefineConstants.Contains(';NET')) " to bool.

and when you work around that you get

ClientKit/ClientKit.csproj: error : /home/chris/OSVR-Unity/Managed-OSVR/ClientKit/ClientKit.csproj: Item has already been added. Key in dictionary: 'DestDir'  Key being added: 'DestDir'

and then I gave up for the time being.

Will linux libraries and plugins come any time soon?

@ChristophHaag
Copy link

Oh, I was mistaken. I believed that the precompiled packages contained windows-specific libraries, but it looks like it's all .Net code that works on linux. I tried to build a very simple project on the experimental unity editor for linux and both the in-editor view and the build work fine: It goes into side by side mode and has working head tracking fully automatically: https://www.youtube.com/watch?v=rwTlW2Nr6i0

Maybe the specific references to windows can be removed from http://access.osvr.com/binary/osvr-unity

OSVR-Unity Windows Assets
These builds contain Windows 32-bit binary packages for use with the Unity3D game engine.

@rpavlik
Copy link
Member

rpavlik commented Sep 22, 2015

Good catch, thanks. That page's hand-written content hasn't been touched in a while apparently - we've been shipping 64-bit native binaries for Windows in there too for a while.

@ChristophHaag
Copy link

This script dropped in the root of OSVR-Unity builds a .unitypackage for me with msbuild:

#!/usr/bin/bash

set -e # exit when something goes wrong

SCRIPTDIR=$(dirname "$(readlink -f "$0")")
cd ${SCRIPTDIR}

echo "Running in $pwd"

#default values can be overwritten by command line arguments
MSBUILD="/usr/share/msbuild/Microsoft.Build.Mono.Debug.14.1.0.0-prerelease/lib/MSBuild.exe"
MONO=$(which mono)
UNITY="/opt/Unity/Editor/Unity"

while [[ $# > 1 ]]
do
key="$1"

case $key in
    -b|--msbuild-path)
    MSBUILD="$2"
    shift
    ;;

    -m|--mono-path)
    MONO="$2"
    shift
    ;;

    -u|--unity-path)
    UNITY="$2"
    shift
    ;;

    *)
        echo "Usage: $0 [--msbuild-path foo/MSBuild.exe]"
    ;;
esac
shift
done

echo "MSBuild.exe path: $MSBUILD"
if [ ! -f "$MSBUILD" ]; then
  echo "Error: MSBuild.exe not found. Set with --msbuild-path"
  exit 1
fi

echo "mono path: $MONO"
if [ ! -f "$MONO" ]; then
  echo "Error: mono not found. Set with --mono-path"
  exit 1
fi

echo "Unity path: $UNITY"
if [ ! -f "$UNITY" ]; then
  echo "Error: Unity Editor not found. Set with --unity-path"
  exit 1
fi

if [ ! -d "Managed-OSVR" ]; then
  git clone https://github.com/OSVR/Managed-OSVR.git
fi

cd Managed-OSVR
mono ${MSBUILD} ClientKit/ClientKit.csproj /p:Configuration=Release20 /p:OutputPath=../Managed-OSVR-Unity /p:NativeOutputSuffix32=x86 /p:NativeOutputSuffix64=x86_64 /p:DefineConstants="NET20"

cp -r Managed-OSVR-Unity/* ../OSVR-Unity/Assets/Plugins

cd "$SCRIPTDIR"

${UNITY} -quit -batchmode -projectPath "$SCRIPTDIR/OSVR-Unity" -logFile "$SCRIPTDIR/unity.log" -executeMethod OSVRUnityBuild.build
cat "$SCRIPTDIR/unity.log"

mkdir -p OSVR-Unity-Dist
cp OSVR-Unity/*.unitypackage OSVR-Unity-Dist
echo "Your unitypackage is in $SCRIPTDIR/OSVR-Unity-Dist"

To anyone: Feel free to improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants