Skip to content
Browse files

Merge branch 'lion' into eigen3

  • Loading branch information...
2 parents 765f1a9 + 11ffcd2 commit b0543f4513837f574ab6678111070e4517715187 @kintel kintel committed Aug 20, 2012
Showing with 61 additions and 10 deletions.
  1. +37 −9 scripts/macosx-build-dependencies.sh
  2. +19 −0 tests/CMakeLists.txt
  3. +3 −1 tests/OffscreenContext.mm
  4. +2 −0 tests/csgtestcore.cc
View
46 scripts/macosx-build-dependencies.sh
@@ -6,8 +6,9 @@
#
# This script must be run from the OpenSCAD source root directory
#
-# Usage: macosx-build-dependencies.sh [-6]
+# Usage: macosx-build-dependencies.sh [-6l]
# -6 Build only 64-bit binaries
+# -l Force use of LLVM compiler
#
# Prerequisites:
# - MacPorts: curl, cmake
@@ -24,13 +25,15 @@ SRCDIR=$BASEDIR/src
DEPLOYDIR=$BASEDIR/install
MAC_OSX_VERSION_MIN=10.5
OPTION_32BIT=true
+OPTION_LLVM=false
export QMAKESPEC=macx-g++
printUsage()
{
- echo "Usage: $0 [-6]"
+ echo "Usage: $0 [-6l]"
echo
echo " -6 Build only 64-bit binaries"
+ echo " -l Force use of LLVM compiler"
}
# Hack warning: gmplib is built separately in 32-bit and 64-bit mode
@@ -171,18 +174,21 @@ build_boost()
echo "Building boost" $version "..."
cd $BASEDIR/src
rm -rf boost_$bversion
- if [ ! -f boost_$bversion.tar.bz2 ]; then
- curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2
- fi
+# if [ ! -f boost_$bversion.tar.bz2 ]; then
+# curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2
+# fi
tar xjf boost_$bversion.tar.bz2
cd boost_$bversion
# We only need the thread and program_options libraries
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
if $OPTION_32BIT; then
BOOST_EXTRA_FLAGS="-arch i386"
fi
- ./bjam cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS"
- ./bjam install
+ if $OPTION_LLVM; then
+ BOOST_TOOLSET="toolset=darwin-llvm"
+ echo "using darwin : llvm : llvm-g++ ;" >> tools/build/v2/user-config.jam
+ fi
+ ./b2 -d+2 $BOOST_TOOLSET cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" install
install_name_tool -id $DEPLOYDIR/lib/libboost_thread.dylib $DEPLOYDIR/lib/libboost_thread.dylib
install_name_tool -id $DEPLOYDIR/lib/libboost_program_options.dylib $DEPLOYDIR/lib/libboost_program_options.dylib
install_name_tool -id $DEPLOYDIR/lib/libboost_filesystem.dylib $DEPLOYDIR/lib/libboost_filesystem.dylib
@@ -297,13 +303,35 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then
exit 0
fi
-while getopts '6' c
+while getopts '6l' c
do
case $c in
- 6) OPTION_32BIT=false
+ 6) OPTION_32BIT=false;;
+ l) OPTION_LLVM=true;;
esac
done
+OSVERSION=`sw_vers -productVersion | cut -d. -f2`
+if [[ $OSVERSION -ge 7 ]]; then
+ echo "Detected Lion or later"
+ export LION=1
+ export CC=gcc
+ export CXX=g++
+ export CPP=cpp
+ # Somehow, qmake in Qt-4.8.2 doesn't detect Lion's gcc and falls back into
+ # project file mode unless manually given a QMAKESPEC
+ export QMAKESPEC=macx-llvm
+else
+ echo "Detected Snow Leopard or earlier"
+fi
+
+if $OPTION_LLVM; then
+ echo "Using LLVM compiler"
+ export CC=llvm-gcc
+ export CXX=llvm-g++
+ export QMAKESPEC=macx-llvm
+fi
+
echo "Using basedir:" $BASEDIR
mkdir -p $SRCDIR $DEPLOYDIR
build_eigen 3.1.1
View
19 tests/CMakeLists.txt
@@ -6,6 +6,25 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSIO
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0017
cmake_policy(SET CMP0017 NEW)
endif()
+
+# Detect Lion and force gcc
+IF (APPLE)
+ EXECUTE_PROCESS(COMMAND sw_vers -productVersion OUTPUT_VARIABLE MACOSX_VERSION)
+ IF (NOT ${MACOSX_VERSION} VERSION_LESS "10.7.0")
+ message("Detected Lion or later")
+ set(CMAKE_C_COMPILER "gcc")
+ set(CMAKE_CXX_COMPILER "g++")
+ ELSE()
+ message("Detected Snow Leopard or older")
+ if (USE_LLVM)
+ message("Using LLVM compiler")
+ set(CMAKE_C_COMPILER "llvm-gcc")
+ set(CMAKE_CXX_COMPILER "llvm-g++")
+ endif()
+ ENDIF()
+ENDIF(APPLE)
+
+
project(tests)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
View
4 tests/OffscreenContext.mm
@@ -57,9 +57,11 @@
NSOpenGLPixelFormatAttribute attributes[] = {
NSOpenGLPFAPixelBuffer,
NSOpenGLPFANoRecovery,
- NSOpenGLPFAAccelerated,
NSOpenGLPFADepthSize, 24,
NSOpenGLPFAStencilSize, 8,
+// Took out the acceleration requirement to be able to run the tests
+// in a non-accelerated VM.
+// NSOpenGLPFAAccelerated,
(NSOpenGLPixelFormatAttribute) 0
};
NSOpenGLPixelFormat *pixFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
View
2 tests/csgtestcore.cc
@@ -367,6 +367,8 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
OpenCSG::setContext(0);
OpenCSG::setOption(OpenCSG::OffscreenSetting, OpenCSG::FrameBufferObject);
+ // FIXME: This is necessary for Mac OS X 10.7 for now. kintel 20120527.
+ OpenCSG::setOption(OpenCSG::AlgorithmSetting, OpenCSG::Goldfeather);
csgInfo.glview->paintGL();

0 comments on commit b0543f4

Please sign in to comment.
Something went wrong with that request. Please try again.