summaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt107
1 files changed, 71 insertions, 36 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 29f8b25..314b51f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -27,11 +27,7 @@ endif()
if(WIN32_STATIC_BUILD)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
- set(EMSG "\nTo build Win32 STATIC OpenSCAD tests you must run")
- set(EMSG "${EMSG} \ncmake .. -DCMAKE_BUILD_TYPE=Release")
- set(EMSG "${EMSG} \nthen replace /MD with /MT in CMakeCache.txt")
- set(EMSG "${EMSG} \ni.e. sed -i s/\\/MD/\\/MT/ CMakeCache.txt")
- set(EMSG "${EMSG} \nthen re-run cmake ..")
+ set(EMSG "\nTo build Win32 STATIC OpenSCAD please see doc/testing.txt")
message(FATAL_ERROR ${EMSG})
endif()
endif()
@@ -75,24 +71,26 @@ if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
set(BOOST_ROOT "$ENV{MACOSX_DEPLOY_DIR}")
endif()
-if(BOOST_ROOT)
- #set(Boost_DEBUG TRUE)
- 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()
+if (WIN32)
+ set(Boost_USE_STATIC_LIBS TRUE)
+ set(BOOST_STATIC TRUE)
+ set(BOOST_THREAD_USE_LIB TRUE)
+endif()
+
+#set(Boost_DEBUG TRUE)
+set(Boost_NO_SYSTEM_PATHS TRUE)
+set(Boost_ADDITIONAL_VERSIONS "1.47.0" "1.46.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 unset. Assuming it will be found automatically.")
+ message(STATUS "BOOST_ROOT: ${BOOST_ROOT}")
+ message(FATAL_ERROR "Boost not found.")
endif()
# Mac OS X
@@ -141,10 +139,10 @@ if (NOT OPENCSG_INCLUDE_DIR)
message(STATUS "OPENCSG_DIR: " ${OPENCSG_DIR})
find_path(OPENCSG_INCLUDE_DIR
opencsg.h
- PATHS ${OPENCSG_DIR}/include)
+ HINTS ${OPENCSG_DIR}/include)
find_library(OPENCSG_LIBRARY
opencsg
- PATHS ${OPENCSG_DIR}/lib)
+ HINTS ${OPENCSG_DIR}/lib)
if (NOT OPENCSG_INCLUDE_DIR OR NOT OPENCSG_LIBRARY)
message(FATAL_ERROR "OpenCSG not found")
else()
@@ -156,7 +154,9 @@ include_directories(${OPENCSG_INCLUDE_DIR})
# GLEW
-if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
+if (NOT $ENV{GLEW_DIR} STREQUAL "")
+ set(GLEW_DIR "$ENV{GLEW_DIR}")
+elseif (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
set(GLEW_DIR "$ENV{MACOSX_DEPLOY_DIR}")
endif()
@@ -185,16 +185,35 @@ BISON_TARGET(OpenSCADparser ../src/parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser_y
ADD_FLEX_BISON_DEPENDENCY(OpenSCADlexer OpenSCADparser)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c PROPERTIES LANGUAGE "CXX")
-if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
+# CGAL
+
+if (NOT $ENV{CGAL_DIR} STREQUAL "")
+ set(CGAL_DIR "$ENV{CGAL_DIR}")
+elseif (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
set(CGAL_DIR "$ENV{MACOSX_DEPLOY_DIR}/lib/CGAL")
set(CMAKE_MODULE_PATH "${CGAL_DIR}")
endif()
+message(STATUS "CGAL_DIR: " ${CGAL_DIR})
find_package(CGAL REQUIRED)
+message(STATUS "CGAL config found in " ${CGAL_USE_FILE} )
+foreach(cgal_incdir ${CGAL_INCLUDE_DIRS})
+ message(STATUS "CGAL include found in " ${cgal_incdir} )
+endforeach()
+message(STATUS "CGAL libraries found in " ${CGAL_LIBRARIES_DIR} )
if("${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}" VERSION_LESS 3.6)
message(FATAL_ERROR "CGAL >= 3.6 required")
endif()
include_directories(${CGAL_INCLUDE_DIRS})
+# Imagemagick
+
+find_package(ImageMagick COMPONENTS convert)
+if (ImageMagick_convert_FOUND)
+ message(STATUS "ImageMagick convert executable found: " ${ImageMagick_convert_EXECUTABLE})
+else()
+ message(FATAL_ERROR "Couldn't find imagemagick 'convert' program")
+endif()
+
# Internal includes
include_directories(../src)
@@ -239,7 +258,7 @@ set(NOCGAL_SOURCES
set(CGAL_SOURCES
${NOCGAL_SOURCES}
- ../src/CSGTermEvaluator.cc
+ ../src/CSGTermEvaluator.cc
../src/CGAL_Nef_polyhedron.cc
../src/cgalutils.cc
../src/CGALEvaluator.cc
@@ -262,13 +281,13 @@ set(COMMON_SOURCES
#
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS "Offscreen OpenGL Context - using Apple CGL")
- set(OFFSCREEN_CTX_SOURCE "OffscreenContext.mm")
+ set(OFFSCREEN_CTX_SOURCE "OffscreenContext.mm" CACHE TYPE STRING)
elseif(UNIX)
message(STATUS "Offscreen OpenGL Context - using Unix GLX")
- set(OFFSCREEN_CTX_SOURCE "OffscreenContext.cc")
+ set(OFFSCREEN_CTX_SOURCE "OffscreenContextGLX.cc" CACHE TYPE STRING)
elseif(WIN32)
message(STATUS "Offscreen OpenGL Context - using Microsoft WGL")
- set(OFFSCREEN_CTX_SOURCE "OffscreenContextWGL.cc")
+ set(OFFSCREEN_CTX_SOURCE "OffscreenContextWGL.cc" CACHE TYPE STRING)
endif()
set(OFFSCREEN_SOURCES
@@ -287,6 +306,7 @@ target_link_libraries(tests-cgal tests-common)
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}")
#
# echotest
@@ -295,11 +315,6 @@ add_executable(echotest echotest.cc)
target_link_libraries(echotest tests-nocgal tests-core ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
#
-# Yangli Hector Yee's PerceptualDiff code
-# FIXME: Disabled since we use ImageMagick now. Eventually remove this and the files.
-# add_executable(yee_compare yee_compare.cpp lodepng.cpp)
-
-#
# dumptest
#
add_executable(dumptest dumptest.cc)
@@ -437,13 +452,30 @@ macro(add_cmdline_test TESTCMD TESTSUFFIX)
set(CONFARG CONFIGURATIONS)
set(CONFVAL ${FOUNDCONFIGS})
- add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
+ add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
endif()
endforeach()
endmacro()
enable_testing()
+# set up custom pretty printing of results
+
+set(INFOCMD "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/opencsgtest --info OUTPUT_FILE sysinfo.txt)")
+set(PRETTYCMD "\"${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py --builddir=${CMAKE_CURRENT_BINARY_DIR}\"")
+set(CTEST_CUSTOM_FILE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
+set(CTEST_CUSTOM_TXT "\n
+ message(\"running 'opencsgtest --info' to generate sysinfo.txt\")\n
+ ${INFOCMD}\n
+ set(CTEST_CUSTOM_POST_TEST ${PRETTYCMD})\n
+")
+file(WRITE ${CTEST_CUSTOM_FILE} ${CTEST_CUSTOM_TXT})
+
+#foreach(FILE test_pretty_print.py)
+# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
+# ${CMAKE_CURRENT_BINARY_DIR}/${FILE} COPYONLY)
+#endforeach()
+
set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_SOURCE_DIR}/EnforceConfig.cmake")
# Find all scad files
@@ -493,6 +525,9 @@ disable_tests(dumptest_transform-tests
# Reenable it when this is improved
disable_tests(opencsgtest_child-background)
+# FIXME: This single test takes over an hour to run on a 2.7 GHz P4
+disable_tests(opencsgtest_example006 cgalpngtest_example006)
+
# These tests only makes sense in OpenCSG mode
disable_tests(cgalpngtest_child-background
cgalpngtest_highlight-and-background-modifier
contact: Jan Huwald // Impressum