[PATCH] 3 tiny OSX build patches (against master)

Jeroen Massar jeroen at massar.ch
Wed Mar 16 01:19:57 PDT 2016


Hola,

Noticed that I stated that I did not had a /usr/include, well, that is
correct when one does not have done a 'xcode-select install' and thus
installed the command line tools.... aha! ;)

Installing that solved quite a bit of the puzzle, hence I've added a
check for that in the third patch. I went for an error, as auto
installing that causes possibly unexpected popups for accepting apple
licenses, thus better to error out at that point.


Find attached three separate tiny patches:
 - [PATCH 1/3] Debug reminder: how to get more verbose details out of
 cmake
 - [PATCH 2/3] Detect Homebrew qt5 + preserve that path in
 CMAKE_PREFIX_PATH and pass it along to cmake
 - [PATCH 3/3] Verify that the Xcode Command Line Tools are installed

If there are any formatting or other general comments, don't hesitate to
fire them back so that I can fix those issues.

I'll test later (likely over the weekend though) on a clean OSX install
to make sure that we have tackled all the possibly missing steps.

Note that my build do not include mysql/postgres support, the build
properly notes that at the end[1]. Also, I only booted the app, did not
do further testing yet, another thing for the weekend.

There are a bunch of other weird build messages that I'll dig in then too.

I'll separate provide these against 4.5, see next mail.

Greets,
 Jeroen

--

[1] "-- two ERRORS here about libmysqlclient and libpq not found are
harmless"
-------------- next part --------------
From 0cc6c0d8ec5ce8ba0d34206bb77ec56fd2d656e0 Mon Sep 17 00:00:00 2001
From: Jeroen Massar <jeroen at massar.ch>
Date: Wed, 16 Mar 2016 08:57:41 +0100
Subject: [PATCH 1/3] Debug reminder: how to get more verbose details out of
 cmake

Signed-off-by: Jeroen Massar <jeroen at massar.ch>
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c636d1f..ea6f17e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,8 @@
 # cmake based build of Subsurface
 
+# Uncomment his to see all commands cmake actually executes
+# set(CMAKE_VERBOSE_MAKEFILE ON)
+
 project(Subsurface)
 cmake_minimum_required(VERSION 2.8.11)
 
-- 
2.7.3

-------------- next part --------------
From fc6d411fbbbc317d156fe207e9e636017f901840 Mon Sep 17 00:00:00 2001
From: Jeroen Massar <jeroen at massar.ch>
Date: Wed, 16 Mar 2016 09:00:37 +0100
Subject: [PATCH 2/3] Detect Homebrew qt5 + preserve that path in
 CMAKE_PREFIX_PATH and pass it along to cmake

Signed-off-by: Jeroen Massar <jeroen at massar.ch>
---
 scripts/build.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/build.sh b/scripts/build.sh
index e4164db..a3cad13 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -144,6 +144,9 @@ if [ $PLATFORM = Darwin ] ; then
 		export CMAKE_PREFIX_PATH=~/Qt/5.5/clang_64/lib/cmake
 	elif [ -d "~/Qt/5.6" ] ; then
 		export CMAKE_PREFIX_PATH=~/Qt/5.6/clang_64/lib/cmake
+	elif [ -d /usr/local/opt/qt5/lib ] ; then
+		# Homebrew location for qt5 package
+		export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake
 	else
 		echo "cannot find Qt 5.5 or 5.6 in ~/Qt"
 		exit 1
@@ -218,7 +221,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
 
 	mkdir -p $SRC/subsurface/$BUILDDIR
 	cd $SRC/subsurface/$BUILDDIR
-	export CMAKE_PREFIX_PATH=$INSTALL_ROOT/lib/cmake
+	export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
 	cmake -DCMAKE_BUILD_TYPE=Debug .. \
 		-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
 		-DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \
@@ -227,6 +230,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
 		-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
 		-DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \
 		-DMARBLE_LIBRARIES=$INSTALL_ROOT/lib/libssrfmarblewidget.$SH_LIB_EXT \
+		-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
 		-DNO_PRINTING=OFF
 
 	if [ $PLATFORM = Darwin ] ; then
-- 
2.7.3

-------------- next part --------------
From e6c0232ed1be9bb36bd079d8f740b9c7862cc502 Mon Sep 17 00:00:00 2001
From: Jeroen Massar <jeroen at massar.ch>
Date: Wed, 16 Mar 2016 09:02:03 +0100
Subject: [PATCH 3/3] Verify that the Xcode Command Line Tools are installed

Otherwise /usr/include does not exist on a clean-ish install

Signed-off-by: Jeroen Massar <jeroen at massar.ch>
---
 scripts/build.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/build.sh b/scripts/build.sh
index a3cad13..36a91c3 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -23,6 +23,18 @@ exec 1> >(tee build.log) 2>&1
 SRC=$(pwd)
 PLATFORM=$(uname)
 
+# Verify that the Xcode Command Line Tools are installed
+if [ $PLATFORM = Darwin ] ; then
+	if [ ! -d /usr/include ] ; then
+		echo "Error: Xcode Command Line Tools are not installed"
+		echo ""
+		echo "Please run:"
+		echo " xcode-select --install"
+		echo "to install them (you'll have to agree to Apple's licensing terms etc), then run build.sh again"
+		exit 1;
+	fi
+fi
+
 # normally this script builds the desktop version in subsurface/build
 # if the first argument is "-mobile" then build Subsurface-mobile in subsurface/build-mobile
 # if the first argument is "-both" then build both in subsurface/build and subsurface/build-mobile
-- 
2.7.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160316/d569c6eb/attachment.sig>


More information about the subsurface mailing list