diff options
59 files changed, 506 insertions, 222 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f8b512b69b..70196d00df6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -780,9 +780,11 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release") if(MSVC) set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6") endif() - set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}") - set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") - set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") + if(COMPILER_ASAN_LIBRARY) + set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}") + set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") + set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") + endif() endif() endif() diff --git a/build_files/build_environment/cmake/blosc.cmake b/build_files/build_environment/cmake/blosc.cmake index 221fa9d58bf..0a8e13746c8 100644 --- a/build_files/build_environment/cmake/blosc.cmake +++ b/build_files/build_environment/cmake/blosc.cmake @@ -29,13 +29,11 @@ set(BLOSC_EXTRA_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON ) -if(WIN32) - # Prevent blosc from including it's own local copy of zlib in the object file - # and cause linker errors with everybody else. - set(BLOSC_EXTRA_ARGS ${BLOSC_EXTRA_ARGS} - -DPREFER_EXTERNAL_ZLIB=ON - ) -endif() +# Prevent blosc from including it's own local copy of zlib in the object file +# and cause linker errors with everybody else. +set(BLOSC_EXTRA_ARGS ${BLOSC_EXTRA_ARGS} + -DPREFER_EXTERNAL_ZLIB=ON +) ExternalProject_Add(external_blosc URL ${BLOSC_URI} diff --git a/build_files/build_environment/patches/blosc.diff b/build_files/build_environment/patches/blosc.diff index 653649bb914..ee5826a2e98 100644 --- a/build_files/build_environment/patches/blosc.diff +++ b/build_files/build_environment/patches/blosc.diff @@ -10,6 +10,70 @@ diff -Naur src/blosc/CMakeLists.txt external_blosc/blosc/CMakeLists.txt endif(NOT Threads_FOUND) else(WIN32) find_package(Threads REQUIRED) +diff -Naur src/CMakeLists.txt external_blosc/CMakeLists.txt +--- src/CMakeLists.txt 2016-02-03 10:26:28 -0700 ++++ external_blosc/CMakeLists.txt 2017-03-03 09:03:31 -0700 +@@ -17,8 +17,8 @@ + # do not include support for the Snappy library + # DEACTIVATE_ZLIB: default OFF + # do not include support for the Zlib library +-# PREFER_EXTERNAL_COMPLIBS: default ON +-# when found, use the installed compression libs instead of included sources ++# PREFER_EXTERNAL_ZLIB: default ON ++# when found, use the installed zlib instead of included sources + # TEST_INCLUDE_BENCH_SINGLE_1: default ON + # add a test that runs the benchmark program passing "single" with 1 thread + # as first parameter +@@ -80,29 +80,23 @@ + "Do not include support for the SNAPPY library." OFF) + option(DEACTIVATE_ZLIB + "Do not include support for the ZLIB library." OFF) +-option(PREFER_EXTERNAL_COMPLIBS +- "When found, use the installed compression libs instead of included sources." ON) ++option(PREFER_EXTERNAL_ZLIB ++ "When found, use the installed zlib instead of included sources." ON) + + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +-if(NOT PREFER_EXTERNAL_COMPLIBS) ++if(NOT PREFER_EXTERNAL_ZLIB) + message(STATUS "Finding external libraries disabled. Using internal sources.") +-endif(NOT PREFER_EXTERNAL_COMPLIBS) ++endif(NOT PREFER_EXTERNAL_ZLIB) + + + if(NOT DEACTIVATE_LZ4) +- if(PREFER_EXTERNAL_COMPLIBS) +- find_package(LZ4) +- endif(PREFER_EXTERNAL_COMPLIBS) + # HAVE_LZ4 will be set to true because even if the library is + # not found, we will use the included sources for it + set(HAVE_LZ4 TRUE) + endif(NOT DEACTIVATE_LZ4) + + if(NOT DEACTIVATE_SNAPPY) +- if(PREFER_EXTERNAL_COMPLIBS) +- find_package(Snappy) +- endif(PREFER_EXTERNAL_COMPLIBS) + # HAVE_SNAPPY will be set to true because even if the library is not found, + # we will use the included sources for it + set(HAVE_SNAPPY TRUE) +@@ -110,13 +104,13 @@ + + if(NOT DEACTIVATE_ZLIB) + # import the ZLIB_ROOT environment variable to help finding the zlib library +- if(PREFER_EXTERNAL_COMPLIBS) ++ if(PREFER_EXTERNAL_ZLIB) + set(ZLIB_ROOT $ENV{ZLIB_ROOT}) + find_package( ZLIB ) + if (NOT ZLIB_FOUND ) + message(STATUS "No zlib found. Using internal sources.") + endif (NOT ZLIB_FOUND ) +- endif(PREFER_EXTERNAL_COMPLIBS) ++ endif(PREFER_EXTERNAL_ZLIB) + # HAVE_ZLIB will be set to true because even if the library is not found, + # we will use the included sources for it + set(HAVE_ZLIB TRUE) diff -Naur external_blosc.orig/blosc/blosc.c external_blosc/blosc/blosc.c --- external_blosc.orig/blosc/blosc.c 2018-07-30 04:56:38 -0600 +++ external_blosc/blosc/blosc.c 2018-08-11 15:27:26 -0600 diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 23ed5b6cbfb..2d13476f09a 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -251,8 +251,59 @@ function(blender_add_lib__impl add_library(${name} ${sources}) + # On Windows certain libraries have two sets of binaries: one for debug builds and one for + # release builds. The root of this requirement goes into ABI, I believe, but that's outside + # of a scope of this comment. + # + # CMake have a native way of dealing with this, which is specifying what build type the + # libraries are provided for: + # + # target_link_libraries(tagret optimized|debug|general <libraries>) + # + # The build type is to be provided as a separate argument to the function. + # + # CMake's variables for libraries will contain build type in such cases. For example: + # + # set(FOO_LIBRARIES optimized libfoo.lib debug libfoo_d.lib) + # + # Complications starts with a single argument for library_deps: all the elements are being + # put to a list: "${FOO_LIBRARIES}" will become "optimized;libfoo.lib;debug;libfoo_d.lib". + # This makes it impossible to pass it as-is to target_link_libraries sine it will treat + # this argument as a list of libraries to be linked against, causing missing libraries + # for optimized.lib. + # + # What this code does it traverses library_deps and extracts information about whether + # library is to provided as general, debug or optimized. This is a little state machine which + # keeps track of whiuch build type library is to provided for: + # + # - If "debug" or "optimized" word is found, the next element in the list is expected to be + # a library which will be passed to target_link_libraries() under corresponding build type. + # + # - If there is no "debug" or "optimized" used library is specified for all build types. + # + # NOTE: If separated libraries for debug and release ar eneeded every library is the list are + # to be prefixed explicitly. + # + # Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d" + # NOT: "optimized libfoo libbar debug libfoo_d libbar_d" if(NOT "${library_deps}" STREQUAL "") - target_link_libraries(${name} INTERFACE "${library_deps}") + set(next_library_mode "") + foreach(library ${library_deps}) + string(TOLOWER "${library}" library_lower) + if(("${library_lower}" STREQUAL "optimized") OR + ("${library_lower}" STREQUAL "debug")) + set(next_library_mode "${library_lower}") + else() + if("${next_library_mode}" STREQUAL "optimized") + target_link_libraries(${name} optimized ${library}) + elseif("${next_library_mode}" STREQUAL "debug") + target_link_libraries(${name} debug ${library}) + else() + target_link_libraries(${name} ${library}) + endif() + set(next_library_mode "") + endif() + endforeach() endif() # works fine without having the includes @@ -404,6 +455,11 @@ function(setup_liblinks target ) + # NOTE: This might look like it affects global scope, accumulating linker flags on every call + # to setup_liblinks, but this isn't how CMake works. These flags will only affect current + # directory from where the function is called. + # This means that setup_liblinks() called for ffmpeg_test will not affect blender, and each + # of thsoe targets will have single set of linker flags. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE) @@ -416,201 +472,17 @@ function(setup_liblinks set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE) set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE) - # Work around undefined reference errors when disabling certain libraries. - # Finding the right order for all combinations of options is too hard, so - # we use --start-group and --end-group so the linker does not discard symbols - # too early. This appears to have no significant performance impact. - if(UNIX AND NOT APPLE) - target_link_libraries( - ${target} - -Wl,--start-group - ) - endif() - # jemalloc must be early in the list, to be before pthread (see T57998) if(WITH_MEM_JEMALLOC) target_link_libraries(${target} ${JEMALLOC_LIBRARIES}) endif() - target_link_libraries( - ${target} - ${PNG_LIBRARIES} - ${FREETYPE_LIBRARY} - ) - - - if(WITH_PYTHON) - target_link_libraries(${target} ${PYTHON_LINKFLAGS}) - target_link_libraries(${target} ${PYTHON_LIBRARIES}) - endif() - - if(WITH_LZO AND WITH_SYSTEM_LZO) - target_link_libraries(${target} ${LZO_LIBRARIES}) - endif() - if(WITH_SYSTEM_GLEW) - target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES}) - endif() - if(WITH_BULLET AND WITH_SYSTEM_BULLET) - target_link_libraries(${target} ${BULLET_LIBRARIES}) - endif() - if(WITH_AUDASPACE AND WITH_SYSTEM_AUDASPACE) - target_link_libraries(${target} ${AUDASPACE_C_LIBRARIES} ${AUDASPACE_PY_LIBRARIES}) - endif() - if(WITH_OPENAL) - target_link_libraries(${target} ${OPENAL_LIBRARY}) - endif() - if(WITH_FFTW3) - target_link_libraries(${target} ${FFTW3_LIBRARIES}) - endif() - if(WITH_JACK AND NOT WITH_JACK_DYNLOAD) - target_link_libraries(${target} ${JACK_LIBRARIES}) - endif() - if(WITH_CODEC_SNDFILE) - target_link_libraries(${target} ${LIBSNDFILE_LIBRARIES}) - endif() - if(WITH_SDL AND NOT WITH_SDL_DYNLOAD) - target_link_libraries(${target} ${SDL_LIBRARY}) - endif() - if(WITH_CYCLES_OSL) - target_link_libraries(${target} ${OSL_LIBRARIES}) - endif() - if(WITH_OPENVDB) - target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${BLOSC_LIBRARIES}) - endif() - if(WITH_USD) - # Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives - if(WIN32) - target_link_libraries(${target} ${USD_LIBRARIES}) - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /WHOLEARCHIVE:${USD_DEBUG_LIB}") - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /WHOLEARCHIVE:${USD_RELEASE_LIB}") - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /WHOLEARCHIVE:${USD_RELEASE_LIB}") - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /WHOLEARCHIVE:${USD_RELEASE_LIB}") - elseif(CMAKE_COMPILER_IS_GNUCXX) - target_link_libraries(${target} -Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive) - elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - target_link_libraries(${target} -Wl,-force_load ${USD_LIBRARIES}) - else() - message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}") - endif() - endif() - if(WITH_OPENIMAGEIO) - target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES}) - endif() - if(WITH_OPENIMAGEDENOISE) - target_link_libraries(${target} ${OPENIMAGEDENOISE_LIBRARIES}) - endif() - if(WITH_TBB) - target_link_libraries(${target} ${TBB_LIBRARIES}) - endif() - if(WITH_OPENCOLORIO) - target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES}) - endif() - if(WITH_OPENSUBDIV) - target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES}) - endif() - if(WITH_CYCLES_EMBREE) - target_link_libraries(${target} ${EMBREE_LIBRARIES}) - endif() - if(WITH_BOOST) - target_link_libraries(${target} ${BOOST_LIBRARIES}) - if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU) - target_link_libraries(${target} ${ICU_LIBRARIES}) - endif() - endif() - target_link_libraries(${target} ${JPEG_LIBRARIES}) - if(WITH_ALEMBIC) - target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES}) - endif() - if(WITH_IMAGE_TIFF) - target_link_libraries(${target} ${TIFF_LIBRARY}) - endif() - if(WITH_IMAGE_OPENEXR) - target_link_libraries(${target} ${OPENEXR_LIBRARIES}) - endif() - if(WITH_IMAGE_OPENJPEG) - target_link_libraries(${target} ${OPENJPEG_LIBRARIES}) - endif() - if(WITH_CODEC_FFMPEG) - target_link_libraries(${target} ${FFMPEG_LIBRARIES}) - endif() - if(WITH_OPENCOLLADA) - if(WIN32 AND NOT UNIX) - file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d") - target_link_libraries_debug(${target} "${OPENCOLLADA_LIBRARIES_DEBUG}") - target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}") - unset(OPENCOLLADA_LIBRARIES_DEBUG) - - file_list_suffix(PCRE_LIBRARIES_DEBUG "${PCRE_LIBRARIES}" "_d") - target_link_libraries_debug(${target} "${PCRE_LIBRARIES_DEBUG}") - target_link_libraries_optimized(${target} "${PCRE_LIBRARIES}") - unset(PCRE_LIBRARIES_DEBUG) - - if(EXPAT_LIB) - file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d") - target_link_libraries_debug(${target} "${EXPAT_LIB_DEBUG}") - target_link_libraries_optimized(${target} "${EXPAT_LIB}") - unset(EXPAT_LIB_DEBUG) - endif() - else() - target_link_libraries( - ${target} - ${OPENCOLLADA_LIBRARIES} - ${PCRE_LIBRARIES} - ${XML2_LIBRARIES} - ${EXPAT_LIB} - ) - endif() - endif() - if(WITH_LLVM) - target_link_libraries(${target} ${LLVM_LIBRARY}) - endif() if(WIN32 AND NOT UNIX) target_link_libraries(${target} ${PTHREADS_LIBRARIES}) endif() - if(UNIX AND NOT APPLE) - if(WITH_OPENMP_STATIC) - target_link_libraries(${target} ${OpenMP_LIBRARIES}) - endif() - if(WITH_INPUT_NDOF) - target_link_libraries(${target} ${NDOF_LIBRARIES}) - endif() - endif() - if(WITH_SYSTEM_GLOG) - target_link_libraries(${target} ${GLOG_LIBRARIES}) - endif() - if(WITH_SYSTEM_GFLAGS) - target_link_libraries(${target} ${GFLAGS_LIBRARIES}) - endif() - - # We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES depends on them.. - if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV) - target_link_libraries(${target} "extern_clew") - if(WITH_CUDA_DYNLOAD) - target_link_libraries(${target} "extern_cuew") - else() - target_link_libraries(${target} ${CUDA_CUDA_LIBRARY}) - endif() - endif() - - target_link_libraries( - ${target} - ${ZLIB_LIBRARIES} - ) - - # System libraries with no dependencies such as platform link libs or opengl should go last. - target_link_libraries(${target} - ${BLENDER_GL_LIBRARIES}) # target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS}) target_link_libraries(${target} ${PLATFORM_LINKLIBS}) - - # See comments above regarding --start-group. - if(UNIX AND NOT APPLE) - target_link_libraries( - ${target} - -Wl,--end-group - ) - endif() endfunction() macro(TEST_SSE_SUPPORT diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index e60760e6cfd..a4de3876243 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -132,13 +132,13 @@ if(WITH_FFTW3) set(FFTW3_LIBPATH ${FFTW3}/lib) endif() -set(PNG_LIBRARIES png) -set(JPEG_LIBRARIES jpeg) - set(ZLIB /usr) set(ZLIB_INCLUDE_DIRS "${ZLIB}/include") set(ZLIB_LIBRARIES z bz2) +set(PNG_LIBRARIES png ${ZLIB_LIBRARIES}) +set(JPEG_LIBRARIES jpeg) + set(FREETYPE ${LIBDIR}/freetype) set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2) set(FREETYPE_LIBPATH ${FREETYPE}/lib) @@ -228,10 +228,6 @@ if(WITH_OPENCOLLADA) # set(PCRE ${LIBDIR}/pcre) # set(PCRE_LIBPATH ${PCRE}/lib) set(PCRE_LIBRARIES pcre) - # libxml2 is used - # set(EXPAT ${LIBDIR}/expat) - # set(EXPAT_LIBPATH ${EXPAT}/lib) - set(EXPAT_LIB) endif() if(WITH_SDL) diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index d4a75e5e5c0..5d46ee751af 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -336,6 +336,11 @@ if(WITH_BOOST) set(BOOST_LIBRARIES ${Boost_LIBRARIES}) set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS}) set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB") + + if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU) + find_package(IcuLinux) + list(APPEND BOOST_LIBRARIES ${ICU_LIBRARIES}) + endif() endif() if(WITH_OPENIMAGEIO) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index f485490f300..b228930bfb1 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -225,7 +225,7 @@ windows_find_package(png) if(NOT PNG_FOUND) warn_hardcoded_paths(libpng) set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include) - set(PNG_LIBRARIES ${LIBDIR}/png/lib/libpng.lib) + set(PNG_LIBRARIES ${LIBDIR}/png/lib/libpng.lib ${ZLIB_LIBRARY}) set(PNG "${LIBDIR}/png") set(PNG_INCLUDE_DIRS "${PNG}/include") set(PNG_LIBPATH ${PNG}/lib) # not cmake defined @@ -269,21 +269,33 @@ if(WITH_OPENCOLLADA) ) set(OPENCOLLADA_LIBRARIES - ${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib - ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib - ${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib - ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib - ${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib - ${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib - ${OPENCOLLADA}/lib/opencollada/xml.lib - ${OPENCOLLADA}/lib/opencollada/buffer.lib - ${OPENCOLLADA}/lib/opencollada/ftoa.lib + optimized ${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib + optimized ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib + optimized ${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib + optimized ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib + optimized ${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib + optimized ${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib + optimized ${OPENCOLLADA}/lib/opencollada/xml.lib + optimized ${OPENCOLLADA}/lib/opencollada/buffer.lib + optimized ${OPENCOLLADA}/lib/opencollada/ftoa.lib + + debug ${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader_d.lib + debug ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework_d.lib + debug ${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils_d.lib + debug ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter_d.lib + debug ${OPENCOLLADA}/lib/opencollada/MathMLSolver_d.lib + debug ${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser_d.lib + debug ${OPENCOLLADA}/lib/opencollada/xml_d.lib + debug ${OPENCOLLADA}/lib/opencollada/buffer_d.lib + debug ${OPENCOLLADA}/lib/opencollada/ftoa_d.lib ) list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib) set(PCRE_LIBRARIES - ${OPENCOLLADA}/lib/opencollada/pcre.lib + optimized ${OPENCOLLADA}/lib/opencollada/pcre.lib + + debug ${OPENCOLLADA}/lib/opencollada/pcre_d.lib ) endif() diff --git a/extern/ceres/CMakeLists.txt b/extern/ceres/CMakeLists.txt index 4ab3bffb705..009445ea690 100644 --- a/extern/ceres/CMakeLists.txt +++ b/extern/ceres/CMakeLists.txt @@ -257,7 +257,8 @@ set(SRC ) set(LIB - extern_glog + ${GLOG_LIBRARIES} + ${GFLAGS_LIBRARIES} ) if(WITH_LIBMV_SCHUR_SPECIALIZATIONS) diff --git a/extern/ceres/bundle.sh b/extern/ceres/bundle.sh index bf5a43852b5..02af59faf28 100755 --- a/extern/ceres/bundle.sh +++ b/extern/ceres/bundle.sh @@ -136,7 +136,8 @@ ${headers} ) set(LIB - extern_glog + \${GLOG_LIBRARIES} + \${GFLAGS_LIBRARIES} ) if(WITH_LIBMV_SCHUR_SPECIALIZATIONS) diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt index aab1fdd0219..d2f78f7ab6c 100644 --- a/extern/mantaflow/CMakeLists.txt +++ b/extern/mantaflow/CMakeLists.txt @@ -73,6 +73,9 @@ if(WITH_TBB) list(APPEND INC_SYS ${TBB_INCLUDE_DIRS} ) + list(APPEND LIB + ${TBB_LIBRARIES} + ) endif() if(WITH_OPENVDB) @@ -81,6 +84,18 @@ if(WITH_OPENVDB) ${OPENEXR_INCLUDE_DIRS} ${OPENVDB_INCLUDE_DIRS} ) + list(APPEND LIB + ${OPENVDB_LIBRARIES} + ${OPENEXR_LIBRARIES} + ${ZLIB_LIBRARIES} + ${BOOST_LIBRARIES} + ) + if(WITH_OPENVDB_BLOSC) + list(APPEND LIB + ${BLOSC_LIBRARIES} + ${ZLIB_LIBRARIES} + ) + endif() endif() set(SRC @@ -207,6 +222,8 @@ set(SRC ) set(LIB + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) blender_add_lib(extern_mantaflow "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/extern/quadriflow/CMakeLists.txt b/extern/quadriflow/CMakeLists.txt index 0f10b8fe707..bf64e5edb67 100644 --- a/extern/quadriflow/CMakeLists.txt +++ b/extern/quadriflow/CMakeLists.txt @@ -105,6 +105,7 @@ set(SRC ) set(LIB + ${BOOST_LIBRARIES} ) blender_add_lib(extern_quadriflow "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index 1972a5fc94c..254fb5ecf19 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -50,6 +50,11 @@ if(NOT WITH_SYSTEM_AUDASPACE) extern_sdlew ) endif() +else() + list(APPEND LIB + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} + ) endif() if(WITH_PYTHON) @@ -60,6 +65,10 @@ if(WITH_PYTHON) intern/AUD_PyInit.cpp intern/AUD_PyInit.h ) + list(APPEND LIB + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} + ) if(NOT WITH_SYSTEM_AUDASPACE) list(APPEND LIB audaspace-py diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index 09379bf2017..b6ecab28555 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -49,11 +49,15 @@ set(LIB cycles_render cycles_subd cycles_util + + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) if(WITH_CYCLES_LOGGING) list(APPEND LIB - extern_glog + ${GLOG_LIBRARIES} + ${GFLAGS_LIBRARIES} ) endif() diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt index 27a7f604e1c..fb724704a84 100644 --- a/intern/cycles/bvh/CMakeLists.txt +++ b/intern/cycles/bvh/CMakeLists.txt @@ -39,9 +39,16 @@ set(SRC_HEADERS set(LIB cycles_render + cycles_util ) include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) +if(WITH_CYCLES_EMBREE) + list(APPEND LIB + ${EMBREE_LIBRARIES} + ) +endif() + cycles_add_library(cycles_bvh "${LIB}" ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake index 0efd8bb7ea8..13328a8b6bf 100644 --- a/intern/cycles/cmake/macros.cmake +++ b/intern/cycles/cmake/macros.cmake @@ -8,8 +8,64 @@ endfunction() macro(cycles_add_library target library_deps) add_library(${target} ${ARGN}) - if(NOT ("${library_deps}" STREQUAL "")) - target_link_libraries(${target} "${library_deps}") + + # On Windows certain libraries have two sets of binaries: one for debug builds and one for + # release builds. The root of this requirement goes into ABI, I believe, but that's outside + # of a scope of this comment. + # + # CMake have a native way of dealing with this, which is specifying what build type the + # libraries are provided for: + # + # target_link_libraries(tagret optimized|debug|general <libraries>) + # + # The build type is to be provided as a separate argument to the function. + # + # CMake's variables for libraries will contain build type in such cases. For example: + # + # set(FOO_LIBRARIES optimized libfoo.lib debug libfoo_d.lib) + # + # Complications starts with a single argument for library_deps: all the elements are being + # put to a list: "${FOO_LIBRARIES}" will become "optimized;libfoo.lib;debug;libfoo_d.lib". + # This makes it impossible to pass it as-is to target_link_libraries sine it will treat + # this argument as a list of libraries to be linked against, causing missing libraries + # for optimized.lib. + # + # What this code does it traverses library_deps and extracts information about whether + # library is to provided as general, debug or optimized. This is a little state machine which + # keeps track of whiuch build type library is to provided for: + # + # - If "debug" or "optimized" word is found, the next element in the list is expected to be + # a library which will be passed to target_link_libraries() under corresponding build type. + # + # - If there is no "debug" or "optimized" used library is specified for all build types. + # + # NOTE: If separated libraries for debug and release ar eneeded every library is the list are + # to be prefixed explicitly. + # + # Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d" + # NOT: "optimized libfoo libbar debug libfoo_d libbar_d" + # + # TODO(sergey): This is the same as Blender's side CMake. Find a way to avoid duplication + # somehow in a way which allows to have Cycles standalone. + if(NOT "${library_deps}" STREQUAL "") + set(next_library_mode "") + foreach(library ${library_deps}) + string(TOLOWER "${library}" library_lower) + if(("${library_lower}" STREQUAL "optimized") OR + ("${library_lower}" STREQUAL "debug")) + set(next_library_mode "${library_lower}") + else() + if("${next_library_mode}" STREQUAL "optimized") + target_link_libraries(${target} optimized ${library}) + elseif("${next_library_mode}" STREQUAL "debug") + target_link_libraries(${target} debug ${library}) + else() + target_link_libraries(${target} ${library}) + endif() + set(next_library_mode "") + endif() + endforeach() endif() + cycles_set_solution_folder(${target}) endmacro() diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt index a8c4949ad07..35a79356957 100644 --- a/intern/cycles/device/CMakeLists.txt +++ b/intern/cycles/device/CMakeLists.txt @@ -60,7 +60,9 @@ set(SRC_HEADERS ) set(LIB - + cycles_render + cycles_kernel + cycles_util ) if(WITH_CUDA_DYNLOAD) diff --git a/intern/cycles/graph/CMakeLists.txt b/intern/cycles/graph/CMakeLists.txt index c6c46941598..9ff1c5b98c6 100644 --- a/intern/cycles/graph/CMakeLists.txt +++ b/intern/cycles/graph/CMakeLists.txt @@ -17,7 +17,7 @@ set(SRC_HEADERS ) set(LIB - + cycles_util ) include_directories(${INC}) diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt index 35cca2da8ad..5be5bd181ec 100644 --- a/intern/cycles/kernel/osl/CMakeLists.txt +++ b/intern/cycles/kernel/osl/CMakeLists.txt @@ -27,6 +27,10 @@ set(HEADER_SRC set(LIB cycles_render + + ${OSL_LIBRARIES} + ${OPENIMAGEIO_LIBRARIES} + ${LLVM_LIBRARY} ) include_directories(${INC}) diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt index 53196b013f6..92578b888a6 100644 --- a/intern/cycles/render/CMakeLists.txt +++ b/intern/cycles/render/CMakeLists.txt @@ -77,6 +77,9 @@ set(SRC_HEADERS set(LIB cycles_bvh + cycles_device + cycles_subd + cycles_util ) if(WITH_CYCLES_OSL) diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index ec2e84268be..cc671e31f92 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -112,6 +112,9 @@ if(WITH_INPUT_NDOF) list(APPEND INC_SYS ${NDOF_INCLUDE_DIRS} ) + list(APPEND LIB + ${NDOF_LIBRARIES} + ) endif() if(WITH_HEADLESS OR WITH_GHOST_SDL) @@ -141,6 +144,11 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} ) + if(NOT WITH_SDL_DYNLOAD) + list(APPEND LIB + ${SDL_LIBRARY} + ) + endif() endif() elseif(APPLE AND NOT WITH_X11) diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt index e16e27368d0..f587aee615b 100644 --- a/intern/libmv/CMakeLists.txt +++ b/intern/libmv/CMakeLists.txt @@ -38,6 +38,8 @@ set(LIB ) if(WITH_LIBMV) + setup_libdirs() + if(WIN32) add_definitions(-D_USE_MATH_DEFINES) endif() @@ -62,7 +64,10 @@ if(WITH_LIBMV) list(APPEND LIB extern_ceres - extern_glog + + ${GLOG_LIBRARIES} + ${GFLAGS_LIBRARIES} + ${PNG_LIBRARIES} ) add_definitions( diff --git a/intern/libmv/bundle.sh b/intern/libmv/bundle.sh index 08bdf491d3b..2601a2d6754 100755 --- a/intern/libmv/bundle.sh +++ b/intern/libmv/bundle.sh @@ -117,6 +117,8 @@ set(LIB ) if(WITH_LIBMV) + setup_libdirs() + add_definitions(\${GFLAGS_DEFINES}) add_definitions(\${GLOG_DEFINES}) add_definitions(\${CERES_DEFINES}) @@ -138,7 +140,10 @@ if(WITH_LIBMV) list(APPEND LIB extern_ceres - extern_glog + + \${GLOG_LIBRARIES} + \${GFLAGS_LIBRARIES} + \${PNG_LIBRARIES} ) add_definitions( diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt index 5c5da31482d..732fa1e4d11 100644 --- a/intern/locale/CMakeLists.txt +++ b/intern/locale/CMakeLists.txt @@ -53,6 +53,9 @@ if(WITH_INTERNATIONAL) list(APPEND INC_SYS ${BOOST_INCLUDE_DIR} ) + list(APPEND LIB + ${BOOST_LIBRARIES} + ) add_definitions(-DWITH_INTERNATIONAL) add_definitions(${BOOST_DEFINITIONS}) endif() diff --git a/intern/mantaflow/CMakeLists.txt b/intern/mantaflow/CMakeLists.txt index 9fdd8b59aca..c7b3c56c3c2 100644 --- a/intern/mantaflow/CMakeLists.txt +++ b/intern/mantaflow/CMakeLists.txt @@ -62,6 +62,10 @@ set(SRC set(LIB extern_mantaflow + + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} + ${ZLIB_LIBRARIES} ) blender_add_lib(bf_intern_mantaflow "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/opencolorio/CMakeLists.txt b/intern/opencolorio/CMakeLists.txt index 4d95c1b701b..d2336692d22 100644 --- a/intern/opencolorio/CMakeLists.txt +++ b/intern/opencolorio/CMakeLists.txt @@ -59,6 +59,10 @@ if(WITH_OPENCOLORIO) ocio_impl_glsl.cc ) + list(APPEND LIB + ${OPENCOLORIO_LIBRARIES} + ) + if(WIN32) list(APPEND INC_SYS ${BOOST_INCLUDE_DIR} @@ -66,6 +70,9 @@ if(WITH_OPENCOLORIO) add_definitions( -DOpenColorIO_STATIC ) + list(APPEND LIB + ${BOOST_LIBRARIES} + ) endif() data_to_c_simple(gpu_shader_display_transform.glsl SRC) diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt index 69f4bad62b2..268b4e31d7d 100644 --- a/intern/opensubdiv/CMakeLists.txt +++ b/intern/opensubdiv/CMakeLists.txt @@ -83,6 +83,16 @@ if(WITH_OPENSUBDIV) internal/opensubdiv_util.h ) + list(APPEND LIB + ${OPENSUBDIV_LIBRARIES} + ) + + if(WITH_OPENMP_STATIC) + list(APPEND LIB + ${OpenMP_LIBRARIES} + ) + endif() + OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP) # TODO(sergey): OpenCL is not tested and totally unstable atm. # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL) diff --git a/intern/openvdb/CMakeLists.txt b/intern/openvdb/CMakeLists.txt index fdc57d1a282..a681d723b9c 100644 --- a/intern/openvdb/CMakeLists.txt +++ b/intern/openvdb/CMakeLists.txt @@ -77,11 +77,26 @@ if(WITH_OPENVDB) openvdb_util.h ) + list(APPEND LIB + ${OPENVDB_LIBRARIES} + ${OPENEXR_LIBRARIES} + ${ZLIB_LIBRARIES} + ) + if(WITH_OPENVDB_BLOSC) add_definitions( -DWITH_OPENVDB_BLOSC ) + list(APPEND LIB + ${BLOSC_LIBRARIES} + ${ZLIB_LIBRARIES} + ) endif() + + list(APPEND LIB + ${BOOST_LIBRARIES} + ${TBB_LIBRARIES} + ) endif() blender_add_lib(bf_intern_openvdb "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/quadriflow/CMakeLists.txt b/intern/quadriflow/CMakeLists.txt index 35cfe22a018..5fe60f3eda2 100644 --- a/intern/quadriflow/CMakeLists.txt +++ b/intern/quadriflow/CMakeLists.txt @@ -36,6 +36,7 @@ set(SRC set(LIB extern_quadriflow + ${BOOST_LIBRARIES} ) if(WIN32) diff --git a/intern/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt index cf9b70448e0..77d88548e1b 100644 --- a/intern/rigidbody/CMakeLists.txt +++ b/intern/rigidbody/CMakeLists.txt @@ -33,6 +33,7 @@ set(SRC ) set(LIB + ${BULLET_LIBRARIES} ) blender_add_lib(bf_intern_rigidbody "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt index 82812fb81cf..4618246013a 100644 --- a/source/blender/alembic/CMakeLists.txt +++ b/source/blender/alembic/CMakeLists.txt @@ -75,10 +75,20 @@ set(SRC set(LIB bf_blenkernel bf_blenlib + + ${ALEMBIC_LIBRARIES} + ${OPENEXR_LIBRARIES} ) if(WITH_ALEMBIC_HDF5) add_definitions(-DWITH_ALEMBIC_HDF5) + list(APPEND LIB + ${HDF5_LIBRARIES} + ) endif() +list(APPEND LIB + ${BOOST_LIBRARIES} +) + blender_add_lib(bf_alembic "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index 721905ec9d4..eafb299944d 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -47,6 +47,7 @@ set(SRC ) set(LIB + ${JPEG_LIBRARIES} ) blender_add_lib(bf_avi "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index ba8697a44b6..fa02d6d21c9 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -54,6 +54,8 @@ set(SRC set(LIB bf_gpu bf_intern_guardedalloc + + ${FREETYPE_LIBRARY} ) if(WIN32) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 3db878ab95f..61aeb51a197 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -423,6 +423,10 @@ if(WITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} ) + list(APPEND LIB + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} + ) endif() if(WITH_BULLET) @@ -435,6 +439,8 @@ if(WITH_BULLET) list(APPEND LIB bf_intern_rigidbody extern_bullet + + ${BULLET_LIBRARIES} ) add_definitions(-DWITH_BULLET) endif() @@ -489,6 +495,9 @@ if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) + list(APPEND LIB + ${FFMPEG_LIBRARIES} + ) add_definitions(-DWITH_FFMPEG) remove_strict_c_flags_file( @@ -542,6 +551,9 @@ if(WITH_LZO) list(APPEND INC_SYS ${LZO_INCLUDE_DIR} ) + list(APPEND LIB + ${LZO_LIBRARIES} + ) add_definitions(-DWITH_SYSTEM_LZO) else() list(APPEND INC_SYS @@ -572,6 +584,9 @@ if(WITH_FFTW3) list(APPEND INC_SYS ${FFTW3_INCLUDE_DIRS} ) + list(APPEND LIB + ${FFTW3_LIBRARIES} + ) add_definitions(-DFFTW3=1) endif() @@ -594,6 +609,9 @@ if(WITH_OPENSUBDIV) list(APPEND INC_SYS ${OPENSUBDIV_INCLUDE_DIRS} ) + list(APPEND LIB + ${OPENSUBDIV_LIBRARIES} + ) add_definitions(-DWITH_OPENSUBDIV) endif() @@ -629,6 +647,9 @@ if(WITH_TBB) list(APPEND INC_SYS ${TBB_INCLUDE_DIRS} ) + list(APPEND LIB + ${TBB_LIBRARIES} + ) endif() # # Warnings as errors, this is too strict! diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index f3740b5d39f..d22b1cd0ddb 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -261,6 +261,8 @@ set(LIB bf_intern_guardedalloc bf_intern_numaapi extern_wcwidth + + ${FREETYPE_LIBRARY} ) if(WITH_MEM_VALGRIND) diff --git a/source/blender/blentranslation/msgfmt/CMakeLists.txt b/source/blender/blentranslation/msgfmt/CMakeLists.txt index 0361137f5b1..147c375aa6e 100644 --- a/source/blender/blentranslation/msgfmt/CMakeLists.txt +++ b/source/blender/blentranslation/msgfmt/CMakeLists.txt @@ -30,6 +30,7 @@ set(SRC msgfmt.c ) +setup_libdirs() add_cc_flags_custom_test(msgfmt) if(APPLE) diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index 00954eb400c..35c33837d64 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -183,6 +183,8 @@ if(WITH_BULLET) ) list(APPEND LIB extern_bullet + + ${BULLET_LIBRARIES} ) add_definitions(-DWITH_BULLET) endif() diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index 40762db759e..a88fd05a18f 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -126,6 +126,9 @@ set(SRC ) set(LIB + ${OPENCOLLADA_LIBRARIES} + ${PCRE_LIBRARIES} + ${XML2_LIBRARIES} ) if(WITH_BUILDINFO) diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index ed14397f73c..8d609d545f8 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -568,6 +568,10 @@ if(WITH_OPENIMAGEDENOISE) ${OPENIMAGEDENOISE_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ) + list(APPEND LIB + ${OPENIMAGEDENOISE_LIBRARIES} + ${TBB_LIBRARIES} + ) endif() blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index 7f4b5a45aa3..b4099edce68 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -47,6 +47,9 @@ if(WITH_AUDASPACE) ) list(APPEND LIB bf_intern_audaspace + + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} ) add_definitions(-DWITH_AUDASPACE) endif() diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index f4d31886e3f..8170c920990 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -56,6 +56,9 @@ if(WITH_AUDASPACE) ) list(APPEND LIB bf_intern_audaspace + + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} ) add_definitions(-DWITH_AUDASPACE) endif() diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index 84ded1dd2c7..da7d9e2a8f3 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -62,6 +62,10 @@ if(WITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} ) + list(APPEND LIB + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} + ) endif() if(WITH_INTERNATIONAL) diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index ba5172c7916..8270476e9dd 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -549,6 +549,9 @@ set(SRC set(LIB bf_python_mathutils + + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) set(INC diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 8daeda67c80..25f9ef886e9 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -129,6 +129,7 @@ set(SRC ) set(LIB + ${BLENDER_GL_LIBRARIES} ) if(NOT WITH_SYSTEM_GLEW) diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index b8d43b8e9c2..7aab644fc12 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -90,6 +90,9 @@ set(LIB bf_intern_guardedalloc bf_intern_memutil bf_intern_opencolorio + + ${PNG_LIBRARIES} + ${JPEG_LIBRARIES} ) if(WITH_IMAGE_OPENEXR) @@ -110,6 +113,9 @@ if(WITH_IMAGE_TIFF) list(APPEND SRC intern/tiff.c ) + list(APPEND LIB + ${TIFF_LIBRARY} + ) add_definitions(-DWITH_TIFF) endif() @@ -128,6 +134,9 @@ if(WITH_IMAGE_OPENJPEG) list(APPEND SRC intern/jp2.c ) + list(APPEND LIB + ${OPENJPEG_LIBRARIES} + ) add_definitions(-DWITH_OPENJPEG ${OPENJPEG_DEFINES}) endif() @@ -149,6 +158,10 @@ if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) + list(APPEND LIB + ${FFMPEG_LIBRARIES} + ${OPENJPEG_LIBRARIES} + ) add_definitions(-DWITH_FFMPEG) remove_strict_c_flags_file( diff --git a/source/blender/imbuf/intern/oiio/CMakeLists.txt b/source/blender/imbuf/intern/oiio/CMakeLists.txt index 984e62bc75a..211b6a0b40e 100644 --- a/source/blender/imbuf/intern/oiio/CMakeLists.txt +++ b/source/blender/imbuf/intern/oiio/CMakeLists.txt @@ -47,11 +47,22 @@ if(WITH_OPENIMAGEIO) ${OPENIMAGEIO_INCLUDE_DIRS} ${BOOST_INCLUDE_DIR} ) + list(APPEND LIB + ${OPENIMAGEIO_LIBRARIES} + ) if(WITH_IMAGE_OPENEXR) list(APPEND INC_SYS ${OPENEXR_INCLUDE_DIRS} ) + list(APPEND LIB + ${OPENEXR_LIBRARIES} + ) endif() + + list(APPEND LIB + ${BOOST_LIBRARIES} + ) + add_definitions(-DWITH_OPENIMAGEIO) endif() diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index fc584ace81e..a84f31c7025 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -47,6 +47,9 @@ if(WITH_IMAGE_OPENEXR) list(APPEND INC_SYS ${OPENEXR_INCLUDE_DIRS} ) + list(APPEND LIB + ${OPENEXR_LIBRARIES} + ) add_definitions(-DWITH_OPENEXR) endif() diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 3082daa83a4..b2f1f6c651d 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -228,6 +228,10 @@ if(WITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} ) + list(APPEND LIB + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} + ) endif() if(WITH_CODEC_FFMPEG) @@ -237,6 +241,9 @@ if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) + list(APPEND LIB + ${FFMPEG_LIBRARIES} + ) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 2eb2a6b380a..e15eb5af2c4 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -275,6 +275,10 @@ if(WITH_PYTHON) list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS} ) + list(APPEND LIB + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} + ) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/physics/CMakeLists.txt b/source/blender/physics/CMakeLists.txt index edcfdceb697..10520a18513 100644 --- a/source/blender/physics/CMakeLists.txt +++ b/source/blender/physics/CMakeLists.txt @@ -48,4 +48,10 @@ set(SRC set(LIB ) +if(WITH_OPENMP_STATIC) + list(APPEND LIB + ${OpenMP_LIBRARIES} + ) +endif() + blender_add_lib(bf_physics "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt index 3875057185a..818498fe7db 100644 --- a/source/blender/python/bmesh/CMakeLists.txt +++ b/source/blender/python/bmesh/CMakeLists.txt @@ -55,6 +55,9 @@ set(LIB bf_blenkernel bf_blenlib bf_python_mathutils + + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) if(WITH_FREESTYLE) diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index c878103e19d..822f05bad90 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -50,6 +50,8 @@ set(SRC set(LIB ${GLEW_LIBRARY} + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/python/gpu/CMakeLists.txt b/source/blender/python/gpu/CMakeLists.txt index ca0e6ced42b..22a3d3a79de 100644 --- a/source/blender/python/gpu/CMakeLists.txt +++ b/source/blender/python/gpu/CMakeLists.txt @@ -55,6 +55,8 @@ set(SRC ) set(LIB + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 012492fe9a7..adcda710622 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -123,6 +123,9 @@ set(LIB bf_editor_interface bf_editor_space_api bf_python_gpu + + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) # only to check if buildinfo is available @@ -156,6 +159,9 @@ if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) + list(APPEND LIB + ${FFMPEG_LIBRARIES} + ) add_definitions(-DWITH_FFMPEG) endif() @@ -240,6 +246,11 @@ if(WITH_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} ) + if(NOT WITH_SDL_DYNLOAD) + list(APPEND LIB + ${SDL_LIBRARY} + ) + endif() add_definitions(-DWITH_SDL) endif() diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt index cdb562a3233..e34432f0c54 100644 --- a/source/blender/python/mathutils/CMakeLists.txt +++ b/source/blender/python/mathutils/CMakeLists.txt @@ -58,6 +58,9 @@ set(SRC set(LIB bf_blenlib bf_python_ext + + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} ) diff --git a/source/blender/usd/CMakeLists.txt b/source/blender/usd/CMakeLists.txt index 12d281f643d..1d72593f829 100644 --- a/source/blender/usd/CMakeLists.txt +++ b/source/blender/usd/CMakeLists.txt @@ -78,4 +78,36 @@ set(LIB bf_blenlib ) +# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives +if(WIN32) + list(APPEND LIB + ${USD_LIBRARIES} + ) +elseif(CMAKE_COMPILER_IS_GNUCXX) + list(APPEND LIB + -Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive + ) +elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + list(APPEND LIB + -Wl,-force_load ${USD_LIBRARIES} + ) +else() + message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}") +endif() + +list(APPEND LIB + ${BOOST_LIBRARIES} +) + +list(APPEND LIB + ${TBB_LIBRARIES} +) + blender_add_lib(bf_usd "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +if(WIN32) + set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /WHOLEARCHIVE:${USD_DEBUG_LIB}") + set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /WHOLEARCHIVE:${USD_RELEASE_LIB}") + set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /WHOLEARCHIVE:${USD_RELEASE_LIB}") + set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /WHOLEARCHIVE:${USD_RELEASE_LIB}") +endif() diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index d84b0f795ec..e7a4ca9a005 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -123,6 +123,10 @@ if(WITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} ) + list(APPEND LIB + ${AUDASPACE_C_LIBRARIES} + ${AUDASPACE_PY_LIBRARIES} + ) endif() add_definitions(${GL_DEFINITIONS}) @@ -139,6 +143,9 @@ if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) + list(APPEND LIB + ${FFMPEG_LIBRARIES} + ) add_definitions(-DWITH_FFMPEG) endif() diff --git a/tests/gtests/alembic/CMakeLists.txt b/tests/gtests/alembic/CMakeLists.txt index 57b1fb52022..f8b2c373029 100644 --- a/tests/gtests/alembic/CMakeLists.txt +++ b/tests/gtests/alembic/CMakeLists.txt @@ -37,6 +37,9 @@ set(LIB bf_intern_opencolorio # Should not be needed but gives windows linker errors if the ocio libs are linked before this bf_gpu # Should not be needed but gives windows linker errors if the ocio libs are linked before this bf_alembic + + ${OPENEXR_LIBRARIES} + ${BOOST_LIBRARIES} ) include_directories(${INC}) diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt index 1f52886132f..c6b23615a5a 100644 --- a/tests/gtests/blenlib/CMakeLists.txt +++ b/tests/gtests/blenlib/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC ../../../intern/atomic ) +setup_libdirs() include_directories(${INC}) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}") diff --git a/tests/gtests/usd/CMakeLists.txt b/tests/gtests/usd/CMakeLists.txt index 21bd2aba07f..3850d279b3c 100644 --- a/tests/gtests/usd/CMakeLists.txt +++ b/tests/gtests/usd/CMakeLists.txt @@ -52,6 +52,9 @@ set(LIB bf_gpu bf_usd + + ${BOOST_LIBRARIES} + ${TBB_LIBRARIES} ) include_directories(${INC}) |