diff --git a/.gitignore b/.gitignore index 91a498c3..94dab4e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -/*.user -/build* -.DS_Store - +/*.user +/build* +.DS_Store +CMakeFiles/ +__/ diff --git a/.travis.yml b/.travis.yml index 750d6f91..9a7d9733 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/.travis/travis_build.sh b/.travis/travis_build.sh old mode 100644 new mode 100755 index 3689d357..0f1a4d6b --- a/.travis/travis_build.sh +++ b/.travis/travis_build.sh @@ -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 diff --git a/.travis/travis_install.sh b/.travis/travis_install.sh old mode 100644 new mode 100755 index 5e63bdcf..ae7735b4 --- a/.travis/travis_install.sh +++ b/.travis/travis_install.sh @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6229438d..956c91a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" ) diff --git a/libsrc/bonjour/CMakeLists.txt b/libsrc/bonjour/CMakeLists.txt index f3f70b95..557691a1 100644 --- a/libsrc/bonjour/CMakeLists.txt +++ b/libsrc/bonjour/CMakeLists.txt @@ -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 diff --git a/libsrc/utils/Logger.cpp b/libsrc/utils/Logger.cpp index 846f6fb6..d833cbd2 100644 --- a/libsrc/utils/Logger.cpp +++ b/libsrc/utils/Logger.cpp @@ -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); } } diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index 3ef8ecaa..e1c73c55 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -1,7 +1,12 @@ #include #include #include -#include + +#ifndef __APPLE__ +/* prctl is Linux only */ +#include +#endif + #include #include @@ -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;