Build: make running executables as part of build/tests work with shared libs

Ensure the environment is set up for blender_test, idiff and oslc so that they
can find the required shared libraries.

Also deduplicate add_bundled_libraries() between Linux and macOS.

Includes contributions by Ray Molenkamp and Brecht Van Lommel.

Ref T99618
This commit is contained in:
2022-12-05 23:05:25 +01:00
parent 2dc51fccb8
commit ebff39d5bb
7 changed files with 56 additions and 25 deletions

View File

@@ -31,6 +31,9 @@ function(add_blender_test testname)
set_tests_properties(${testname} PROPERTIES ENVIRONMENT
LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS}
)
if(PLATFORM_ENV_INSTALL)
set_tests_properties(${testname} PROPERTIES ENVIRONMENT "${PLATFORM_ENV_INSTALL}")
endif()
endfunction()
# Run Python script outside Blender.
@@ -42,10 +45,14 @@ function(add_python_test testname testscript)
add_test(
NAME ${testname}
COMMAND ${TEST_PYTHON_EXE} ${TEST_PYTHON_EXE_EXTRA_ARGS} ${testscript} ${ARGN}
WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>
)
set_tests_properties(${testname} PROPERTIES ENVIRONMENT
LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS}
)
if(PLATFORM_ENV_INSTALL)
set_tests_properties(${testname} PROPERTIES ENVIRONMENT "${PLATFORM_ENV_INSTALL}")
endif()
endfunction()
# ------------------------------------------------------------------------------