diff options
Diffstat (limited to 'source/creator/CMakeLists.txt')
-rw-r--r-- | source/creator/CMakeLists.txt | 341 |
1 files changed, 274 insertions, 67 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index bb9e73c0895..b836046d29d 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -11,6 +11,7 @@ set(INC ../blender/editors/include ../blender/gpu ../blender/imbuf + ../blender/io/usd ../blender/makesdna ../blender/makesrna ../blender/render @@ -371,7 +372,6 @@ elseif(APPLE) set(TARGETDIR_LIB Blender.app/Contents/Resources/lib) set(TARGETDIR_TEXT Blender.app/Contents/Resources/text) endif() - # Skip re-linking on CPACK / install. set_target_properties(blender PROPERTIES BUILD_WITH_INSTALL_RPATH true) endif() @@ -416,7 +416,12 @@ if(WITH_PYTHON) PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE ) - + if(WIN32) + install( + FILES ${CMAKE_SOURCE_DIR}/release/windows/python/usercustomize.py + DESTINATION ${TARGETDIR_VER}/python/lib/site-packages + ) + endif() unset(ADDON_EXCLUDE_CONDITIONAL) unset(FREESTYLE_EXCLUDE_CONDITIONAL) endif() @@ -488,6 +493,33 @@ if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*") ) endif() +# macro to help install files without dragging in unnecessary data. +macro(install_dir from to) + install( + DIRECTORY ${from} + DESTINATION ${to} + # Irrelevant files and caches. + PATTERN ".git" EXCLUDE + PATTERN ".svn" EXCLUDE + PATTERN "*.pyc" EXCLUDE + PATTERN "*.pyo" EXCLUDE + PATTERN "*.orig" EXCLUDE + PATTERN "*.rej" EXCLUDE + PATTERN "__pycache__" EXCLUDE + PATTERN "__MACOSX" EXCLUDE + PATTERN ".DS_Store" EXCLUDE + # Unneeded Python files. + PATTERN "config-${PYTHON_VERSION}/*.a" EXCLUDE # static lib + PATTERN "lib2to3" EXCLUDE # ./lib2to3 + PATTERN "tkinter" EXCLUDE # ./tkinter + PATTERN "lib-dynload/_tkinter.*" EXCLUDE # ./lib-dynload/_tkinter.co + PATTERN "idlelib" EXCLUDE # ./idlelib + PATTERN "test" EXCLUDE # ./test + PATTERN "turtledemo" EXCLUDE # ./turtledemo + PATTERN "turtle.py" EXCLUDE # ./turtle.py + PATTERN "wininst*.exe" EXCLUDE # from distutils, avoid malware false positive + ) +endmacro() # ----------------------------------------------------------------------------- # Install Targets (Platform Specific) @@ -527,6 +559,7 @@ if(UNIX AND NOT APPLE) LIBRARY DESTINATION ${TARGETDIR_BPY} ) endif() + # none of the other files are needed currently elseif(WITH_INSTALL_PORTABLE) install( @@ -615,9 +648,21 @@ if(UNIX AND NOT APPLE) endif() endif() - if(WITH_PYTHON) - if(WITH_PYTHON_INSTALL) + if(WITH_PYTHON AND WITH_PYTHON_INSTALL) + # Install executable + install( + PROGRAMS ${PYTHON_EXECUTABLE} + DESTINATION ${TARGETDIR_VER}/python/bin + ) + if(EXISTS ${LIBDIR}) + # Precompiled libraries, copy over complete lib directory. + install_dir( + ${PYTHON_LIBPATH} + ${TARGETDIR_VER}/python + ) + else() + # System libraries. install( PROGRAMS ${PYTHON_EXECUTABLE} DESTINATION ${TARGETDIR_VER}/python/bin @@ -698,6 +743,24 @@ if(UNIX AND NOT APPLE) unset(_suffix) endif() + if(WITH_USD) + # Install to the same directory as the source, so debian-like + # distros are happy with their policy. + set(_suffix "site-packages") + if(${PYTHON_USD_PATH} MATCHES "dist-packages") + set(_suffix "dist-packages") + endif() + install( + DIRECTORY ${USD_LIBRARY_DIR}/python/ + DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix} + PATTERN ".svn" EXCLUDE + PATTERN "__pycache__" EXCLUDE # * any cache * + PATTERN "*.pyc" EXCLUDE # * any cache * + PATTERN "*.pyo" EXCLUDE # * any cache * + ) + unset(_suffix) + endif() + if(WITH_PYTHON_INSTALL_ZSTANDARD) # Install to the same directory as the source, so debian-like # distributions are happy with their policy. @@ -758,7 +821,6 @@ if(UNIX AND NOT APPLE) unset(_suffix) endif() unset(_target_LIB) - endif() endif() @@ -769,22 +831,22 @@ if(UNIX AND NOT APPLE) ) endif() elseif(WIN32) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/epoxy/bin/epoxy-0.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) if(WITH_OPENMP AND MSVC_CLANG) - install( + windows_install_shared_manifest( FILES ${CLANG_OPENMP_DLL} - DESTINATION ${TARGETDIR_LIB} + ALL ) endif() if(WITH_FFTW3) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/fftw3/lib/libfftw3-3.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) endif() if(MSVC_ASAN) @@ -799,34 +861,69 @@ elseif(WIN32) "this is an optional component during the MSVC install, please install it" ) endif() - install( + windows_install_shared_manifest( FILES ${ASAN_DLL} - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + RELEASE ) - install( + windows_install_shared_manifest( FILES ${ASAN_DEBUG_DLL} - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Debug + DEBUG ) unset(ASAN_DLL) unset(ASAN_DEBUG_DLL) endif() - + if(WITH_IMAGE_OPENEXR OR WITH_OPENIMAGEIO) + if(EXISTS ${LIBDIR}/openexr/bin/Iex.dll) + windows_install_shared_manifest( + FILES + ${LIBDIR}/openexr/bin/Iex.dll + ${LIBDIR}/openexr/bin/IlmThread.dll + ${LIBDIR}/openexr/bin/OpenEXRCore.dll + ${LIBDIR}/openexr/bin/OpenEXRUtil.dll + ${LIBDIR}/openexr/bin/OpenEXR.dll + ${LIBDIR}/imath/bin/imath.dll + RELEASE + ) + windows_install_shared_manifest( + FILES + ${LIBDIR}/openexr/bin/Iex_d.dll + ${LIBDIR}/openexr/bin/IlmThread_d.dll + ${LIBDIR}/openexr/bin/OpenEXRCore_d.dll + ${LIBDIR}/openexr/bin/OpenEXRUtil_d.dll + ${LIBDIR}/openexr/bin/OpenEXR_d.dll + ${LIBDIR}/imath/bin/imath_d.dll + DEBUG + ) + endif() + endif() + if(WITH_OPENIMAGEIO) + if(EXISTS ${LIBDIR}/openimageio/bin/openimageio.dll) + windows_install_shared_manifest( + FILES + ${LIBDIR}/openimageio/bin/openimageio.dll + ${LIBDIR}/openimageio/bin/openimageio_util.dll + RELEASE + ) + windows_install_shared_manifest( + FILES + ${LIBDIR}/openimageio/bin/openimageio_d.dll + ${LIBDIR}/openimageio/bin/openimageio_util_d.dll + DEBUG + ) + endif() + endif() if(WITH_GMP) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/gmp/lib/libgmp-10.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/gmp/lib/libgmpxx.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + RELEASE ) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/gmp/lib/libgmpxx_d.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Debug + DEBUG ) endif() @@ -846,16 +943,30 @@ elseif(WIN32) endif() if(WITH_OPENVDB) - install( - FILES ${LIBDIR}/openvdb/bin/openvdb.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel - ) - install( - FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Debug - ) + windows_install_shared_manifest( + FILES ${LIBDIR}/openvdb/bin/openvdb.dll + RELEASE + ) + windows_install_shared_manifest( + FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll + DEBUG + ) + + # This will not exist for 3.4 and earlier lib folders + # to ease the transition, support both 3.4 and 3.5 lib + # folders. + if(EXISTS ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd) + install( + FILES ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd + DESTINATION ${TARGETDIR_VER}/python/lib/site-packages + CONFIGURATIONS Debug + ) + install( + FILES ${LIBDIR}/openvdb/python/pyopenvdb.pyd + DESTINATION ${TARGETDIR_VER}/python/lib/site-packages + CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + ) + endif() endif() if(WITH_PYTHON) @@ -906,7 +1017,7 @@ elseif(WIN32) PATTERN ".svn" EXCLUDE PATTERN "__pycache__" EXCLUDE # * any cache * PATTERN "*.pyc" EXCLUDE # * any cache * - PATTERN "*.pyo" EXCLUDE # * any cache *) + PATTERN "*.pyo" EXCLUDE # * any cache * ) install( @@ -938,31 +1049,58 @@ elseif(WIN32) CONFIGURATIONS Debug ) + if(WITH_USD) + # This will not exist for 3.4 and earlier lib folders + # to ease the transition, support both 3.4 and 3.5 lib + # folders. + if(EXISTS ${USD_LIBRARY_DIR}/python/) + install( + DIRECTORY ${USD_LIBRARY_DIR}/python/ + DESTINATION ${TARGETDIR_VER}/python/lib/site-packages + CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + PATTERN ".svn" EXCLUDE + PATTERN "__pycache__" EXCLUDE # * any cache * + PATTERN "*.pyc" EXCLUDE # * any cache * + PATTERN "*.pyo" EXCLUDE # * any cache * + ) + endif() + if(EXISTS ${USD_LIBRARY_DIR}/debug/python/) + install( + DIRECTORY ${USD_LIBRARY_DIR}/debug/python/ + DESTINATION ${TARGETDIR_VER}/python/lib/site-packages + CONFIGURATIONS Debug + PATTERN ".svn" EXCLUDE + PATTERN "__pycache__" EXCLUDE # * any cache * + PATTERN "*.pyc" EXCLUDE # * any cache * + PATTERN "*.pyo" EXCLUDE # * any cache * + ) + endif() + endif() + if(WINDOWS_PYTHON_DEBUG) install( FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}.pdb - DESTINATION ${TARGETDIR_LIB} + DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel ) install( FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}_d.pdb - DESTINATION ${TARGETDIR_LIB} + DESTINATION "." CONFIGURATIONS Debug ) endif() endif() - unset(_PYTHON_VERSION_NO_DOTS) endif() if(WITH_CODEC_FFMPEG) # Filenames change slightly between FFMPEG versions check both 5.0 and fallback to 4.4 # to ease the transition between versions. if(EXISTS "${LIBDIR}/ffmpeg/lib/avcodec-59.dll") - install( + windows_install_shared_manifest( FILES ${LIBDIR}/ffmpeg/lib/avcodec-59.dll ${LIBDIR}/ffmpeg/lib/avformat-59.dll @@ -970,10 +1108,10 @@ elseif(WIN32) ${LIBDIR}/ffmpeg/lib/avutil-57.dll ${LIBDIR}/ffmpeg/lib/swscale-6.dll ${LIBDIR}/ffmpeg/lib/swresample-4.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) else() - install( + windows_install_shared_manifest( FILES ${LIBDIR}/ffmpeg/lib/avcodec-58.dll ${LIBDIR}/ffmpeg/lib/avformat-58.dll @@ -981,61 +1119,57 @@ elseif(WIN32) ${LIBDIR}/ffmpeg/lib/avutil-56.dll ${LIBDIR}/ffmpeg/lib/swscale-5.dll ${LIBDIR}/ffmpeg/lib/swresample-3.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) endif() endif() if(WITH_TBB) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/tbb/bin/tbb.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + RELEASE ) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/tbb/bin/tbb_debug.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Debug + DEBUG ) endif() if(WITH_TBB_MALLOC_PROXY) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/tbb/bin/tbbmalloc.dll ${LIBDIR}/tbb/bin/tbbmalloc_proxy.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + RELEASE ) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll ${LIBDIR}/tbb/bin/tbbmalloc_proxy_debug.dll - DESTINATION ${TARGETDIR_LIB} - CONFIGURATIONS Debug + DEBUG ) list(APPEND LIB ${TBB_MALLOC_LIBRARIES}) endif() if(WITH_CODEC_SNDFILE) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) endif() if(WITH_OPENAL) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/openal/lib/OpenAL32.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) endif() if(WITH_SDL) - install( + windows_install_shared_manifest( FILES ${LIBDIR}/sdl/lib/SDL2.dll - DESTINATION ${TARGETDIR_LIB} + ALL ) endif() @@ -1045,7 +1179,7 @@ elseif(WIN32) ${LIBDIR}/audaspace/lib/audaspace.dll ${LIBDIR}/audaspace/lib/audaspace-c.dll ${LIBDIR}/audaspace/lib/audaspace-py.dll - DESTINATION ${TARGETDIR_LIB} + DESTINATION "." ) endif() @@ -1308,12 +1442,79 @@ blender_target_include_dirs(blender ${INC}) # These files are required at runtime. if(WITH_USD) add_definitions(-DWITH_USD) - install( - DIRECTORY ${USD_LIBRARY_DIR}/usd - DESTINATION "${TARGETDIR_VER}/datafiles" - ) + absolute_include_dirs(../blender/io/usd) + + # On windows the usd library sits in ./blender.shared copy the files + # relative to the location of the USD dll, if the dll does not exist + # assume we are linking against the static 3.5 lib. + if(WIN32 AND + ( + EXISTS ${LIBDIR}/usd/lib/usd_usd_ms.dll OR # USD 22.03 + EXISTS ${LIBDIR}/usd/lib/usd_ms.dll # USD 22.11 + ) + ) + install(DIRECTORY + ${USD_LIBRARY_DIR}/usd + DESTINATION "./blender.shared" + ) + elseif(USD_PYTHON_SUPPORT) + install(DIRECTORY + ${USD_LIBRARY_DIR}/usd + DESTINATION ${TARGETDIR_LIB} + ) + else() + install(DIRECTORY + ${USD_LIBRARY_DIR}/usd + DESTINATION "${TARGETDIR_VER}/datafiles" + ) + endif() + if(WIN32) + # If this file exists we are building against a 3.5 22.03 library folder + # that needs these dll's installed. + if(EXISTS ${LIBDIR}/usd/lib/usd_usd_ms.dll) + windows_install_shared_manifest(FILES + ${LIBDIR}/usd/lib/usd_usd_ms.dll + RELEASE + ) + windows_install_shared_manifest(FILES + ${LIBDIR}/usd/lib/usd_usd_ms_d.dll + DEBUG + ) + endif() + # If this file exists we are building against a 3.5 22.11 library folder + # that needs these dll's installed. + if(EXISTS ${LIBDIR}/usd/lib/usd_ms.dll) + windows_install_shared_manifest(FILES + ${LIBDIR}/usd/lib/usd_ms.dll + RELEASE + ) + windows_install_shared_manifest(FILES + ${LIBDIR}/usd/lib/usd_ms_d.dll + DEBUG + ) + endif() + endif() endif() +if(WIN32 AND WITH_BOOST) + set(BOOST_COMPONENTS atomic chrono date_time filesystem + iostreams locale program_options regex + serialization system thread wave wserialization + python${_PYTHON_VERSION_NO_DOTS} numpy${_PYTHON_VERSION_NO_DOTS} + ) + foreach(component ${BOOST_COMPONENTS}) + if(EXISTS ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_${component}-${BOOST_POSTFIX}.dll) + windows_install_shared_manifest( + FILES ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_${component}-${BOOST_POSTFIX}.dll + RELEASE + ) + windows_install_shared_manifest( + FILES ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_${component}-${BOOST_DEBUG_POSTFIX}.dll + DEBUG + ) + endif() + endforeach() +endif() # `vcpkg` substitutes our libraries with theirs, which will cause issues when you you run # these builds on other systems due to missing DLL's. So we opt out the use of `vcpkg`. @@ -1359,6 +1560,12 @@ if(WIN32 AND NOT WITH_PYTHON_MODULE) endif() # ----------------------------------------------------------------------------- +# Windows shared library manifest +if(WIN32) + windows_generate_shared_manifest() +endif() + +# ----------------------------------------------------------------------------- # Post-install script if(POSTINSTALL_SCRIPT) |