2 # Always run tests from install path, so all required scripts and libraries
3 # are available and we are testing the actual installation layout.
5 # Getting the install path of the executable is somewhat involved, as there are
6 # no direct CMake generator expressions to get the install paths of executables.
7 get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
8 if(GENERATOR_IS_MULTI_CONFIG)
9 string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
11 string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
14 # Path to Blender and Python executables for all platforms.
16 set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender.exe)
17 set(_default_test_python_exe "${TEST_INSTALL_DIR}/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>")
19 set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/Blender.app/Contents/MacOS/Blender)
20 set(_default_test_python_exe ${PYTHON_EXECUTABLE})
22 set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender)
23 set(_default_test_python_exe ${PYTHON_EXECUTABLE})
26 # The installation directory's Python is the best one to use. However, it can only be there after the install step,
27 # which means that Python will never be there on a fresh system. To suit different needs, the user can pass
28 # -DTEST_PYTHON_EXE=/path/to/python to CMake.
29 if (NOT TEST_PYTHON_EXE)
30 set(TEST_PYTHON_EXE ${_default_test_python_exe})
31 message(STATUS "Tests: Using Python executable: ${TEST_PYTHON_EXE}")
32 elseif(NOT EXISTS ${TEST_PYTHON_EXE})
33 message(FATAL_ERROR "Tests: TEST_PYTHON_EXE ${TEST_PYTHON_EXE} does not exist")
35 unset(_default_test_python_exe)
38 # For testing with Valgrind
39 # set(TEST_BLENDER_EXE valgrind --track-origins=yes --error-limit=no ${TEST_BLENDER_EXE})
41 # Standard Blender arguments for running tests.
42 set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
45 if(WITH_BLENDER AND WITH_PYTHON)
46 add_subdirectory(python)
50 add_subdirectory(gtests)