1# Attempt to build up the path/ld_library_path/python path needed to run VTK. 2# On Windows simply executing the .bat file should be enough, on Linux/Mac the 3# file can be sourced in the shell. You can also copy and paste the relevant 4# parts into other files if preferred. 5# 6# Note: on Windows Debug and Release are added, if another build type is 7# used, it would need to be added to the PATH too. 8 9set(VTK_PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") 10 11if(WIN32) 12 list(APPEND VTK_PYTHONPATH 13 "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Debug" 14 "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Release") 15endif() 16 17set(VTK_LIBRARY_PATH 18 "${VTK_PYTHONPATH}") 19 20if(WIN32) 21 file(WRITE "${VTK_BINARY_DIR}/windows_path.bat" 22 "set PATH=${VTK_LIBRARY_PATH};%PATH% 23 set PYTHONPATH=${VTK_PYTHONPATH};%PYTHONPATH%") 24elseif(UNIX) 25 # Replace the semicolons with colons for Unix operating systems 26 string(REPLACE ";" ":" VTK_LIBRARY_PATH "${VTK_LIBRARY_PATH}") 27 string(REPLACE ";" ":" VTK_PYTHONPATH "${VTK_PYTHONPATH}") 28 if(APPLE) 29 set(DYLD "DYLD") 30 else() 31 set(DYLD "LD") 32 endif() 33 file(WRITE "${VTK_BINARY_DIR}/unix_path.sh" 34 "export ${DYLD}_LIBRARY_PATH=${VTK_LIBRARY_PATH}:\${${DYLD}_LIBRARY_PATH} 35 export PYTHONPATH=${VTK_PYTHONPATH}:\${PYTHONPATH}\n") 36endif() 37