set(ANTLR_DIR "" CACHE STRING "Set ANTLR3 install directory")
set(CADICAL_DIR "" CACHE STRING "Set CaDiCaL install directory")
set(CRYPTOMINISAT_DIR "" CACHE STRING "Set CryptoMiniSat install directory")
+set(CXXTEST_DIR "" CACHE STRING "Set CxxTest install directory")
set(GLPK_DIR "" CACHE STRING "Set GLPK install directory")
set(GMP_DIR "" CACHE STRING "Set GMP install directory")
set(LFSC_DIR "" CACHE STRING "Set LFSC install directory")
add_definitions(-DCVC4_TRACING)
endif()
-if(ENABLE_UNIT_TESTING)
- find_package(CxxTest REQUIRED)
-endif()
-
if(ENABLE_STATISTICS)
add_definitions(-DCVC4_STATISTICS_ON)
endif()
--- /dev/null
+# Find CxxTest
+# CxxTest_FOUND - system has CxxTest lib
+# CxxTest_INCLUDE_DIR - the CxxTest include directory
+# CxxTest_TESTGEN_EXECUTABLE - CxxTest excecutable
+# CxxTest_TESTGEN_INTERPRETER - Python/Perl interpreter for running executable
+
+find_package(PythonInterp QUIET)
+find_package(Perl QUIET)
+
+find_path(CxxTest_INCLUDE_DIR cxxtest/TestSuite.h
+ PATHS ${CxxTest_HOME}
+ NO_DEFAULT_PATH)
+find_program(CxxTest_PYTHON_TESTGEN_EXECUTABLE
+ NAMES cxxtestgen cxxtestgen.py
+ PATHS ${CxxTest_HOME}/bin
+ NO_DEFAULT_PATH)
+find_program(CxxTest_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
+ PATHS ${CxxTest_HOME}/bin
+ NO_DEFAULT_PATH)
+
+if(NOT CxxTest_HOME)
+ find_path(CxxTest_INCLUDE_DIR cxxtest/TestSuite.h)
+ find_program(CxxTest_PYTHON_TESTGEN_EXECUTABLE NAMES cxxtestgen cxxtestgen.py)
+ find_program(CxxTest_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl)
+endif()
+
+if(PYTHONINTERP_FOUND AND CxxTest_PYTHON_TESTGEN_EXECUTABLE)
+ set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_PYTHON_TESTGEN_EXECUTABLE})
+ set(CxxTest_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE})
+elseif(PERL_FOUND AND CxxTest_PERL_TESTGEN_EXECUTABLE)
+ set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_PERL_TESTGEN_EXECUTABLE})
+ set(CxxTest_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
+elseif(NOT PYTHONINTERP_FOUND AND NOT PERL_FOUND AND CxxTest_FIND_REQUIRED)
+ message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest.")
+endif()
+
+if(NOT DEFINED CxxTest_TESTGEN_ARGS)
+ set(CxxTest_TESTGEN_ARGS --error-printer)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ CxxTest DEFAULT_MSG CxxTest_INCLUDE_DIR CxxTest_TESTGEN_EXECUTABLE)
+
+mark_as_advanced(CxxTest_INCLUDE_DIR CxxTest_TESTGEN_EXECUTABLE)
--antlr-dir=PATH path to ANTLR C headers and libraries
--cadical-dir=PATH path to top level of CaDiCaL source tree
--cryptominisat-dir=PATH path to top level of CryptoMiniSat source tree
- --cxxtest-dir=DIR path to CxxTest installation
+ --cxxtest-dir=PATH path to CxxTest installation
--glpk-dir=PATH path to top level of GLPK installation
--gmp-dir=PATH path to top level of GMP installation
--lfsc-dir=PATH path to top level of LFSC source tree
antlr_dir=default
cadical_dir=default
cryptominisat_dir=default
+cxxtest_dir=default
glpk_dir=default
gmp_dir=default
lfsc_dir=default
--cryptominisat-dir) die "missing argument to $1 (try -h)" ;;
--cryptominisat-dir=*) cryptominisat_dir=${1##*=} ;;
+ --cxxtest-dir) die "missing argument to $1 (try -h)" ;;
+ --cxxtest-dir=*) cxxtest_dir=${1##*=} ;;
+
--glpk-dir) die "missing argument to $1 (try -h)" ;;
--glpk-dir=*) glpk_dir=${1##*=} ;;
&& cmake_opts="$cmake_opts -DCADICAL_DIR=$cadical_dir"
[ "$cryptominisat_dir" != default ] \
&& cmake_opts="$cmake_opts -DCRYPTOMINISAT_DIR=$cryptominisat_dir"
+[ "$cxxtest_dir" != default ] \
+ && cmake_opts="$cmake_opts -DCXXTEST_DIR=$cxxtest_dir"
[ "$glpk_dir" != default ] \
&& cmake_opts="$cmake_opts -DGLPK_DIR=$glpk_dir"
[ "$gmp_dir" != default ] \
+# Note: We use our custom CxxTest finder here to specify custom directories and
+# fail if it is not found in the specified directory (similar to the other
+# custom finder modules).
+set(CxxTest_HOME ${CXXTEST_DIR})
+find_package(CxxTest REQUIRED)
+
include_directories(.)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src/include)
OUTPUT ${test_src}
DEPENDS ${test_header}
COMMAND
- ${CXXTEST_TESTGEN_INTERPRETER}
- ${CXXTEST_TESTGEN_EXECUTABLE}
- ${CXXTEST_TESTGEN_ARGS} -o ${test_src} ${test_header}
+ ${CxxTest_TESTGEN_INTERPRETER}
+ ${CxxTest_TESTGEN_EXECUTABLE}
+ ${CxxTest_TESTGEN_ARGS} -o ${test_src} ${test_header}
)
set_source_files_properties(${test_src} PROPERTIES GENERATED true)
# The build target is created without the path prefix (not supported),