adobe / USD-Fileformat-plugins

A collection of USD fileformat plugins
298 stars 22 forks source link

Unable to build FBX plugin #12

Closed TheMostDiligent closed 5 months ago

TheMostDiligent commented 5 months ago

Hello!

I am trying to follow the steps to build the FBX plugin: I downloaded and installed the FBX sdk and provided a path to it through the FBXSDK_ROOT CMake variable. However, CMake configuration steps fails with the following error:

-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- PROJECT VERSION IS: 1.0.2
Building without ASM
-- Fetching GTest
-- Fetching libxml2
CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find FBXSDK (missing: FBXSDK_LIBRARIES)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindFBXSDK.cmake:101 (find_package_handle_standard_args)
  fbx/CMakeLists.txt:10 (find_package)

There are no CMake files in the SDK folder, and the FindFBXSDK.cmake does not set the FBXSDK_LIBRARIES variable.

The plugins build fine without FBX (-DUSD_FILEFORMATS_ENABLE_FBX=OFF) Can you please suggest how the build should be set up to enable FBX?

kwblackstone commented 5 months ago

Hello,

My initial thought is that this might be related to the CMake version you're using. Could you please confirm which version of CMake you have installed? If it's older than 3.24 please update to atleast that version.

If updating CMake doesn't resolve the issue, please double-check that the FBX SDK is correctly installed at the location specified in the -DFBXSDK_ROOT variable. Ensure that this path directly points to the directory containing the SDK's lib and include folders.

Lastly, could you share the exact CMake command you are using to configure the project? This may help figure it out.

Thanks!

TheMostDiligent commented 5 months ago

@kwblackstone Thank you for looking into this issue!

Could you please confirm which version of CMake you have installed?

3.24.1

Ensure that this path directly points to the directory containing the SDK's lib and include folders.

I set the path to point to the SDK root folder. This is what is in the folder:

image

Lastly, could you share the exact CMake command you are using to configure the project? This may help figure it out.

cmake -S . -B build/Debug -DCMAKE_INSTALL_PREFIX=bin -Dpxr_ROOT=c:\GitHub\OpenUSD\build\Debug -DFBXSDK_ROOT=c:\GitHub\FBX_SDK_2020.3.7
kwblackstone commented 5 months ago

Thanks! I think the issue is probably related to the FBX_SDK version needing to match the MSVC version. There was a pull request recently merged to fix VS2022 support. If you are on the v1.0.2 tagged release, please try pulling down the latest main. (if you are on the latest main you may want to go back to the tagged version and see if that works instead)

You can see the logic here

In short, if you explore your lib folder from the SDK it should show a vs folder, maybe "vs2019" or "vs2022" etc... The FBX_COMPILER_SUFFIX set in the FindFBXSDK.cmake must match that folder. Please let me know if this helps, and if you have a setup we aren't properly accounting for.

TheMostDiligent commented 5 months ago

@kwblackstone I renamed vs2019 to vs2022 in the FBX SDK and it worked - thank you! Note that starting with VS2015, static libraries built with one version are compatible with another version. So that for VS2022 it is totally OK to use static libs built for VS2019 - exact match is not required.

kwblackstone commented 5 months ago

Glad that fixed it and thanks for the tip! I'll add a ticket for us to generalize this a bit, hopefully for next release.