Commit: 29450a2af3dd1f3f52de82cfe689da22a6100e6d
Author: Brecht Van Lommel
Date:   Wed Jan 12 19:32:02 2022 +0100
Branches: master
https://developer.blender.org/rB29450a2af3dd1f3f52de82cfe689da22a6100e6d

Build: remove usage of link_directories

We are now always using absolute paths for libraries, as recommended by the
CMake docs.

Followup to D9177.

===================================================================

M       build_files/cmake/macros.cmake
M       intern/cycles/app/CMakeLists.txt
M       intern/cycles/cmake/macros.cmake
M       intern/cycles/test/CMakeLists.txt
M       intern/libmv/CMakeLists.txt
M       intern/libmv/bundle.sh
M       source/blender/blenlib/tests/performance/CMakeLists.txt
M       source/blender/blentranslation/msgfmt/CMakeLists.txt
M       source/blender/datatoc/CMakeLists.txt
M       source/creator/CMakeLists.txt
M       tests/gtests/runner/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 25a8b66af51..e0219cd1121 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -488,7 +488,6 @@ function(blender_add_test_executable
 
   include_directories(${includes})
   include_directories(${includes_sys})
-  setup_libdirs()
 
   BLENDER_SRC_GTEST_EX(
     NAME ${name}
@@ -525,83 +524,6 @@ function(setup_heavy_lib_pool)
   endif()
 endfunction()
 
-function(SETUP_LIBDIRS)
-
-  # NOTE: For all new libraries, use absolute library paths.
-  # This should eventually be phased out.
-  # APPLE platform uses full paths for linking libraries, and avoids 
link_directories.
-  if(NOT MSVC AND NOT APPLE)
-    link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} 
${FREETYPE_LIBPATH})
-
-    if(WITH_PYTHON)  #  AND NOT WITH_PYTHON_MODULE  # WIN32 needs
-      link_directories(${PYTHON_LIBPATH})
-    endif()
-    if(WITH_SDL AND NOT WITH_SDL_DYNLOAD)
-      link_directories(${SDL_LIBPATH})
-    endif()
-    if(WITH_CODEC_FFMPEG)
-      link_directories(${FFMPEG_LIBPATH})
-    endif()
-    if(WITH_IMAGE_OPENEXR)
-      link_directories(${OPENEXR_LIBPATH})
-    endif()
-    if(WITH_IMAGE_TIFF)
-      link_directories(${TIFF_LIBPATH})
-    endif()
-    if(WITH_BOOST)
-      link_directories(${BOOST_LIBPATH})
-    endif()
-    if(WITH_OPENIMAGEIO)
-      link_directories(${OPENIMAGEIO_LIBPATH})
-    endif()
-    if(WITH_OPENIMAGEDENOISE)
-      link_directories(${OPENIMAGEDENOISE_LIBPATH})
-    endif()
-    if(WITH_OPENCOLORIO)
-      link_directories(${OPENCOLORIO_LIBPATH})
-    endif()
-    if(WITH_OPENVDB)
-      link_directories(${OPENVDB_LIBPATH})
-    endif()
-    if(WITH_OPENAL)
-      link_directories(${OPENAL_LIBPATH})
-    endif()
-    if(WITH_JACK AND NOT WITH_JACK_DYNLOAD)
-      link_directories(${JACK_LIBPATH})
-    endif()
-    if(WITH_PULSEAUDIO AND NOT WITH_PULSEAUDIO_DYNLOAD)
-      link_directories(${LIBPULSE_LIBPATH})
-    endif()
-    if(WITH_CODEC_SNDFILE)
-      link_directories(${LIBSNDFILE_LIBPATH})
-    endif()
-    if(WITH_FFTW3)
-      link_directories(${FFTW3_LIBPATH})
-    endif()
-    if(WITH_OPENCOLLADA)
-      link_directories(${OPENCOLLADA_LIBPATH})
-      # # Never set
-      # link_directories(${PCRE_LIBPATH})
-      # link_directories(${EXPAT_LIBPATH})
-    endif()
-    if(WITH_LLVM)
-      link_directories(${LLVM_LIBPATH})
-    endif()
-
-    if(WITH_ALEMBIC)
-      link_directories(${ALEMBIC_LIBPATH})
-    endif()
-
-    if(WITH_GMP)
-      link_directories(${GMP_LIBPATH})
-    endif()
-
-    if(WIN32 AND NOT UNIX)
-      link_directories(${PTHREADS_LIBPATH})
-    endif()
-  endif()
-endfunction()
-
 # Platform specific linker flags for targets.
 function(setup_platform_linker_flags
   target)
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 50600793854..781639986f6 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -51,8 +51,6 @@ list(APPEND LIBRARIES ${CYCLES_GL_LIBRARIES})
 
 # Common configuration.
 
-cycles_link_directories()
-
 add_definitions(${GL_DEFINITIONS})
 
 include_directories(${INC})
diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake
index 044058a25a8..5619f7bab72 100644
--- a/intern/cycles/cmake/macros.cmake
+++ b/intern/cycles/cmake/macros.cmake
@@ -84,39 +84,6 @@ macro(cycles_add_library target library_deps)
   cycles_set_solution_folder(${target})
 endmacro()
 
-# Cycles library dependencies common to all executables
-
-function(cycles_link_directories)
-  if(APPLE)
-    # APPLE platform uses full paths for linking libraries, and avoids 
link_directories.
-    return()
-  endif()
-
-  if(WITH_OPENCOLORIO)
-    link_directories(${OPENCOLORIO_LIBPATH})
-  endif()
-  if(WITH_OPENVDB)
-    link_directories(${OPENVDB_LIBPATH} ${BLOSC_LIBPATH})
-  endif()
-  if(WITH_OPENSUBDIV)
-    link_directories(${OPENSUBDIV_LIBPATH})
-  endif()
-  if(WITH_OPENIMAGEDENOISE)
-    link_directories(${OPENIMAGEDENOISE_LIBPATH})
-  endif()
-
-  link_directories(
-    ${OPENIMAGEIO_LIBPATH}
-    ${BOOST_LIBPATH}
-    ${PNG_LIBPATH}
-    ${JPEG_LIBPATH}
-    ${ZLIB_LIBPATH}
-    ${TIFF_LIBPATH}
-    ${OPENEXR_LIBPATH}
-    ${OPENJPEG_LIBPATH}
-  )
-endfunction()
-
 macro(cycles_target_link_libraries target)
   if(WITH_CYCLES_LOGGING)
     target_link_libraries(${target} ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES})
diff --git a/intern/cycles/test/CMakeLists.txt 
b/intern/cycles/test/CMakeLists.txt
index 634daab5dc1..c6c992008a0 100644
--- a/intern/cycles/test/CMakeLists.txt
+++ b/intern/cycles/test/CMakeLists.txt
@@ -38,8 +38,6 @@ set(ALL_CYCLES_LIBRARIES
 )
 include_directories(${INC})
 
-cycles_link_directories()
-
 set(SRC
   integrator_adaptive_sampling_test.cpp
   integrator_render_scheduler_test.cpp
diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt
index 596e8efa082..cd5565fbe16 100644
--- a/intern/libmv/CMakeLists.txt
+++ b/intern/libmv/CMakeLists.txt
@@ -38,8 +38,6 @@ set(LIB
 )
 
 if(WITH_LIBMV)
-  setup_libdirs()
-
   if(WIN32)
     add_definitions(-D_USE_MATH_DEFINES)
   endif()
diff --git a/intern/libmv/bundle.sh b/intern/libmv/bundle.sh
index b728d038c5b..fecae324a0a 100755
--- a/intern/libmv/bundle.sh
+++ b/intern/libmv/bundle.sh
@@ -118,8 +118,6 @@ set(LIB
 )
 
 if(WITH_LIBMV)
-  setup_libdirs()
-
   if(WIN32)
     add_definitions(-D_USE_MATH_DEFINES)
   endif()
diff --git a/source/blender/blenlib/tests/performance/CMakeLists.txt 
b/source/blender/blenlib/tests/performance/CMakeLists.txt
index 5342dbe286c..036955a4b43 100644
--- a/source/blender/blenlib/tests/performance/CMakeLists.txt
+++ b/source/blender/blenlib/tests/performance/CMakeLists.txt
@@ -23,7 +23,6 @@ set(INC
   ..
 )
 
-setup_libdirs()
 include_directories(${INC})
 
 BLENDER_TEST_PERFORMANCE(BLI_ghash_performance "bf_blenlib")
diff --git a/source/blender/blentranslation/msgfmt/CMakeLists.txt 
b/source/blender/blentranslation/msgfmt/CMakeLists.txt
index 4b8f0878c75..a535d5b8e2d 100644
--- a/source/blender/blentranslation/msgfmt/CMakeLists.txt
+++ b/source/blender/blentranslation/msgfmt/CMakeLists.txt
@@ -30,7 +30,6 @@ set(SRC
   msgfmt.c
 )
 
-setup_libdirs()
 add_cc_flags_custom_test(msgfmt)
 
 if(WIN32)
diff --git a/source/blender/datatoc/CMakeLists.txt 
b/source/blender/datatoc/CMakeLists.txt
index 8411a1a468e..756ab15b163 100644
--- a/source/blender/datatoc/CMakeLists.txt
+++ b/source/blender/datatoc/CMakeLists.txt
@@ -52,10 +52,6 @@ if(NOT WITH_HEADLESS)
   endif()
 
   include_directories(${PNG_INCLUDE_DIRS})
-  if(NOT APPLE)
-    # APPLE platform uses full paths for linking libraries.
-    link_directories(${PNG_LIBPATH} ${ZLIB_LIBPATH})
-  endif()
 
   add_executable(datatoc_icon ${SRC})
   setup_platform_linker_flags(datatoc_icon)
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 816d3a60fc3..7e657abd937 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -18,8 +18,6 @@
 # All rights reserved.
 # ***** END GPL LICENSE BLOCK *****
 
-setup_libdirs()
-
 blender_include_dirs(
   ../../intern/clog
   ../../intern/glew-mx
@@ -73,10 +71,6 @@ endif()
 
 if(WITH_TBB)
   blender_include_dirs(${TBB_INCLUDE_DIRS})
-  if(NOT APPLE)
-    # APPLE platform uses full paths for linking libraries.
-    link_directories(${LIBDIR}/tbb/lib)
-  endif()
 endif()
 
 
diff --git a/tests/gtests/runner/CMakeLists.txt 
b/tests/gtests/runner/CMakeLists.txt
index 4500aa7b30f..732ae08822b 100644
--- a/tests/gtests/runner/CMakeLists.txt
+++ b/tests/gtests/runner/CMakeLists.txt
@@ -44,7 +44,6 @@ else()
 endif()
 
 # This builds `bin/tests/blender_test`, but does not add it as a single test.
-setup_libdirs()
 BLENDER_SRC_GTEST_EX(
   NAME blender
   SRC "${SRC}"

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to