Skip to content

Commit

Permalink
Added OSX build on travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldotknopf committed Aug 1, 2018
1 parent 0ebef45 commit bb0b6cf
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
output/
samples/PhotoFrame/\.vscode/
samples/PhotoFrame/\.idea/
build/Qt/
build/qtci/
15 changes: 14 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
sudo: required
matrix:
include:
- os: linux
dist: trusty
sudo: required
services: docker
- os: osx
osx_image: xcode9.4
language: csharp
mono: none
dotnet: 2.1.302
cache:
directories:
- build/Qt
if: tag IS blank
services:
- docker
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/Buildary
Submodule Buildary updated 1 files
+10 −0 Runtime.cs
13 changes: 12 additions & 1 deletion build/scripts/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Threading.Tasks;
using static Bullseye.Targets;
using static Build.Buildary.Directory;
Expand Down Expand Up @@ -25,7 +26,17 @@ static Task<int> Main(string[] args)

Add("test", () =>
{
RunShell($"dotnet test src/net/Qml.Net.Tests/ {commandBuildArgs}");
if (IsOSX())
{
// OSX prevent's DYLD_LIBRARY_PATH from being sent to
// child shells. We must manually send it.
var ldLibraryPath = Environment.GetEnvironmentVariable("DYLD_LIBRARY_PATH");
RunShell($"DYLD_LIBRARY_PATH={ldLibraryPath} dotnet test src/net/Qml.Net.Tests/ {commandBuildArgs}");
}
else
{
RunShell($"dotnet test src/net/Qml.Net.Tests/ {commandBuildArgs}");
}
});

Add("build-native", () =>
Expand Down
13 changes: 13 additions & 0 deletions build/travis.linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

$SCRIPT_DIR/docker/build-linux-ci.sh

docker run -it --rm \
-v $SCRIPT_DIR/../:/work \
-w /work \
-e LD_LIBRARY_PATH=/work/src/native/output \
-e QT_QPA_PLATFORM=offscreen \
net-core-qml-linux-ci \
./build.sh ci
36 changes: 36 additions & 0 deletions build/travis.osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -ex

SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
QT_DIR=$SCRIPT_DIR/Qt

if [ ! -e $QT_DIR ]; then

# Checkout some helper scripts for installing Qt in ci.
if [ ! -e $SCRIPT_DIR/qtci ]; then
git clone https://github.com/benlau/qtci $SCRIPT_DIR/qtci
fi
export PATH=$PATH:$SCRIPT_DIR/qtci/bin:$SCRIPT_DIR/qtci/recipes

DOWNLOAD_URL="https://download.qt.io/archive/qt/5.11/5.11.1/qt-opensource-mac-x64-5.11.1.dmg"
INSTALLER=`basename $DOWNLOAD_URL`
INSTALLER_NAME=${INSTALLER%.*}
APPFILE=/Volumes/${INSTALLER_NAME}/${INSTALLER_NAME}.app/Contents/MacOS/${INSTALLER_NAME}

if [ ! -e ${INSTALLER} ]; then
echo "Downloading ${DOWNLOAD_URL}..."
wget -c $DOWNLOAD_URL > /dev/null 2>&1
fi

echo "Mounting and extracting Qt..."
hdiutil mount ${INSTALLER}
export QT_CI_PACKAGES=qt.qt5.5111.qtvirtualkeyboard.clang_64,qt.qt5.5111.clang_64
extract-qt-installer $APPFILE $QT_DIR

fi

export PATH=$PATH:$QT_DIR/5.11.1/clang_64/bin
export DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/src/native/output

# We need to source this script, so that DYLD_LIBRARY_PATH get's passed.
. $TRAVIS_BUILD_DIR/build.sh ci
23 changes: 14 additions & 9 deletions build/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ set -e

SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

$SCRIPT_DIR/docker/build-linux-ci.sh

docker run -it --rm \
-v $SCRIPT_DIR/../:/work \
-w /work \
-e LD_LIBRARY_PATH=/work/src/native/output \
-e QT_QPA_PLATFORM=offscreen \
net-core-qml-linux-ci \
./build.sh ci
if [ "$TRAVIS_OS_NAME" == "linux" ]; then

$SCRIPT_DIR/travis.linux.sh

elif [ "$TRAVIS_OS_NAME" == "osx" ]; then

$SCRIPT_DIR/travis.osx.sh

else

echo "Unsupported os."
exit 1

fi
4 changes: 4 additions & 0 deletions src/native/QmlNet/QmlNet.pro
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ win32 {
INSTALLS += qtqml
}

macx {
# See here: https://stackoverflow.com/questions/51638447/c-sharp-pinvoke-returning-invalid-wrong-bool-value-only-when-native-code-compil
CONFIG += debug
}
2 changes: 1 addition & 1 deletion src/native/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ mkdir -p $BUILD_DIR
cd $BUILD_DIR
PREFIX=$OUTPUT_DIR qmake ../QmlNet
make
make install
make install

0 comments on commit bb0b6cf

Please sign in to comment.