on Windows, also emit a path containing runtime library dirs

Summary:
Update the CMake build to emit a LIBRARY_DEP_DIRS.txt file in the build output
directory.  This file should contain additional directories that may contain
runtime library dependencies for the generated build artifacts, one directory
per line.  This file will be parsed by getdeps.py so that it can set `$PATH`
properly when running tests in order to find all of the necessary library
dependencies.

At the moment the runtime location of the Python DLL is the main thing that
needs to be stored in this directory.  CMake can find the Python location from the
registry, even if that location is not in the user's `$PATH`.  On its own
getdeps.py won't be able to find the location of the Python DLL unless we
explicitly give it this information through this file.

Reviewed By: wez

Differential Revision: D20688289

fbshipit-source-id: 078d07d860de8604c97bf6adede464c0d95fc079
This commit is contained in:
Adam Simpkins 2020-03-31 11:33:28 -07:00 committed by Facebook GitHub Bot
parent 0d4db87a26
commit 353e248dd4

View File

@ -93,6 +93,14 @@ if(WIN32)
get_target_property(python_dll Python3::Python LOCATION)
install(FILES "${python_dll}" DESTINATION bin)
endif()
# Also a emit a file listing additional directories containing runtime
# library dependencies. On Windows this is needed to help figure out runtime
# dependencies needed to run the generated build artifacts. This file can be
# processed by getdeps.py
get_filename_component(python_dll_dir "${python_dll}" DIRECTORY)
file(TO_NATIVE_PATH "${python_dll_dir}" python_dll_dir)
file(WRITE "${CMAKE_BINARY_DIR}/LIBRARY_DEP_DIRS.txt" "${python_dll_dir}\n")
endif()
configure_file(