summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/macosx-build-dependencies.sh40
-rwxr-xr-xscripts/ubuntu-build-dependencies.sh17
-rw-r--r--tests/CMakeLists.txt47
-rw-r--r--tests/OffscreenContext.mm4
4 files changed, 75 insertions, 33 deletions
diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh
index f009fce..2d7275c 100755
--- a/scripts/macosx-build-dependencies.sh
+++ b/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
@@ -181,8 +184,11 @@ build_boost()
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
diff --git a/scripts/ubuntu-build-dependencies.sh b/scripts/ubuntu-build-dependencies.sh
index 0609172..1754e32 100755
--- a/scripts/ubuntu-build-dependencies.sh
+++ b/scripts/ubuntu-build-dependencies.sh
@@ -26,21 +26,8 @@ fi
echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)"
-
-if [ "`dpkg --list | grep -i cgal`" ]; then
- echo "Please make sure you have run apt-get purge on all cgal packages"
- exit
-fi
-
-if [ "`dpkg --list | grep -i opencsg`" ]; then
- echo "Please make sure you have run apt-get purge on all opencsg packages"
- exit
-fi
-
sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \
libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \
- libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev
+ libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev \
+ libcgal-dev libopencsg-dev
-echo "now copy/paste the following to install CGAL and OpenCSG from source:"
-echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs"
-echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg"
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 9a23380..12fca3c 100644
--- a/tests/CMakeLists.txt
+++ b/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}")
@@ -439,73 +458,79 @@ set(OFFSCREEN_SOURCES
add_library(tests-core STATIC ${CORE_SOURCES})
target_link_libraries(tests-core ${OPENGL_LIBRARY})
+set(TESTS-CORE-LIBRARIES ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+
add_library(tests-common STATIC ${COMMON_SOURCES})
target_link_libraries(tests-common tests-core)
+
add_library(tests-cgal STATIC ${CGAL_SOURCES})
set_target_properties(tests-cgal PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
target_link_libraries(tests-cgal tests-common)
+set(TESTS-CGAL-LIBRARIES ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${GMP_LIBRARIES} ${MPFR_LIBRARIES} ${TESTS-CORE-LIBRARIES})
+
add_library(tests-nocgal STATIC ${NOCGAL_SOURCES})
target_link_libraries(tests-nocgal tests-common)
add_library(tests-offscreen STATIC ${OFFSCREEN_SOURCES})
# set_target_properties(tests-offscreen PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
+set(TESTS-NOCGAL-LIBRARIES ${TESTS-CORE-LIBRARIES})
#
# echotest
#
add_executable(echotest echotest.cc)
-target_link_libraries(echotest tests-nocgal tests-core ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(echotest tests-nocgal ${TESTS-NOCGAL-LIBRARIES})
#
# dumptest
#
add_executable(dumptest dumptest.cc)
-target_link_libraries(dumptest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(dumptest tests-nocgal ${TESTS-NOCGAL-LIBRARIES})
#
# modulecachetest
#
add_executable(modulecachetest modulecachetest.cc)
-target_link_libraries(modulecachetest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(modulecachetest tests-nocgal ${TESTS-NOCGAL-LIBRARIES})
#
# csgtexttest
#
add_executable(csgtexttest csgtexttest.cc CSGTextRenderer.cc CSGTextCache.cc)
-target_link_libraries(csgtexttest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(csgtexttest tests-nocgal ${TESTS-NOCGAL-LIBRARIES})
#
# csgtermtest
#
add_executable(csgtermtest csgtermtest.cc ../src/CSGTermEvaluator.cc)
-target_link_libraries(csgtermtest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(csgtermtest tests-nocgal ${TESTS-NOCGAL-LIBRARIES})
#
# cgaltest
#
add_executable(cgaltest cgaltest.cc)
set_target_properties(cgaltest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(cgaltest tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(cgaltest tests-cgal ${TESTS-CGAL-LIBRARIES})
#
# cgalstlsanitytest
#
add_executable(cgalstlsanitytest cgalstlsanitytest.cc)
set_target_properties(cgalstlsanitytest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(cgalstlsanitytest tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(cgalstlsanitytest tests-cgal ${TESTS-CGAL-LIBRARIES})
#
# cgalpngtest
#
add_executable(cgalpngtest cgalpngtest.cc bboxhelp.cc ../src/CGALRenderer.cc ../src/renderer.cc ../src/rendersettings.cc)
set_target_properties(cgalpngtest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(cgalpngtest tests-offscreen tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(cgalpngtest tests-offscreen tests-cgal ${OPENCSG_LIBRARY} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
#
# cgalcachetest
#
add_executable(cgalcachetest cgalcachetest.cc bboxhelp.cc)
set_target_properties(cgalcachetest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(cgalcachetest tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(cgalcachetest tests-cgal ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
#
# opencsgtest
@@ -513,7 +538,7 @@ target_link_libraries(cgalcachetest tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_
add_executable(opencsgtest opencsgtest.cc csgtestcore.cc ../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc ../src/renderer.cc ../src/rendersettings.cc)
set_target_properties(opencsgtest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(opencsgtest tests-offscreen tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(opencsgtest tests-offscreen tests-cgal ${OPENCSG_LIBRARY} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
#
# throwntogethertest
@@ -521,7 +546,7 @@ target_link_libraries(opencsgtest tests-offscreen tests-cgal ${CGAL_LIBRARY} ${C
add_executable(throwntogethertest throwntogethertest.cc csgtestcore.cc ../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc ../src/renderer.cc ../src/rendersettings.cc)
set_target_properties(throwntogethertest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(throwntogethertest tests-offscreen tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(throwntogethertest tests-offscreen tests-cgal ${OPENCSG_LIBRARY} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
#
# Tags tests as disabled. This is more convenient than removing them manually
diff --git a/tests/OffscreenContext.mm b/tests/OffscreenContext.mm
index 990d3a4..a0995fa 100644
--- a/tests/OffscreenContext.mm
+++ b/tests/OffscreenContext.mm
@@ -57,9 +57,11 @@ OffscreenContext *create_offscreen_context(int w, int h)
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];
contact: Jan Huwald // Impressum