Skip to content

Commit

Permalink
CMake: LINK_FILESYSTEM is now for both lib and app (#1862)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal authored Jan 3, 2025
1 parent 59fbc71 commit a0eadcf
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/actions/android-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ runs:
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_SYSTEM_VERSION=${{inputs.api_level}}
-DF3D_BINDINGS_JAVA=ON
-DF3D_LINUX_LINK_FILESYSTEM=OFF
-DF3D_MODULE_UI=OFF
-DF3D_PLUGIN_BUILD_EXODUS=OFF
-DF3D_STRICT_BUILD=ON
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ include(GNUInstallDirs)
cmake_dependent_option(F3D_WINDOWS_GUI "Build a non-console Win32 application" ON "WIN32" OFF)
cmake_dependent_option(F3D_MACOS_BUNDLE "Build a macOS bundle application" ON "APPLE" OFF)

if(UNIX AND NOT APPLE)
option(F3D_LINUX_LINK_FILESYSTEM "Link with libstdc++fs" ON)
mark_as_advanced(F3D_LINUX_LINK_FILESYSTEM)
endif()

# Force static library when creating a macOS bundle
cmake_dependent_option(BUILD_SHARED_LIBS "Build f3d with shared libraries" ON "NOT ANDROID" OFF)

Expand Down
8 changes: 2 additions & 6 deletions application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ if(UNIX)
target_link_libraries(f3d PRIVATE Threads::Threads)
endif()

if(UNIX AND NOT APPLE)
option(F3D_LINUX_APPLICATION_LINK_FILESYSTEM "Link with libstdc++fs" ON)
mark_as_advanced(F3D_LINUX_APPLICATION_LINK_FILESYSTEM)
if(F3D_LINUX_APPLICATION_LINK_FILESYSTEM)
target_link_libraries(f3d PRIVATE stdc++fs)
endif()
if(F3D_LINUX_LINK_FILESYSTEM)
target_link_libraries(f3d PRIVATE stdc++fs)
endif()

set_target_properties(f3d PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Your data probably contains some translucent data for some reason, turn on trans

> I have a link error related to `stdc++fs` not found.
With some C++ STD library version, explicit linking to `stdc++fs` is not supported. We provide a CMake option `F3D_LINUX_APPLICATION_LINK_FILESYSTEM` that you can set to `OFF` to workaround this issue.
With some C++ STD library version, explicit linking to `stdc++fs` is not supported. We provide a CMake option `F3D_LINUX_LINK_FILESYSTEM` that you can set to `OFF` to workaround this issue.

> I have a link error related to undefined reference to symbol of `libatomic`.
Expand Down
4 changes: 4 additions & 0 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ target_link_libraries(libf3d PRIVATE ${F3D_VTK_MODULES} ${F3D_STATIC_PLUGIN_TARG
target_compile_options(libf3d PUBLIC ${f3d_compile_options_public} PRIVATE ${f3d_compile_options_private})
target_link_options(libf3d PUBLIC ${f3d_link_options_public})

if(F3D_LINUX_LINK_FILESYSTEM)
target_link_libraries(libf3d PRIVATE stdc++fs)
endif()

# exr
if (F3D_MODULE_EXR)
target_compile_definitions(libf3d PRIVATE F3D_MODULE_EXR)
Expand Down
9 changes: 5 additions & 4 deletions webassembly/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ set -euo pipefail

cmake -S /src -B /build \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=$1 \
-DCMAKE_FIND_ROOT_PATH:PATH=/depends \
-DF3D_LINUX_LINK_FILESYSTEM=OFF \
-DF3D_MODULE_UI=OFF \
-DF3D_STRICT_BUILD=ON \
-DF3D_PLUGIN_BUILD_ASSIMP=ON \
-DF3D_PLUGIN_BUILD_DRACO=ON \
-DF3D_PLUGIN_BUILD_EXODUS=OFF \
-DF3D_PLUGIN_BUILD_OCCT=ON \
-DF3D_WASM_COPY_APP=ON \
-DCMAKE_BUILD_TYPE=$1 \
-DCMAKE_FIND_ROOT_PATH:PATH=/depends
-DF3D_STRICT_BUILD=ON \
-DF3D_WASM_COPY_APP=ON

cmake --build /build

Expand Down

0 comments on commit a0eadcf

Please sign in to comment.