Changeset View
Changeset View
Standalone View
Standalone View
tests/gtests/CMakeLists.txt
| # GTest | |||||
| if(WITH_GTESTS) | if(WITH_GTESTS) | ||||
| # Otherwise we get warnings here that we cant fix in external projects | |||||
| remove_strict_flags() | |||||
| include(GTestTesting) | # Build the test runner. This runner takes care of running all GTests, i.e. | ||||
| # the code that was built using the blender_add_test_lib() CMake macro (see | |||||
| # macros.cmake). | |||||
| set(SRC | |||||
| blender_test.cc | |||||
| ) | |||||
| if(WITH_BUILDINFO) | |||||
| list(APPEND SRC | |||||
| "$<TARGET_OBJECTS:buildinfoobj>" | |||||
| ) | |||||
| endif() | |||||
sergey: `# This runner takes care of ...` | |||||
| add_definitions(${GFLAGS_DEFINES}) | |||||
| add_definitions(${GLOG_DEFINES}) | |||||
| add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE}) | |||||
| # Otherwise we get warnings here that we cant fix in external projects | # Test libraries need to be linked "whole archive", because they're not | ||||
| remove_strict_flags() | # directly referenced from other code. | ||||
| get_property(_test_libs GLOBAL PROPERTY BLENDER_TEST_LIBS) | |||||
| if(WIN32) | |||||
| list(APPEND TEST_LIBS ${_test_libs}) | |||||
| elseif(CMAKE_COMPILER_IS_GNUCXX) | |||||
| list(APPEND TEST_LIBS "-Wl,--whole-archive" ${_test_libs} "-Wl,--no-whole-archive") | |||||
| elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | |||||
| list(APPEND TEST_LIBS "-Wl,-force_load" ${_test_libs}) | |||||
| else() | |||||
| message(FATAL_ERROR "Unknown how to link whole-archive with your compiler ${CMAKE_CXX_COMPILER_ID}") | |||||
| endif() | |||||
brechtUnsubmitted Done Inline ActionsThe logic here should be changed like we did in: rB59b523c3c98e: Fix build with USD, Clang and Linux. brecht: The logic here should be changed like we did in: {rB59b523c}. | |||||
| unset(_test_libs) | |||||
| # This builds `bin/tests/blender_test`, but does not add it as a single test. | |||||
Done Inline ActionsMaybe a good name for this executable is just blender_test rather than bf_gtest_runner_test? I guess running it will work like any other test executable, the difference would be that for ctest it's called with specific arguments to run a subset of the tests. brecht: Maybe a good name for this executable is just `blender_test` rather than… | |||||
| setup_libdirs() | |||||
| BLENDER_SRC_GTEST_EX( | |||||
| NAME blender | |||||
| SRC "${SRC}" | |||||
| EXTRA_LIBS "${TEST_LIBS}" | |||||
| SKIP_ADD_TEST | |||||
| ) | |||||
| setup_liblinks(blender_test) | |||||
| # This runs the blender_test executable with `--gtest_list_tests`, then | |||||
| # exposes those tests individually to the ctest runner. | |||||
| # See https://cmake.org/cmake/help/v3.18/module/GoogleTest.html | |||||
| include(GoogleTest) | |||||
| gtest_discover_tests(blender_test) | |||||
| # Build the not-yet-ported tests | |||||
brechtUnsubmitted Done Inline ActionsDoing all this setup for blender_test and then going into all the subdirectories is causing problems here with duplicate build flags, that then give build errors. We can split building the test runner into another folder, at least as long as we need subdirectories here for non-ported tests. brecht: Doing all this setup for `blender_test` and then going into all the subdirectories is causing… | |||||
| include(GTestTesting) | |||||
| add_subdirectory(testing) | add_subdirectory(testing) | ||||
| add_subdirectory(blenkernel) | |||||
| add_subdirectory(blenlib) | add_subdirectory(blenlib) | ||||
| add_subdirectory(blenloader) | add_subdirectory(blenloader) | ||||
| add_subdirectory(guardedalloc) | add_subdirectory(guardedalloc) | ||||
| add_subdirectory(bmesh) | add_subdirectory(bmesh) | ||||
| if(WITH_CODEC_FFMPEG) | if(WITH_CODEC_FFMPEG) | ||||
| add_subdirectory(ffmpeg) | add_subdirectory(ffmpeg) | ||||
| endif() | endif() | ||||
| if(WITH_ALEMBIC) | if(WITH_ALEMBIC) | ||||
| add_subdirectory(alembic) | add_subdirectory(alembic) | ||||
| endif() | endif() | ||||
| if(WITH_USD) | if(WITH_USD) | ||||
| add_subdirectory(usd) | add_subdirectory(usd) | ||||
| endif() | endif() | ||||
| endif() | endif() | ||||
# This runner takes care of ...