Skip to content

Commit

Permalink
Merge pull request #795 from mwestphal/better_occt_coloring_cmake_logic
Browse files Browse the repository at this point in the history
Better cmake logic for coloring support
  • Loading branch information
mwestphal authored Apr 30, 2023
2 parents e4a4669 + b6284e4 commit 4992ca9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
shell: powershell
run: echo "PATH=$env:PATH;$(pwd)\dependencies\install\bin\;$(pwd)\install\bin\;"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

# occt coloring not supported on macOS because of #792
- name: Configure
working-directory: ${{github.workspace}}/build
shell: bash
Expand All @@ -137,6 +138,7 @@ jobs:
-DF3D_PLUGIN_BUILD_ASSIMP=ON
-DF3D_PLUGIN_BUILD_DRACO=ON
-DF3D_PLUGIN_BUILD_OCCT=ON
-DF3D_PLUGIN_OCCT_COLORING_SUPPORT=${{ runner.os == 'macOS' && 'OFF' || 'ON' }}
-DF3D_STRICT_BUILD=ON
-DF3D_WINDOWS_GUI=ON
${{ runner.os == 'Windows' && '-Ax64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL' || null }}
Expand Down
5 changes: 1 addition & 4 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,7 @@ if(F3D_PLUGIN_BUILD_OCCT)
f3d_test(NAME TestSTEP DATA f3d.stp DEFAULT_LIGHTS ARGS --load-plugins=occt --up=+Z)
f3d_test(NAME TestIGES DATA f3d.igs DEFAULT_LIGHTS ARGS --load-plugins=occt --up=+Z)

# Following tests are failing if OpenCascade was built without coloring support
# They are also failing with F3D_MACOS_BUNDLE because of config file mechanism
# and failing more generally on macOS because of #795
if(NOT F3D_MACOS_BUNDLE AND NOT APPLE)
if(F3D_PLUGIN_OCCT_COLORING_SUPPORT AND NOT F3D_MACOS_BUNDLE)
file(COPY "${CMAKE_SOURCE_DIR}/plugins/occt/configs/config.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/config_build.d")
f3d_test(NAME TestDefaultConfigFileOCCT DATA f3d.stp CONFIG config_build DEFAULT_LIGHTS)

Expand Down
4 changes: 4 additions & 0 deletions doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ Set the codepage to UTF-8, run `chcp 65001`.
> Using the binary release, I'm unable to run F3D because macOS warns about F3D not being signed.
F3D is not signed by Apple yet so macOS shows this warning. To run F3D, right click on the app and click "open", then click "open" again to be able to run F3D.

> I'm unable to get coloring right with step files
F3D on macOS does not support coloring on cells because of a [VTK issue](https://gitlab.kitware.com/vtk/vtk/-/issues/18969)
13 changes: 7 additions & 6 deletions plugins/occt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ endif()

find_package(OpenCASCADE REQUIRED)

set(F3D_PLUGIN_OCCT_XCAF 0)

if("${OpenCASCADE_VERSION}" VERSION_LESS "7.5.0")
message(FATAL_ERROR "Plugin: OpenCASCADE: ${OpenCASCADE_VERSION} is not supported by F3D, please update your OpenCASCADE installation.")
endif()
Expand All @@ -25,10 +23,13 @@ endif()

message(STATUS "Plugin: OpenCASCADE ${OpenCASCADE_VERSION} found")

if((TARGET "TKXDESTEP") AND (TARGET "TKXDEIGES"))
set(F3D_PLUGIN_OCCT_XCAF 1)
else()
message(WARNING "OpenCASCADE: TKXDESTEP and TKXDEIGES are not found. Parts color and name are not supported.")
option(F3D_PLUGIN_OCCT_COLORING_SUPPORT "Enable coloring support in occt plugin" ON)
mark_as_advanced(F3D_PLUGIN_OCCT_COLORING_SUPPORT)

if(F3D_PLUGIN_OCCT_COLORING_SUPPORT)
if (NOT (TARGET "TKXDESTEP") OR NOT (TARGET "TKXDEIGES"))
message(FATAL_ERROR "occt plugin: TKXDESTEP and TKXDEIGES OCCT modules are not found. Turn off F3D_PLUGIN_OCCT_COLORING_SUPPORT or enable them in your OpenCascade build.")
endif()
endif()

f3d_plugin_init()
Expand Down
2 changes: 1 addition & 1 deletion plugins/occt/module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vtk_module_link(f3d::VTKExtensionsOCCTReader
PRIVATE
${OpenCASCADE_LIBRARIES})

if(F3D_PLUGIN_OCCT_XCAF)
if(F3D_PLUGIN_OCCT_COLORING_SUPPORT)
vtk_module_definitions(f3d::VTKExtensionsOCCTReader
PRIVATE F3D_PLUGIN_OCCT_XCAF)
endif()
7 changes: 2 additions & 5 deletions plugins/occt/module/vtkF3DOCCTReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,8 @@ class vtkF3DOCCTReader::vtkInternals
}
else
{
float fn[3] = { 0.0, 0.0 };
for (Standard_Integer i = 1; i <= nbV; i++)
{
uvs->InsertNextTypedTuple(fn);
}
uvs->SetNumberOfTuples(nbV);
uvs->Fill(0.0);
}

for (int i = 1; i <= nbT; i++)
Expand Down

0 comments on commit 4992ca9

Please sign in to comment.