CMake: remove BLENDER_SORTED_LIBS
Use CMake's target_link_libraries instead of manually maintaining library dependencies in a single list. In practice adding new libraries often ended up being guess-work, now each library lists the libraries it uses. This was used for the game player executable so libraries could optionally link to stubs. If we need this functionality it can be done using target-properties as described in T46725.
This commit is contained in:
parent
616597e7ea
commit
31c2e69d49
|
@ -234,11 +234,8 @@ function(blender_add_lib__impl
|
|||
|
||||
add_library(${name} ${sources})
|
||||
|
||||
# Use for testing 'BLENDER_SORTED_LIBS' removal.
|
||||
if(DEFINED WITHOUT_SORTED_LIBS AND WITHOUT_SORTED_LIBS)
|
||||
if (NOT "${library_deps}" STREQUAL "")
|
||||
target_link_libraries(${name} "${library_deps}")
|
||||
endif()
|
||||
if (NOT "${library_deps}" STREQUAL "")
|
||||
target_link_libraries(${name} "${library_deps}")
|
||||
endif()
|
||||
|
||||
# works fine without having the includes
|
||||
|
@ -542,266 +539,6 @@ function(setup_liblinks
|
|||
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(SETUP_BLENDER_SORTED_LIBS)
|
||||
|
||||
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
|
||||
|
||||
list(APPEND BLENDER_LINK_LIBS
|
||||
bf_windowmanager
|
||||
bf_render
|
||||
)
|
||||
|
||||
if(WITH_MOD_FLUID)
|
||||
list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES)
|
||||
list(APPEND BLENDER_LINK_LIBS
|
||||
cycles_render
|
||||
cycles_graph
|
||||
cycles_bvh
|
||||
cycles_device
|
||||
cycles_kernel
|
||||
cycles_util
|
||||
cycles_subd)
|
||||
if(WITH_CYCLES_OSL)
|
||||
list(APPEND BLENDER_LINK_LIBS cycles_kernel_osl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)
|
||||
list(APPEND BLENDER_LINK_LIBS
|
||||
audaspace
|
||||
audaspace-py)
|
||||
endif()
|
||||
|
||||
# Sort libraries
|
||||
set(BLENDER_SORTED_LIBS
|
||||
bf_windowmanager
|
||||
|
||||
bf_editor_undo
|
||||
|
||||
bf_editor_space_api
|
||||
bf_editor_space_action
|
||||
bf_editor_space_buttons
|
||||
bf_editor_space_console
|
||||
bf_editor_space_file
|
||||
bf_editor_space_graph
|
||||
bf_editor_space_image
|
||||
bf_editor_space_info
|
||||
bf_editor_space_logic
|
||||
bf_editor_space_nla
|
||||
bf_editor_space_node
|
||||
bf_editor_space_outliner
|
||||
bf_editor_space_script
|
||||
bf_editor_space_sequencer
|
||||
bf_editor_space_statusbar
|
||||
bf_editor_space_text
|
||||
bf_editor_space_time
|
||||
bf_editor_space_topbar
|
||||
bf_editor_space_userpref
|
||||
bf_editor_space_view3d
|
||||
bf_editor_space_clip
|
||||
|
||||
bf_editor_transform
|
||||
bf_editor_uvedit
|
||||
bf_editor_curve
|
||||
bf_editor_interface
|
||||
bf_editor_gizmo_library
|
||||
bf_editor_mesh
|
||||
bf_editor_metaball
|
||||
bf_editor_object
|
||||
bf_editor_gpencil
|
||||
bf_editor_lattice
|
||||
bf_editor_armature
|
||||
bf_editor_physics
|
||||
bf_editor_render
|
||||
bf_editor_scene
|
||||
bf_editor_screen
|
||||
bf_editor_sculpt_paint
|
||||
bf_editor_sound
|
||||
bf_editor_animation
|
||||
bf_editor_datafiles
|
||||
bf_editor_mask
|
||||
bf_editor_io
|
||||
bf_editor_util
|
||||
|
||||
bf_render
|
||||
bf_python
|
||||
bf_python_ext
|
||||
bf_python_mathutils
|
||||
bf_python_gpu
|
||||
bf_python_bmesh
|
||||
bf_freestyle
|
||||
bf_ikplugin
|
||||
bf_modifiers
|
||||
bf_gpencil_modifiers
|
||||
bf_alembic
|
||||
bf_bmesh
|
||||
bf_gpu
|
||||
bf_draw
|
||||
bf_blenloader
|
||||
bf_blenkernel
|
||||
bf_shader_fx
|
||||
bf_gpencil_modifiers
|
||||
bf_physics
|
||||
bf_nodes
|
||||
bf_rna
|
||||
bf_editor_gizmo_library # rna -> gizmo bad-level calls
|
||||
bf_python
|
||||
bf_imbuf
|
||||
bf_blenlib
|
||||
bf_depsgraph
|
||||
bf_intern_ghost
|
||||
bf_intern_string
|
||||
bf_avi
|
||||
bf_imbuf_cineon
|
||||
bf_imbuf_openexr
|
||||
bf_imbuf_openimageio
|
||||
bf_imbuf_dds
|
||||
bf_collada
|
||||
bf_intern_elbeem
|
||||
bf_intern_memutil
|
||||
bf_intern_guardedalloc
|
||||
bf_intern_ctr
|
||||
bf_intern_utfconv
|
||||
bf_intern_smoke
|
||||
extern_lzma
|
||||
extern_curve_fit_nd
|
||||
bf_intern_moto
|
||||
extern_openjpeg
|
||||
bf_dna
|
||||
|
||||
bf_blenfont
|
||||
bf_gpu # duplicate for blenfont
|
||||
bf_blentranslation
|
||||
bf_intern_audaspace
|
||||
audaspace
|
||||
audaspace-py
|
||||
bf_intern_mikktspace
|
||||
bf_intern_dualcon
|
||||
bf_intern_cycles
|
||||
cycles_device
|
||||
cycles_render
|
||||
cycles_graph
|
||||
cycles_bvh
|
||||
cycles_kernel
|
||||
cycles_util
|
||||
cycles_subd
|
||||
bf_intern_opencolorio
|
||||
bf_intern_gawain
|
||||
bf_intern_eigen
|
||||
extern_rangetree
|
||||
extern_wcwidth
|
||||
bf_intern_libmv
|
||||
extern_sdlew
|
||||
|
||||
bf_intern_glew_mx
|
||||
bf_intern_clog
|
||||
bf_intern_opensubdiv
|
||||
bf_intern_numaapi
|
||||
)
|
||||
|
||||
if(NOT WITH_SYSTEM_GLOG)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_glog)
|
||||
endif()
|
||||
|
||||
if(NOT WITH_SYSTEM_GFLAGS)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_gflags)
|
||||
endif()
|
||||
|
||||
if(WITH_COMPOSITOR)
|
||||
# added for opencl compositor
|
||||
list_insert_before(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_compositor")
|
||||
list_insert_after(BLENDER_SORTED_LIBS "bf_compositor" "bf_intern_opencl")
|
||||
endif()
|
||||
|
||||
if(WITH_LIBMV)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_ceres)
|
||||
endif()
|
||||
|
||||
if(WITH_MOD_CLOTH_ELTOPO)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
|
||||
endif()
|
||||
|
||||
if(NOT WITH_SYSTEM_LZO)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_minilzo)
|
||||
endif()
|
||||
|
||||
if(NOT WITH_SYSTEM_GLEW)
|
||||
list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WITH_BINRELOC)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
|
||||
endif()
|
||||
|
||||
if(WITH_CXX_GUARDEDALLOC)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
|
||||
endif()
|
||||
|
||||
if(WITH_IK_SOLVER)
|
||||
list_insert_after(BLENDER_SORTED_LIBS "bf_intern_elbeem" "bf_intern_iksolver")
|
||||
endif()
|
||||
|
||||
if(WITH_IK_ITASC)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_XDND)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_OSL)
|
||||
list_insert_after(BLENDER_SORTED_LIBS "cycles_kernel" "cycles_kernel_osl")
|
||||
endif()
|
||||
|
||||
if(WITH_INTERNATIONAL)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
|
||||
endif()
|
||||
|
||||
if(WITH_BULLET)
|
||||
list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_intern_rigidbody")
|
||||
endif()
|
||||
|
||||
if(WITH_BULLET AND NOT WITH_SYSTEM_BULLET)
|
||||
list_insert_after(BLENDER_SORTED_LIBS "extern_openjpeg" "extern_bullet")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_openvdb)
|
||||
endif()
|
||||
|
||||
foreach(SORTLIB ${BLENDER_SORTED_LIBS})
|
||||
set(REMLIB ${SORTLIB})
|
||||
foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
|
||||
if(${SEARCHLIB} STREQUAL ${SORTLIB})
|
||||
set(REMLIB "")
|
||||
endif()
|
||||
endforeach()
|
||||
if(REMLIB)
|
||||
# message(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
|
||||
list(APPEND REM_MSG ${REMLIB})
|
||||
list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
|
||||
endif()
|
||||
endforeach()
|
||||
if(REM_MSG)
|
||||
list(SORT REM_MSG)
|
||||
message(STATUS "Blender Skipping: (${REM_MSG})")
|
||||
endif()
|
||||
|
||||
|
||||
set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} PARENT_SCOPE)
|
||||
|
||||
# for top-level tests
|
||||
set_property(GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP ${BLENDER_SORTED_LIBS})
|
||||
endfunction()
|
||||
|
||||
macro(TEST_SSE_SUPPORT
|
||||
_sse_flags
|
||||
_sse2_flags)
|
||||
|
|
|
@ -8,10 +8,8 @@ endfunction()
|
|||
|
||||
macro(cycles_add_library target library_deps)
|
||||
add_library(${target} ${ARGN})
|
||||
if(DEFINED WITHOUT_SORTED_LIBS AND WITHOUT_SORTED_LIBS)
|
||||
if(NOT ("${library_deps}" STREQUAL ""))
|
||||
target_link_libraries(${target} "${library_deps}")
|
||||
endif()
|
||||
if(NOT ("${library_deps}" STREQUAL ""))
|
||||
target_link_libraries(${target} "${library_deps}")
|
||||
endif()
|
||||
cycles_set_solution_folder(${target})
|
||||
endmacro()
|
||||
|
|
|
@ -1051,19 +1051,11 @@ install(
|
|||
# Setup link libs
|
||||
|
||||
add_dependencies(blender makesdna)
|
||||
|
||||
# Use for testing 'BLENDER_SORTED_LIBS' removal.
|
||||
if(NOT (DEFINED WITHOUT_SORTED_LIBS AND WITHOUT_SORTED_LIBS))
|
||||
setup_blender_sorted_libs()
|
||||
target_link_libraries(blender ${BLENDER_SORTED_LIBS})
|
||||
else()
|
||||
target_link_libraries(blender ${LIB})
|
||||
endif()
|
||||
|
||||
target_link_libraries(blender ${LIB})
|
||||
unset(LIB)
|
||||
|
||||
setup_liblinks(blender)
|
||||
|
||||
unset(LIB)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Setup launcher
|
||||
|
|
|
@ -32,6 +32,11 @@ set(INC
|
|||
${OPENEXR_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(LIB
|
||||
bf_blenloader # Should not be needed but gives linking error without it.
|
||||
bf_alembic
|
||||
)
|
||||
|
||||
include_directories(${INC})
|
||||
|
||||
setup_libdirs()
|
||||
|
@ -44,7 +49,7 @@ else()
|
|||
endif()
|
||||
|
||||
# For motivation on doubling BLENDER_SORTED_LIBS, see ../bmesh/CMakeLists.txt
|
||||
BLENDER_SRC_GTEST(alembic "abc_matrix_test.cc;abc_export_test.cc;${_buildinfo_src}" "${BLENDER_SORTED_LIBS};${BLENDER_SORTED_LIBS}")
|
||||
BLENDER_SRC_GTEST(alembic "abc_matrix_test.cc;abc_export_test.cc;${_buildinfo_src}" "${LIB}")
|
||||
|
||||
unset(_buildinfo_src)
|
||||
|
||||
|
|
|
@ -27,21 +27,21 @@ set(INC
|
|||
../../../intern/guardedalloc
|
||||
)
|
||||
|
||||
set(LIB
|
||||
bf_blenloader # Should not be needed but gives linking error without it.
|
||||
bf_bmesh
|
||||
)
|
||||
|
||||
include_directories(${INC})
|
||||
|
||||
setup_libdirs()
|
||||
get_property(BLENDER_SORTED_LIBS GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP)
|
||||
|
||||
# Current BLENDER_SORTED_LIBS works with starting list of symbols in creator, but not
|
||||
# for this test. Doubling the list does let all the symbols be resolved, but link time is a bit painful.
|
||||
set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} ${BLENDER_SORTED_LIBS})
|
||||
|
||||
if(WITH_BUILDINFO)
|
||||
set(_buildinfo_src "$<TARGET_OBJECTS:buildinfoobj>")
|
||||
else()
|
||||
set(_buildinfo_src "")
|
||||
endif()
|
||||
BLENDER_SRC_GTEST(bmesh_core "bmesh_core_test.cc;${_buildinfo_src}" "${BLENDER_SORTED_LIBS}")
|
||||
BLENDER_SRC_GTEST(bmesh_core "bmesh_core_test.cc;${_buildinfo_src}" "${LIB}")
|
||||
unset(_buildinfo_src)
|
||||
|
||||
setup_liblinks(bmesh_core_test)
|
||||
|
|
Loading…
Reference in New Issue