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

Use proper boost target name #637

Merged
merged 1 commit into from
Jul 14, 2020
Merged
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
11 changes: 10 additions & 1 deletion plugin/al/lib/AL_USDMaya/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ target_include_directories(
$<$<BOOL:${UFE_FOUND}>:${UFE_INCLUDE_DIR}>
)

# There were bugs in both cmake and findboost with the boost version string. So in
# order to support all boost and cmake versions, we check how the boost version is
# defined and create our version comparison string.
if(${Boost_VERSION} MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
set(boost_1_70_0_ver_string "1.70.0")
else()
set(boost_1_70_0_ver_string "107000")
endif()
Comment on lines +185 to +192
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USD uses a different version of boost on Windows (1.70.0) and Linux/Mac, python 2 (1.66.0) and python 3 (1.70.0). Because of this the Boost_VERSION string has a different format between the two versions. And Boost_VERSION_STRING is not always set. There is also a fix in cmake 3.15, but we support 3.13-3.17.

-- Boost_VERSION = 106100
-- Boost_VERSION_STRING = 1.61.0

-- Boost_VERSION = 1.70.0
-- Boost_VERSION_STRING =

So in order to work around all of this I detect the format of the boost version and set a string for 1.70.0 to compare against.


target_link_libraries(${LIBRARY_NAME}
AL_EventSystem
AL_USDMayaUtils
Expand All @@ -201,7 +210,7 @@ target_link_libraries(${LIBRARY_NAME}
usdImagingGL
vt
Boost::python
$<IF:$<BOOL:${IS_WINDOWS}>,Boost::thread,${Boost_THREAD_LIBRARY}>
$<IF:$<VERSION_GREATER_EQUAL:${Boost_VERSION},${boost_1_70_0_ver_string}>,Boost::thread,${Boost_THREAD_LIBRARY}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are 1.70.0 or greater use the Boost::thread, otherwise use Boost_THREAD_LIBRARY. Note: in 1.70.0, Boost_THREAD_LIBRARY is not set because we are setting boost_root to the USD location so it uses the boost config cmake files there.

I would like to use Boost::thread all the time, but that causes a problem with v1.66.0 on the Mac in that it brings in Boost::chrono, but we don't have that.

$<$<BOOL:${IS_WINDOWS}>:Boost::chrono>
$<$<BOOL:${IS_WINDOWS}>:Boost::date_time>
$<$<BOOL:${NEED_BOOST_FILESYSTEM}>:Boost::filesystem>
Expand Down