summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boost.pri2
-rw-r--r--doc/testing.txt8
-rw-r--r--openscad.pro5
-rw-r--r--tests/CMakeLists.txt37
-rw-r--r--tests/FindGLEW.cmake2
-rw-r--r--tests/OffscreenContext.cc41
6 files changed, 86 insertions, 9 deletions
diff --git a/boost.pri b/boost.pri
index 078a17f..d93b738 100644
--- a/boost.pri
+++ b/boost.pri
@@ -20,6 +20,8 @@ boost {
win32 {
LIBS += -llibboost_thread-vc90-mt-s-1_46_1 -llibboost_program_options-vc90-mt-s-1_46_1
} else {
+ # some platforms have only '-mt' versions. uncomment if needed.
+ # LIBS += -lboost_thread-mt -lboost_program_options-mt
LIBS += -lboost_thread -lboost_program_options
}
}
diff --git a/doc/testing.txt b/doc/testing.txt
index c5fb243..089d18e 100644
--- a/doc/testing.txt
+++ b/doc/testing.txt
@@ -10,7 +10,7 @@ cmake ..
make
make test
-Windows:
+Running on Windows:
First, get a normal build working by following instructions at
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows
@@ -25,6 +25,12 @@ cmake ..
nmake -f Makefile
nmake -f Makefile test
+Running on headless (no X) servers:
+
+Xvnc :5 -screen 0 800x600x24 &
+DISPLAY=:5 make test
+
+
Adding a new regression test:
------------------------------
diff --git a/openscad.pro b/openscad.pro
index f08cecc..ebe5d46 100644
--- a/openscad.pro
+++ b/openscad.pro
@@ -1,3 +1,8 @@
+
+isEmpty(QT_VERSION) {
+ error("Please use qmake for Qt 4 (probably qmake-qt4)")
+}
+
# Auto-include config_<variant>.pri if the VARIANT variable is give on the
# command-line, e.g. qmake VARIANT=mybuild
!isEmpty(VARIANT) {
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index fb007cc..dda4aea 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -62,6 +62,30 @@ endif()
# Build test apps
#
+# Boost
+#
+# usually it's found automatically, but some systems may need a custom install.
+# in that case, run cmake with -DBOOST_ROOT=/path/to/boost/install
+# (being the same path you passed to boost's --prefix when you built it)
+if(BOOST_ROOT)
+ set(Boost_NO_SYSTEM_PATHS TRUE)
+ set(Boost_ADDITIONAL_VERSIONS "1.47.0")
+ find_package( Boost 1.35.0 COMPONENTS thread program_options )
+ if(Boost_FOUND)
+ message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS})
+ message(STATUS "Boost libraries found:")
+ foreach(boostlib ${Boost_LIBRARIES})
+ message(STATUS " " ${boostlib})
+ endforeach()
+ include_directories(${Boost_INCLUDE_DIRS})
+ else()
+ message(STATUS "BOOST_ROOT:" ${BOOST_ROOT})
+ message(FATAL_ERROR "BOOST_ROOT specified but no boost found")
+ endif()
+else()
+ message(STATUS "BOOST_ROOT unset. Assuming it will be found automatically.")
+endif()
+
# Mac OS X
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
@@ -105,7 +129,7 @@ elseif (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
set(OPENCSG_DIR "$ENV{MACOSX_DEPLOY_DIR}")
endif()
if (NOT OPENCSG_INCLUDE_DIR)
- message(STATUS ${OPENCSG_DIR})
+ message(STATUS "OPENCSG_DIR: " ${OPENCSG_DIR})
find_path(OPENCSG_INCLUDE_DIR
opencsg.h
PATHS ${OPENCSG_DIR}/include)
@@ -115,7 +139,8 @@ if (NOT OPENCSG_INCLUDE_DIR)
if (NOT OPENCSG_INCLUDE_DIR OR NOT OPENCSG_LIBRARY)
message(FATAL_ERROR "OpenCSG not found")
else()
- message(STATUS "OpenCSG found in " ${OPENCSG_LIBRARY})
+ message(STATUS "OpenCSG include found in " ${OPENCSG_INCLUDE_DIR})
+ message(STATUS "OpenCSG library found in " ${OPENCSG_LIBRARY})
endif()
endif()
include_directories(${OPENCSG_INCLUDE_DIR})
@@ -262,7 +287,7 @@ add_executable(cgaltest cgaltest.cc ../src/CGAL_Nef_polyhedron.cc ../src/cgaluti
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
${COMMON_SOURCES})
set_target_properties(cgaltest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(cgaltest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY})
+target_link_libraries(cgaltest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
#
# cgalpngtest
@@ -274,7 +299,7 @@ add_executable(cgalpngtest cgalpngtest.cc OffscreenView.cc bboxhelp.cc ${OFFSCRE
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
${COMMON_SOURCES})
set_target_properties(cgalpngtest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(cgalpngtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY})
+target_link_libraries(cgalpngtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
#
# opencsgtest
@@ -287,7 +312,7 @@ add_executable(opencsgtest opencsgtest.cc csgtestcore.cc OffscreenView.cc ${OFFS
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
${COMMON_SOURCES})
set_target_properties(opencsgtest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(opencsgtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY})
+target_link_libraries(opencsgtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
#
# throwntogethertest
@@ -300,7 +325,7 @@ add_executable(throwntogethertest throwntogethertest.cc csgtestcore.cc Offscreen
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
${COMMON_SOURCES})
set_target_properties(throwntogethertest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(throwntogethertest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY})
+target_link_libraries(throwntogethertest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
#
diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake
index bd0669d..32c2d6e 100644
--- a/tests/FindGLEW.cmake
+++ b/tests/FindGLEW.cmake
@@ -30,7 +30,7 @@ IF (WIN32)
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
DOC "The GLEW library")
ELSE (WIN32)
- message("-- GLEW_DIR: " ${GLEW_DIR})
+ message(STATUS "GLEW_DIR: " ${GLEW_DIR})
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
PATHS ${GLEW_DIR}/include /usr/include /usr/local/include
NO_DEFAULT_PATH
diff --git a/tests/OffscreenContext.cc b/tests/OffscreenContext.cc
index e4045af..839eea9 100644
--- a/tests/OffscreenContext.cc
+++ b/tests/OffscreenContext.cc
@@ -13,6 +13,28 @@ See Also
*/
+/*
+ * Some portions of the code below are:
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
#include "OffscreenContext.h"
#include "printutils.h"
#include "imageutils.h"
@@ -98,7 +120,24 @@ bool create_glx_dummy_window(OffscreenContext &ctx)
// can't depend on xWin==NULL at failure. use a custom Xlib error handler instead.
original_xlib_handler = XSetErrorHandler( XCreateWindow_error );
- Window xWin = XCreateSimpleWindow( dpy, DefaultRootWindow(dpy), 0,0,10,10, 0,0,0 );
+
+ Window root = DefaultRootWindow( dpy );
+ XSetWindowAttributes xwin_attr;
+ int width = 42;
+ int height = 42;
+ xwin_attr.background_pixel = 0;
+ xwin_attr.border_pixel = 0;
+ xwin_attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ xwin_attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+ unsigned long int mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ Window xWin = XCreateWindow( dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &xwin_attr );
+
+ // Window xWin = XCreateSimpleWindow( dpy, DefaultRootWindow(dpy), 0,0,42,42, 0,0,0 );
+
+
XSync( dpy, false );
if ( XCreateWindow_failed ) {
XFree( visinfo );
contact: Jan Huwald // Impressum