diff options
Diffstat (limited to 'build_files')
18 files changed, 439 insertions, 137 deletions
diff --git a/build_files/build_environment/cmake/jpeg.cmake b/build_files/build_environment/cmake/jpeg.cmake index 47f526e3d29..0d611219353 100644 --- a/build_files/build_environment/cmake/jpeg.cmake +++ b/build_files/build_environment/cmake/jpeg.cmake @@ -18,7 +18,7 @@ if(WIN32) # cmake for windows - set(JPEG_EXTRA_ARGS -DNASM=${NASM_PATH} -DWITH_JPEG8=ON -DCMAKE_DEBUG_POSTFIX=d) + set(JPEG_EXTRA_ARGS -DNASM=${NASM_PATH} -DWITH_JPEG8=ON -DCMAKE_DEBUG_POSTFIX=d -DWITH_CRT_DLL=On) ExternalProject_Add(external_jpeg URL ${JPEG_URI} diff --git a/build_files/build_environment/cmake/openimagedenoise.cmake b/build_files/build_environment/cmake/openimagedenoise.cmake index b20bb838ede..1332a38fea6 100644 --- a/build_files/build_environment/cmake/openimagedenoise.cmake +++ b/build_files/build_environment/cmake/openimagedenoise.cmake @@ -21,7 +21,7 @@ set(OIDN_EXTRA_ARGS -DWITH_EXAMPLE=OFF -DWITH_TEST=OFF -DTBB_ROOT=${LIBDIR}/tbb - -DTBB_STATIC_LIB=ON + -DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY} -DOIDN_STATIC_LIB=ON ) diff --git a/build_files/build_environment/cmake/opensubdiv.cmake b/build_files/build_environment/cmake/opensubdiv.cmake index 5c1ebe46a20..9ec849a219b 100644 --- a/build_files/build_environment/cmake/opensubdiv.cmake +++ b/build_files/build_environment/cmake/opensubdiv.cmake @@ -36,7 +36,7 @@ if(WIN32) set(OPENSUBDIV_EXTRA_ARGS ${OPENSUBDIV_EXTRA_ARGS} -DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include - -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb_static.lib + -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib -DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL -DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT} -DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include diff --git a/build_files/build_environment/cmake/pthreads.cmake b/build_files/build_environment/cmake/pthreads.cmake index c5c331117fc..7ddf6867e2b 100644 --- a/build_files/build_environment/cmake/pthreads.cmake +++ b/build_files/build_environment/cmake/pthreads.cmake @@ -24,7 +24,7 @@ if(WIN32) set(PTHREAD_CPPFLAGS "/I. /DHAVE_CONFIG_H ") endif() - set(PTHREADS_BUILD cd ${BUILD_DIR}/pthreads/src/external_pthreads/ && cd && nmake VC-static /e CPPFLAGS=${PTHREAD_CPPFLAGS} /e XLIBS=/NODEFAULTLIB:msvcr) + set(PTHREADS_BUILD cd ${BUILD_DIR}/pthreads/src/external_pthreads/ && cd && nmake VC-static /e CPPFLAGS=${PTHREAD_CPPFLAGS}) ExternalProject_Add(external_pthreads URL ${PTHREADS_URI} @@ -32,6 +32,7 @@ if(WIN32) URL_HASH MD5=${PTHREADS_HASH} PREFIX ${BUILD_DIR}/pthreads CONFIGURE_COMMAND echo . + PATCH_COMMAND COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/pthreads/src/external_pthreads < ${PATCH_DIR}/pthreads.diff BUILD_COMMAND ${PTHREADS_BUILD} INSTALL_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/libpthreadVC3${LIBEXT} ${LIBDIR}/pthreads/lib/pthreadVC3${LIBEXT} && diff --git a/build_files/build_environment/cmake/tbb.cmake b/build_files/build_environment/cmake/tbb.cmake index 8bd2f3160d0..1cb852fb5d1 100644 --- a/build_files/build_environment/cmake/tbb.cmake +++ b/build_files/build_environment/cmake/tbb.cmake @@ -20,8 +20,10 @@ if(WIN32) -DTBB_BUILD_SHARED=On -DTBB_BUILD_TBBMALLOC=On -DTBB_BUILD_TBBMALLOC_PROXY=On - -DTBB_BUILD_STATIC=On -) + -DTBB_BUILD_STATIC=Off + ) + set(TBB_LIBRARY tbb) + set(TBB_STATIC_LIBRARY Off) else() set(TBB_EXTRA_ARGS -DTBB_BUILD_SHARED=Off @@ -29,6 +31,8 @@ else() -DTBB_BUILD_TBBMALLOC_PROXY=Off -DTBB_BUILD_STATIC=On ) + set(TBB_LIBRARY tbb_static) + set(TBB_STATIC_LIBRARY On) endif() # CMake script for TBB from https://github.com/wjakob/tbb/blob/master/CMakeLists.txt @@ -46,7 +50,8 @@ ExternalProject_Add(external_tbb if(WIN32) if(BUILD_MODE STREQUAL Release) ExternalProject_Add_Step(external_tbb after_install - COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb.dll COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc.dll COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.lib @@ -57,7 +62,12 @@ if(WIN32) endif() if(BUILD_MODE STREQUAL Debug) ExternalProject_Add_Step(external_tbb after_install - COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib + # findtbb.cmake in some deps *NEEDS* to find tbb.lib even if they are not going to use it + # to make that test pass, we place a copy with the right name in the lib folder. + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${LIBDIR}/tbb/lib/tbb.lib + # Normal collection of build artifacts + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.dll ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.dll COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc.dll COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc_proxy.dll diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake index c3594390f80..505607535e9 100644 --- a/build_files/build_environment/cmake/usd.cmake +++ b/build_files/build_environment/cmake/usd.cmake @@ -23,8 +23,8 @@ set(USD_EXTRA_ARGS -DBoost_USE_STATIC_RUNTIME=OFF -DBOOST_ROOT=${LIBDIR}/boost -DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include - -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT} - -DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT} + -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT} + -DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT} # This is a preventative measure that avoids possible conflicts when add-ons # try to load another USD library into the same process space. diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 6a247e81148..5f73756ec0b 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -53,15 +53,15 @@ getopt \ --long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\ with-all,with-opencollada,with-jack,with-embree,with-oidn,\ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,\ -force-all,force-python,force-numpy,force-boost,\ +force-all,force-python,force-numpy,force-boost,force-tbb,\ force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\ force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\ force-xr-openxr,\ -build-all,build-python,build-numpy,build-boost,\ +build-all,build-python,build-numpy,build-boost,build-tbb,\ build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\ build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\ build-xr-openxr,\ -skip-python,skip-numpy,skip-boost,\ +skip-python,skip-numpy,skip-boost,skip-tbb,\ skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\ skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\ skip-xr-openxr \ @@ -191,6 +191,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --build-boost Force the build of Boost. + --build-tbb + Force the build of TBB. + --build-ocio Force the build of OpenColorIO. @@ -255,6 +258,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --force-boost Force the rebuild of Boost. + --force-tbb + Force the rebuild of TBB. + --force-ocio Force the rebuild of OpenColorIO. @@ -312,6 +318,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --skip-boost Unconditionally skip Boost installation/building. + --skip-tbb + Unconditionally skip TBB installation/building. + --skip-ocio Unconditionally skip OpenColorIO installation/building. @@ -385,6 +394,13 @@ BOOST_FORCE_BUILD=false BOOST_FORCE_REBUILD=false BOOST_SKIP=false +TBB_VERSION="2019" +TBB_VERSION_UPDATE="_U9" # Used for source packages... +TBB_VERSION_MIN="2018" +TBB_FORCE_BUILD=false +TBB_FORCE_REBUILD=false +TBB_SKIP=false + OCIO_VERSION="1.1.0" OCIO_VERSION_MIN="1.0" OCIO_FORCE_BUILD=false @@ -653,6 +669,7 @@ while true; do PYTHON_FORCE_BUILD=true NUMPY_FORCE_BUILD=true BOOST_FORCE_BUILD=true + TBB_FORCE_BUILD=true OCIO_FORCE_BUILD=true OPENEXR_FORCE_BUILD=true OIIO_FORCE_BUILD=true @@ -682,6 +699,9 @@ while true; do --build-boost) BOOST_FORCE_BUILD=true; shift; continue ;; + --build-tbb) + TBB_FORCE_BUILD=true; shift; continue + ;; --build-ocio) OCIO_FORCE_BUILD=true; shift; continue ;; @@ -728,6 +748,7 @@ while true; do PYTHON_FORCE_REBUILD=true NUMPY_FORCE_REBUILD=true BOOST_FORCE_REBUILD=true + TBB_FORCE_REBUILD=true OCIO_FORCE_REBUILD=true OPENEXR_FORCE_REBUILD=true OIIO_FORCE_REBUILD=true @@ -755,6 +776,9 @@ while true; do --force-boost) BOOST_FORCE_REBUILD=true; shift; continue ;; + --force-tbb) + TBB_FORCE_REBUILD=true; shift; continue + ;; --force-ocio) OCIO_FORCE_REBUILD=true; shift; continue ;; @@ -806,6 +830,9 @@ while true; do --skip-boost) BOOST_SKIP=true; shift; continue ;; + --skip-tbb) + TBB_SKIP=true; shift; continue + ;; --skip-ocio) OCIO_SKIP=true; shift; continue ;; @@ -898,9 +925,12 @@ PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHO NUMPY_SOURCE=( "https://github.com/numpy/numpy/releases/download/v$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" ) _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'` -BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" ) +BOOST_SOURCE=( "https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" ) BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options" +TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" ) +TBB_SOURCE_CMAKE=( "https://raw.githubusercontent.com/wjakob/tbb/master/CMakeLists.txt" ) + OCIO_USE_REPO=false OCIO_SOURCE=( "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v$OCIO_VERSION.tar.gz") #~ OCIO_SOURCE_REPO=( "https://github.com/imageworks/OpenColorIO.git" ) @@ -1011,6 +1041,7 @@ You may also want to build them yourself (optional ones are [between brackets]): * Python $PYTHON_VERSION_MIN (from $PYTHON_SOURCE). * [NumPy $NUMPY_VERSION_MIN] (from $NUMPY_SOURCE). * Boost $BOOST_VERSION_MIN (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES). + * TBB $TBB_VERSION_MIN (from $TBB_SOURCE). * [FFMpeg $FFMPEG_VERSION_MIN (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)] (from $FFMPEG_SOURCE). * [OpenColorIO $OCIO_VERSION_MIN] (from $OCIO_SOURCE). * ILMBase $OPENEXR_VERSION_MIN (from $OPENEXR_SOURCE). @@ -1248,8 +1279,10 @@ _update_deps_python() { clean_Python() { clean_Numpy _init_python + if [ -d $_inst ]; then + _update_deps_python + fi _clean - _update_deps_python } compile_Python() { @@ -1332,8 +1365,10 @@ _update_deps_numpy() { clean_Numpy() { _init_numpy + if [ -d $_inst ]; then + _update_deps_numpy + fi _clean - _update_deps_numpy } compile_Numpy() { @@ -1418,8 +1453,10 @@ _update_deps_boost() { clean_Boost() { _init_boost + if [ -d $_inst ]; then + _update_deps_boost + fi _clean - _update_deps_boost } compile_Boost() { @@ -1485,6 +1522,128 @@ compile_Boost() { } # ---------------------------------------------------------------------------- +# Build TBB + +_init_tbb() { + _src=$SRC/TBB-$TBB_VERSION + _git=false + _inst=$INST/tbb-$TBB_VERSION + _inst_shortcut=$INST/tbb +} + +_update_deps_tbb() { + OSD_FORCE_REBUILD=true + OPENVDB_FORCE_REBUILD=true + USD_FORCE_REBUILD=true + OIDN_FORCE_REBUILD=true + if [ "$_is_building" = true ]; then + OSD_FORCE_BUILD=true + OPENVDB_FORCE_BUILD=true + USD_FORCE_BUILD=true + OIDN_FORCE_BUILD=true + fi +} + +clean_TBB() { + _init_tbb + if [ -d $_inst ]; then + _update_deps_tbb + fi + _clean +} + +compile_TBB() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, TBB will not be compiled!" + return + fi + + # To be changed each time we make edits that would modify the compiled result! + tbb_magic=0 + _init_tbb + + # Clean install if needed! + magic_compile_check tbb-$TBB_VERSION $tbb_magic + if [ $? -eq 1 -o "$TBB_FORCE_REBUILD" = true ]; then + clean_TBB + fi + + if [ ! -d $_inst ]; then + INFO "Building TBB-$TBB_VERSION$TBB_VERSION_UPDATE" + _is_building=true + + # Rebuild dependencies as well! + _update_deps_tbb + + prepare_opt + + if [ ! -d $_src ]; then + INFO "Downloading TBB-$TBB_VERSION$TBB_VERSION_UPDATE" + mkdir -p $SRC + + download TBB_SOURCE[@] $_src.tar.gz + INFO "Unpacking TBB-$TBB_VERSION$TBB_VERSION_UPDATE" + tar -C $SRC --transform "s,(.*/?)oneTBB[^/]*(.*),\1TBB-$TBB_VERSION\2,x" \ + -xf $_src.tar.gz + + INFO + + # Super-hack: Add some cmake builder to tbb... since they don't even have an install target by default, sic. + download TBB_SOURCE_CMAKE[@] $_src/CMakeLists.txt + cp $_src/build/vs2013/version_string.ver $_src/build/version_string.ver.in + fi + + cd $_src + + # Always refresh the whole build! + if [ -d cmake_build ]; then + rm -rf cmake_build + fi + mkdir cmake_build + cd cmake_build + + cmake_d="-D CMAKE_BUILD_TYPE=Release" + cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst" + cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" + cmake_d="$cmake_d -D TBB_BUILD_SHARED=ON" + cmake_d="$cmake_d -D TBB_BUILD_STATIC=OFF" + cmake_d="$cmake_d -D TBB_BUILD_TBBMALLOC=ON" + cmake_d="$cmake_d -D TBB_BUILD_TBBMALLOC_PROXY=OFF" + cmake_d="$cmake_d -D TBB_BUILD_TESTS=OFF" + + if file /bin/cp | grep -q '32-bit'; then + cflags="-fPIC -m32 -march=i686" + else + cflags="-fPIC" + fi + + cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" .. + + make -j$THREADS && make install + + make clean + + if [ -d $_inst ]; then + _create_inst_shortcut + else + ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting" + exit 1 + fi + + magic_compile_set tbb-$TBB_VERSION $tbb_magic + + cd $CWD + INFO "Done compiling TBB-$TBB_VERSION$TBB_VERSION_UPDATE!" + _is_building=false + else + INFO "Own TBB-$TBB_VERSION$TBB_VERSION_UPDATE is up to date, nothing to do!" + INFO "If you want to force rebuild of this lib, use the --force-tbb option." + fi + + run_ldconfig "tbb" +} + +# ---------------------------------------------------------------------------- # Build OCIO _init_ocio() { @@ -1504,8 +1663,10 @@ _update_deps_ocio() { clean_OCIO() { _init_ocio + if [ -d $_inst ]; then + _update_deps_ocio + fi _clean - _update_deps_ocio } compile_OCIO() { @@ -1617,7 +1778,7 @@ compile_OCIO() { _init_openexr() { _src=$SRC/OpenEXR-$OPENEXR_VERSION _git=false - _inst=$_openexr_inst + _inst=$INST/openexr-$OPENEXR_VERSION _inst_shortcut=$INST/openexr } @@ -1632,8 +1793,10 @@ _update_deps_openexr() { clean_OPENEXR() { _init_openexr + if [ -d $_inst ]; then + _update_deps_openexr + fi _clean - _update_deps_openexr } compile_OPENEXR() { @@ -1651,7 +1814,6 @@ compile_OPENEXR() { clean_OPENEXR fi - _openexr_inst=$INST/openexr-$OPENEXR_VERSION PRINT "" _init_openexr @@ -1697,7 +1859,7 @@ compile_OPENEXR() { mkdir build cd build - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_openexr_inst" + cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" cmake_d="$cmake_d -D CMAKE_INSTALL_DOCDIR=/dev/null" # Hack, there is no option to disable that currently... cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON" cmake_d="$cmake_d -D BUILD_TESTING=OFF" @@ -1759,8 +1921,10 @@ _update_deps_oiio() { clean_OIIO() { _init_oiio + if [ -d $_inst ]; then + _update_deps_oiio + fi _clean - _update_deps_oiio } compile_OIIO() { @@ -1912,8 +2076,10 @@ _update_deps_llvm() { clean_LLVM() { _init_llvm + if [ -d $_inst ]; then + _update_deps_llvm + fi _clean - _update_deps_llvm } compile_LLVM() { @@ -2019,8 +2185,10 @@ _update_deps_osl() { clean_OSL() { _init_osl + if [ -d $_inst ]; then + _update_deps_osl + fi _clean - _update_deps_osl } compile_OSL() { @@ -2162,8 +2330,10 @@ _update_deps_osd() { clean_OSD() { _init_osd + if [ -d $_inst ]; then + _update_deps_osd + fi _clean - _update_deps_osd } compile_OSD() { @@ -2222,6 +2392,9 @@ compile_OSD() { mkdir build cd build + if [ -d $INST/tbb ]; then + cmake_d="$cmake_d $cmake_d -D TBB_LOCATION=$INST/tbb" + fi cmake_d="-D CMAKE_BUILD_TYPE=Release" cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" # ptex is only needed when nicholas bishop is ready @@ -2274,8 +2447,10 @@ _update_deps_blosc() { clean_BLOSC() { _init_blosc + if [ -d $_inst ]; then + _update_deps_blosc + fi _clean - _update_deps_blosc } compile_BLOSC() { @@ -2369,8 +2544,10 @@ _update_deps_openvdb() { clean_OPENVDB() { _init_openvdb + if [ -d $_inst ]; then + _update_deps_openvdb + fi _clean - _update_deps_openvdb } compile_OPENVDB() { @@ -2429,6 +2606,9 @@ compile_OPENVDB() { if [ -d $INST/boost ]; then make_d="$make_d BOOST_INCL_DIR=$INST/boost/include BOOST_LIB_DIR=$INST/boost/lib" fi + if [ -d $INST/tbb ]; then + make_d="$make_d TBB_ROOT=$INST/tbb TBB_USE_STATIC_LIBS=OFF" + fi if [ "$_with_built_openexr" = true ]; then make_d="$make_d ILMBASE_INCL_DIR=$INST/openexr/include ILMBASE_LIB_DIR=$INST/openexr/lib" @@ -2482,8 +2662,10 @@ _update_deps_alembic() { clean_ALEMBIC() { _init_alembic + if [ -d $_inst ]; then + _update_deps_alembic + fi _clean - _update_deps_alembic } compile_ALEMBIC() { @@ -2585,8 +2767,10 @@ _update_deps_usd() { clean_USD() { _init_usd + if [ -d $_inst ]; then + _update_deps_usd + fi _clean - _update_deps_usd } compile_USD() { @@ -2630,6 +2814,10 @@ compile_USD() { if [ -d $INST/boost ]; then cmake_d="$cmake_d $cmake_d -D BOOST_ROOT=$INST/boost" fi + + if [ -d $INST/tbb ]; then + cmake_d="$cmake_d $cmake_d -D TBB_ROOT_DIR=$INST/tbb" + fi cmake_d="$cmake_d -DPXR_SET_INTERNAL_NAMESPACE=usdBlender" cmake_d="$cmake_d -DPXR_ENABLE_PYTHON_SUPPORT=OFF" cmake_d="$cmake_d -DPXR_BUILD_IMAGING=OFF" @@ -2678,8 +2866,10 @@ _update_deps_collada() { clean_OpenCOLLADA() { _init_opencollada + if [ -d $_inst ]; then + _update_deps_collada + fi _clean - _update_deps_collada } compile_OpenCOLLADA() { @@ -2782,8 +2972,10 @@ _update_deps_embree() { clean_Embree() { _init_embree + if [ -d $_inst ]; then + _update_deps_embree + fi _clean - _update_deps_embree } compile_Embree() { @@ -2889,8 +3081,10 @@ _update_deps_oidn() { clean_oidn() { _init_oidn + if [ -d $_inst ]; then + _update_deps_oidn + fi _clean - _update_deps_oidn } compile_OIDN() { @@ -2952,6 +3146,10 @@ compile_OIDN() { cmake_d="$cmake_d -D WITH_TEST=OFF" cmake_d="$cmake_d -D OIDN_STATIC_LIB=ON" + if [ -d $INST/tbb ]; then + make_d="$make_d TBB_ROOT=$INST/tbb" + fi + cmake $cmake_d ../ make -j$THREADS && make install @@ -2992,8 +3190,10 @@ _update_deps_ffmpeg() { clean_FFmpeg() { _init_ffmpeg + if [ -d $_inst ]; then + _update_deps_ffmpeg + fi _clean - _update_deps_ffmpeg } compile_FFmpeg() { @@ -3119,8 +3319,10 @@ _update_deps_xr_openxr_sdk() { clean_XR_OpenXR_SDK() { _init_xr_openxr_sdk + if [ -d $_inst ]; then + _update_deps_xr_openxr_sdk + fi _clean - _update_deps_xr_openxr_sdk } compile_XR_OpenXR_SDK() { @@ -3134,7 +3336,7 @@ compile_XR_OpenXR_SDK() { _init_xr_openxr_sdk # Clean install if needed! - magic_compile_check xr-openxr-$OPENXR_VERSION $xr_openxr_magic + magic_compile_check xr-openxr-$XR_OPENXR_VERSION $xr_openxr_magic if [ $? -eq 1 -o "$XR_OPENXR_FORCE_REBUILD" = true ]; then clean_XR_OpenXR_SDK fi @@ -3311,7 +3513,7 @@ install_DEB() { THEORA_DEV="libtheora-dev" _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \ - git libfreetype6-dev libx11-dev flex bison libtbb-dev libxxf86vm-dev \ + git libfreetype6-dev libx11-dev flex bison libxxf86vm-dev \ libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \ libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \ libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \ @@ -3521,6 +3723,23 @@ install_DEB() { PRINT "" + if [ "$TBB_SKIP" = true ]; then + WARNING "Skipping TBB installation, as requested..." + elif [ "$TBB_FORCE_BUILD" = true ]; then + INFO "Forced TBB building, as requested..." + compile_TBB + else + check_package_version_ge_DEB libtbb-dev $TBB_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_DEB libtbb-dev + clean_TBB + else + compile_TBB + fi + fi + + + PRINT "" if [ "$OCIO_SKIP" = true ]; then WARNING "Skipping OpenColorIO installation, as requested..." elif [ "$OCIO_FORCE_BUILD" = true ]; then @@ -3956,7 +4175,7 @@ install_RPM() { THEORA_USE=true if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then - _packages="$_packages freetype-devel tbb-devel" + _packages="$_packages freetype-devel" if [ "$WITH_JACK" = true ]; then _packages="$_packages jack-audio-connection-kit-devel" @@ -3998,17 +4217,6 @@ install_RPM() { install_packages_RPM $_packages PRINT "" - # Install TBB on openSUSE, from temporary repo - check_package_RPM tbb-devel - if [ $? -eq 0 ]; then - install_packages_RPM tbb-devel - else - $SUDO zypper ar -f http://download.opensuse.org/repositories/devel:/libraries:/c_c++/openSUSE_$_suse_rel/devel:libraries:c_c++.repo - $SUDO zypper -n --gpg-auto-import-keys install tbb-devel - $SUDO zypper rr devel_libraries_c_c++ - fi - - PRINT "" X264_DEV="libx264-devel" check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then @@ -4144,6 +4352,23 @@ install_RPM() { PRINT "" + if [ "$TBB_SKIP" = true ]; then + WARNING "Skipping TBB installation, as requested..." + elif [ "$TBB_FORCE_BUILD" = true ]; then + INFO "Forced TBB building, as requested..." + compile_TBB + else + check_package_version_ge_RPM tbb-devel $TBB_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_RPM tbb-devel + clean_TBB + else + compile_TBB + fi + fi + + + PRINT "" if [ "$OCIO_SKIP" = true ]; then WARNING "Skipping OpenColorIO installation, as requested..." elif [ "$OCIO_FORCE_BUILD" = true ]; then @@ -4499,7 +4724,7 @@ install_ARCH() { _packages="$BASE_DEVEL git cmake \ libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \ - $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw intel-tbb \ + $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \ libxml2 yaml-cpp tinyxml python-requests jemalloc" OPENJPEG_USE=true @@ -4639,6 +4864,23 @@ install_ARCH() { PRINT "" + if [ "$TBB_SKIP" = true ]; then + WARNING "Skipping TBB installation, as requested..." + elif [ "$TBB_FORCE_BUILD" = true ]; then + INFO "Forced TBB building, as requested..." + compile_TBB + else + check_package_version_ge_ARCH intel-tbb $TBB_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_ARCH intel-tbb + clean_TBB + else + compile_TBB + fi + fi + + + PRINT "" if [ "$OCIO_SKIP" = true ]; then WARNING "Skipping OpenColorIO installation, as requested..." elif [ "$OCIO_FORCE_BUILD" = true ]; then @@ -4932,15 +5174,10 @@ install_OTHER() { fi PRINT "" - _do_compile_python=false if [ "$PYTHON_SKIP" = true ]; then WARNING "Skipping Python/NumPy installation, as requested..." elif [ "$PYTHON_FORCE_BUILD" = true ]; then INFO "Forced Python/NumPy building, as requested..." - _do_compile_python=true - fi - - if [ "$_do_compile_python" = true ]; then compile_Python PRINT "" if [ "$NUMPY_SKIP" = true ]; then @@ -4961,6 +5198,15 @@ install_OTHER() { PRINT "" + if [ "$TBB_SKIP" = true ]; then + WARNING "Skipping TBB installation, as requested..." + elif [ "$TBB_FORCE_BUILD" = true ]; then + INFO "Forced TBB building, as requested..." + compile_TBB + fi + + + PRINT "" if [ "$OCIO_SKIP" = true ]; then WARNING "Skipping OpenColorIO installation, as requested..." elif [ "$OCIO_FORCE_BUILD" = true ]; then @@ -4989,16 +5235,10 @@ install_OTHER() { PRINT "" have_llvm=false - _do_compile_llvm=false if [ "$LLVM_SKIP" = true ]; then WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..." elif [ "$LLVM_FORCE_BUILD" = true ]; then INFO "Forced LLVM building, as requested..." - _do_compile_llvm=true - fi - - if [ "$_do_compile_llvm" = true ]; then - PRINT "" compile_LLVM have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION @@ -5006,15 +5246,10 @@ install_OTHER() { PRINT "" - _do_compile_osl=false if [ "$OSL_SKIP" = true ]; then WARNING "Skipping OpenShadingLanguage installation, as requested..." elif [ "$OSL_FORCE_BUILD" = true ]; then INFO "Forced OpenShadingLanguage building, as requested..." - _do_compile_osl=true - fi - - if [ "$_do_compile_osl" = true ]; then if [ "$have_llvm" = true ]; then PRINT "" compile_OSL @@ -5025,66 +5260,40 @@ install_OTHER() { PRINT "" - _do_compile_osd=false if [ "$OSD_SKIP" = true ]; then WARNING "Skipping OpenSubdiv installation, as requested..." elif [ "$OSD_FORCE_BUILD" = true ]; then INFO "Forced OpenSubdiv building, as requested..." - _do_compile_osd=true - fi - - if [ "$_do_compile_osd" = true ]; then - PRINT "" compile_OSD fi if [ "$WITH_OPENCOLLADA" = true ]; then - _do_compile_collada=false PRINT "" if [ "$OPENCOLLADA_SKIP" = true ]; then WARNING "Skipping OpenCOLLADA installation, as requested..." elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then INFO "Forced OpenCollada building, as requested..." - _do_compile_collada=true - fi - - if [ "$_do_compile_collada" = true ]; then - PRINT "" compile_OpenCOLLADA fi fi if [ "$WITH_EMBREE" = true ]; then - _do_compile_embree=false PRINT "" if [ "$EMBREE_SKIP" = true ]; then WARNING "Skipping Embree installation, as requested..." elif [ "$EMBREE_FORCE_BUILD" = true ]; then INFO "Forced Embree building, as requested..." - _do_compile_embree=true - fi - - if [ "$_do_compile_embree" = true ]; then - PRINT "" compile_Embree fi fi if [ "$WITH_OIDN" = true ]; then - _do_compile_oidn=false PRINT "" if [ "$OIDN_SKIP" = true ]; then WARNING "Skipping OpenImgeDenoise installation, as requested..." elif [ "$OIDN_FORCE_BUILD" = true ]; then INFO "Forced OpenImageDenoise building, as requested..." - _do_compile_oidn=true - else - # No package currently! - _do_compile_oidn=true - fi - - if [ "$_do_compile_oidn" = true ]; then compile_OIDN fi fi @@ -5103,9 +5312,6 @@ install_OTHER() { elif [ "$XR_OPENXR_FORCE_BUILD" = true ]; then INFO "Forced OpenXR-SDK building, as requested..." compile_XR_OpenXR_SDK - else - # No package currently! - compile_XR_OpenXR_SDK fi } @@ -5191,7 +5397,7 @@ print_info() { PRINT "" PRINT "If you're using CMake add this to your configuration flags:" - _buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost*" + _buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*" _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*" _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*" @@ -5216,6 +5422,12 @@ print_info() { _buildargs="$_buildargs $_1 $_2" fi + if [ -d $INST/tbb ]; then + _1="-D TBB_ROOT_DIR=$INST/tbb" + PRINT " $_1" + _buildargs="$_buildargs $_1" + fi + if [ "$OCIO_SKIP" = false ]; then _1="-D WITH_OPENCOLORIO=ON" PRINT " $_1" diff --git a/build_files/build_environment/patches/cmakelists_tbb.txt b/build_files/build_environment/patches/cmakelists_tbb.txt index da9fd938943..7edf3aa2785 100644 --- a/build_files/build_environment/patches/cmakelists_tbb.txt +++ b/build_files/build_environment/patches/cmakelists_tbb.txt @@ -109,6 +109,9 @@ if (WIN32) MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def COMMENT "Preprocessing tbbmalloc.def" ) + list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/tbb_resource.rc) + list(APPEND tbbmalloc_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc) + list(APPEND tbbmalloc_proxy_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc) else() add_custom_command(OUTPUT tbb.def COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def @@ -145,8 +148,12 @@ if (TBB_BUILD_SHARED) set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbb.def") elseif(WIN32) set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbb.def") + endif() install(TARGETS tbb DESTINATION lib) + if(WIN32) + set_target_properties(tbb PROPERTIES OUTPUT_NAME "tbb$<$<CONFIG:Debug>:_debug>") + endif() endif() if(CMAKE_COMPILER_IS_GNUCC) @@ -196,7 +203,7 @@ if(TBB_BUILD_TBBMALLOC_PROXY) add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src}) set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) - link_libraries(tbbmalloc_proxy tbbmalloc) + target_link_libraries(tbbmalloc_proxy tbbmalloc) install(TARGETS tbbmalloc_proxy DESTINATION lib) endif() endif() diff --git a/build_files/build_environment/patches/openimagedenoise.diff b/build_files/build_environment/patches/openimagedenoise.diff index f83b0776c30..7bfc3aa2eba 100644 --- a/build_files/build_environment/patches/openimagedenoise.diff +++ b/build_files/build_environment/patches/openimagedenoise.diff @@ -18,17 +18,6 @@ diff --git a/mkl-dnn/cmake/TBB.cmake b/mkl-dnn/cmake/TBB.cmake index 0711e699..c14210b6 100644 --- a/mkl-dnn/cmake/TBB.cmake +++ b/mkl-dnn/cmake/TBB.cmake -@@ -90,8 +90,8 @@ if(WIN32) - NO_DEFAULT_PATH - ) - set(TBB_LIB_DIR ${TBB_ROOT}/lib/${TBB_ARCH}/${TBB_VCVER}) -- find_library(TBB_LIBRARY tbb PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH) -- find_library(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH) -+ find_library(TBB_LIBRARY tbb_static PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH) -+ find_library(TBB_LIBRARY_MALLOC tbbmalloc_static PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH) - endif() - - else() @@ -138,13 +138,13 @@ else() set(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND) if(APPLE) diff --git a/build_files/build_environment/patches/pthreads.diff b/build_files/build_environment/patches/pthreads.diff index bbabfdc8925..4b6c9766e11 100644 --- a/build_files/build_environment/patches/pthreads.diff +++ b/build_files/build_environment/patches/pthreads.diff @@ -1,13 +1,12 @@ ---- pthread.h.orig 2012-05-26 22:16:45 -0600 -+++ pthread.h 2016-04-01 09:20:36 -0600 -@@ -109,6 +109,10 @@ - /* Include everything */ - #endif +diff -Naur orig/Makefile external_pthreads/Makefile +--- orig/Makefile 2018-08-08 04:47:40 -0600 ++++ external_pthreads/Makefile 2020-05-09 11:20:28 -0600 +@@ -185,7 +185,7 @@ + @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).inlined_static_stamp -+#if _MSC_VER >= 1900 -+# define HAVE_STRUCT_TIMESPEC 1 -+#endif -+ - #if defined(_UWIN) - # define HAVE_STRUCT_TIMESPEC 1 - # define HAVE_SIGNAL_H 1 + VC-static: +- @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).inlined_static_stamp ++ @ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCFLAGS) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER).inlined_static_stamp + + VC-static-debug: + @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).inlined_static_stamp diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake index 04e1670aef6..c36b264a300 100644 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -66,6 +66,9 @@ macro(BLENDER_SRC_GTEST_EX) if(UNIX AND NOT APPLE) target_link_libraries(${TARGET_NAME} bf_intern_libc_compat) endif() + if(WITH_TBB) + target_link_libraries(${TARGET_NAME} ${TBB_LIBRARIES}) + endif() get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(GENERATOR_IS_MULTI_CONFIG) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 6287da55580..d99e46ce76e 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -440,6 +440,14 @@ function(SETUP_LIBDIRS) link_directories(${HDF5_LIBPATH}) endif() + if(WITH_GHOST_WAYLAND) + link_directories( + ${wayland-client_LIBRARY_DIRS} + ${wayland-egl_LIBRARY_DIRS} + ${xkbcommon_LIBRARY_DIRS} + ${wayland-cursor_LIBRARY_DIRS}) + endif() + if(WIN32 AND NOT UNIX) link_directories(${PTHREADS_LIBPATH}) endif() diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index e4102e3437b..6e00a2dec7b 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -505,7 +505,27 @@ if(WITH_SYSTEM_AUDASPACE) endif() endif() -if(WITH_X11) +if(WITH_GHOST_WAYLAND) + find_package(PkgConfig) + pkg_check_modules(wayland-client REQUIRED wayland-client>=1.12) + pkg_check_modules(wayland-egl REQUIRED wayland-egl) + pkg_check_modules(wayland-scanner REQUIRED wayland-scanner) + pkg_check_modules(xkbcommon REQUIRED xkbcommon) + pkg_check_modules(wayland-cursor REQUIRED wayland-cursor) + + set(WITH_GL_EGL ON) + + if(WITH_GHOST_WAYLAND) + list(APPEND PLATFORM_LINKLIBS + ${wayland-client_LIBRARIES} + ${wayland-egl_LIBRARIES} + ${xkbcommon_LIBRARIES} + ${wayland-cursor_LIBRARIES} + ) + endif() +endif() + +if(WITH_GHOST_X11) find_package(X11 REQUIRED) find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH}) @@ -576,6 +596,19 @@ if(CMAKE_COMPILER_IS_GNUCC) unset(LD_VERSION) endif() + if(WITH_LINKER_LLD) + execute_process( + COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version + ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) + if("${LD_VERSION}" MATCHES "LLD") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld") + else() + message(STATUS "LLD linker isn't available, using the default system linker.") + endif() + unset(LD_VERSION) + endif() + # CLang is the same as GCC for now. elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing") diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 1ecde8635c8..6760da95767 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -51,6 +51,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang") endif() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \"${CLANG_OPENMP_LIB}\"") endif() + if(WITH_WINDOWS_STRIPPED_PDB) + message(WARNING "stripped pdb not supported with clang, disabling..") + set(WITH_WINDOWS_STRIPPED_PDB Off) + endif() endif() set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS}) @@ -107,12 +111,13 @@ endif() unset(_min_ver) # needed for some MSVC installations -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") +# 4099 : PDB 'filename' was not found with 'object/library' +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /ignore:4099") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /ignore:4099") +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /ignore:4099") list(APPEND PLATFORM_LINKLIBS - ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 + ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp Shlwapi ) @@ -134,7 +139,12 @@ add_definitions(-D_ALLOW_KEYWORD_MACROS) # We want to support Windows 7 level ABI add_definitions(-D_WIN32_WINNT=0x601) include(build_files/cmake/platform/platform_win32_bundle_crt.cmake) -remove_cc_flag("/MDd" "/MD") +remove_cc_flag("/MDd" "/MD" "/Zi") + +if(WITH_WINDOWS_PDB) + set(PDB_INFO_OVERRIDE_FLAGS "/Z7") + set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO") +endif() if(MSVC_CLANG) # Clangs version of cl doesn't support all flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ") @@ -151,16 +161,30 @@ if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-") endif() +if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND) + message(WARNING "Disabling sccache, sccache is not supported with msbuild") + set(WITH_WINDOWS_SCCACHE Off) +endif() -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI") -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /ZI") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD") -set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD") -set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD") - +if(WITH_WINDOWS_SCCACHE) + set(CMAKE_C_COMPILER_LAUNCHER sccache) + set(CMAKE_CXX_COMPILER_LAUNCHER sccache) + set(SYMBOL_FORMAT /Z7) +else() + unset(CMAKE_C_COMPILER_LAUNCHER) + unset(CMAKE_CXX_COMPILER_LAUNCHER) + set(SYMBOL_FORMAT /ZI) +endif() + +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}") +set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}") +set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}") +unset(SYMBOL_FORMAT) # JMC is available on msvc 15.8 (1915) and up if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC") @@ -172,6 +196,7 @@ set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAUL # Ignore meaningless for us linker warnings. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221") +set(PLATFORM_LINKFLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${PDB_INFO_OVERRIDE_LINKER_FLAGS}") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") if(CMAKE_CL_64) @@ -209,7 +234,7 @@ endif() # Mark libdir as system headers with a lower warn level, to resolve some warnings # that we have very little control over -if(MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG) +if(MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG AND NOT WITH_WINDOWS_SCCACHE) add_compile_options(/experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0) endif() @@ -572,7 +597,7 @@ if(WITH_SYSTEM_AUDASPACE) endif() if(WITH_TBB) - set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib) + set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/debug/tbb_debug.lib) set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include) set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) if(WITH_TBB_MALLOC_PROXY) diff --git a/build_files/windows/configure_msbuild.cmd b/build_files/windows/configure_msbuild.cmd index 3c1194011cd..4956f1e3ea1 100644 --- a/build_files/windows/configure_msbuild.cmd +++ b/build_files/windows/configure_msbuild.cmd @@ -2,6 +2,11 @@ set BUILD_GENERATOR_POST= set BUILD_PLATFORM_SELECT= set MSBUILD_PLATFORM=x64 +if "%BUILD_WITH_SCCACHE%"=="1" ( + echo sccache is only supported with ninja as the build system. + exit /b 1 +) + if "%WITH_CLANG%"=="1" ( set CLANG_CMAKE_ARGS=-T"llvm" if "%WITH_ASAN%"=="1" ( diff --git a/build_files/windows/configure_ninja.cmd b/build_files/windows/configure_ninja.cmd index 1650e43cda9..20692847bef 100644 --- a/build_files/windows/configure_ninja.cmd +++ b/build_files/windows/configure_ninja.cmd @@ -6,6 +6,13 @@ if %ERRORLEVEL% NEQ 0 ( set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% +if "%BUILD_WITH_SCCACHE%"=="1" ( + set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_WINDOWS_SCCACHE=On + if NOT "%verbose%" == "" ( + echo Enabling sccache + ) +) + if "%WITH_CLANG%" == "1" ( set LLVM_DIR= for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C diff --git a/build_files/windows/parse_arguments.cmd b/build_files/windows/parse_arguments.cmd index 4ee05bfde7d..54dc41ece87 100644 --- a/build_files/windows/parse_arguments.cmd +++ b/build_files/windows/parse_arguments.cmd @@ -86,6 +86,8 @@ if NOT "%1" == "" ( set BUILD_UPDATE_ARGS="--no-libraries" ) else if "%1" == "ninja" ( SET BUILD_WITH_NINJA=1 + ) else if "%1" == "sccache" ( + SET BUILD_WITH_SCCACHE=1 ) else if "%1" == "clean" ( set MUST_CLEAN=1 ) else if "%1" == "verbose" ( diff --git a/build_files/windows/reset_variables.cmd b/build_files/windows/reset_variables.cmd index 48a61aff44a..262874713eb 100644 --- a/build_files/windows/reset_variables.cmd +++ b/build_files/windows/reset_variables.cmd @@ -30,3 +30,4 @@ set WITH_PYDEBUG= set PYDEBUG_CMAKE_ARGS= set FORMAT= set TEST= +set BUILD_WITH_SCCACHE= |