Skip to content

Commit 12d8a2d

Browse files
Fix FBX SDK linking errors on Linux for static builds
The io_marker_test was failing to link on Linux CI because the FBX SDK static library requires zlib and libdl dependencies that weren't being linked. Changes: - cmake/FindFbxSdk.cmake: Added ZLIB and libdl (via CMAKE_DL_LIBS) to the Linux dependencies list. This fixes undefined references to zlib functions (deflate, inflate, crc32, adler32) and libdl functions (dlopen, dlclose, dlsym). - cmake/momentum-config.cmake.in: Added conditional find_dependency for FbxSdk when MOMENTUM_ENABLE_FBX_SAVING is enabled. This ensures downstream projects can properly link against momentum when built with FBX SDK support as static libraries. - CMakeLists.txt: Added FindFbxSdk.cmake to the install command so the finder module is available to downstream projects. Fixes: https://github.com/facebookresearch/momentum/actions/runs/19022913829/job/54321176648?pr=753
1 parent 2c71006 commit 12d8a2d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ install(
920920

921921
# Install CMake modules
922922
install(
923-
FILES cmake/Findre2.cmake
923+
FILES cmake/Findre2.cmake cmake/FindFbxSdk.cmake
924924
DESTINATION ${MOMENTUM_CONFIG_INSTALL_DIR}
925925
)
926926

cmake/FindFbxSdk.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
8686
list(APPEND required_vars LibXml2_FOUND Iconv_FOUND ZLIB_LIBRARIES)
8787
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
8888
find_package(LibXml2 MODULE QUIET)
89-
list(APPEND FBXSDK_LIBRARIES LibXml2::LibXml2)
90-
list(APPEND FBXSDK_LIBRARIES_DEBUG LibXml2::LibXml2)
91-
list(APPEND required_vars LibXml2_FOUND)
89+
find_package(ZLIB MODULE QUIET)
90+
list(APPEND FBXSDK_LIBRARIES LibXml2::LibXml2 ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
91+
list(APPEND FBXSDK_LIBRARIES_DEBUG LibXml2::LibXml2 ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
92+
list(APPEND required_vars LibXml2_FOUND ZLIB_LIBRARIES)
9293
endif()
9394

9495
# Set (NAME)_FOUND if all the variables and the version are satisfied.

cmake/momentum-config.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ if(@MOMENTUM_ENABLE_PROFILING@)
3636
find_dependency(Tracy CONFIG)
3737
endif()
3838

39+
if(@MOMENTUM_ENABLE_FBX_SAVING@)
40+
find_dependency(FbxSdk MODULE)
41+
endif()
42+
3943
list(REMOVE_AT CMAKE_MODULE_PATH -1)
4044

4145
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

0 commit comments

Comments
 (0)