Travis osx support (#155)

* fixed OS X compatibility

* adding OS X travis test

* ignoring autogenerated files

* adding OS X travis test

* fixed os x building

* fixed os x building

* reduced ignore file

* v4l osx issue fixed

* improved qt5 detection

* disabled cleaning of child threads on os x for the time being

* fixed avahi on OS X
This commit is contained in:
Rick van Hattem 2016-08-07 18:39:45 +02:00 committed by redPanther
parent 84c041a6fb
commit 05812f107b
8 changed files with 36 additions and 20 deletions

9
.gitignore vendored
View File

@ -1,4 +1,5 @@
/*.user
/build*
.DS_Store
/*.user
/build*
.DS_Store
CMakeFiles/
__/

View File

@ -6,8 +6,8 @@ matrix:
- os: linux
dist: trusty
sudo: required
# - os: osx
# osx_image: xcode7.3
- os: osx
osx_image: xcode7.3
before_install:
- chmod +x ./.travis/travis_install.sh
- ./.travis/travis_install.sh

8
.travis/travis_build.sh Normal file → Executable file
View File

@ -10,11 +10,13 @@
# compile hyperion on osx
if [[ $TRAVIS_OS_NAME == 'osx' ]]
then
cmake . -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.6.1-1
procs=$(sysctl -n hw.ncpu | xargs)
echo "Processes: $procs"
mkdir build || exit 1
cd build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON -Wno-dev .. || exit 2
make -j$(nproc) || exit 3
make -j$procs || exit 3
# make -j$(nproc) package || exit 4 # currently osx(dmg) package creation not implemented
fi

12
.travis/travis_install.sh Normal file → Executable file
View File

@ -2,15 +2,17 @@
# install osx deps for hyperion compile
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
echo "Install OSX deps"
brew update
brew install qt5
brew install libusb
brew install cmake
time brew update
time brew install qt5 || true
time brew install libusb || true
time brew install cmake || true
time brew install doxygen || true
fi
# install linux deps for hyperion compile
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
echo "Install linux deps"
sudo apt-get -qq update ; sudo apt-get install -qq -y qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev doxygen
sudo apt-get -qq update
sudo apt-get install -qq -y qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev doxygen
fi

View File

@ -27,13 +27,16 @@ SET ( DEFAULT_WS2812BPWM OFF )
SET ( DEFAULT_WS281XPWM OFF )
SET ( DEFAULT_V4L2 ON )
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
SET ( DEFAULT_USE_AVAHI_LIBS ON )
SET ( DEFAULT_TESTS OFF )
if (APPLE)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/qt5")
SET ( DEFAULT_OSX ON )
SET ( DEFAULT_V4L2 OFF )
SET ( DEFAULT_V4L2 OFF )
SET ( DEFAULT_SPIDEV OFF )
SET ( DEFAULT_FB OFF )
SET ( DEFAULT_USE_AVAHI_LIBS OFF )
else ()
if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )

View File

@ -46,7 +46,7 @@ if (USE_SHARED_AVAHI_LIBS)
avahi-common
avahi-core
dbus-1)
else()
elseif (DEFAULT_USE_AVAHI_LIBS)
target_link_libraries(bonjour
libdns_sd.a
libavahi-client.a

View File

@ -93,17 +93,18 @@ Logger::Logger ( std::string name, LogLevel minLevel ):
_loggerId(loggerId++)
{
#ifdef __GLIBC__
_appname = std::string(program_invocation_short_name);
const char* _appname_char = program_invocation_short_name;
#else
_appname = std::string(getprogname());
const char* _appname_char = getprogname();
#endif
_appname = std::string(_appname_char);
std::transform(_appname.begin(), _appname.end(),_appname.begin(), ::toupper);
loggerCount++;
if (_syslogEnabled && loggerCount == 1 )
{
openlog (program_invocation_short_name, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog (_appname_char, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);
}
}

View File

@ -1,7 +1,12 @@
#include <cassert>
#include <csignal>
#include <unistd.h>
#include <sys/prctl.h>
#ifndef __APPLE__
/* prctl is Linux only */
#include <sys/prctl.h>
#endif
#include <exception>
#include <QCoreApplication>
@ -123,7 +128,9 @@ int main(int argc, char** argv)
if (argParentPid.getValue() > 0 )
{
Info(log, "hyperiond client, parent is pid %d",argParentPid.getValue());
#ifndef __APPLE__
prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
}
int argvId = -1;