mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
CMake: Copy thirdparty/**/*.dll to bin/ directory
This commit is contained in:
parent
ae59bd031f
commit
f377bdfb29
@ -3,6 +3,8 @@ set(THIRDPARTY_DIRECTORY "" CACHE PATH
|
||||
located here will be prioritized over system libraries. Useful for
|
||||
cross-compiling.")
|
||||
|
||||
set(THIRDPARTY_DLLS)
|
||||
|
||||
if(THIRDPARTY_DIRECTORY)
|
||||
# This policy is necessary for PackageName_ROOT variables to be respected
|
||||
if(POLICY CMP0074)
|
||||
@ -78,6 +80,7 @@ if(THIRDPARTY_DIRECTORY)
|
||||
)
|
||||
|
||||
string(TOLOWER "${_Package}" _package)
|
||||
string(TOUPPER "${_Package}" _PACKAGE)
|
||||
|
||||
# Some packages in the thirdparty dir have different subdirectory names from
|
||||
# the name of the CMake package
|
||||
@ -100,10 +103,44 @@ if(THIRDPARTY_DIRECTORY)
|
||||
# Set search path
|
||||
set(${_Package}_ROOT "${_package_dir}/${_package}")
|
||||
|
||||
# Set up copying DLLs, if necessary
|
||||
file(GLOB _dlls "${${_Package}_ROOT}/bin/*.dll")
|
||||
if(_dlls)
|
||||
set(_havevar "HAVE_${_PACKAGE}")
|
||||
set(THIRDPARTY_DLLS_${_havevar} "${_dlls}")
|
||||
list(APPEND THIRDPARTY_DLLS "${_havevar}")
|
||||
|
||||
endif()
|
||||
|
||||
endforeach(_Package)
|
||||
|
||||
endif()
|
||||
|
||||
# This is used to copy the DLLs alongside the output of `package`
|
||||
function(thirdparty_copy_alongside package)
|
||||
set(_dlls)
|
||||
|
||||
foreach(_havevar ${THIRDPARTY_DLLS})
|
||||
if(${_havevar})
|
||||
list(APPEND _dlls ${THIRDPARTY_DLLS_${_havevar}})
|
||||
endif()
|
||||
endforeach(_havevar)
|
||||
|
||||
if(NOT _dlls)
|
||||
# Don't try to copy/install nothingness
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET ${package} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${_dlls} $<TARGET_FILE_DIR:${package}>
|
||||
)
|
||||
|
||||
# Also install the DLLs
|
||||
install(FILES ${_dlls} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
endfunction(thirdparty_copy_alongside)
|
||||
|
||||
#
|
||||
# ------------ Python ------------
|
||||
#
|
||||
|
@ -8,3 +8,6 @@ install(TARGETS p3dtool
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d
|
||||
ARCHIVE COMPONENT CoreDevel)
|
||||
|
||||
# Also handle thirdparty DLLs
|
||||
thirdparty_copy_alongside(p3dtool)
|
||||
|
Loading…
x
Reference in New Issue
Block a user