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

3
.gitignore vendored
View File

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

View File

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

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

@ -10,11 +10,13 @@
# compile hyperion on osx # compile hyperion on osx
if [[ $TRAVIS_OS_NAME == 'osx' ]] if [[ $TRAVIS_OS_NAME == 'osx' ]]
then 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 mkdir build || exit 1
cd build cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON -Wno-dev .. || exit 2 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 # make -j$(nproc) package || exit 4 # currently osx(dmg) package creation not implemented
fi fi

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

@ -2,15 +2,17 @@
# install osx deps for hyperion compile # install osx deps for hyperion compile
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
echo "Install OSX deps" echo "Install OSX deps"
brew update time brew update
brew install qt5 time brew install qt5 || true
brew install libusb time brew install libusb || true
brew install cmake time brew install cmake || true
time brew install doxygen || true
fi fi
# install linux deps for hyperion compile # install linux deps for hyperion compile
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
echo "Install linux deps" 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 fi

View File

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

View File

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

View File

@ -93,17 +93,18 @@ Logger::Logger ( std::string name, LogLevel minLevel ):
_loggerId(loggerId++) _loggerId(loggerId++)
{ {
#ifdef __GLIBC__ #ifdef __GLIBC__
_appname = std::string(program_invocation_short_name); const char* _appname_char = program_invocation_short_name;
#else #else
_appname = std::string(getprogname()); const char* _appname_char = getprogname();
#endif #endif
_appname = std::string(_appname_char);
std::transform(_appname.begin(), _appname.end(),_appname.begin(), ::toupper); std::transform(_appname.begin(), _appname.end(),_appname.begin(), ::toupper);
loggerCount++; loggerCount++;
if (_syslogEnabled && loggerCount == 1 ) 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 <cassert>
#include <csignal> #include <csignal>
#include <unistd.h> #include <unistd.h>
#ifndef __APPLE__
/* prctl is Linux only */
#include <sys/prctl.h> #include <sys/prctl.h>
#endif
#include <exception> #include <exception>
#include <QCoreApplication> #include <QCoreApplication>
@ -123,7 +128,9 @@ int main(int argc, char** argv)
if (argParentPid.getValue() > 0 ) if (argParentPid.getValue() > 0 )
{ {
Info(log, "hyperiond client, parent is pid %d",argParentPid.getValue()); Info(log, "hyperiond client, parent is pid %d",argParentPid.getValue());
#ifndef __APPLE__
prctl(PR_SET_PDEATHSIG, SIGHUP); prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
} }
int argvId = -1; int argvId = -1;