Skip to content

Commit

Permalink
Fix OSX compile and deploy
Browse files Browse the repository at this point in the history
Set additional compile flag
Fix FindLdap.cmake for OSX
Fix DMG creation (sometimes fails if no volume size is provided)

Closes GH-304.
  • Loading branch information
romibi authored and Sput42 committed Feb 4, 2018
1 parent 0c7ad7a commit 8a7444f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
16 changes: 7 additions & 9 deletions .travis.yml
@@ -1,6 +1,5 @@
os:
- linux
- osx

sudo: required
dist: trusty
Expand All @@ -17,13 +16,13 @@ env:
- QT_VERSION=qt5

matrix:
include:
- os: osx
compiler: gcc
env: QT_VERSION=qt5
exclude:
- compiler: clang
env: QT_VERSION=qt4
- os: osx
compiler: clang
- os: osx
env: QT_VERSION=qt4

install: |-
if [ "$TRAVIS_OS_NAME" == "linux" ]
Expand All @@ -50,13 +49,12 @@ script: |-
make
elif [ "$TRAVIS_OS_NAME" == "osx" ]
then
PATH=$PATH:/usr/local/opt/qt5/bin
if [[ "$TRAVIS_TAG" != "" && "$GH_TOKEN" != "" ]]
then
PATH=$PATH:/usr/local/opt/qt5/bin
# The LDAP headers found in OSX Frameworks seem to be broken
cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DDEPLOY=ON -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DLDAP_INCLUDE_DIR=/usr/include/
cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DDEPLOY=ON
else
cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DLDAP_INCLUDE_DIR=/usr/include/
cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release
fi
ninja install
fi
Expand Down
15 changes: 15 additions & 0 deletions cmake/FindLdap.cmake
Expand Up @@ -15,7 +15,22 @@ endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)

# Attempt to link against ldap.h regardless of platform!
FIND_PATH(LDAP_INCLUDE_DIR ldap.h)

# If we detect path to invalid ldap.h on osx, try /usr/include/
# This might also be achievable with additional parameters to FIND_PATH.
string(TOLOWER ${LDAP_INCLUDE_DIR} ldapincludelower)
if("${ldapincludelower}" MATCHES "\\/system\\/library\\/frameworks\\/ldap\\.framework\\/headers")
set(LDAP_INCLUDE_DIR "/usr/include/")
endif()

FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)

# On osx remove invalid ldap.h
string(TOLOWER ${LDAP_LIBRARIES} ldaplower)
if("${ldaplower}" MATCHES "\\/system\\/library\\/frameworks\\/ldap\\.framework")
set(LDAP_LIBRARIES FALSE)
endif()

FIND_LIBRARY(LBER_LIBRARIES NAMES lber)

# It'd be nice to link against winldap on Windows, unfortunately
Expand Down
3 changes: 1 addition & 2 deletions cmake/QuasselCompileSettings.cmake
Expand Up @@ -80,6 +80,5 @@ endif()
# Mac build stuff
if (APPLE AND DEPLOY)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.9")
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.9 -stdlib=libc++")
endif()
3 changes: 2 additions & 1 deletion scripts/build/macosx_makePackage.sh
Expand Up @@ -80,5 +80,6 @@ case $BUILDTYPE in
exit 1
;;
esac
hdiutil create -srcfolder ${PACKAGETMPDIR} -format UDBZ -volname "Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}" "${WORKINGDIR}${QUASSEL_DMG}" >/dev/null
PACKAGESIZE=$(echo "$(du -ms ${PACKAGETMPDIR} | cut -f1) * 1.1" | bc)
hdiutil create -srcfolder ${PACKAGETMPDIR} -format UDBZ -size ${PACKAGESIZE}M -volname "Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}" "${WORKINGDIR}${QUASSEL_DMG}" >/dev/null
rm -rf ${PACKAGETMPDIR}

0 comments on commit 8a7444f

Please sign in to comment.