Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Boost_NO_BOOST_CMAKE=ON for Boost::python #912

Merged
merged 1 commit into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion plugin/al/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ option(SKIP_USDMAYA_TESTS "Build tests" OFF)
# Adding specific components forces calls to _Boost_find_library, which
# is the rationale for listing them here.
set(Boost_FIND_COMPONENTS
python
thread
)
if(NEED_BOOST_FILESYSTEM)
Expand All @@ -44,6 +43,35 @@ if(WIN32)
endif()
endif()

find_package(Boost REQUIRED)

# As of boost 1.67 the boost_python component name includes the
# associated Python version (e.g. python27, python36). After boost 1.70
# the built-in cmake files will deal with this. If we are using boost
# that does not have working cmake files, or we are using a new boost
# and not using cmake's boost files, we need to do the below.
# https://cmake.org/cmake/help/latest/module/FindBoost.html
# Find the component under the versioned name and then set the generic
# Boost_PYTHON_LIBRARY variable so that we don't have to duplicate this
# logic in each library's CMakeLists.txt.
set(boost_version_string "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
if (((${boost_version_string} VERSION_GREATER_EQUAL "1.67") AND
(${boost_version_string} VERSION_LESS "1.70")) OR
((${boost_version_string} VERSION_GREATER_EQUAL "1.70") AND
Boost_NO_BOOST_CMAKE))

set(python_version_nodot "${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
list(APPEND Boost_FIND_COMPONENTS
python${python_version_nodot}
)

set(Boost_PYTHON_LIBRARY "${Boost_PYTHON${python_version_nodot}_LIBRARY}")
else()
list(APPEND Boost_FIND_COMPONENTS
python
)
endif()

find_package(Boost COMPONENTS
${Boost_FIND_COMPONENTS}
REQUIRED
Expand Down
2 changes: 1 addition & 1 deletion plugin/al/lib/AL_USDMaya/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ target_link_libraries(${LIBRARY_NAME}
usdImaging
usdImagingGL
vt
Boost::python
${Boost_PYTHON_LIBRARY}
$<IF:$<VERSION_GREATER_EQUAL:${Boost_VERSION},${boost_1_70_0_ver_string}>,Boost::thread,${Boost_THREAD_LIBRARY}>
$<$<BOOL:${IS_WINDOWS}>:Boost::chrono>
$<$<BOOL:${IS_WINDOWS}>:Boost::date_time>
Expand Down
2 changes: 1 addition & 1 deletion plugin/al/schemas/AL/usd/schemas/maya/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ target_link_libraries(${TARGET_NAME}
tf
vt
plug
Boost::python
${Boost_PYTHON_LIBRARY}
)

# install
Expand Down
2 changes: 1 addition & 1 deletion plugin/al/usdmayautils/AL/usdmaya/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ target_link_libraries(${USDMAYA_UTILS_LIBRARY_NAME}
usdGeom
usdUtils
vt
Boost::python
${Boost_PYTHON_LIBRARY}
${PYTHON_LIBRARIES}
${MAYA_Foundation_LIBRARY}
${MAYA_OpenMaya_LIBRARY}
Expand Down