2010-07-07 02:54:16 +04:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2011-10-20 18:43:49 +04:00
|
|
|
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
|
2011-10-17 00:50:29 +04:00
|
|
|
# Explicitly use new include policy to avoid globally shadowing included modules
|
|
|
|
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0017
|
|
|
|
cmake_policy(SET CMP0017 NEW)
|
|
|
|
endif()
|
2010-07-07 02:54:16 +04:00
|
|
|
project(tests)
|
|
|
|
|
2010-11-08 07:26:39 +03:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
|
|
|
|
|
2010-11-03 21:26:42 +03:00
|
|
|
# Build debug build as default
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif()
|
|
|
|
|
2011-10-16 00:48:41 +04:00
|
|
|
#
|
|
|
|
# Windows
|
|
|
|
#
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(WIN32_STATIC_BUILD "True")
|
|
|
|
endif()
|
2011-10-11 06:46:27 +04:00
|
|
|
|
|
|
|
if(WIN32_STATIC_BUILD)
|
|
|
|
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
2011-10-16 00:48:41 +04:00
|
|
|
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")
|
2011-10-11 06:46:27 +04:00
|
|
|
set(EMSG "${EMSG} \ni.e. sed -i s/\\/MD/\\/MT/ CMakeCache.txt")
|
2011-10-16 00:48:41 +04:00
|
|
|
set(EMSG "${EMSG} \nthen re-run cmake ..")
|
2011-10-11 06:46:27 +04:00
|
|
|
message(FATAL_ERROR ${EMSG})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2011-10-16 00:48:41 +04:00
|
|
|
# Disable warnings
|
2011-10-11 03:01:51 +04:00
|
|
|
if(WIN32)
|
|
|
|
# too long decorated names
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4503")
|
|
|
|
# int cast to bool in CGAL
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")
|
|
|
|
# unreferenced parameters in CGAL
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100")
|
2011-10-11 06:46:27 +04:00
|
|
|
# fopen_s advertisement
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_DEPRECATE")
|
2011-10-24 07:41:03 +04:00
|
|
|
# lexer uses strdup & other POSIX stuff
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_NONSTDC_NO_DEPRECATE")
|
2011-10-16 20:54:18 +04:00
|
|
|
# M_PI
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES")
|
2011-10-11 03:01:51 +04:00
|
|
|
endif()
|
|
|
|
|
2011-10-16 00:48:41 +04:00
|
|
|
# Debugging - if you uncomment, use nmake -f Makefile > log.txt (the log is big)
|
|
|
|
if(WIN32)
|
|
|
|
# Linker debugging
|
|
|
|
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -VERBOSE")
|
|
|
|
|
|
|
|
# Compiler debugging
|
|
|
|
# you have to pass -DCMAKE_VERBOSE_MAKEFILE=ON to cmake when you run it.
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
#
|
|
|
|
# Build test apps
|
|
|
|
#
|
|
|
|
|
2011-07-31 05:12:27 +04:00
|
|
|
# Mac OS X
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
|
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
# Qt4
|
|
|
|
find_package(OpenGL)
|
|
|
|
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
|
|
|
|
include(${QT_USE_FILE})
|
|
|
|
|
|
|
|
# Eigen2
|
2011-10-16 05:14:35 +04:00
|
|
|
|
|
|
|
# Turn off Eigen SIMD optimization
|
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2011-10-18 08:16:02 +04:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_ALIGN")
|
|
|
|
endif()
|
2011-10-16 05:14:35 +04:00
|
|
|
endif()
|
|
|
|
|
2010-08-31 02:49:24 +04:00
|
|
|
if (NOT EIGEN2_INCLUDE_DIR)
|
|
|
|
find_path(EIGEN2_INCLUDE_DIR
|
|
|
|
Eigen/Core
|
|
|
|
PATHS ENV EIGEN2DIR /opt/local/include/eigen2 /usr/include/eigen2)
|
2011-10-18 08:16:02 +04:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
find_path(EIGEN2_INCLUDE_DIR
|
|
|
|
Eigen/Core
|
|
|
|
PATHS ENV EIGEN2DIR /usr/local/include/eigen2 )
|
|
|
|
endif()
|
2010-08-31 02:49:24 +04:00
|
|
|
if (NOT EIGEN2_INCLUDE_DIR)
|
|
|
|
message(FATAL_ERROR "Eigen2 not found")
|
|
|
|
else()
|
|
|
|
message(STATUS "Eigen2 found in " ${EIGEN2_INCLUDE_DIR})
|
|
|
|
endif()
|
2010-08-31 01:57:11 +04:00
|
|
|
endif()
|
2010-08-31 02:49:24 +04:00
|
|
|
include_directories(${EIGEN2_INCLUDE_DIR})
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2010-11-08 07:26:39 +03:00
|
|
|
# OpenCSG
|
2011-08-02 03:43:29 +04:00
|
|
|
if (NOT $ENV{OPENCSG_DIR} STREQUAL "")
|
|
|
|
set(OPENCSG_DIR "$ENV{OPENCSG_DIR}")
|
|
|
|
elseif (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
|
2010-11-08 07:26:39 +03:00
|
|
|
set(OPENCSG_DIR "$ENV{MACOSX_DEPLOY_DIR}")
|
|
|
|
endif()
|
|
|
|
if (NOT OPENCSG_INCLUDE_DIR)
|
2011-08-02 03:43:29 +04:00
|
|
|
message(STATUS ${OPENCSG_DIR})
|
2010-11-08 07:26:39 +03:00
|
|
|
find_path(OPENCSG_INCLUDE_DIR
|
|
|
|
opencsg.h
|
2011-08-02 03:43:29 +04:00
|
|
|
PATHS ${OPENCSG_DIR}/include)
|
2010-11-08 07:26:39 +03:00
|
|
|
find_library(OPENCSG_LIBRARY
|
|
|
|
opencsg
|
2011-08-03 01:47:52 +04:00
|
|
|
PATHS ${OPENCSG_DIR}/lib)
|
2010-11-08 07:26:39 +03:00
|
|
|
if (NOT OPENCSG_INCLUDE_DIR OR NOT OPENCSG_LIBRARY)
|
|
|
|
message(FATAL_ERROR "OpenCSG not found")
|
|
|
|
else()
|
|
|
|
message(STATUS "OpenCSG found in " ${OPENCSG_LIBRARY})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
include_directories(${OPENCSG_INCLUDE_DIR})
|
|
|
|
|
2011-08-28 02:11:47 +04:00
|
|
|
# GLEW
|
|
|
|
|
2011-10-16 00:48:41 +04:00
|
|
|
if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
|
2010-11-17 09:26:39 +03:00
|
|
|
set(GLEW_DIR "$ENV{MACOSX_DEPLOY_DIR}")
|
|
|
|
endif()
|
2011-10-11 06:46:27 +04:00
|
|
|
|
2010-11-08 07:26:39 +03:00
|
|
|
find_package(GLEW REQUIRED)
|
|
|
|
include_directories(${GLEW_INCLUDE_PATH})
|
|
|
|
|
2011-10-11 06:46:27 +04:00
|
|
|
if(WIN32_STATIC_BUILD)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLEW_STATIC")
|
|
|
|
endif()
|
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
# Flex/Bison
|
|
|
|
find_package(BISON)
|
2011-10-18 08:16:02 +04:00
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
# FreeBSD has an old flex in /usr/bin and a new flex in /usr/local/bin
|
|
|
|
set(FLEX_EXECUTABLE /usr/local/bin/flex)
|
|
|
|
endif()
|
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
find_package(FLEX)
|
|
|
|
# The COMPILE_FLAGS and forced C++ compiler is just to be compatible with qmake
|
2011-10-11 03:01:51 +04:00
|
|
|
if (WIN32)
|
|
|
|
set(FLEX_UNISTD_FLAG "-DYY_NO_UNISTD_H")
|
|
|
|
endif()
|
|
|
|
FLEX_TARGET(OpenSCADlexer ../src/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp COMPILE_FLAGS "-Plexer ${FLEX_UNISTD_FLAG}")
|
2010-08-31 01:57:11 +04:00
|
|
|
BISON_TARGET(OpenSCADparser ../src/parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c COMPILE_FLAGS "-p parser")
|
|
|
|
ADD_FLEX_BISON_DEPENDENCY(OpenSCADlexer OpenSCADparser)
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c PROPERTIES LANGUAGE "CXX")
|
|
|
|
|
|
|
|
|
|
|
|
# Internal includes
|
|
|
|
include_directories(../src)
|
|
|
|
|
2011-10-04 05:04:00 +04:00
|
|
|
add_definitions(-DOPENSCAD_VERSION=test -DOPENSCAD_YEAR=2011 -DOPENSCAD_MONTH=10)
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2011-10-16 19:50:33 +04:00
|
|
|
set(CORE_SOURCES
|
2011-11-05 22:38:03 +04:00
|
|
|
tests-common.cc
|
2011-10-11 03:01:51 +04:00
|
|
|
../src/mathc99.cc
|
2011-09-04 02:03:16 +04:00
|
|
|
../src/handle_dep.cc
|
|
|
|
../src/qhash.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/value.cc
|
|
|
|
../src/expr.cc
|
|
|
|
../src/func.cc
|
|
|
|
../src/module.cc
|
|
|
|
../src/node.cc
|
|
|
|
../src/context.cc
|
|
|
|
../src/csgterm.cc
|
|
|
|
../src/polyset.cc
|
|
|
|
../src/csgops.cc
|
|
|
|
../src/transform.cc
|
2011-09-03 01:54:41 +04:00
|
|
|
../src/color.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/primitives.cc
|
|
|
|
../src/projection.cc
|
|
|
|
../src/cgaladv.cc
|
|
|
|
../src/surface.cc
|
|
|
|
../src/control.cc
|
|
|
|
../src/render.cc
|
|
|
|
../src/import.cc
|
|
|
|
../src/dxfdata.cc
|
|
|
|
../src/dxftess.cc
|
|
|
|
../src/dxfdim.cc
|
2011-09-30 05:11:28 +04:00
|
|
|
../src/linearextrude.cc
|
|
|
|
../src/rotateextrude.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/printutils.cc
|
|
|
|
../src/progress.cc
|
2011-10-16 19:50:33 +04:00
|
|
|
${FLEX_OpenSCADlexer_OUTPUTS}
|
|
|
|
${BISON_OpenSCADparser_OUTPUTS})
|
|
|
|
|
|
|
|
set(COMMON_SOURCES
|
|
|
|
${CORE_SOURCES}
|
|
|
|
../src/export.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/nodedumper.cc
|
|
|
|
../src/traverser.cc
|
2011-07-31 05:12:27 +04:00
|
|
|
../src/PolySetEvaluator.cc
|
2011-09-11 11:10:31 +04:00
|
|
|
../src/PolySetCache.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/Tree.cc
|
2011-09-18 01:13:37 +04:00
|
|
|
lodepng.cpp
|
2010-08-31 02:49:24 +04:00
|
|
|
${FLEX_OpenSCADlexer_OUTPUTS}
|
|
|
|
${BISON_OpenSCADparser_OUTPUTS})
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2011-10-16 19:50:33 +04:00
|
|
|
#
|
|
|
|
# echotest
|
|
|
|
#
|
|
|
|
add_executable(echotest echotest.cc ${CORE_SOURCES})
|
|
|
|
target_link_libraries(echotest ${QT_LIBRARIES} ${OPENGL_LIBRARY})
|
|
|
|
|
2011-09-18 01:13:37 +04:00
|
|
|
#
|
|
|
|
# Offscreen OpenGL context source code
|
|
|
|
#
|
2011-10-11 03:01:51 +04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2011-10-16 00:48:41 +04:00
|
|
|
message(STATUS "Offscreen OpenGL Context - using Apple CGL")
|
2011-09-18 01:13:37 +04:00
|
|
|
set(OFFSCREEN_CTX_SOURCE "OffscreenContext.mm")
|
2011-10-11 03:01:51 +04:00
|
|
|
elseif(UNIX)
|
2011-10-16 00:48:41 +04:00
|
|
|
message(STATUS "Offscreen OpenGL Context - using Unix GLX")
|
2011-09-18 01:13:37 +04:00
|
|
|
set(OFFSCREEN_CTX_SOURCE "OffscreenContext.cc")
|
2011-10-11 03:01:51 +04:00
|
|
|
elseif(WIN32)
|
2011-10-16 00:48:41 +04:00
|
|
|
message(STATUS "Offscreen OpenGL Context - using Microsoft WGL")
|
2011-10-11 03:01:51 +04:00
|
|
|
set(OFFSCREEN_CTX_SOURCE "OffscreenContextWGL.cc")
|
2011-09-18 01:13:37 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#
|
2011-09-22 05:11:01 +04:00
|
|
|
# Yangli Hector Yee's PerceptualDiff code
|
2011-09-18 01:13:37 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
add_executable(yee_compare yee_compare.cpp lodepng.cpp)
|
|
|
|
|
2010-11-17 09:26:39 +03:00
|
|
|
#
|
|
|
|
# dumptest
|
|
|
|
#
|
2010-08-31 02:49:24 +04:00
|
|
|
add_executable(dumptest dumptest.cc ${COMMON_SOURCES})
|
2010-08-31 01:57:11 +04:00
|
|
|
target_link_libraries(dumptest ${QT_LIBRARIES} ${OPENGL_LIBRARY})
|
2010-11-17 09:26:39 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# csgtexttest
|
|
|
|
#
|
2010-08-31 02:49:24 +04:00
|
|
|
add_executable(csgtexttest csgtexttest.cc CSGTextRenderer.cc CSGTextCache.cc ../src/qhash.cc ${COMMON_SOURCES})
|
|
|
|
target_link_libraries(csgtexttest ${QT_LIBRARIES} ${OPENGL_LIBRARY})
|
2010-11-17 09:26:39 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# csgtermtest
|
|
|
|
#
|
2011-07-31 05:12:27 +04:00
|
|
|
add_executable(csgtermtest csgtermtest.cc ../src/CSGTermEvaluator.cc ${COMMON_SOURCES})
|
2010-08-31 02:49:24 +04:00
|
|
|
target_link_libraries(csgtermtest ${QT_LIBRARIES} ${OPENGL_LIBRARY})
|
|
|
|
|
2010-09-07 04:05:08 +04:00
|
|
|
if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
|
|
|
|
set(CGAL_DIR "$ENV{MACOSX_DEPLOY_DIR}/lib/CGAL")
|
|
|
|
set(CMAKE_MODULE_PATH "${CGAL_DIR}")
|
|
|
|
endif()
|
|
|
|
find_package(CGAL REQUIRED)
|
|
|
|
include_directories(${CGAL_INCLUDE_DIRS})
|
2010-11-17 09:26:39 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# cgaltest
|
|
|
|
#
|
2011-10-20 15:49:52 +04:00
|
|
|
add_executable(cgaltest cgaltest.cc ../src/CGAL_Nef_polyhedron.cc ../src/cgalutils.cc ../src/CSGTermEvaluator.cc
|
2011-09-11 12:51:55 +04:00
|
|
|
../src/CGALEvaluator.cc ../src/CGALCache.cc ../src/PolySetCGALEvaluator.cc ../src/qhash.cc
|
2011-09-07 00:01:42 +04:00
|
|
|
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
|
2011-09-01 06:09:06 +04:00
|
|
|
${COMMON_SOURCES})
|
2010-09-07 04:05:08 +04:00
|
|
|
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})
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2011-09-01 07:04:42 +04:00
|
|
|
#
|
|
|
|
# cgalpngtest
|
|
|
|
#
|
2011-10-20 04:37:00 +04:00
|
|
|
add_executable(cgalpngtest cgalpngtest.cc OffscreenView.cc bboxhelp.cc ${OFFSCREEN_CTX_SOURCE} imageutils.cc fbo.cc system-gl.cc
|
2011-09-08 00:04:59 +04:00
|
|
|
../src/CGALRenderer.cc ../src/CGAL_Nef_polyhedron.cc ../src/cgalutils.cc
|
2011-09-11 12:51:55 +04:00
|
|
|
../src/CSGTermEvaluator.cc ../src/CGALEvaluator.cc ../src/CGALCache.cc
|
2011-09-01 07:04:42 +04:00
|
|
|
../src/PolySetCGALEvaluator.cc ../src/qhash.cc
|
2011-09-07 00:01:42 +04:00
|
|
|
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
|
2011-09-01 07:04:42 +04:00
|
|
|
${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})
|
|
|
|
|
2010-11-17 09:26:39 +03:00
|
|
|
#
|
|
|
|
# opencsgtest
|
|
|
|
#
|
2011-08-28 02:11:47 +04:00
|
|
|
|
2011-10-20 04:37:00 +04:00
|
|
|
add_executable(opencsgtest opencsgtest.cc csgtestcore.cc OffscreenView.cc ${OFFSCREEN_CTX_SOURCE} imageutils.cc fbo.cc system-gl.cc
|
2011-09-01 06:09:06 +04:00
|
|
|
../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc
|
2011-09-08 00:04:59 +04:00
|
|
|
../src/CSGTermEvaluator.cc ../src/CGAL_Nef_polyhedron.cc ../src/cgalutils.cc
|
2011-09-11 12:51:55 +04:00
|
|
|
../src/CGALEvaluator.cc ../src/CGALCache.cc ../src/PolySetCGALEvaluator.cc ../src/qhash.cc
|
2011-09-07 00:01:42 +04:00
|
|
|
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
|
2010-11-08 07:26:39 +03:00
|
|
|
${COMMON_SOURCES})
|
|
|
|
set_target_properties(opencsgtest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
|
2011-07-31 05:12:27 +04:00
|
|
|
target_link_libraries(opencsgtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY})
|
2010-11-08 07:26:39 +03:00
|
|
|
|
2011-09-22 05:11:01 +04:00
|
|
|
#
|
|
|
|
# throwntogethertest
|
|
|
|
#
|
|
|
|
|
2011-10-19 05:55:42 +04:00
|
|
|
add_executable(throwntogethertest throwntogethertest.cc csgtestcore.cc OffscreenView.cc ${OFFSCREEN_CTX_SOURCE} imageutils.cc fbo.cc system-gl.cc
|
2011-09-22 05:11:01 +04:00
|
|
|
../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc
|
|
|
|
../src/CSGTermEvaluator.cc ../src/CGAL_Nef_polyhedron.cc ../src/cgalutils.cc
|
|
|
|
../src/CGALEvaluator.cc ../src/CGALCache.cc ../src/PolySetCGALEvaluator.cc ../src/qhash.cc
|
2011-10-19 05:55:42 +04:00
|
|
|
../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc
|
2011-09-22 05:11:01 +04:00
|
|
|
${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})
|
|
|
|
|
|
|
|
|
2010-07-11 23:06:43 +04:00
|
|
|
#
|
2010-09-07 04:05:08 +04:00
|
|
|
# This functions adds cmd-line tests given files.
|
|
|
|
# Files are sent as the parameters following TESTSUFFIX
|
2010-07-11 23:06:43 +04:00
|
|
|
#
|
2011-10-16 07:59:54 +04:00
|
|
|
find_package(PythonInterp)
|
2010-09-07 04:05:08 +04:00
|
|
|
function(add_cmdline_test TESTCMD TESTSUFFIX)
|
2010-07-11 23:06:43 +04:00
|
|
|
get_filename_component(TESTCMD_NAME ${TESTCMD} NAME_WE)
|
2010-09-07 04:05:08 +04:00
|
|
|
foreach (SCADFILE ${ARGN})
|
2010-07-11 23:06:43 +04:00
|
|
|
get_filename_component(TESTNAME ${SCADFILE} NAME_WE)
|
2011-04-29 19:07:10 +04:00
|
|
|
string(REPLACE " " "_" TESTNAME ${TESTNAME}) # Test names cannot include spaces
|
2011-10-16 07:59:54 +04:00
|
|
|
add_test("${TESTCMD_NAME}_${TESTNAME}" ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
|
2010-07-11 23:06:43 +04:00
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
2010-07-07 02:54:16 +04:00
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
# Find all scad files
|
2011-07-11 03:33:17 +04:00
|
|
|
file(GLOB MINIMAL_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/*.scad)
|
|
|
|
file(GLOB FEATURES_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/*.scad)
|
|
|
|
file(GLOB BUGS_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/*.scad)
|
2011-10-01 02:43:38 +04:00
|
|
|
file(GLOB SCAD_DXF_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/dxf/*.scad)
|
2010-07-07 02:54:16 +04:00
|
|
|
|
2011-11-03 22:50:56 +04:00
|
|
|
list(APPEND DUMPTEST_FILES ${MINIMAL_FILES}
|
|
|
|
${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
|
|
|
|
2011-10-16 19:50:33 +04:00
|
|
|
list(APPEND ECHO_FILES
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/echo.scad
|
2011-11-05 19:21:47 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/echo-tests.scad
|
2011-11-05 20:06:13 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parser-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/builtin-tests.scad)
|
2011-10-16 19:50:33 +04:00
|
|
|
|
|
|
|
# Add echotest tests to CTest
|
|
|
|
add_cmdline_test(echotest txt ${ECHO_FILES})
|
2010-07-07 02:54:16 +04:00
|
|
|
# Add dumptest tests to CTest
|
2011-11-03 22:50:56 +04:00
|
|
|
add_cmdline_test(dumptest txt ${DUMPTEST_FILES})
|
2010-07-07 03:44:58 +04:00
|
|
|
# Add csgtexttest tests to CTest
|
2011-08-04 20:26:25 +04:00
|
|
|
add_cmdline_test(csgtexttest txt ${MINIMAL_FILES})
|
2010-08-31 02:49:24 +04:00
|
|
|
# Add csgtermtest tests to CTest
|
2011-08-04 20:26:25 +04:00
|
|
|
add_cmdline_test(csgtermtest txt ${MINIMAL_FILES})
|
|
|
|
|
2010-07-09 02:46:19 +04:00
|
|
|
# Add cgaltest tests to CTest
|
2010-09-07 04:05:08 +04:00
|
|
|
add_cmdline_test(cgaltest stl ${CGALTEST_FILES})
|
|
|
|
|
2011-09-01 07:04:42 +04:00
|
|
|
# Add cgalpngtest tests to CTest
|
2011-09-02 04:48:22 +04:00
|
|
|
LIST(APPEND CGALPNGTEST_FILES
|
2011-09-06 16:56:04 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/2d-3d.scad
|
2011-09-02 04:48:22 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/circle-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/square-tests.scad
|
2011-09-04 00:42:48 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/polygon-tests.scad
|
2011-09-02 04:48:22 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/cube-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/sphere-tests.scad
|
2011-09-02 16:31:56 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/cylinder-tests.scad
|
2011-09-30 05:25:42 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/polyhedron-tests.scad
|
2011-09-02 16:38:27 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/union-tests.scad
|
2011-09-02 16:46:45 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/difference-tests.scad
|
2011-09-03 01:33:18 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/intersection-tests.scad
|
2011-09-05 19:03:39 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/linear_extrude-tests.scad
|
2011-09-05 19:15:56 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/rotate_extrude-tests.scad
|
2011-09-06 16:56:04 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/minkowski2-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/minkowski3-tests.scad
|
2011-09-07 00:01:42 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/hull2-tests.scad
|
2011-09-05 20:00:20 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/surface-tests.scad
|
2011-09-04 00:42:48 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/import_dxf-tests.scad
|
2011-09-05 20:20:43 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/transform-tests.scad
|
2011-09-04 20:25:17 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/color-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/background-modifier.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/highlight-modifier.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/root-modifier.scad
|
2011-09-05 02:04:12 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/disable-modifier.scad
|
2011-09-05 18:38:50 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/for-tests.scad
|
2011-09-05 19:55:17 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/for-nested-tests.scad
|
2011-09-06 20:28:01 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/intersection_for-tests.scad
|
2011-09-06 22:36:45 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/render-tests.scad
|
2011-09-08 00:56:39 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/projection-tests.scad
|
2011-09-08 04:31:47 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/assign-tests.scad
|
2011-09-08 10:21:53 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/include-tests.scad
|
2011-09-08 10:52:31 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/child-tests.scad
|
2011-10-30 16:49:28 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/ifelse-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/rotate_extrude_dxf-tests.scad)
|
2011-10-01 02:43:38 +04:00
|
|
|
LIST(APPEND CGALPNGTEST_FILES ${SCAD_DXF_FILES})
|
2011-09-02 04:48:22 +04:00
|
|
|
#LIST(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2011-09-01 22:04:01 +04:00
|
|
|
add_cmdline_test(cgalpngtest png ${CGALPNGTEST_FILES})
|
2010-09-07 04:05:08 +04:00
|
|
|
|
2011-08-04 20:26:25 +04:00
|
|
|
# Add opencsg tests to CTest
|
2011-09-02 00:44:16 +04:00
|
|
|
LIST(APPEND OPENCSGTEST_FILES ${CGALPNGTEST_FILES})
|
2011-09-29 00:32:35 +04:00
|
|
|
LIST(APPEND OPENCSGTEST_FILES
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/highlight-and-background-modifier.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/child-background.scad)
|
2011-10-01 02:43:38 +04:00
|
|
|
LIST(APPEND OPENCSGTEST_FILES ${SCAD_DXF_FILES})
|
2011-08-04 20:28:04 +04:00
|
|
|
add_cmdline_test(opencsgtest png ${OPENCSGTEST_FILES})
|
2011-08-04 20:26:25 +04:00
|
|
|
|
2011-09-22 05:11:01 +04:00
|
|
|
# Add throwntogether tests to CTest
|
|
|
|
LIST(APPEND THROWNTOGETHERTEST_FILES ${CGALPNGTEST_FILES})
|
|
|
|
add_cmdline_test(throwntogethertest png ${THROWNTOGETHERTEST_FILES})
|
|
|
|
|
2010-07-11 23:06:43 +04:00
|
|
|
# Add dxfexport tests to CTest
|
2011-09-22 05:11:01 +04:00
|
|
|
add_cmdline_test(${CMAKE_SOURCE_DIR}/../test-code/exportdxf dxf ${SCAD_FILES})
|