From 8711bd25006bda5b63516a222b762e71a9954a56 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 9 Mar 2013 13:04:36 -0500 Subject: Set preprocessor define for deployment builds. Don't include sparkle in development builds. Note: Development snapshots are considered deployment builds diff --git a/openscad.pro b/openscad.pro index 6f3ddfb..c661afd 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 e208fdd..11d9919 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 a30d43a..10a1c18 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 75d7b9d..682ccb7 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,13 +485,11 @@ 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; if (filename) qfilename = QString::fromStdString(boosty::stringy(boosty::absolute(filename))); -- cgit v0.10.1 From 65e65b6c4c9bf57b0e4a9182519c1f1aa207a589 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 9 Mar 2013 19:00:56 +0100 Subject: Support cmake < 2.8.3 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 23928ed..c8eacfb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,6 +7,9 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSIO cmake_policy(SET CMP0017 NEW) endif() +# Needed for cmake < 2.8.3 +include(CMakeParseArguments.cmake) + # Detect Lion and force gcc IF (APPLE) EXECUTE_PROCESS(COMMAND sw_vers -productVersion OUTPUT_VARIABLE MACOSX_VERSION) diff --git a/tests/CMakeParseArguments.cmake b/tests/CMakeParseArguments.cmake new file mode 100644 index 0000000..406780e --- /dev/null +++ b/tests/CMakeParseArguments.cmake @@ -0,0 +1,138 @@ +# CMAKE_PARSE_ARGUMENTS( args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# parsing the arguments given to that macro or function. +# It processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any value +# following, like e.g. the OPTIONAL keyword of the install() command. +# +# The argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The argument contains all keywords for this macro +# which can be followed by more than one value, like e.g. the TARGETS or +# FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in , and +# a variable composed of the given +# followed by "_" and the name of the respective keyword. +# These variables will then hold the respective value from the argument list. +# For the keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# _UNPARSED_ARGUMENTS, this can be checked afterwards to see whether +# your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments as the +# real install() command: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# Assume my_install() has been called like this: +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# After the cmake_parse_arguments() call the macro will have set the following +# variables: +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# You can the continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a one_value_keyword +# another recognized keyword follows, this is interpreted as the beginning of +# the new option. +# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would +# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach() + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach() + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else() + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif() + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach() + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach() + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction() -- cgit v0.10.1 From 58e9eff236b8a10d642a99fd21b9277968e86b6b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 9 Mar 2013 20:43:44 +0100 Subject: Disable use of multithreaded boost libs when building CGAL to ensure it finds our libraries instead of the system libraries diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index b793e9b..dc61f74 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -298,7 +298,7 @@ build_cgal() if [ "`echo $2 | grep use-sys-libs`" ]; then cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=$CGAL_BUILDTYPE .. else - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=$CGAL_BUILD_TYPE .. + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DBoost_USE_MULTITHREADED=false -DCMAKE_BUILD_TYPE=$CGAL_BUILD_TYPE .. fi make -j$NUMCPU make install -- cgit v0.10.1