From f63accd3b6ce8412213d3720e41808143f6e86a6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 3 Jan 2024 14:49:11 +0100 Subject: [PATCH] Cleanup: move CMake test utility functions into testing.cmake Combining functions from macros.cmake and Modules/GTestTesting.cmake. It was unusual to have Blender specific code in the Modules folder. Pull Request: https://projects.blender.org/blender/blender/pulls/116719 --- CMakeLists.txt | 4 + build_files/cmake/Modules/GTestTesting.cmake | 116 -------- build_files/cmake/macros.cmake | 155 ---------- build_files/cmake/testing.cmake | 268 ++++++++++++++++++ intern/atomic/CMakeLists.txt | 1 - intern/cycles/test/CMakeLists.txt | 2 - intern/ffmpeg/CMakeLists.txt | 1 - intern/guardedalloc/CMakeLists.txt | 1 - intern/libmv/CMakeLists.txt | 2 - intern/libmv/bundle.sh | 2 - intern/opensubdiv/CMakeLists.txt | 2 - source/blender/animrig/CMakeLists.txt | 1 - source/blender/asset_system/CMakeLists.txt | 1 - source/blender/blenkernel/CMakeLists.txt | 1 - source/blender/blenlib/CMakeLists.txt | 1 - source/blender/blenloader/CMakeLists.txt | 1 - source/blender/bmesh/CMakeLists.txt | 1 - source/blender/compositor/CMakeLists.txt | 1 - source/blender/depsgraph/CMakeLists.txt | 1 - source/blender/draw/CMakeLists.txt | 1 - .../blender/editors/animation/CMakeLists.txt | 1 - source/blender/functions/CMakeLists.txt | 1 - source/blender/gpu/CMakeLists.txt | 1 - source/blender/io/alembic/CMakeLists.txt | 1 - source/blender/io/common/CMakeLists.txt | 1 - source/blender/io/ply/CMakeLists.txt | 1 - source/blender/io/stl/CMakeLists.txt | 1 - source/blender/io/usd/CMakeLists.txt | 1 - .../blender/io/wavefront_obj/CMakeLists.txt | 1 - source/blender/windowmanager/CMakeLists.txt | 1 - 30 files changed, 272 insertions(+), 301 deletions(-) delete mode 100644 build_files/cmake/Modules/GTestTesting.cmake create mode 100644 build_files/cmake/testing.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a36ab662bb9..8355d0ebbf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2191,6 +2191,10 @@ endif() # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}") # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}") +# ----------------------------------------------------------------------------- +# Testing Functions + +include(build_files/cmake/testing.cmake) # ----------------------------------------------------------------------------- # Add Sub-Directories diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake deleted file mode 100644 index e533fe47a3f..00000000000 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ /dev/null @@ -1,116 +0,0 @@ -# SPDX-FileCopyrightText: 2014 Blender Authors -# -# SPDX-License-Identifier: BSD-3-Clause - -# Inspired on the Testing.cmake from Libmv - -function(GET_BLENDER_TEST_INSTALL_DIR VARIABLE_NAME) - get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if(GENERATOR_IS_MULTI_CONFIG) - string(REPLACE "\${BUILD_TYPE}" "$" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) - else() - string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) - endif() - set(${VARIABLE_NAME} "${TEST_INSTALL_DIR}" PARENT_SCOPE) -endfunction() - - -macro(BLENDER_SRC_GTEST_EX) - if(WITH_GTESTS) - set(options SKIP_ADD_TEST) - set(oneValueArgs NAME) - set(multiValueArgs SRC EXTRA_LIBS COMMAND_ARGS) - cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - - set(TARGET_NAME ${ARG_NAME}_test) - get_property(_current_include_directories - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - PROPERTY INCLUDE_DIRECTORIES) - set(TEST_INC - ${_current_include_directories} - ${CMAKE_SOURCE_DIR}/tests/gtests - ) - set(TEST_INC_SYS - ${GLOG_INCLUDE_DIRS} - ${GFLAGS_INCLUDE_DIRS} - ${CMAKE_SOURCE_DIR}/extern/gtest/include - ${CMAKE_SOURCE_DIR}/extern/gmock/include - ) - unset(_current_include_directories) - if(WIN32) - set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest") - else() - set(MANIFEST "") - endif() - - add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST}) - setup_platform_linker_flags(${TARGET_NAME}) - target_compile_definitions(${TARGET_NAME} PRIVATE ${GFLAGS_DEFINES}) - target_compile_definitions(${TARGET_NAME} PRIVATE ${GLOG_DEFINES}) - target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}") - target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}") - blender_link_libraries(${TARGET_NAME} "${ARG_EXTRA_LIBS};${PLATFORM_LINKLIBS}") - if(WITH_TBB) - # Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so - # that it is initialized before MKL and static library initialization order - # issues are avoided. - target_link_libraries(${TARGET_NAME} PRIVATE ${TBB_LIBRARIES}) - if(WITH_OPENIMAGEDENOISE) - target_link_libraries(${TARGET_NAME} PRIVATE ${OPENIMAGEDENOISE_LIBRARIES}) - endif() - endif() - target_link_libraries(${TARGET_NAME} PRIVATE - bf_testing_main - bf_intern_eigen - bf_intern_guardedalloc - extern_gtest - extern_gmock - # Needed for GLOG. - ${GLOG_LIBRARIES} - ${GFLAGS_LIBRARIES}) - - if(DEFINED PTHREADS_LIBRARIES) # Needed for GLOG. - target_link_libraries(${TARGET_NAME} PRIVATE ${PTHREADS_LIBRARIES}) - endif() - if(WITH_OPENMP AND WITH_OPENMP_STATIC) - target_link_libraries(${TARGET_NAME} PRIVATE ${OpenMP_LIBRARIES}) - endif() - if(UNIX AND NOT APPLE) - target_link_libraries(${TARGET_NAME} PRIVATE bf_intern_libc_compat) - endif() - if(WITH_TBB) - target_link_libraries(${TARGET_NAME} PRIVATE ${TBB_LIBRARIES}) - endif() - if(WITH_GMP) - target_link_libraries(${TARGET_NAME} PRIVATE ${GMP_LIBRARIES}) - endif() - - get_blender_test_install_dir(TEST_INSTALL_DIR) - set_target_properties(${TARGET_NAME} PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}") - if(NOT ARG_SKIP_ADD_TEST) - add_test( - NAME ${TARGET_NAME} - COMMAND ${TESTS_OUTPUT_DIR}/${TARGET_NAME} ${ARG_COMMAND_ARGS} - WORKING_DIRECTORY ${TEST_INSTALL_DIR}) - - # Don't fail tests on leaks since these often happen in external libraries - # that we can't fix. - set_tests_properties(${TARGET_NAME} PROPERTIES - ENVIRONMENT LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS} - ) - if(WIN32) - set_tests_properties(${TARGET_NAME} PROPERTIES ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}") - endif() - endif() - if(WIN32) - set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false") - endif() - unset(MANIFEST) - unset(TEST_INC) - unset(TEST_INC_SYS) - unset(TARGET_NAME) - endif() -endmacro() diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 0ed6d0d348c..56168258d79 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -456,161 +456,6 @@ function(blender_add_lib set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name}) endfunction() -function(blender_add_test_suite) - if(ARGC LESS 1) - message(FATAL_ERROR "No arguments supplied to blender_add_test_suite()") - endif() - - # Parse the arguments - set(oneValueArgs TARGET SUITE_NAME) - set(multiValueArgs SOURCES) - cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # Figure out the release dir, as some tests need files from there. - get_blender_test_install_dir(TEST_INSTALL_DIR) - if(APPLE) - set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION}) - else() - if(WIN32 OR WITH_INSTALL_PORTABLE) - set(_test_release_dir ${TEST_INSTALL_DIR}/${BLENDER_VERSION}) - else() - set(_test_release_dir ${TEST_INSTALL_DIR}/share/blender/${BLENDER_VERSION}) - endif() - endif() - - # Define a test case with our custom gtest_add_tests() command. - include(GTest) - gtest_add_tests( - TARGET ${ARGS_TARGET} - SOURCES "${ARGS_SOURCES}" - TEST_PREFIX ${ARGS_SUITE_NAME} - WORKING_DIRECTORY "${TEST_INSTALL_DIR}" - EXTRA_ARGS - --test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests" - --test-release-dir "${_test_release_dir}" - ) - if(WIN32) - set_tests_properties( - ${ARGS_SUITE_NAME} PROPERTIES - ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}" - ) - endif() - unset(_test_release_dir) -endfunction() - -# Add tests for a Blender library, to be called in tandem with blender_add_lib(). -# The tests will be part of the blender_test executable (see tests/gtests/runner). -function(blender_add_test_lib - name - sources - includes - includes_sys - library_deps - ) - - add_cc_flags_custom_test(${name} PARENT_SCOPE) - - # Otherwise external projects will produce warnings that we cannot fix. - remove_strict_flags() - - # This duplicates logic that's also in GTestTesting.cmake, macro BLENDER_SRC_GTEST_EX. - # TODO(Sybren): deduplicate after the general approach in D7649 has been approved. - list(APPEND includes - ${CMAKE_SOURCE_DIR}/tests/gtests - ) - list(APPEND includes_sys - ${GLOG_INCLUDE_DIRS} - ${GFLAGS_INCLUDE_DIRS} - ${CMAKE_SOURCE_DIR}/extern/gtest/include - ${CMAKE_SOURCE_DIR}/extern/gmock/include - ) - - blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}") - - target_compile_definitions(${name} PRIVATE ${GFLAGS_DEFINES}) - target_compile_definitions(${name} PRIVATE ${GLOG_DEFINES}) - - set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name}) - - blender_add_test_suite( - TARGET blender_test - SUITE_NAME ${name} - SOURCES "${sources}" - ) -endfunction() - - -# Add tests for a Blender library, to be called in tandem with blender_add_lib(). -# Test will be compiled into a ${name}_test executable. -# -# To be used for smaller isolated libraries, that do not have many dependencies. -# For libraries that do drag in many other Blender libraries and would create a -# very large executable, blender_add_test_lib() should be used instead. -function(blender_add_test_executable_impl - name - add_test_suite - sources - includes - includes_sys - library_deps - ) - - add_cc_flags_custom_test(${name} PARENT_SCOPE) - - ## Otherwise external projects will produce warnings that we cannot fix. - remove_strict_flags() - - blender_src_gtest_ex( - NAME ${name} - SRC "${sources}" - EXTRA_LIBS "${library_deps}" - SKIP_ADD_TEST - ) - if(add_test_suite) - blender_add_test_suite( - TARGET ${name}_test - SUITE_NAME ${name} - SOURCES "${sources}" - ) - endif() - blender_target_include_dirs(${name}_test ${includes}) - blender_target_include_dirs_sys(${name}_test ${includes_sys}) -endfunction() - -function(blender_add_test_executable - name - sources - includes - includes_sys - library_deps - ) - blender_add_test_executable_impl( - "${name}" - TRUE - "${sources}" - "${includes}" - "${includes_sys}" - "${library_deps}" - ) -endfunction() - -function(blender_add_performancetest_executable - name - sources - includes - includes_sys - library_deps - ) - blender_add_test_executable_impl( - "${name}" - FALSE - "${sources}" - "${includes}" - "${includes_sys}" - "${library_deps}" - ) -endfunction() - # Ninja only: assign 'heavy pool' to some targets that are especially RAM-consuming to build. function(setup_heavy_lib_pool) if(WITH_NINJA_POOL_JOBS AND NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS) diff --git a/build_files/cmake/testing.cmake b/build_files/cmake/testing.cmake new file mode 100644 index 00000000000..563465afda5 --- /dev/null +++ b/build_files/cmake/testing.cmake @@ -0,0 +1,268 @@ +# SPDX-FileCopyrightText: 2006-2023 Blender Authors +# +# SPDX-License-Identifier: GPL-2.0-or-later + +function(get_blender_test_install_dir VARIABLE_NAME) + get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(GENERATOR_IS_MULTI_CONFIG) + string(REPLACE "\${BUILD_TYPE}" "$" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) + else() + string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) + endif() + set(${VARIABLE_NAME} "${TEST_INSTALL_DIR}" PARENT_SCOPE) +endfunction() + +macro(blender_src_gtest_ex) + if(WITH_GTESTS) + set(options SKIP_ADD_TEST) + set(oneValueArgs NAME) + set(multiValueArgs SRC EXTRA_LIBS COMMAND_ARGS) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + set(TARGET_NAME ${ARG_NAME}_test) + get_property(_current_include_directories + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + PROPERTY INCLUDE_DIRECTORIES) + set(TEST_INC + ${_current_include_directories} + ${CMAKE_SOURCE_DIR}/tests/gtests + ) + set(TEST_INC_SYS + ${GLOG_INCLUDE_DIRS} + ${GFLAGS_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/extern/gtest/include + ${CMAKE_SOURCE_DIR}/extern/gmock/include + ) + unset(_current_include_directories) + if(WIN32) + set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest") + else() + set(MANIFEST "") + endif() + + add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST}) + setup_platform_linker_flags(${TARGET_NAME}) + target_compile_definitions(${TARGET_NAME} PRIVATE ${GFLAGS_DEFINES}) + target_compile_definitions(${TARGET_NAME} PRIVATE ${GLOG_DEFINES}) + target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}") + target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}") + blender_link_libraries(${TARGET_NAME} "${ARG_EXTRA_LIBS};${PLATFORM_LINKLIBS}") + if(WITH_TBB) + # Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so + # that it is initialized before MKL and static library initialization order + # issues are avoided. + target_link_libraries(${TARGET_NAME} PRIVATE ${TBB_LIBRARIES}) + if(WITH_OPENIMAGEDENOISE) + target_link_libraries(${TARGET_NAME} PRIVATE ${OPENIMAGEDENOISE_LIBRARIES}) + endif() + endif() + target_link_libraries(${TARGET_NAME} PRIVATE + bf_testing_main + bf_intern_eigen + bf_intern_guardedalloc + extern_gtest + extern_gmock + # Needed for GLOG. + ${GLOG_LIBRARIES} + ${GFLAGS_LIBRARIES}) + + if(DEFINED PTHREADS_LIBRARIES) # Needed for GLOG. + target_link_libraries(${TARGET_NAME} PRIVATE ${PTHREADS_LIBRARIES}) + endif() + if(WITH_OPENMP AND WITH_OPENMP_STATIC) + target_link_libraries(${TARGET_NAME} PRIVATE ${OpenMP_LIBRARIES}) + endif() + if(UNIX AND NOT APPLE) + target_link_libraries(${TARGET_NAME} PRIVATE bf_intern_libc_compat) + endif() + if(WITH_TBB) + target_link_libraries(${TARGET_NAME} PRIVATE ${TBB_LIBRARIES}) + endif() + if(WITH_GMP) + target_link_libraries(${TARGET_NAME} PRIVATE ${GMP_LIBRARIES}) + endif() + + get_blender_test_install_dir(TEST_INSTALL_DIR) + set_target_properties(${TARGET_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}") + if(NOT ARG_SKIP_ADD_TEST) + add_test( + NAME ${TARGET_NAME} + COMMAND ${TESTS_OUTPUT_DIR}/${TARGET_NAME} ${ARG_COMMAND_ARGS} + WORKING_DIRECTORY ${TEST_INSTALL_DIR}) + + # Don't fail tests on leaks since these often happen in external libraries + # that we can't fix. + set_tests_properties(${TARGET_NAME} PROPERTIES + ENVIRONMENT LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS} + ) + if(WIN32) + set_tests_properties(${TARGET_NAME} PROPERTIES ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}") + endif() + endif() + if(WIN32) + set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false") + endif() + unset(MANIFEST) + unset(TEST_INC) + unset(TEST_INC_SYS) + unset(TARGET_NAME) + endif() +endmacro() + +function(blender_add_test_suite) + if(ARGC LESS 1) + message(FATAL_ERROR "No arguments supplied to blender_add_test_suite()") + endif() + + # Parse the arguments + set(oneValueArgs TARGET SUITE_NAME) + set(multiValueArgs SOURCES) + cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + # Figure out the release dir, as some tests need files from there. + get_blender_test_install_dir(TEST_INSTALL_DIR) + if(APPLE) + set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION}) + else() + if(WIN32 OR WITH_INSTALL_PORTABLE) + set(_test_release_dir ${TEST_INSTALL_DIR}/${BLENDER_VERSION}) + else() + set(_test_release_dir ${TEST_INSTALL_DIR}/share/blender/${BLENDER_VERSION}) + endif() + endif() + + # Define a test case with our custom gtest_add_tests() command. + include(GTest) + gtest_add_tests( + TARGET ${ARGS_TARGET} + SOURCES "${ARGS_SOURCES}" + TEST_PREFIX ${ARGS_SUITE_NAME} + WORKING_DIRECTORY "${TEST_INSTALL_DIR}" + EXTRA_ARGS + --test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests" + --test-release-dir "${_test_release_dir}" + ) + if(WIN32) + set_tests_properties( + ${ARGS_SUITE_NAME} PROPERTIES + ENVIRONMENT "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}" + ) + endif() + unset(_test_release_dir) +endfunction() + +# Add tests for a Blender library, to be called in tandem with blender_add_lib(). +# The tests will be part of the blender_test executable (see tests/gtests/runner). +function(blender_add_test_lib + name + sources + includes + includes_sys + library_deps + ) + + add_cc_flags_custom_test(${name} PARENT_SCOPE) + + # Otherwise external projects will produce warnings that we cannot fix. + remove_strict_flags() + + # This duplicates logic that's also in blender_src_gtest_ex. + # TODO(Sybren): deduplicate after the general approach in D7649 has been approved. + list(APPEND includes + ${CMAKE_SOURCE_DIR}/tests/gtests + ) + list(APPEND includes_sys + ${GLOG_INCLUDE_DIRS} + ${GFLAGS_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/extern/gtest/include + ${CMAKE_SOURCE_DIR}/extern/gmock/include + ) + + blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}") + + target_compile_definitions(${name} PRIVATE ${GFLAGS_DEFINES}) + target_compile_definitions(${name} PRIVATE ${GLOG_DEFINES}) + + set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name}) + + blender_add_test_suite( + TARGET blender_test + SUITE_NAME ${name} + SOURCES "${sources}" + ) +endfunction() + + +# Add tests for a Blender library, to be called in tandem with blender_add_lib(). +# Test will be compiled into a ${name}_test executable. +# +# To be used for smaller isolated libraries, that do not have many dependencies. +# For libraries that do drag in many other Blender libraries and would create a +# very large executable, blender_add_test_lib() should be used instead. +function(blender_add_test_executable_impl + name + add_test_suite + sources + includes + includes_sys + library_deps + ) + + add_cc_flags_custom_test(${name} PARENT_SCOPE) + + ## Otherwise external projects will produce warnings that we cannot fix. + remove_strict_flags() + + blender_src_gtest_ex( + NAME ${name} + SRC "${sources}" + EXTRA_LIBS "${library_deps}" + SKIP_ADD_TEST + ) + if(add_test_suite) + blender_add_test_suite( + TARGET ${name}_test + SUITE_NAME ${name} + SOURCES "${sources}" + ) + endif() + blender_target_include_dirs(${name}_test ${includes}) + blender_target_include_dirs_sys(${name}_test ${includes_sys}) +endfunction() + +function(blender_add_test_executable + name + sources + includes + includes_sys + library_deps + ) + blender_add_test_executable_impl( + "${name}" + TRUE + "${sources}" + "${includes}" + "${includes_sys}" + "${library_deps}" + ) +endfunction() + +function(blender_add_performancetest_executable + name + sources + includes + includes_sys + library_deps + ) + blender_add_test_executable_impl( + "${name}" + FALSE + "${sources}" + "${includes}" + "${includes_sys}" + "${library_deps}" + ) +endfunction() diff --git a/intern/atomic/CMakeLists.txt b/intern/atomic/CMakeLists.txt index d69ade46bfd..b3013a4a650 100644 --- a/intern/atomic/CMakeLists.txt +++ b/intern/atomic/CMakeLists.txt @@ -41,6 +41,5 @@ if(WITH_GTESTS) set(TEST_LIB PRIVATE bf_intern_atomic ) - include(GTestTesting) blender_add_test_executable(atomic "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/intern/cycles/test/CMakeLists.txt b/intern/cycles/test/CMakeLists.txt index 1e74b160e40..184e4b6af55 100644 --- a/intern/cycles/test/CMakeLists.txt +++ b/intern/cycles/test/CMakeLists.txt @@ -3,8 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 if(WITH_GTESTS AND WITH_CYCLES_LOGGING) - Include(GTestTesting) - # Otherwise we get warnings here that we can't fix in external projects remove_strict_flags() endif() diff --git a/intern/ffmpeg/CMakeLists.txt b/intern/ffmpeg/CMakeLists.txt index b8bf5a2c940..3e41030da8d 100644 --- a/intern/ffmpeg/CMakeLists.txt +++ b/intern/ffmpeg/CMakeLists.txt @@ -22,6 +22,5 @@ if(WITH_GTESTS) if(WITH_IMAGE_OPENJPEG) set(TEST_LIB ${TEST_LIB} ${OPENJPEG_LIBRARIES}) endif() - include(GTestTesting) blender_add_test_lib(ffmpeg_codecs "${TEST_SRC}" "${TEST_INC}" "${TEST_INC_SYS}" "${TEST_LIB}") endif() diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt index 81abc5a1092..be4db5725a5 100644 --- a/intern/guardedalloc/CMakeLists.txt +++ b/intern/guardedalloc/CMakeLists.txt @@ -83,6 +83,5 @@ if(WITH_GTESTS) bf_intern_guardedalloc bf_blenlib ) - include(GTestTesting) blender_add_test_executable(guardedalloc "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt index 7cb06c4725b..965d0028020 100644 --- a/intern/libmv/CMakeLists.txt +++ b/intern/libmv/CMakeLists.txt @@ -198,8 +198,6 @@ if(WITH_LIBMV) if(WITH_GTESTS) - include(GTestTesting) - blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}" "") blender_add_test_executable("libmv_predict_tracks" "./libmv/autotrack/predict_tracks_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres") diff --git a/intern/libmv/bundle.sh b/intern/libmv/bundle.sh index 29e4dce60a8..b35b16b5058 100755 --- a/intern/libmv/bundle.sh +++ b/intern/libmv/bundle.sh @@ -190,8 +190,6 @@ ${third_headers} if(WITH_GTESTS) - include(GTestTesting) - blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "\${INC}" "\${INC_SYS}" "") ${tests} diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt index 00cd6de23d3..f3c07a0c4c8 100644 --- a/intern/opensubdiv/CMakeLists.txt +++ b/intern/opensubdiv/CMakeLists.txt @@ -105,8 +105,6 @@ blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # Tests. if(WITH_GTESTS AND WITH_OPENSUBDIV) - include(GTestTesting) - add_definitions(${GFLAGS_DEFINES}) add_definitions(${GLOG_DEFINES}) diff --git a/source/blender/animrig/CMakeLists.txt b/source/blender/animrig/CMakeLists.txt index dff06f030b8..1e24abf68c6 100644 --- a/source/blender/animrig/CMakeLists.txt +++ b/source/blender/animrig/CMakeLists.txt @@ -63,6 +63,5 @@ if(WITH_GTESTS) set(TEST_LIB PRIVATE bf::animrig ) - include(GTestTesting) blender_add_test_lib(bf_animrig_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/asset_system/CMakeLists.txt b/source/blender/asset_system/CMakeLists.txt index 9200d1da9c0..6085432e77c 100644 --- a/source/blender/asset_system/CMakeLists.txt +++ b/source/blender/asset_system/CMakeLists.txt @@ -64,6 +64,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_asset_system ) - include(GTestTesting) blender_add_test_lib(bf_asset_system_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index eb07fcdce40..f5c1e476ae8 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -863,7 +863,6 @@ if(WITH_GTESTS) set(TEST_INC ../editors/include ) - include(GTestTesting) blender_add_test_lib(bf_blenkernel_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.h diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 3de5abb69e9..361dbfac763 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -571,7 +571,6 @@ if(WITH_GTESTS) set(TEST_LIB bf_blenlib ) - include(GTestTesting) blender_add_test_executable(blenlib "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") add_subdirectory(tests/performance) diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 383bd6ef3eb..b994dab2d5d 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -111,6 +111,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_blenloader ) - include(GTestTesting) blender_add_test_lib(bf_blenloader_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index 0e62b06ff00..be6001b743d 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -232,6 +232,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_bmesh ) - include(GTestTesting) blender_add_test_lib(bf_bmesh_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 0a726e650a1..46e8d1116be 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -674,7 +674,6 @@ if(WITH_COMPOSITOR_CPU) set(TEST_LIB bf_compositor ) - include(GTestTesting) blender_add_test_lib(bf_compositor_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index ae5d5d55d8b..e84f5aa0049 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -178,6 +178,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_depsgraph ) - include(GTestTesting) blender_add_test_lib(bf_depsgraph_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB}") endif() diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 0f4dd5fe19e..091d8e865dd 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -995,7 +995,6 @@ if(WITH_GTESTS) ) set(TEST_LIB ) - include(GTestTesting) blender_add_test_lib(bf_draw_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() endif() diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index f5ed75c72cd..b4aa4a7537a 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -71,6 +71,5 @@ if(WITH_GTESTS) ) set(TEST_LIB ) - include(GTestTesting) blender_add_test_lib(bf_editor_animation_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt index 7d184b3f9b6..b297d754275 100644 --- a/source/blender/functions/CMakeLists.txt +++ b/source/blender/functions/CMakeLists.txt @@ -79,6 +79,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_functions ) - include(GTestTesting) blender_add_test_lib(bf_functions_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index b295562a477..9f8e68d79d3 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -923,7 +923,6 @@ if(WITH_GTESTS) tests/gpu_testing.hh ) - include(GTestTesting) blender_add_test_lib(bf_gpu_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() endif() diff --git a/source/blender/io/alembic/CMakeLists.txt b/source/blender/io/alembic/CMakeLists.txt index 3f7822dcb77..d2018e2ccfe 100644 --- a/source/blender/io/alembic/CMakeLists.txt +++ b/source/blender/io/alembic/CMakeLists.txt @@ -114,6 +114,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_io_alembic ) - include(GTestTesting) blender_add_test_lib(bf_io_alembic_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/io/common/CMakeLists.txt b/source/blender/io/common/CMakeLists.txt index 10269e17d2e..77695dbe27e 100644 --- a/source/blender/io/common/CMakeLists.txt +++ b/source/blender/io/common/CMakeLists.txt @@ -55,6 +55,5 @@ if(WITH_GTESTS) bf_blenloader_tests bf_io_common ) - include(GTestTesting) blender_add_test_lib(bf_io_common_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/io/ply/CMakeLists.txt b/source/blender/io/ply/CMakeLists.txt index 04232accb2d..eb1f88d80b2 100644 --- a/source/blender/io/ply/CMakeLists.txt +++ b/source/blender/io/ply/CMakeLists.txt @@ -74,6 +74,5 @@ if(WITH_GTESTS) set(TEST_LIB bf_io_ply ) - include(GTestTesting) blender_add_test_lib(bf_io_ply_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/io/stl/CMakeLists.txt b/source/blender/io/stl/CMakeLists.txt index a3289f7a618..13a1fc02270 100644 --- a/source/blender/io/stl/CMakeLists.txt +++ b/source/blender/io/stl/CMakeLists.txt @@ -71,7 +71,6 @@ if(WITH_GTESTS) bf_io_stl ) - include(GTestTesting) blender_add_test_lib(bf_io_stl_tests "${TEST_SRC}" "${TEST_INC}" "${INC_SYS}" "${TEST_LIB}") add_dependencies(bf_io_stl_tests bf_io_stl) endif() diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt index a77f7a02f99..5a60906bce5 100644 --- a/source/blender/io/usd/CMakeLists.txt +++ b/source/blender/io/usd/CMakeLists.txt @@ -253,7 +253,6 @@ if(WITH_GTESTS) ) set(TEST_LIB ) - include(GTestTesting) blender_add_test_lib(bf_io_usd_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() diff --git a/source/blender/io/wavefront_obj/CMakeLists.txt b/source/blender/io/wavefront_obj/CMakeLists.txt index 70e421be6fb..0076e293583 100644 --- a/source/blender/io/wavefront_obj/CMakeLists.txt +++ b/source/blender/io/wavefront_obj/CMakeLists.txt @@ -95,7 +95,6 @@ if(WITH_GTESTS) bf_io_wavefront_obj ) - include(GTestTesting) blender_add_test_lib(bf_io_wavefront_obj_tests "${TEST_SRC}" "${TEST_INC}" "${INC_SYS}" "${TEST_LIB}") add_dependencies(bf_io_wavefront_obj_tests bf_io_wavefront_obj) endif() diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 80eae0a0ae8..f9b8b90e482 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -217,6 +217,5 @@ if(WITH_GTESTS) set(TEST_SRC intern/wm_dragdrop_test.cc ) - include(GTestTesting) blender_add_test_lib(bf_wm_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB}") endif()