44 lines
1.2 KiB
CMake
44 lines
1.2 KiB
CMake
# CMake script to copy VTK DLLs based on build configuration
|
|
# Usage: cmake -DCONFIG=<Debug|Release> -DVTK_BIN_DIR=<path> -DOUTPUT_DIR=<path> -P copy_vtk_dlls.cmake
|
|
|
|
if(NOT DEFINED CONFIG)
|
|
message(FATAL_ERROR "CONFIG not defined")
|
|
endif()
|
|
|
|
if(NOT DEFINED VTK_BIN_DIR)
|
|
message(FATAL_ERROR "VTK_BIN_DIR not defined")
|
|
endif()
|
|
|
|
if(NOT DEFINED OUTPUT_DIR)
|
|
message(FATAL_ERROR "OUTPUT_DIR not defined")
|
|
endif()
|
|
|
|
# Determine DLL suffix based on configuration
|
|
if(CONFIG STREQUAL "Debug")
|
|
set(DLL_PATTERN "*-8.2d.dll")
|
|
message(STATUS "Copying VTK Debug DLLs...")
|
|
else()
|
|
set(DLL_PATTERN "*-8.2.dll")
|
|
message(STATUS "Copying VTK Release DLLs...")
|
|
endif()
|
|
|
|
# Find and copy DLLs
|
|
file(GLOB VTK_DLLS "${VTK_BIN_DIR}/${DLL_PATTERN}")
|
|
|
|
foreach(dll ${VTK_DLLS})
|
|
get_filename_component(dll_name ${dll} NAME)
|
|
|
|
# Skip debug DLLs when in Release mode
|
|
if(NOT CONFIG STREQUAL "Debug")
|
|
string(REGEX MATCH ".*d\\.dll$" is_debug ${dll_name})
|
|
if(is_debug)
|
|
continue()
|
|
endif()
|
|
endif()
|
|
|
|
message(STATUS "Copying ${dll_name}")
|
|
file(COPY "${dll}" DESTINATION "${OUTPUT_DIR}")
|
|
endforeach()
|
|
|
|
message(STATUS "VTK DLLs copied successfully")
|