From 8711bd25006bda5b63516a222b762e71a9954a56 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 9 Mar 2013 13:04:36 -0500 Subject: [PATCH] Set preprocessor define for deployment builds. Don't include sparkle in development builds. Note: Development snapshots are considered deployment builds --- openscad.pro | 20 ++++++++++++-------- scripts/macosx-build-dependencies.sh | 13 +++++++++---- scripts/release-common.sh | 4 +--- src/openscad.cc | 8 ++++---- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/openscad.pro b/openscad.pro index 6f3ddfb5..c661afdb 100644 --- a/openscad.pro +++ b/openscad.pro @@ -55,20 +55,26 @@ else { } } -macx { - # add CONFIG+=deploy to the qmake command-line to make a deployment build - deploy { - message("Building deployment version") +# add CONFIG+=deploy to the qmake command-line to make a deployment build +deploy { + message("Building deployment version") + DEFINES += OPENSCAD_DEPLOY + macx { CONFIG += x86 x86_64 + LIBS += -framework Sparkle + HEADERS += src/SparkleAutoUpdater.h + OBJECTIVE_SOURCES += src/SparkleAutoUpdater.mm } +} +macx { TARGET = OpenSCAD ICON = icons/OpenSCAD.icns QMAKE_INFO_PLIST = Info.plist APP_RESOURCES.path = Contents/Resources APP_RESOURCES.files = OpenSCAD.sdef dsa_pub.pem icons/SCAD.icns QMAKE_BUNDLE_DATA += APP_RESOURCES - LIBS += -framework Cocoa -framework Sparkle + LIBS += -framework Cocoa } else { TARGET = openscad @@ -357,11 +363,9 @@ SOURCES += src/cgalutils.cc \ macx { HEADERS += src/AppleEvents.h \ src/EventFilter.h \ - src/SparkleAutoUpdater.h \ src/CocoaUtils.h SOURCES += src/AppleEvents.cc - OBJECTIVE_SOURCES += src/SparkleAutoUpdater.mm \ - src/CocoaUtils.mm + OBJECTIVE_SOURCES += src/CocoaUtils.mm } isEmpty(PREFIX):PREFIX = /usr/local diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index e208fdde..11d9919a 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -6,10 +6,11 @@ # # This script must be run from the OpenSCAD source root directory # -# Usage: macosx-build-dependencies.sh [-6l] +# Usage: macosx-build-dependencies.sh [-6lcd] # -6 Build only 64-bit binaries # -l Force use of LLVM compiler # -c Force use of clang compiler +# -d Build for deployment (if not specified, e.g. Sparkle won't be built) # # Prerequisites: # - MacPorts: curl, cmake @@ -32,11 +33,12 @@ export QMAKESPEC=macx-g++ printUsage() { - echo "Usage: $0 [-6lc]" + echo "Usage: $0 [-6lcd]" echo echo " -6 Build only 64-bit binaries" echo " -l Force use of LLVM compiler" echo " -c Force use of clang compiler" + echo " -d Build for deployment" } # FIXME: Support gcc/llvm/clang flags. Use -platform to make this work? kintel 20130117 @@ -354,12 +356,13 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then exit 0 fi -while getopts '6lc' c +while getopts '6lcd' c do case $c in 6) OPTION_32BIT=false;; l) OPTION_LLVM=true;; c) OPTION_CLANG=true;; + d) OPTION_DEPLOY=true;; esac done @@ -415,4 +418,6 @@ build_boost 1.53.0 build_cgal 4.1 build_glew 1.9.0 build_opencsg 1.3.2 -build_sparkle 0ed83cf9f2eeb425d4fdd141c01a29d843970c20 +if $OPTION_DEPLOY; then + build_sparkle 0ed83cf9f2eeb425d4fdd141c01a29d843970c20 +fi diff --git a/scripts/release-common.sh b/scripts/release-common.sh index a30d43a8..10a1c184 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -110,13 +110,12 @@ fi echo "Building openscad-$VERSION ($VERSIONDATE) $CONFIGURATION..." +CONFIG=deploy case $OS in LINUX|MACOSX) - CONFIG=deploy TARGET= ;; WIN) - unset CONFIG export QTDIR=/c/devmingw/qt2009.03 export QTMAKESPEC=win32-g++ export PATH=$PATH:/c/devmingw/qt2009.03/bin:/c/devmingw/qt2009.03/qt/bin @@ -125,7 +124,6 @@ case $OS in TARGET=release ;; LINXWIN) - unset CONFIG . ./scripts/setenv-mingw-xbuild.sh TARGET=release ZIP="zip" diff --git a/src/openscad.cc b/src/openscad.cc index 75d7b9d8..682ccb7b 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -55,7 +55,9 @@ #ifdef Q_WS_MAC #include "EventFilter.h" #include "AppleEvents.h" -#include "SparkleAutoUpdater.h" +#ifdef OPENSCAD_DEPLOY + #include "SparkleAutoUpdater.h" +#endif #endif #include "Camera.h" @@ -483,12 +485,10 @@ int main(int argc, char **argv) installAppleEventHandlers(); #endif -#ifndef DEBUG -#ifdef Q_WS_MAC +#if defined(OPENSCAD_DEPLOY) && defined(Q_WS_MAC) AutoUpdater *updater = new SparkleAutoUpdater; AutoUpdater::setUpdater(updater); if (updater->automaticallyChecksForUpdates()) updater->checkForUpdates(); -#endif #endif QString qfilename;