2011-12-14 03:53:12 +04:00
|
|
|
# instructions - see ../doc/testing.txt
|
|
|
|
|
2013-09-23 01:46:48 +04:00
|
|
|
# set(DEBUG_OSCD 1) # print debug info during cmake
|
2013-09-21 09:12:42 +04:00
|
|
|
|
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()
|
2012-08-20 16:56:29 +04:00
|
|
|
|
2013-03-09 22:00:56 +04:00
|
|
|
# Needed for cmake < 2.8.3
|
|
|
|
include(CMakeParseArguments.cmake)
|
|
|
|
|
2012-08-20 16:56:29 +04:00
|
|
|
# Detect Lion and force gcc
|
|
|
|
IF (APPLE)
|
|
|
|
EXECUTE_PROCESS(COMMAND sw_vers -productVersion OUTPUT_VARIABLE MACOSX_VERSION)
|
2013-04-27 02:32:19 +04:00
|
|
|
IF (NOT ${MACOSX_VERSION} VERSION_LESS "10.8.0")
|
2013-06-20 08:05:09 +04:00
|
|
|
message("Detected Mountain Lion (10.8) or later")
|
|
|
|
set(CMAKE_C_COMPILER "clang")
|
|
|
|
set(CMAKE_CXX_COMPILER "clang++")
|
2013-04-27 02:32:19 +04:00
|
|
|
ELSEIF (NOT ${MACOSX_VERSION} VERSION_LESS "10.7.0")
|
2013-06-20 08:05:09 +04:00
|
|
|
message("Detected Lion (10.7)")
|
|
|
|
set(CMAKE_C_COMPILER "clang")
|
|
|
|
set(CMAKE_CXX_COMPILER "clang++")
|
2012-08-20 16:56:29 +04:00
|
|
|
ELSE()
|
2013-06-20 08:05:09 +04:00
|
|
|
message("Detected Snow Leopard (10.6) or older")
|
2012-08-20 16:56:29 +04:00
|
|
|
if (USE_LLVM)
|
|
|
|
message("Using LLVM compiler")
|
|
|
|
set(CMAKE_C_COMPILER "llvm-gcc")
|
|
|
|
set(CMAKE_CXX_COMPILER "llvm-g++")
|
|
|
|
endif()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF(APPLE)
|
|
|
|
|
|
|
|
|
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)
|
2013-09-23 01:35:29 +04:00
|
|
|
# set(CMAKE_BUILD_TYPE Release)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
|
|
|
if (GCC_VERSION VERSION_GREATER 4.6)
|
|
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
|
|
|
else()
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
|
|
|
endif()
|
2012-01-01 03:53:39 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
2011-12-18 03:32:17 +04:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
|
2010-11-03 21:26:42 +03:00
|
|
|
endif()
|
|
|
|
|
2011-11-08 08:12:49 +04:00
|
|
|
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
|
|
|
|
endif()
|
|
|
|
|
2013-01-28 09:38:50 +04:00
|
|
|
# MCAD
|
|
|
|
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../libraries/MCAD/__init__.py)
|
|
|
|
message(FATAL_ERROR "MCAD not found. You can install from the OpenSCAD root as follows: \n git submodule update --init")
|
|
|
|
endif()
|
|
|
|
|
2011-10-16 00:48:41 +04:00
|
|
|
#
|
|
|
|
# Windows
|
|
|
|
#
|
|
|
|
|
2011-12-31 20:02:55 +04:00
|
|
|
if(WIN32 AND MSVC)
|
2011-10-16 00:48:41 +04:00
|
|
|
set(WIN32_STATIC_BUILD "True")
|
|
|
|
endif()
|
2011-10-11 06:46:27 +04:00
|
|
|
|
2011-12-31 20:02:55 +04:00
|
|
|
if(WIN32_STATIC_BUILD AND MSVC)
|
2011-10-11 06:46:27 +04:00
|
|
|
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
2011-12-01 08:24:14 +04:00
|
|
|
set(EMSG "\nTo build Win32 STATIC OpenSCAD please see doc/testing.txt")
|
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-12-31 20:02:55 +04:00
|
|
|
if(WIN32 AND MSVC)
|
2011-10-11 03:01:51 +04:00
|
|
|
# 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)
|
2011-12-31 20:02:55 +04:00
|
|
|
if(WIN32 AND MSVC)
|
2011-10-16 00:48:41 +04:00
|
|
|
# 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()
|
|
|
|
|
2011-12-31 20:02:55 +04:00
|
|
|
if(WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -frounding-math")
|
|
|
|
endif()
|
|
|
|
|
2012-08-19 06:35:12 +04:00
|
|
|
# Clang compiler
|
|
|
|
|
2013-04-19 04:23:08 +04:00
|
|
|
if(${CMAKE_CXX_COMPILER} MATCHES ".*clang.*")
|
2012-08-19 06:35:12 +04:00
|
|
|
# disable enormous amount of warnings about CGAL
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-extensions")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
|
|
|
|
endif()
|
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
#
|
|
|
|
# Build test apps
|
|
|
|
#
|
|
|
|
|
2011-12-27 02:32:33 +04:00
|
|
|
function(inclusion user_set_path found_paths)
|
2013-09-21 09:12:42 +04:00
|
|
|
# Set up compiler include paths with prepend/append rules. Input is
|
|
|
|
# a path and a set of paths. If user_set_path matches anything in found_paths
|
|
|
|
# then we prepend the found_paths because we assume the user wants
|
|
|
|
# their set_paths to be a priority.
|
|
|
|
|
|
|
|
if (DEBUG_OSCD)
|
|
|
|
message(STATUS "inclusion ${user_set_path} ${found_paths}")
|
|
|
|
message(STATUS "inclusion ${${user_set_path}} ${${found_paths}}")
|
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
set( inclusion_match 0 )
|
|
|
|
foreach( found_path ${${found_paths}} )
|
|
|
|
if (${found_path} MATCHES ${${user_set_path}}.*)
|
|
|
|
set( inclusion_match 1 )
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (user_set_path AND inclusion_match)
|
|
|
|
include_directories(BEFORE ${${found_paths}})
|
2013-09-21 09:12:42 +04:00
|
|
|
if (DEBUG_OSCD)
|
|
|
|
message(STATUS "inclusion prepend ${${found_paths}} for ${user_set_path}")
|
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
else()
|
|
|
|
include_directories(AFTER ${${found_paths}})
|
2013-09-21 09:12:42 +04:00
|
|
|
if (DEBUG_OSCD)
|
|
|
|
message(STATUS "inclusion append ${${found_paths}} for ${user_set_path}")
|
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
endif()
|
|
|
|
set( inclusion_match 0 )
|
|
|
|
endfunction()
|
|
|
|
|
2011-11-05 04:19:48 +04:00
|
|
|
# Boost
|
2012-01-03 06:44:50 +04:00
|
|
|
#
|
|
|
|
# FindBoost.cmake has been included from Cmake's GIT circa the end of 2011
|
|
|
|
# because most existing installs of cmake had a buggy older version.
|
|
|
|
#
|
2011-12-26 21:53:22 +04:00
|
|
|
# Update this if FindBoost.cmake gets out of sync with the current boost release
|
|
|
|
# set(Boost_ADDITIONAL_VERSIONS "1.47.0" "1.46.0")
|
2011-11-07 06:02:57 +04:00
|
|
|
|
2011-12-26 21:53:22 +04:00
|
|
|
if (WIN32)
|
|
|
|
set(Boost_USE_STATIC_LIBS TRUE)
|
|
|
|
set(BOOST_STATIC TRUE)
|
|
|
|
set(BOOST_THREAD_USE_LIB TRUE)
|
2011-12-07 10:36:33 +04:00
|
|
|
endif()
|
|
|
|
|
2011-12-15 08:17:04 +04:00
|
|
|
if (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
|
|
|
|
set(BOOST_ROOT "$ENV{OPENSCAD_LIBRARIES}")
|
2011-12-26 21:53:22 +04:00
|
|
|
if (EXISTS ${BOOST_ROOT}/include/boost)
|
2011-12-26 22:51:30 +04:00
|
|
|
# if boost is under OPENSCAD_LIBRARIES, then
|
|
|
|
# don't look in the system paths (workaround FindBoost.cmake bug)
|
2011-12-26 21:53:22 +04:00
|
|
|
set(Boost_NO_SYSTEM_PATHS "TRUE")
|
2011-12-26 22:51:30 +04:00
|
|
|
message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
|
2011-12-26 21:53:22 +04:00
|
|
|
endif()
|
2011-11-07 06:02:57 +04:00
|
|
|
endif()
|
|
|
|
|
2011-12-13 04:23:39 +04:00
|
|
|
if (NOT $ENV{BOOSTDIR} STREQUAL "")
|
2011-12-26 21:53:22 +04:00
|
|
|
set(BOOST_ROOT "$ENV{BOOSTDIR}")
|
2011-12-07 10:36:33 +04:00
|
|
|
set(Boost_NO_SYSTEM_PATHS "TRUE")
|
|
|
|
set(Boost_DEBUG TRUE)
|
2011-12-26 21:53:22 +04:00
|
|
|
message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
|
2011-12-07 10:36:33 +04:00
|
|
|
endif()
|
|
|
|
|
2012-01-15 00:14:26 +04:00
|
|
|
find_package( Boost 1.35.0 COMPONENTS thread program_options filesystem system regex REQUIRED)
|
2011-12-27 02:32:33 +04:00
|
|
|
message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS})
|
|
|
|
message(STATUS "Boost libraries found:")
|
|
|
|
foreach(boostlib ${Boost_LIBRARIES})
|
|
|
|
message(STATUS " " ${boostlib})
|
|
|
|
endforeach()
|
2011-12-07 10:36:33 +04:00
|
|
|
|
2011-12-27 02:32:33 +04:00
|
|
|
inclusion(BOOST_ROOT Boost_INCLUDE_DIRS)
|
2012-02-03 01:50:51 +04:00
|
|
|
add_definitions(-DBOOST_FILESYSTEM_VERSION=3) # Use V3 for boost 1.44-1.45
|
2011-11-05 04:19:48 +04:00
|
|
|
|
2011-07-31 05:12:27 +04:00
|
|
|
# Mac OS X
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2011-12-19 19:30:43 +04:00
|
|
|
FIND_LIBRARY(COCOA_LIBRARY Cocoa REQUIRED)
|
2011-07-31 05:12:27 +04:00
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
|
2012-08-19 00:44:46 +04:00
|
|
|
|
|
|
|
# Eigen
|
2011-10-16 05:14:35 +04:00
|
|
|
|
|
|
|
# Turn off Eigen SIMD optimization
|
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2013-08-09 03:07:14 +04:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "^FreeBSD")
|
2011-10-18 08:16:02 +04:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_ALIGN")
|
|
|
|
endif()
|
2011-10-16 05:14:35 +04:00
|
|
|
endif()
|
|
|
|
|
2012-08-19 16:58:30 +04:00
|
|
|
# Priority
|
2013-11-16 00:48:43 +04:00
|
|
|
# 3. EIGENDIR if set
|
2012-08-19 16:58:30 +04:00
|
|
|
# 1. OPENSCAD_LIBRARIES eigen3
|
|
|
|
# 4. system's standard include paths for eigen3
|
2012-08-19 00:44:46 +04:00
|
|
|
|
2012-08-19 17:10:33 +04:00
|
|
|
set(EIGEN_DIR "$ENV{EIGENDIR}")
|
2012-08-19 16:58:30 +04:00
|
|
|
set(OPENSCAD_LIBDIR "$ENV{OPENSCAD_LIBRARIES}")
|
2012-08-19 17:29:22 +04:00
|
|
|
|
2012-08-19 17:10:33 +04:00
|
|
|
if (EIGEN_DIR)
|
2013-11-16 00:48:43 +04:00
|
|
|
set(EIGHINT ${EIGEN_DIR}/include/eigen3 ${EIGEN_DIR})
|
2012-08-19 17:27:49 +04:00
|
|
|
find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${EIGHINT})
|
2012-08-19 16:58:30 +04:00
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
|
2012-08-19 16:58:30 +04:00
|
|
|
if (NOT EIGEN_INCLUDE_DIR)
|
|
|
|
find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${OPENSCAD_LIBDIR}/include/eigen3)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT EIGEN_INCLUDE_DIR)
|
2011-12-25 20:58:24 +04:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2012-08-19 16:58:30 +04:00
|
|
|
find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/local/include/eigen3)
|
2012-01-04 03:05:02 +04:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
2012-08-19 16:58:30 +04:00
|
|
|
find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/pkg/include/eigen3)
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /opt/local/include/eigen3)
|
2011-12-25 20:58:24 +04:00
|
|
|
else()
|
2012-08-19 16:58:30 +04:00
|
|
|
find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/include/eigen3)
|
2011-12-25 20:58:24 +04:00
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
endif()
|
|
|
|
|
2012-08-19 16:58:30 +04:00
|
|
|
if (NOT EIGEN_INCLUDE_DIR)
|
|
|
|
message(STATUS "Eigen not found")
|
|
|
|
else()
|
|
|
|
message(STATUS "Eigen found in " ${EIGEN_INCLUDE_DIR})
|
|
|
|
inclusion(EIGEN_DIR EIGEN_INCLUDE_DIR)
|
|
|
|
endif()
|
|
|
|
|
2013-03-12 09:14:58 +04:00
|
|
|
# OpenGL
|
|
|
|
find_package(OpenGL REQUIRED)
|
2013-05-24 06:31:49 +04:00
|
|
|
if (NOT OPENGL_GLU_FOUND)
|
|
|
|
message(STATUS "GLU not found in system paths...searching $ENV{OPENSCAD_LIBRARIES} ")
|
|
|
|
find_library(OPENGL_glu_LIBRARY GLU HINTS $ENV{OPENSCAD_LIBRARIES}/lib)
|
|
|
|
if (NOT OPENGL_glu_LIBRARY)
|
|
|
|
message(FATAL "GLU library not found")
|
|
|
|
endif()
|
|
|
|
set(OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES})
|
|
|
|
message(STATUS "OpenGL LIBRARIES: ")
|
|
|
|
foreach(GLLIB ${OPENGL_LIBRARIES})
|
|
|
|
message(STATUS " " ${GLLIB})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2010-11-08 07:26:39 +03:00
|
|
|
# OpenCSG
|
2011-12-13 04:23:39 +04:00
|
|
|
if (NOT $ENV{OPENCSGDIR} STREQUAL "")
|
|
|
|
set(OPENCSG_DIR "$ENV{OPENCSGDIR}")
|
2011-12-15 08:17:04 +04:00
|
|
|
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
|
|
|
|
set(OPENCSG_DIR "$ENV{OPENSCAD_LIBRARIES}")
|
2010-11-08 07:26:39 +03:00
|
|
|
endif()
|
|
|
|
if (NOT OPENCSG_INCLUDE_DIR)
|
2011-11-05 04:27:46 +04:00
|
|
|
message(STATUS "OPENCSG_DIR: " ${OPENCSG_DIR})
|
2010-11-08 07:26:39 +03:00
|
|
|
find_path(OPENCSG_INCLUDE_DIR
|
|
|
|
opencsg.h
|
2011-11-26 22:17:54 +04:00
|
|
|
HINTS ${OPENCSG_DIR}/include)
|
2010-11-08 07:26:39 +03:00
|
|
|
find_library(OPENCSG_LIBRARY
|
|
|
|
opencsg
|
2011-11-26 22:17:54 +04:00
|
|
|
HINTS ${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()
|
2011-11-05 04:27:46 +04:00
|
|
|
message(STATUS "OpenCSG include found in " ${OPENCSG_INCLUDE_DIR})
|
|
|
|
message(STATUS "OpenCSG library found in " ${OPENCSG_LIBRARY})
|
2010-11-08 07:26:39 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
inclusion(OPENCSG_DIR OPENCSG_INCLUDE_DIR)
|
2010-11-08 07:26:39 +03:00
|
|
|
|
2011-08-28 02:11:47 +04:00
|
|
|
# GLEW
|
|
|
|
|
2011-12-27 02:32:33 +04:00
|
|
|
if(WIN32_STATIC_BUILD)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLEW_STATIC")
|
|
|
|
endif()
|
|
|
|
|
2011-12-13 04:23:39 +04:00
|
|
|
if (NOT $ENV{GLEWDIR} STREQUAL "")
|
|
|
|
set(GLEW_DIR "$ENV{GLEWDIR}")
|
2011-12-15 08:17:04 +04:00
|
|
|
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
|
|
|
|
set(GLEW_DIR "$ENV{OPENSCAD_LIBRARIES}")
|
2010-11-17 09:26:39 +03:00
|
|
|
endif()
|
2013-01-27 23:06:08 +04:00
|
|
|
if (GLEW_DIR)
|
2012-02-18 19:26:56 +04:00
|
|
|
find_path(GLEW_INCLUDE_DIR
|
|
|
|
GL/glew.h
|
|
|
|
HINTS ${GLEW_DIR}/include
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
find_library(GLEW_LIBRARY
|
|
|
|
NAMES GLEW glew
|
2012-06-02 23:57:28 +04:00
|
|
|
HINTS ${GLEW_DIR}/lib ${GLEW_DIR}/lib64
|
2012-02-18 19:26:56 +04:00
|
|
|
NO_DEFAULT_PATH)
|
2013-01-27 23:06:08 +04:00
|
|
|
if (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
|
|
|
|
set(GLEW_FOUND 1)
|
2012-02-18 19:26:56 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2011-10-11 06:46:27 +04:00
|
|
|
|
2013-01-27 23:06:08 +04:00
|
|
|
if (NOT GLEW_FOUND)
|
|
|
|
find_package(GLEW REQUIRED)
|
2012-02-18 19:26:56 +04:00
|
|
|
endif()
|
2011-10-11 06:46:27 +04:00
|
|
|
|
2013-01-28 08:15:38 +04:00
|
|
|
message(STATUS "GLEW include: " ${GLEW_INCLUDE_DIR})
|
|
|
|
message(STATUS "GLEW library: " ${GLEW_LIBRARY})
|
|
|
|
|
2012-02-18 19:26:56 +04:00
|
|
|
inclusion(GLEW_DIR GLEW_INCLUDE_DIR)
|
2011-10-11 06:46:27 +04:00
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
# Flex/Bison
|
2011-12-19 19:30:43 +04:00
|
|
|
find_package(BISON REQUIRED)
|
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()
|
|
|
|
|
2013-09-21 09:12:42 +04:00
|
|
|
# prepend the dir where deps were built
|
|
|
|
if (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
|
|
|
|
set(OSCAD_DEPS "")
|
|
|
|
set(OSCAD_DEPS_PATHS $ENV{OPENSCAD_LIBRARIES}/include)
|
|
|
|
inclusion(OSCAD_DEPS OSCAD_DEPS_PATHS)
|
|
|
|
endif()
|
|
|
|
|
2012-01-03 21:21:28 +04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
2012-01-04 03:05:02 +04:00
|
|
|
include_directories( /usr/pkg/include /usr/X11R7/include )
|
2012-01-03 21:21:28 +04:00
|
|
|
set(FLEX_EXECUTABLE /usr/pkg/bin/flex)
|
2013-06-09 08:49:21 +04:00
|
|
|
if(NOT ${CMAKE_CXX_COMPILER} MATCHES ".*clang.*")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
|
|
endif()
|
2012-01-03 21:21:28 +04:00
|
|
|
endif()
|
|
|
|
|
2011-12-19 19:30:43 +04:00
|
|
|
find_package(FLEX REQUIRED)
|
2010-08-31 01:57:11 +04:00
|
|
|
# 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}")
|
2013-05-14 03:31:44 +04:00
|
|
|
BISON_TARGET(OpenSCADparser ../src/parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c COMPILE_FLAGS "-p parser")
|
2010-08-31 01:57:11 +04:00
|
|
|
ADD_FLEX_BISON_DEPENDENCY(OpenSCADlexer OpenSCADparser)
|
2013-05-14 03:31:44 +04:00
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c PROPERTIES LANGUAGE "CXX")
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2011-11-26 21:11:55 +04:00
|
|
|
# CGAL
|
|
|
|
|
2011-12-13 04:23:39 +04:00
|
|
|
if (NOT $ENV{CGALDIR} STREQUAL "")
|
|
|
|
set(CGAL_DIR "$ENV{CGALDIR}")
|
2011-12-15 08:17:04 +04:00
|
|
|
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
|
2011-12-26 22:01:03 +04:00
|
|
|
if (EXISTS "$ENV{OPENSCAD_LIBRARIES}/lib/CGAL")
|
|
|
|
set(CGAL_DIR "$ENV{OPENSCAD_LIBRARIES}/lib/CGAL")
|
|
|
|
set(CMAKE_MODULE_PATH "${CGAL_DIR}")
|
|
|
|
elseif (EXISTS "$ENV{OPENSCAD_LIBRARIES}/include/CGAL")
|
|
|
|
set(CGAL_DIR "$ENV{OPENSCAD_LIBRARIES}")
|
|
|
|
set(CMAKE_MODULE_PATH "${CGAL_DIR}")
|
|
|
|
endif()
|
2011-11-07 00:54:17 +04:00
|
|
|
endif()
|
2011-12-01 08:24:14 +04:00
|
|
|
message(STATUS "CGAL_DIR: " ${CGAL_DIR})
|
2011-11-07 00:54:17 +04:00
|
|
|
find_package(CGAL REQUIRED)
|
2011-12-01 08:24:14 +04:00
|
|
|
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} )
|
2011-11-24 21:09:17 +04:00
|
|
|
if("${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}" VERSION_LESS 3.6)
|
|
|
|
message(FATAL_ERROR "CGAL >= 3.6 required")
|
|
|
|
endif()
|
2011-12-27 02:32:33 +04:00
|
|
|
inclusion(CGAL_DIR CGAL_INCLUDE_DIRS)
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2013-04-19 04:23:08 +04:00
|
|
|
if(${CMAKE_CXX_COMPILER} MATCHES ".*clang.*" AND NOT ${CGAL_CXX_FLAGS_INIT} STREQUAL "" )
|
2013-02-24 07:54:53 +04:00
|
|
|
string(REPLACE "-frounding-math" "" CGAL_CXX_FLAGS_INIT ${CGAL_CXX_FLAGS_INIT})
|
2013-03-06 07:10:10 +04:00
|
|
|
string(REPLACE "--param=ssp-buffer-size=4" "" CGAL_CXX_FLAGS_INIT ${CGAL_CXX_FLAGS_INIT})
|
2013-02-24 07:54:53 +04:00
|
|
|
endif()
|
|
|
|
|
2011-11-26 21:11:55 +04:00
|
|
|
# Imagemagick
|
|
|
|
|
2013-02-15 08:29:53 +04:00
|
|
|
if (SKIP_IMAGEMAGICK)
|
2013-02-16 17:37:16 +04:00
|
|
|
if (NOT MINGW_CROSS_ENV_DIR)
|
|
|
|
set(ImageMagick_convert_EXECUTABLE "echo")
|
|
|
|
endif()
|
2013-02-15 08:29:53 +04:00
|
|
|
else()
|
2011-12-31 20:02:55 +04:00
|
|
|
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()
|
2011-11-26 21:11:55 +04:00
|
|
|
endif()
|
|
|
|
|
2013-01-28 09:38:50 +04:00
|
|
|
if ( "${ImageMagick_VERSION_STRING}" VERSION_LESS "6.5.9.4" )
|
|
|
|
message(STATUS "ImageMagick version less than 6.5.9.4, cannot use -morphology comparison")
|
|
|
|
message(STATUS "ImageMagick Using older image comparison method")
|
|
|
|
set(COMPARATOR "old")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
execute_process(COMMAND ${ImageMagick_convert_EXECUTABLE} --version OUTPUT_VARIABLE IM_OUT )
|
|
|
|
if ( ${IM_OUT} MATCHES "OpenMP" )
|
|
|
|
# http://www.daniloaz.com/en/617/systems/high-cpu-load-when-converting-images-with-imagemagick
|
|
|
|
message(STATUS "ImageMagick: OpenMP bug workaround - setting MAGICK_THREAD_LIMIT=1")
|
|
|
|
set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};MAGICK_THREAD_LIMIT=1")
|
|
|
|
endif()
|
|
|
|
|
2010-08-31 01:57:11 +04:00
|
|
|
# Internal includes
|
|
|
|
include_directories(../src)
|
|
|
|
|
2013-10-20 01:15:05 +04:00
|
|
|
# Handle OpenSCAD version based on VERSION env. variable.
|
|
|
|
# Use current timestamp if not specified (development builds)
|
|
|
|
if ("$ENV{VERSION}" STREQUAL "")
|
|
|
|
# Timestamp is only available in cmake >= 2.8.11
|
|
|
|
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.10)
|
|
|
|
string(TIMESTAMP VERSION "%Y.%m.%d")
|
|
|
|
else()
|
|
|
|
set(VERSION "2013.06")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(VERSION $ENV{VERSION})
|
|
|
|
endif()
|
|
|
|
message(STATUS "OpenSCAD version: ${VERSION}")
|
|
|
|
string(REGEX MATCHALL "^[0-9]+|[0-9]+|[0-9]+$" MYLIST "${VERSION}")
|
|
|
|
list(GET MYLIST 0 OPENSCAD_YEAR)
|
|
|
|
list(GET MYLIST 1 OPENSCAD_MONTH)
|
2013-11-08 09:34:01 +04:00
|
|
|
math(EXPR OPENSCAD_MONTH ${OPENSCAD_MONTH}) # get rid of leading zero
|
2013-10-20 01:15:05 +04:00
|
|
|
list(LENGTH MYLIST VERSIONLEN)
|
|
|
|
if (${VERSIONLEN} EQUAL 3)
|
|
|
|
list(GET MYLIST 2 OPENSCAD_DAY)
|
2013-11-08 09:34:01 +04:00
|
|
|
math(EXPR OPENSCAD_DAY ${OPENSCAD_DAY}) # get rid of leading zero
|
2013-10-20 01:15:05 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_definitions(-DOPENSCAD_VERSION=${VERSION} -DOPENSCAD_YEAR=${OPENSCAD_YEAR} -DOPENSCAD_MONTH=${OPENSCAD_MONTH})
|
|
|
|
if (DEFINED OPENSCAD_DAY)
|
|
|
|
add_definitions(-DOPENSCAD_DAY=${OPENSCAD_DAY})
|
|
|
|
endif()
|
|
|
|
|
2011-11-25 02:10:46 +04:00
|
|
|
add_definitions(-DOPENSCAD_TESTING)
|
2010-08-31 01:57:11 +04:00
|
|
|
|
2013-10-08 02:46:45 +04:00
|
|
|
# Search for MCAD in correct place
|
|
|
|
set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};OPENSCADPATH=${CMAKE_CURRENT_SOURCE_DIR}/../libraries")
|
|
|
|
|
2013-09-20 09:19:09 +04:00
|
|
|
# Platform specific settings
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
message(STATUS "Offscreen OpenGL Context - using Apple CGL")
|
|
|
|
set(OFFSCREEN_CTX_SOURCE "OffscreenContextCGL.mm" CACHE TYPE STRING)
|
|
|
|
set(OFFSCREEN_IMGUTILS_SOURCE "imageutils-macosx.cc" CACHE TYPE STRING)
|
|
|
|
set(PLATFORMUTILS_SOURCE "PlatformUtils-mac.mm" CACHE TYPE STRING)
|
|
|
|
elseif(UNIX)
|
|
|
|
message(STATUS "Offscreen OpenGL Context - using Unix GLX")
|
|
|
|
set(OFFSCREEN_CTX_SOURCE "OffscreenContextGLX.cc" CACHE TYPE STRING)
|
|
|
|
set(OFFSCREEN_IMGUTILS_SOURCE "imageutils-lodepng.cc" CACHE TYPE STRING)
|
|
|
|
set(PLATFORMUTILS_SOURCE "PlatformUtils-posix.cc" CACHE TYPE STRING)
|
|
|
|
elseif(WIN32)
|
|
|
|
message(STATUS "Offscreen OpenGL Context - using Microsoft WGL")
|
|
|
|
set(OFFSCREEN_CTX_SOURCE "OffscreenContextWGL.cc" CACHE TYPE STRING)
|
|
|
|
set(OFFSCREEN_IMGUTILS_SOURCE "imageutils-lodepng.cc" CACHE TYPE STRING)
|
|
|
|
set(PLATFORMUTILS_SOURCE "PlatformUtils-win.cc" CACHE TYPE STRING)
|
|
|
|
endif()
|
|
|
|
|
2011-10-16 19:50:33 +04:00
|
|
|
set(CORE_SOURCES
|
2011-11-05 22:38:03 +04:00
|
|
|
tests-common.cc
|
2011-12-25 01:02:37 +04:00
|
|
|
../src/parsersettings.cc
|
2011-10-11 03:01:51 +04:00
|
|
|
../src/mathc99.cc
|
2011-12-23 17:33:40 +04:00
|
|
|
../src/linalg.cc
|
2011-09-04 02:03:16 +04:00
|
|
|
../src/handle_dep.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/value.cc
|
|
|
|
../src/expr.cc
|
|
|
|
../src/func.cc
|
2013-04-24 17:17:25 +04:00
|
|
|
../src/localscope.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/module.cc
|
2012-02-04 04:43:53 +04:00
|
|
|
../src/ModuleCache.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/node.cc
|
|
|
|
../src/context.cc
|
2013-04-09 08:28:16 +04:00
|
|
|
../src/modcontext.cc
|
|
|
|
../src/evalcontext.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/csgterm.cc
|
2011-12-26 22:15:51 +04:00
|
|
|
../src/csgtermnormalizer.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../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
|
2013-09-20 09:19:09 +04:00
|
|
|
../src/rendersettings.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/dxfdata.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
|
2013-05-09 14:12:58 +04:00
|
|
|
../src/fileutils.cc
|
2010-08-31 02:49:24 +04:00
|
|
|
../src/progress.cc
|
2013-03-12 09:14:58 +04:00
|
|
|
../src/boost-utils.cc
|
2011-10-16 19:50:33 +04:00
|
|
|
${FLEX_OpenSCADlexer_OUTPUTS}
|
|
|
|
${BISON_OpenSCADparser_OUTPUTS})
|
|
|
|
|
2011-11-07 00:54:17 +04:00
|
|
|
set(NOCGAL_SOURCES
|
2011-11-07 00:52:49 +04:00
|
|
|
../src/builtin.cc
|
2011-11-07 00:54:17 +04:00
|
|
|
../src/dxftess.cc
|
|
|
|
../src/import.cc
|
2013-09-20 09:19:09 +04:00
|
|
|
../src/export.cc)
|
2011-11-07 00:54:17 +04:00
|
|
|
|
|
|
|
set(CGAL_SOURCES
|
|
|
|
${NOCGAL_SOURCES}
|
2013-09-20 09:19:09 +04:00
|
|
|
../src/CSGTermEvaluator.cc
|
2011-11-07 00:54:17 +04:00
|
|
|
../src/CGAL_Nef_polyhedron.cc
|
|
|
|
../src/cgalutils.cc
|
|
|
|
../src/CGALEvaluator.cc
|
|
|
|
../src/CGALCache.cc
|
|
|
|
../src/PolySetCGALEvaluator.cc
|
|
|
|
../src/CGAL_Nef_polyhedron_DxfData.cc
|
2012-10-28 23:22:04 +04:00
|
|
|
../src/cgaladv_minkowski2.cc
|
|
|
|
../src/svg.cc)
|
2011-11-07 00:54:17 +04:00
|
|
|
|
2011-10-16 19:50:33 +04:00
|
|
|
set(COMMON_SOURCES
|
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
|
2013-01-26 21:55:47 +04:00
|
|
|
../src/lodepng.cpp)
|
2011-10-16 19:50:33 +04:00
|
|
|
|
2011-09-18 01:13:37 +04:00
|
|
|
#
|
|
|
|
# Offscreen OpenGL context source code
|
|
|
|
#
|
|
|
|
|
2011-11-07 00:54:17 +04:00
|
|
|
set(OFFSCREEN_SOURCES
|
2013-02-24 04:50:20 +04:00
|
|
|
../src/GLView.cc
|
2013-01-26 21:55:47 +04:00
|
|
|
../src/OffscreenView.cc
|
|
|
|
../src/${OFFSCREEN_CTX_SOURCE}
|
|
|
|
../src/${OFFSCREEN_IMGUTILS_SOURCE}
|
|
|
|
../src/imageutils.cc
|
|
|
|
../src/fbo.cc
|
2013-09-20 09:19:09 +04:00
|
|
|
../src/system-gl.cc
|
|
|
|
../src/export_png.cc
|
|
|
|
../src/CGALRenderer.cc
|
|
|
|
../src/ThrownTogetherRenderer.cc
|
|
|
|
../src/renderer.cc
|
|
|
|
../src/render.cc
|
2013-09-20 10:54:53 +04:00
|
|
|
../src/PlatformUtils.cc
|
|
|
|
../src/${PLATFORMUTILS_SOURCE}
|
2013-09-20 09:19:09 +04:00
|
|
|
../src/OpenCSGRenderer.cc)
|
2011-11-07 00:54:17 +04:00
|
|
|
|
|
|
|
add_library(tests-core STATIC ${CORE_SOURCES})
|
2013-05-29 04:15:42 +04:00
|
|
|
target_link_libraries(tests-core ${OPENGL_LIBRARIES})
|
|
|
|
set(TESTS-CORE-LIBRARIES ${OPENGL_LIBRARIES} ${Boost_LIBRARIES})
|
2012-08-21 03:15:14 +04:00
|
|
|
|
2011-11-07 00:54:17 +04:00
|
|
|
add_library(tests-common STATIC ${COMMON_SOURCES})
|
|
|
|
target_link_libraries(tests-common tests-core)
|
2012-08-21 03:15:14 +04:00
|
|
|
|
2011-11-07 00:54:17 +04:00
|
|
|
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)
|
2012-08-21 03:15:14 +04:00
|
|
|
set(TESTS-CGAL-LIBRARIES ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${GMP_LIBRARIES} ${MPFR_LIBRARIES} ${TESTS-CORE-LIBRARIES})
|
|
|
|
|
2011-11-07 00:54:17 +04:00
|
|
|
add_library(tests-nocgal STATIC ${NOCGAL_SOURCES})
|
|
|
|
target_link_libraries(tests-nocgal tests-common)
|
|
|
|
add_library(tests-offscreen STATIC ${OFFSCREEN_SOURCES})
|
2013-09-20 09:19:09 +04:00
|
|
|
set_target_properties(tests-offscreen PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
|
2012-08-21 03:15:14 +04:00
|
|
|
set(TESTS-NOCGAL-LIBRARIES ${TESTS-CORE-LIBRARIES})
|
2011-11-07 00:54:17 +04:00
|
|
|
|
2012-02-04 04:43:53 +04:00
|
|
|
#
|
|
|
|
# modulecachetest
|
|
|
|
#
|
|
|
|
add_executable(modulecachetest modulecachetest.cc)
|
2013-09-20 09:19:09 +04:00
|
|
|
target_link_libraries(modulecachetest tests-nocgal ${TESTS-NOCGAL-LIBRARIES} ${Boost_LIBRARIES})
|
2012-02-04 04:43:53 +04:00
|
|
|
|
2010-11-17 09:26:39 +03:00
|
|
|
#
|
|
|
|
# csgtexttest
|
|
|
|
#
|
2011-11-09 06:18:11 +04:00
|
|
|
add_executable(csgtexttest csgtexttest.cc CSGTextRenderer.cc CSGTextCache.cc)
|
2012-08-21 03:15:14 +04:00
|
|
|
target_link_libraries(csgtexttest tests-nocgal ${TESTS-NOCGAL-LIBRARIES})
|
2010-11-17 09:26:39 +03:00
|
|
|
|
2012-01-10 03:00:31 +04:00
|
|
|
#
|
|
|
|
# cgalcachetest
|
|
|
|
#
|
2013-01-26 21:55:47 +04:00
|
|
|
add_executable(cgalcachetest cgalcachetest.cc)
|
2012-01-10 03:00:31 +04:00
|
|
|
set_target_properties(cgalcachetest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
|
2012-08-21 03:15:14 +04:00
|
|
|
target_link_libraries(cgalcachetest tests-cgal ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
|
2012-01-10 03:00:31 +04:00
|
|
|
|
2013-01-31 06:42:33 +04:00
|
|
|
#
|
2013-09-20 09:19:09 +04:00
|
|
|
# openscad no-qt
|
2013-01-31 06:42:33 +04:00
|
|
|
#
|
2013-09-21 09:12:42 +04:00
|
|
|
add_executable(openscad_nogui ../src/openscad.cc)
|
|
|
|
set_target_properties(openscad_nogui PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing -DEIGEN_DONT_ALIGN -DENABLE_CGAL -DENABLE_OPENCSG ${CGAL_CXX_FLAGS_INIT}")
|
|
|
|
target_link_libraries(openscad_nogui tests-offscreen tests-cgal tests-nocgal ${TESTS-CORE-LIBRARIES} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${Boost_LIBRARIES} ${OPENCSG_LIBRARY} ${COCOA_LIBRARY} )
|
2013-01-31 06:42:33 +04:00
|
|
|
|
2013-09-20 09:19:09 +04:00
|
|
|
#
|
|
|
|
# GUI binary tests
|
|
|
|
#
|
|
|
|
#if(APPLE)
|
|
|
|
# set(OPENSCAD_BINPATH "${CMAKE_CURRENT_SOURCE_DIR}/../OpenSCAD.app/Contents/MacOS/OpenSCAD")
|
|
|
|
#elseif (MINGW_CROSS_ENV_DIR)
|
|
|
|
# set(OPENSCAD_BINPATH "${CMAKE_CURRENT_SOURCE_DIR}/../mingw32/release/openscad.exe")
|
|
|
|
#elseif(WIN32)
|
|
|
|
# set(OPENSCAD_BINPATH "${CMAKE_CURRENT_SOURCE_DIR}/../Release/openscad.exe")
|
|
|
|
#else()
|
|
|
|
# set(OPENSCAD_BINPATH "${CMAKE_CURRENT_SOURCE_DIR}/../openscad")
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
#if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/openscad")
|
|
|
|
# set(OPENSCAD_BINPATH "${CMAKE_CURRENT_BINARY_DIR}/openscad")
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
#if(EXISTS "${OPENSCAD_BINPATH}")
|
|
|
|
# message(STATUS "Found OpenSCAD binary: ${OPENSCAD_BINPATH}")
|
|
|
|
#else()
|
|
|
|
# message(STATUS "Couldn't find the OpenSCAD binary: ${OPENSCAD_BINPATH}")
|
|
|
|
# message(FATAL_ERROR "Please build the OpenSCAD binary and place it here: ${OPENSCAD_BINPATH}" )
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
2013-09-21 09:12:42 +04:00
|
|
|
set(OPENSCAD_BINPATH "${CMAKE_CURRENT_BINARY_DIR}/openscad_nogui.exe")
|
2013-01-31 08:36:12 +04:00
|
|
|
else()
|
2013-09-21 09:12:42 +04:00
|
|
|
set(OPENSCAD_BINPATH "${CMAKE_CURRENT_BINARY_DIR}/openscad_nogui")
|
2013-01-31 08:36:12 +04:00
|
|
|
endif()
|
2013-01-31 06:42:33 +04:00
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
#
|
|
|
|
# Tags tests as disabled. This is more convenient than removing them manually
|
|
|
|
# from the lists of filenames
|
|
|
|
#
|
|
|
|
macro(disable_tests)
|
|
|
|
foreach (TESTNAME ${ARGN})
|
|
|
|
# message("Disabling ${TESTNAME}")
|
|
|
|
list(APPEND DISABLED_TESTS ${TESTNAME})
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
#
|
|
|
|
# Tags the given tests as belonging to the given CONFIG, i.e. will
|
|
|
|
# only be executed when run using ctest -C <CONFIG>
|
|
|
|
#
|
|
|
|
# Usage example: set_test_config(Heavy dumptest_testname opencsgtest_testname2)
|
|
|
|
#
|
|
|
|
function(set_test_config CONFIG)
|
|
|
|
list(APPEND ${CONFIG}_TEST_CONFIG ${ARGN})
|
|
|
|
list(FIND TEST_CONFIGS ${CONFIG} FOUND)
|
|
|
|
if (FOUND EQUAL -1)
|
|
|
|
list(APPEND TEST_CONFIGS ${CONFIG})
|
|
|
|
# Export to parent scope
|
|
|
|
set(TEST_CONFIGS ${TEST_CONFIGS} PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
# Export to parent scope
|
|
|
|
set(${CONFIG}_TEST_CONFIG ${${CONFIG}_TEST_CONFIG} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns a list of test configs
|
|
|
|
#
|
|
|
|
function(get_test_config TESTNAME CONFIGS)
|
|
|
|
foreach(CONFIG ${TEST_CONFIGS})
|
|
|
|
list(FIND ${CONFIG}_TEST_CONFIG ${TESTNAME} IDX)
|
|
|
|
if (${IDX} GREATER -1)
|
|
|
|
list(APPEND ${CONFIGS} ${CONFIG})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (${CONFIGS})
|
|
|
|
# Convert to a format understood by add_test()
|
|
|
|
string(REPLACE ";" "|" ${${CONFIGS}} ${CONFIGS})
|
|
|
|
# Export to parent scope
|
|
|
|
set(${CONFIGS} ${${CONFIGS}} PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns into the FULLNAME variable the global full test name (identifier)
|
|
|
|
# given a test command and source filename
|
|
|
|
#
|
|
|
|
function(get_test_fullname TESTCMD FILENAME FULLNAME)
|
|
|
|
get_filename_component(TESTCMD_NAME ${TESTCMD} NAME_WE)
|
|
|
|
get_filename_component(TESTNAME ${FILENAME} NAME_WE)
|
|
|
|
string(REPLACE " " "_" TESTNAME ${TESTNAME}) # Test names cannot include spaces
|
|
|
|
set(${FULLNAME} ${TESTCMD_NAME}_${TESTNAME})
|
|
|
|
# Export to parent scope
|
|
|
|
set(${FULLNAME} ${${FULLNAME}} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2010-07-11 23:06:43 +04:00
|
|
|
#
|
2010-09-07 04:05:08 +04:00
|
|
|
# This functions adds cmd-line tests given files.
|
2010-07-11 23:06:43 +04:00
|
|
|
#
|
2013-03-12 00:12:35 +04:00
|
|
|
# Usage add_cmdline_test(testbasename [EXE <executable>] [ARGS <args to exe>]
|
2013-03-08 20:08:36 +04:00
|
|
|
# [EXPECTEDDIR <shared dir>] SUFFIX <suffix> FILES <test files>)
|
2011-11-26 21:58:53 +04:00
|
|
|
#
|
2011-10-16 07:59:54 +04:00
|
|
|
find_package(PythonInterp)
|
2013-03-12 00:12:35 +04:00
|
|
|
function(add_cmdline_test TESTCMD_BASENAME)
|
2013-03-08 20:08:36 +04:00
|
|
|
cmake_parse_arguments(TESTCMD "" "EXE;SUFFIX;EXPECTEDDIR" "FILES;ARGS" ${ARGN})
|
|
|
|
|
|
|
|
# If sharing results with another test, pass on this to the python script
|
|
|
|
if (TESTCMD_EXPECTEDDIR)
|
|
|
|
set(EXTRA_OPTIONS -e ${TESTCMD_EXPECTEDDIR})
|
|
|
|
endif()
|
|
|
|
|
2013-03-12 00:12:35 +04:00
|
|
|
if (TESTCMD_EXE)
|
|
|
|
set(TESTNAME_OPTION -t ${TESTCMD_BASENAME})
|
|
|
|
else()
|
|
|
|
# If no executable was specified, assume it was built by us and resides here
|
|
|
|
set(TESTCMD_EXE ${CMAKE_BINARY_DIR}/${TESTCMD_BASENAME})
|
2013-03-08 20:08:36 +04:00
|
|
|
endif()
|
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
# Add tests from args
|
2013-03-08 20:08:36 +04:00
|
|
|
foreach (SCADFILE ${TESTCMD_FILES})
|
2013-03-12 00:12:35 +04:00
|
|
|
get_filename_component(FILE_BASENAME ${SCADFILE} NAME_WE)
|
|
|
|
string(REPLACE " " "_" FILE_BASENAME ${FILE_BASENAME}) # Test names cannot include spaces
|
|
|
|
set(TEST_FULLNAME "${TESTCMD_BASENAME}_${FILE_BASENAME}")
|
2011-11-26 21:58:53 +04:00
|
|
|
list(FIND DISABLED_TESTS ${TEST_FULLNAME} DISABLED)
|
|
|
|
if (${DISABLED} EQUAL -1)
|
2011-11-26 22:25:16 +04:00
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
# Handle configurations
|
|
|
|
unset(FOUNDCONFIGS)
|
|
|
|
get_test_config(${TEST_FULLNAME} FOUNDCONFIGS)
|
2011-11-26 22:25:16 +04:00
|
|
|
if (NOT FOUNDCONFIGS)
|
|
|
|
set_test_config(Default ${TEST_FULLNAME})
|
2011-11-26 21:58:53 +04:00
|
|
|
endif()
|
2011-11-26 22:25:16 +04:00
|
|
|
set_test_config(All ${TEST_FULLNAME})
|
|
|
|
unset(FOUNDCONFIGS)
|
|
|
|
get_test_config(${TEST_FULLNAME} FOUNDCONFIGS)
|
|
|
|
set(CONFARG CONFIGURATIONS)
|
|
|
|
set(CONFVAL ${FOUNDCONFIGS})
|
2011-11-26 21:58:53 +04:00
|
|
|
|
2012-01-03 22:27:03 +04:00
|
|
|
if (MINGW_CROSS_ENV_DIR)
|
|
|
|
set( MINGW_CROSS_ARG "--mingw-cross-env" )
|
|
|
|
endif()
|
2013-03-08 20:08:36 +04:00
|
|
|
|
|
|
|
# The python script cannot extract the testname when given extra parameters
|
|
|
|
if (TESTCMD_ARGS)
|
2013-03-12 00:12:35 +04:00
|
|
|
set(FILENAME_OPTION -f ${FILE_BASENAME})
|
2013-03-08 20:08:36 +04:00
|
|
|
endif()
|
|
|
|
|
2013-03-12 00:12:35 +04:00
|
|
|
add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py ${MINGW_CROSS_ARG} --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTCMD_SUFFIX} ${EXTRA_OPTIONS} ${TESTNAME_OPTION} ${FILENAME_OPTION} ${TESTCMD_EXE} "${SCADFILE}" ${TESTCMD_ARGS})
|
2013-01-28 09:38:50 +04:00
|
|
|
set_property(TEST ${TEST_FULLNAME} PROPERTY ENVIRONMENT "${CTEST_ENVIRONMENT}")
|
2011-11-26 21:58:53 +04:00
|
|
|
endif()
|
2010-07-11 23:06:43 +04:00
|
|
|
endforeach()
|
2013-03-08 20:29:55 +04:00
|
|
|
endfunction()
|
2010-07-11 23:06:43 +04:00
|
|
|
|
2010-07-07 02:54:16 +04:00
|
|
|
enable_testing()
|
|
|
|
|
2013-01-31 07:14:09 +04:00
|
|
|
|
|
|
|
|
2011-11-26 22:25:16 +04:00
|
|
|
set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_SOURCE_DIR}/EnforceConfig.cmake")
|
|
|
|
|
2012-01-14 06:25:09 +04:00
|
|
|
# Subst files
|
2012-06-04 13:22:09 +04:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/../testdata/scad/templates/include-tests-template.scad
|
2012-01-14 06:25:09 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad)
|
2012-06-04 13:22:09 +04:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/../testdata/scad/templates/use-tests-template.scad
|
2012-01-14 06:25:09 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad)
|
2012-06-04 13:22:09 +04:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/../testdata/scad/templates/import_stl-tests-template.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/import_stl-tests.scad)
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/../testdata/scad/templates/import_dxf-tests-template.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/features/import_dxf-tests.scad)
|
2012-01-14 06:25:09 +04:00
|
|
|
|
2010-07-07 02:54:16 +04:00
|
|
|
# Find all scad files
|
2011-07-11 03:33:17 +04:00
|
|
|
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)
|
2011-11-12 23:53:12 +04:00
|
|
|
file(GLOB FUNCTION_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/functions/*.scad)
|
2011-11-06 07:24:27 +04:00
|
|
|
file(GLOB EXAMPLE_FILES ${CMAKE_SOURCE_DIR}/../examples/*.scad)
|
2010-07-07 02:54:16 +04:00
|
|
|
|
2011-11-12 23:53:12 +04:00
|
|
|
list(APPEND ECHO_FILES ${FUNCTION_FILES}
|
2011-11-09 21:38:52 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/echo-tests.scad
|
2011-11-07 08:36:17 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad
|
2011-11-05 20:06:13 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parser-tests.scad
|
2011-11-12 23:46:00 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/builtin-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/dim-all.scad
|
2011-11-14 00:15:28 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-test.scad
|
2012-02-15 06:22:48 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-indexing.scad
|
2012-02-15 08:04:40 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/vector-values.scad
|
2012-10-10 07:32:56 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/search-tests.scad
|
2013-03-12 01:58:05 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/recursion-tests.scad
|
2013-04-24 17:17:25 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/value-reassignment-tests.scad
|
2013-06-13 09:26:36 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/value-reassignment-tests2.scad
|
2013-05-09 19:28:05 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/variable-scope-tests.scad
|
2013-06-26 07:17:51 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/lookup-tests.scad
|
2013-10-09 07:40:42 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/expression-shortcircuit-tests.scad
|
2013-10-13 21:19:34 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parent_module-tests.scad
|
2013-11-10 06:12:03 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/children-tests.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/range-tests.scad)
|
2011-10-16 19:50:33 +04:00
|
|
|
|
2013-06-23 09:56:04 +04:00
|
|
|
list(APPEND DUMPTEST_FILES ${FEATURES_FILES} ${EXAMPLE_FILES})
|
2012-01-14 06:25:09 +04:00
|
|
|
list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad
|
2013-04-05 09:30:09 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad
|
2013-05-08 18:34:38 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad
|
2013-06-23 09:56:04 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allexpressions.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad
|
2013-12-15 07:58:22 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/nonplanar_polyhedron.scad)
|
2010-09-07 04:05:08 +04:00
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
list(APPEND CGALPNGTEST_FILES ${FEATURES_FILES} ${SCAD_DXF_FILES} ${EXAMPLE_FILES})
|
2012-01-14 06:25:09 +04:00
|
|
|
list(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad
|
2012-08-21 04:39:18 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad
|
2013-04-05 09:30:09 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad
|
2013-12-15 07:58:22 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/nonplanar_polyhedron.scad
|
2013-05-08 18:34:38 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad)
|
2013-04-05 09:30:09 +04:00
|
|
|
|
2011-11-12 23:46:00 +04:00
|
|
|
list(APPEND OPENCSGTEST_FILES ${CGALPNGTEST_FILES})
|
2011-12-23 17:12:35 +04:00
|
|
|
list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/bbox-transform-bug.scad)
|
2012-01-29 22:02:19 +04:00
|
|
|
list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/intersection-prune-test.scad)
|
2011-12-23 17:12:35 +04:00
|
|
|
list(APPEND THROWNTOGETHERTEST_FILES ${OPENCSGTEST_FILES})
|
2011-11-12 23:46:00 +04:00
|
|
|
|
2011-12-26 16:21:29 +04:00
|
|
|
list(APPEND CGALSTLSANITYTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/normal-nan.scad)
|
|
|
|
|
2013-03-12 00:12:35 +04:00
|
|
|
list(APPEND OPENSCAD-CGALPNG_FILES ${CGALPNGTEST_FILES})
|
|
|
|
list(APPEND OPENSCAD-CSGPNG_FILES ${OPENCSGTEST_FILES})
|
2013-01-26 21:55:47 +04:00
|
|
|
|
2011-11-12 23:46:00 +04:00
|
|
|
# FIXME: This test illustrates a weakness in child() combined with modifiers.
|
|
|
|
# Reenable it when this is improved
|
2011-11-26 21:58:53 +04:00
|
|
|
disable_tests(opencsgtest_child-background)
|
2013-03-12 00:12:35 +04:00
|
|
|
disable_tests(openscad-csgpng_child-background)
|
2011-11-26 21:58:53 +04:00
|
|
|
|
2011-12-01 08:24:14 +04:00
|
|
|
# FIXME: This single test takes over an hour to run on a 2.7 GHz P4
|
2011-12-07 04:56:58 +04:00
|
|
|
disable_tests(opencsgtest_example006 cgalpngtest_example006)
|
2013-03-12 00:12:35 +04:00
|
|
|
disable_tests(openscad-csgpng_example006 openscad-cgalpng_example006)
|
2011-12-01 08:24:14 +04:00
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
# These tests only makes sense in OpenCSG mode
|
|
|
|
disable_tests(cgalpngtest_child-background
|
|
|
|
cgalpngtest_highlight-and-background-modifier
|
|
|
|
cgalpngtest_testcolornames
|
2013-03-12 00:12:35 +04:00
|
|
|
openscad-cgalpng_child-background
|
|
|
|
openscad-cgalpng_highlight-and-background-modifier
|
2013-05-25 21:30:38 +04:00
|
|
|
openscad-cgalpng_testcolornames
|
2013-05-27 01:06:56 +04:00
|
|
|
throwntogethertest_testcolornames)
|
2011-11-26 21:58:53 +04:00
|
|
|
|
|
|
|
# Test config handling
|
|
|
|
|
|
|
|
set_test_config(Heavy opencsgtest_minkowski3-tests
|
2013-03-12 00:12:35 +04:00
|
|
|
openscad-csgpng_minkowski3-tests
|
2011-11-26 21:58:53 +04:00
|
|
|
throwntogethertest_minkowski3-tests
|
|
|
|
cgalpngtest_rotate_extrude-tests
|
|
|
|
cgalpngtest_surface-tests
|
|
|
|
cgalpngtest_sphere-tests
|
|
|
|
cgalpngtest_minkowski3-tests
|
|
|
|
cgalpngtest_for-tests
|
|
|
|
cgalpngtest_for-nested-tests
|
2013-02-08 00:57:01 +04:00
|
|
|
cgalpngtest_intersection-tests
|
2013-06-24 21:26:45 +04:00
|
|
|
cgalpngtest_text-search-test)
|
2011-11-26 21:58:53 +04:00
|
|
|
|
|
|
|
foreach(FILE ${EXAMPLE_FILES})
|
|
|
|
get_test_fullname(cgalpngtest ${FILE} TEST_FULLNAME)
|
|
|
|
set_test_config(Examples ${TEST_FULLNAME})
|
|
|
|
get_test_fullname(opencsgtest ${FILE} TEST_FULLNAME)
|
|
|
|
set_test_config(Examples ${TEST_FULLNAME})
|
|
|
|
get_test_fullname(throwntogethertest ${FILE} TEST_FULLNAME)
|
|
|
|
set_test_config(Examples ${TEST_FULLNAME})
|
2013-03-12 00:12:35 +04:00
|
|
|
get_test_fullname(openscad-cgalpng ${FILE} TEST_FULLNAME)
|
2013-01-26 21:55:47 +04:00
|
|
|
set_test_config(Examples ${TEST_FULLNAME})
|
2013-03-12 00:12:35 +04:00
|
|
|
get_test_fullname(openscad-csgpng ${FILE} TEST_FULLNAME)
|
2013-02-25 07:07:37 +04:00
|
|
|
set_test_config(Examples ${TEST_FULLNAME})
|
2011-11-26 21:58:53 +04:00
|
|
|
endforeach()
|
|
|
|
|
2013-01-28 09:38:50 +04:00
|
|
|
# Workaround Gallium bugs
|
|
|
|
if ( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
|
|
|
|
message(STATUS "Workaround PPC bug https://bugs.freedesktop.org/show_bug.cgi?id=42540")
|
|
|
|
set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};GALLIUM_DRIVER=softpipe")
|
|
|
|
set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};DRAW_USE_LLVM=no")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Set up custom commands to run before & after Ctest run.
|
|
|
|
# 1. Start/stop Virtual Framebuffer for linux/bsd. 2. Pretty Print
|
|
|
|
# Please see the CTestCustom.template file for more info.
|
|
|
|
|
2013-02-03 04:39:43 +04:00
|
|
|
#
|
|
|
|
# Post-test pretty print
|
|
|
|
#
|
|
|
|
|
|
|
|
add_executable(test_pretty_print test_pretty_print.cc)
|
2013-02-24 06:54:13 +04:00
|
|
|
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py PYSRC)
|
2013-02-03 04:39:43 +04:00
|
|
|
set_target_properties(test_pretty_print PROPERTIES COMPILE_FLAGS
|
2013-02-24 06:54:13 +04:00
|
|
|
"-DPYBIN=${PYTHON_EXECUTABLE} -DPYSRC=${PYSRC} -DBUILDDIR=--builddir=${CMAKE_CURRENT_BINARY_DIR}"
|
2013-02-03 04:39:43 +04:00
|
|
|
)
|
2013-02-16 19:37:01 +04:00
|
|
|
if (MINGW_CROSS_ENV_DIR)
|
|
|
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print "wine test_pretty_print.exe")
|
|
|
|
execute_process(COMMAND chmod ugo+x ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print)
|
|
|
|
endif()
|
2013-02-03 04:39:43 +04:00
|
|
|
|
2013-01-28 09:38:50 +04:00
|
|
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template TMP)
|
|
|
|
string(REPLACE __cmake_current_binary_dir__ ${CMAKE_CURRENT_BINARY_DIR} TMP ${TMP})
|
|
|
|
string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TMP})
|
|
|
|
string(REPLACE __python__ ${PYTHON_EXECUTABLE} TMP ${TMP})
|
|
|
|
string(REPLACE __header__ "Generated by cmake from ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template" TMP ${TMP})
|
|
|
|
string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP})
|
2013-09-20 09:19:09 +04:00
|
|
|
string(REPLACE __openscad_binpath__ ${OPENSCAD_BINPATH} TMP ${TMP})
|
2013-01-28 09:38:50 +04:00
|
|
|
|
|
|
|
if (MINGW_CROSS_ENV_DIR)
|
|
|
|
string(REPLACE __wine__ wine TMP ${TMP})
|
|
|
|
else()
|
|
|
|
string(REPLACE __wine__ " " TMP ${TMP})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "creating CTestCustom.cmake")
|
|
|
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake ${TMP})
|
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
# Add tests
|
2011-11-12 23:46:00 +04:00
|
|
|
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(moduledumptest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX ast FILES
|
2013-06-23 09:56:04 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allexpressions.scad)
|
2013-06-26 20:06:00 +04:00
|
|
|
add_cmdline_test(csgtexttest SUFFIX txt FILES
|
2013-06-23 09:56:04 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allexpressions.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(csgtermtest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX term FILES
|
2013-06-23 09:56:04 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allexpressions.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad
|
|
|
|
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad)
|
2013-09-21 18:04:01 +04:00
|
|
|
add_cmdline_test(echotest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX echo FILES ${ECHO_FILES})
|
2013-09-21 19:25:36 +04:00
|
|
|
add_cmdline_test(dumptest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX csg FILES ${DUMPTEST_FILES})
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(cgalpngtest EXE ${OPENSCAD_BINPATH} ARGS --render -o SUFFIX png FILES ${CGALPNGTEST_FILES})
|
|
|
|
add_cmdline_test(opencsgtest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX png FILES ${OPENCSGTEST_FILES})
|
|
|
|
add_cmdline_test(throwntogethertest EXE ${OPENSCAD_BINPATH} ARGS --preview=throwntogether -o SUFFIX png FILES ${THROWNTOGETHERTEST_FILES})
|
2011-12-26 16:21:29 +04:00
|
|
|
# FIXME: We don't actually need to compare the output of cgalstlsanitytest
|
|
|
|
# with anything. It's self-contained and returns != 0 on error
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(cgalstlsanitytest EXE ${CMAKE_SOURCE_DIR}/cgalstlsanitytest SUFFIX txt ARGS ${OPENSCAD_BINPATH} FILES ${CGALSTLSANITYTEST_FILES})
|
2011-09-22 05:11:01 +04:00
|
|
|
|
2013-03-12 00:12:35 +04:00
|
|
|
# Tests using the actual OpenSCAD binary
|
2013-03-12 06:14:00 +04:00
|
|
|
|
|
|
|
# non-ASCII filenames
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-nonascii EXE ${OPENSCAD_BINPATH} ARGS -o
|
2013-03-12 06:14:00 +04:00
|
|
|
SUFFIX csg
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/sfære.scad)
|
|
|
|
|
|
|
|
|
|
|
|
# Image output
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-imgsize EXE ${OPENSCAD_BINPATH}
|
2013-03-12 00:12:35 +04:00
|
|
|
ARGS --imgsize 100,100 -o
|
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-imgstretch EXE ${OPENSCAD_BINPATH}
|
2013-03-12 00:12:35 +04:00
|
|
|
ARGS --imgsize 500,100 -o
|
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-imgstretch2 EXE ${OPENSCAD_BINPATH}
|
2013-03-12 00:12:35 +04:00
|
|
|
ARGS --imgsize 100,500 -o
|
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-camdist EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=0,0,0,90,0,90,300 -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-camrot EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=0,0,0,440,337.5,315,300 -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-camtrans EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=100,-20,-10,90,0,90,300 -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-camortho EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=100,-20,-10,90,0,90,300 --projection=o -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-cameye EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=60,40,30,0,0,0 -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-cameye2 EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=160,140,130,0,0,0 -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-cameyeortho EXE ${OPENSCAD_BINPATH}
|
2013-10-08 02:32:05 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=160,140,130,0,0,0 --projection=o -o
|
2013-03-12 00:12:35 +04:00
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
2013-09-20 09:19:09 +04:00
|
|
|
add_cmdline_test(openscad-camcenter EXE ${OPENSCAD_BINPATH}
|
2013-03-12 00:12:35 +04:00
|
|
|
ARGS --imgsize=500,500 --camera=60,40,30,20,10,30 -o
|
|
|
|
SUFFIX png
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad)
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-26 21:58:53 +04:00
|
|
|
message("Available test configurations: ${TEST_CONFIGS}")
|
|
|
|
#foreach(CONF ${TEST_CONFIGS})
|
|
|
|
# message("${CONF}: ${${CONF}_TEST_CONFIG}")
|
|
|
|
#endforeach()
|