Fix cycles_test link error on macOS due to boost python in new 3.5 libraries

The executable would get boost python linking in when not needed, and even when
linking to Python libraries there were still unresolved symbols. Instead split
off boost python libraries and link them only where needed.
This commit is contained in:
Brecht Van Lommel 2022-12-07 20:38:28 +01:00
parent bf18032977
commit fedef4c13a
4 changed files with 13 additions and 2 deletions

View File

@ -260,7 +260,12 @@ if(WITH_BOOST)
endif()
find_package(Boost COMPONENTS ${_boost_FIND_COMPONENTS})
# Boost Python is separate to avoid linking Python into tests that don't need it.
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
if(WITH_USD AND USD_PYTHON_SUPPORT)
set(BOOST_PYTHON_LIBRARIES ${Boost_PYTHON${PYTHON_VERSION_NO_DOTS}_LIBRARY})
list(REMOVE_ITEM BOOST_LIBRARIES ${BOOST_PYTHON_LIBRARIES})
endif()
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_DEFINITIONS)

View File

@ -407,8 +407,13 @@ if(WITH_BOOST)
mark_as_advanced(Boost_INCLUDE_DIR) # why doesn't boost do this?
endif()
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
# Boost Python is separate to avoid linking Python into tests that don't need it.
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
if(WITH_USD AND USD_PYTHON_SUPPORT)
set(BOOST_PYTHON_LIBRARIES ${Boost_PYTHON${PYTHON_VERSION_NO_DOTS}_LIBRARY})
list(REMOVE_ITEM BOOST_LIBRARIES ${BOOST_PYTHON_LIBRARIES})
endif()
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")

View File

@ -575,7 +575,7 @@ if(WITH_BOOST)
)
if (EXISTS ${BOOST_34_TRIGGER_FILE})
if(WITH_USD)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
set(BOOST_PYTHON_LIBRARIES
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_POSTFIX}.lib
)

View File

@ -123,6 +123,7 @@ set(LIB
list(APPEND LIB
${BOOST_LIBRARIES}
${BOOST_PYTHON_LIBRARIES}
${PYTHON_LIBRARIES}
)