1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

Compare commits

..

32 Commits

Author SHA1 Message Date
sshutina
bce10d3e2a GLTF Parser - Fix indices during reader arrays 2025-07-11 13:17:18 +01:00
Pasukhin Dmitry
22d437b771 Visualization - Enhance FFmpeg Compatibility Layer and Update Video Recorder (#582)
- Creation of Media_FFmpegCompatibility.pxx to wrap deprecated functions and API changes.
- Refactoring of Media_FormatContext and Media_CodecContext to use the new compatibility layer.
- Updates to Image_VideoRecorder and its tests to leverage the new compatibility functions and ensure proper codec context handling.
2025-06-27 14:38:01 +01:00
Pasukhin Dmitry
6b69f59803 Coding - Optimize gp_Vec, gp_Vec2d, gp_XY, and gp_XYZ classes (#578)
Renamed parameters and improved consistency across methods.
Simplified mathematical computations and replaced indirect API calls with direct data member access where performance‐critical.
Updated and optimized matrix operations including inversion, transposition, and power calculations.
2025-06-26 09:37:35 +01:00
Pasukhin Dmitry
ed7a447177 Coding - Add conversion utilities for STEP geometrical and visual enumerations (#545)
- Introduced RWStepGeom_RWTransitionCode for converting StepGeom_TransitionCode to/from string representations.
- Refactored RWStepGeom_RWTrimmedCurve to utilize RWStepGeom_RWTrimmingPreference for trimming preference conversions.
- Created RWStepGeom_RWTrimmingPreference for handling StepGeom_TrimmingPreference enumerations.
- Updated RWStepGeom_RWUniformCurve and related classes to use RWStepGeom_RWBSplineCurveForm for B-spline curve form conversions.
- Added RWStepGeom_RWUniformSurface and related classes to use RWStepGeom_RWBSplineSurfaceForm for B-spline surface form conversions.
- Implemented RWStepShape_RWBooleanOperator for boolean operator conversions in STEP shapes.
- Refactored RWStepShape_RWBooleanResult to utilize RWStepShape_RWBooleanOperator for boolean operator handling.
- Introduced RWStepVisual_RWCentralOrParallel for central or parallel projection type conversions.
- Added RWStepVisual_RWSurfaceSide for surface side enumeration conversions.
- Updated RWStepVisual_RWSurfaceStyleUsage to use RWStepVisual_RWSurfaceSide for handling surface side.
- Created RWStepVisual_RWTextPath for text path enumeration conversions.
- Refactored RWStepVisual_RWTextLiteral to utilize RWStepVisual_RWTextPath for text path handling.
- Updated RWStepVisual_RWViewVolume to use RWStepVisual_RWCentralOrParallel for projection type conversions.
2025-06-25 11:40:51 +01:00
Pasukhin Dmitry
dfb331296c Configuration - VCPKG add TclTk support (#580)
Introduces a new "tcltk" feature in vcpkg.json with relevant dependencies.
Updates tcl portfiles and patches to incorporate Tk building, installation, and cleanup.
Modifies CMake and batch environment templates to align with the new TclTk support.
2025-06-25 10:15:04 +01:00
Pasukhin Dmitry
fa5bf5dab2 Configuration - Remove jemalloc port files (#581)
Removed overrides for jemalloc, now use standard port
2025-06-25 10:14:14 +01:00
Pasukhin Dmitry
97920011fa Foundation Classes - Matrix multiplied issue (#522)
Refactor multiplication to avoid self-correlation issues by using a temporary copy.
Add a test file (math_Matrix_Test.cxx) to verify proper behavior.
2025-06-24 12:38:31 +01:00
Pasukhin Dmitry
57d6038b26 Shape Healing - Reusing Surface Analysis for Wire fixing (#565)
Providing prepared analysis from ShapeFix_Face to wire.
2025-06-23 18:22:47 +01:00
Pasukhin Dmitry
9726e465a9 Testing - Update workflows to use Windows 2025 for builds and tests (#579)
- Replace all `windows-2022` runners with `windows-2025`
- Add `ubuntu-24.04-arm` and `ubuntu-22.04-arm` to the OCCT build matrix
2025-06-20 21:22:15 +01:00
ikochetkova
f1cb756901 Data Exchange, Step Export - Ignoring unit factors during tessellation export (#577)
Provide unit factors into the tessellation export methods.
2025-06-20 15:38:33 +01:00
Pasukhin Dmitry
9ddcdae3f9 Coding, Data Exchange - Optimize entity graph evaluating #562
Updated the Evaluate() function to integrate memory pool usage and streamline the evaluation loop.
Simplified shared entity retrieval in GetShareds() and Sharings().
Added necessary include for NCollection_IncAllocator to support memory pooling.
2025-05-30 16:11:22 +01:00
Pasukhin Dmitry
4629ee0ca3 Coding - Refactor switch-case statements and improve memory management #569
- Added missing break statements in switch-case blocks in LDOMBasicString, LDOM_BasicElement, PCDM_ReadWriter, and IntCurve_IntConicConic_1 to prevent fall-through behavior.
- Enhanced Standard_Macro.hxx to support fallthrough attributes across different compilers.
- Corrected the use of std::forward in Standard_MemoryUtils.hxx for better type deduction.
- Replaced raw arrays with NCollection_Array1 in AdvApp2Var_SysBase for improved memory safety.
- Updated Extrema_ExtCC2d to utilize smart pointers for better memory management and avoid potential leaks.
- Refactored Units_UnitsDictionary to use NCollection_Array2 for matrix representation, improving readability and maintainability.
- Initialized TranFirst and TranLast in TopTrans_CurveTransition constructor for better default state management.
- Set myStatus in ShapeConstruct_ProjectCurveOnSurface constructor to ensure proper initialization.
- Changed matrix access in Units_UnitsDictionary to use NCollection_Array2 syntax for consistency.
2025-05-30 14:31:26 +01:00
Pasukhin Dmitry
3b62a5eb29 Configuration - Fixed issue with CSF variable overwriting #561
Include occt_csf file to define CSF variable before usage.
2025-05-24 12:27:14 +01:00
Elias Cohenca
4f2d4c1f4b Data Exchange, GLTF - fix saving edges when Merge Faces is enabled #554
Removed check for LineStrip mode to force use of Lines for merged faces
Updated primitive mode checks by removing LineStrip references
Added getShapeType to correctly determine the underlying shape type from compounds and updated index calculation logic
2025-05-23 12:24:13 +01:00
Dmitrii Kulikov
7ed396b0eb Modeling - Infinite loop when Simplifying Fuse operation, CPU to 100% #557
Minor refactoring of RelocatePCurvesToNewUorigin().
RelocatePCurvesToNewUorigin() can no longer stuck in infinite loop if it found the edge that is not present in theVEmap.
Test bug_gh544 is added to check the fix.
2025-05-22 11:29:54 +01:00
Dmitrii Kulikov
2398b87d36 Testing - GCC bug workaround for test NCollection_LocalArrayTest, CustomType #549
Test was failing on Ubuntu, gcc 13.3.0, debug, due to incorrect linkage.
Fixed by renaming TestStruct to NCollection_LocalArray_TestStruct.
2025-05-19 19:32:46 +01:00
Pasukhin Dmitry
973259d411 Coding - Small optimization of StepData_StepReaderData #543
Refactor SetEntityNumbers to use reusable memory pool.
Update SetRecord to avoid extra map searches.
2025-05-19 12:07:31 +01:00
Pasukhin Dmitry
e668a0d228 Testing - Add a new compilation on Clang without PCH #540
Updated a main workflow to validate the header and more precise warnings.
No PCH helps to validate missed headers.
Fixed PCH issue for mac os
Extend the parameters for occt build action.
2025-05-17 21:08:49 +01:00
Pasukhin Dmitry
c5256dcf70 Draw - Update DrawDefault script to handle missing directory cases #542
Fixed "Warning: could not find DRAW directory"
2025-05-17 13:00:50 +01:00
Elias Cohenca
b29788cae0 Data Exchange, GLTF - Change export line type to LINE_STRIP #535
GLTF exporter mark edges as a LINE, which is 2 connected points.
OCCT polylines is mostly line strip structure.
Updated GLTF reader to handle new type of lines
2025-05-17 10:00:40 +01:00
Dmitrii Kulikov
2eeb0ed5ba Modeling - Bnd_BoundSortBox::Compare fails in some cases #518
Class Bnd_BoundSortBox is refactored.
Some cases when Bnd_BoundSortBox could potentially fail to check
  intersection between boxes are fixed.
Google tests are added for Bnd_BoundSortBox class.
2025-05-16 16:04:48 +01:00
Pasukhin Dmitry
3e80fad177 Configuration - Update minimum version of C++ to 17 #537
Update C++ standard to C++17 in build configuration and documentation
2025-05-16 10:30:25 +01:00
Dmitrii Kulikov
7b016e5c28 Modeling - General Fuse (BOPAlgo_PaveFiller) optimization #514
Adding a null check for the triangulation in BRep_Tool::IsClosed.
Simplifying index lookup logic in BOPDS_DS.
Introducing helper functions (IsPlaneFF and IsClosedFF) and updating iteration loops in BOPAlgo_PaveFiller_6 for improved clarity and robustness.
2025-05-16 00:03:44 +01:00
Dmitrii Kulikov
a56d85bf15 Modeling - BRepFilletAPI_MakeFillet Segfault with two curves and rim #532
Added null checks for TopoDS_Face in ChFi3d_Builder_2 and BRepAdaptor_Surface.
Added tests to check for crash.
2025-05-15 19:35:52 +01:00
Pasukhin Dmitry
ebc3885799 Testing - IR integration enable concurrency #536
Fix concurrency cancel-in-progress condition in CI workflow for IR branch
2025-05-15 19:34:23 +01:00
Dmitrii Kulikov
66d2a06b5a Foundation Classes - Return value is overridden by OCCT #528
- Removed OSD_PerfMeter.h and integrated its functionality directly into OSD_PerfMeter.hxx.
- Updated OSD_PerfMeter to manage stopwatches through a singleton StopwatchStorage class.
- Enhanced meter initialization and management to support shared meters by name.
- Implemented methods for starting, stopping, and printing elapsed time for performance meters.
- Added OSD_PerfMeter_Test.cxx to implement unit tests for OSD_PerfMeter functionality.
- Test bug23237 is delete as it refers to removed code.
2025-05-15 15:21:52 +01:00
Pasukhin Dmitry
e82126db69 Testing - IR integration enable concurrency (#531)
Fix concurrency cancel-in-progress condition in CI workflow for IR branch
2025-05-15 15:20:27 +01:00
Pasukhin Dmitry
469da02ca6 Configuration - Fixed pathes to 3rd-party in cmake configuration (#523)
Update target_link_libraries to use PUBLIC and PRIVATE visibility for dependencies.
Now all 3rd-party is hidden for the external linking, no more issues to invalid path to 3rd-party
2025-05-15 13:04:14 +01:00
Pasukhin Dmitry
81ca522102 Testing - Target branch to compare validation of repo (#524)
Ensure latest workflow run ID is fetched from the correct repository in test summary action
2025-05-15 10:43:52 +01:00
ikochetkova
6aa605ef2f Data Exchange - Add missed headers (#530)
Add headers missed due to enabled BUILD_USE_PCH configure setting
2025-05-14 18:11:12 +01:00
ikochetkova
1158cba0df Modeling Algorithms - XCAFDoc_Editor::RescaleGeometry does not rescale translation of roots reference (#529)
Add processing of roots, which are transformed references of parts/assemblies.
2025-05-14 12:07:52 +01:00
ikochetkova
18a46604fc Data Exchange, Step Export - Apply a scaling transformation (#513)
Add possibility to export scaling factor into the STEP file as a cartesian_transformation_operator_3d.
Add flag for turning on/off (on by default) this behavior.
2025-05-12 17:15:58 +01:00
217 changed files with 5996 additions and 6562 deletions

View File

@@ -19,6 +19,18 @@ inputs:
description: 'Enable VTK'
required: false
default: 'true'
build-use-pch:
description: 'Enable precompiled headers'
required: false
default: 'true'
build-opt-profile:
description: 'Build optimization profile'
required: false
default: 'Production'
cmake-build-type:
description: 'CMake build type (Release, Debug, etc)'
required: false
default: 'Release'
runs:
using: "composite"
@@ -82,10 +94,10 @@ runs:
cmake -T host=x64 `
-D USE_FREETYPE=ON `
-D USE_TK=OFF `
-D BUILD_USE_PCH=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} `
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
@@ -99,8 +111,9 @@ runs:
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++14 `
-D INSTALL_GTEST=ON ${{ inputs.additional-cmake-flags }} ..
-D BUILD_CPP_STANDARD=C++17 `
-D INSTALL_GTEST=ON `
${{ inputs.additional-cmake-flags }} ..
shell: pwsh
- name: Configure OCCT (Windows Clang)
@@ -113,10 +126,10 @@ runs:
-D CMAKE_CXX_COMPILER=clang++ `
-D USE_FREETYPE=ON `
-D USE_TK=OFF `
-D BUILD_USE_PCH=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} `
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
@@ -130,10 +143,9 @@ runs:
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++14 `
-D BUILD_CPP_STANDARD=C++17 `
-D INSTALL_GTEST=ON `
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wno-unknown-warning-option" `
-D CMAKE_C_FLAGS="-Werror -Wall -Wextra -Wno-unknown-warning-option" ${{ inputs.additional-cmake-flags }} ..
${{ inputs.additional-cmake-flags }} ..
shell: pwsh
- name: Configure OCCT (macOS)
@@ -144,9 +156,10 @@ runs:
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D BUILD_USE_PCH=ON \
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \
-D INSTALL_DIR=${{ github.workspace }}/install \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_RAPIDJSON=ON \
@@ -155,10 +168,10 @@ runs:
-D USE_OPENGL=ON \
-D USE_FREEIMAGE=ON \
-D BUILD_GTEST=ON \
-D BUILD_CPP_STANDARD=C++14 \
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" \
-D CMAKE_C_FLAGS="-Werror -Wall -Wextra" ${{ inputs.additional-cmake-flags }} ..
${{ inputs.additional-cmake-flags }} ..
shell: bash
- name: Configure OCCT (Linux)
@@ -169,16 +182,16 @@ runs:
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D BUILD_USE_PCH=ON \
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Production \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D USE_TK=OFF \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \
-D INSTALL_DIR=${{ github.workspace }}/install \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FFMPEG=ON \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
@@ -187,9 +200,9 @@ runs:
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
-D BUILD_GTEST=ON \
-D BUILD_CPP_STANDARD=C++14 \
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
${{ inputs.compiler == 'clang' && '-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" -D CMAKE_C_FLAGS="-Werror -Wall -Wextra"' || '' }} ${{ inputs.additional-cmake-flags }} ..
${{ inputs.additional-cmake-flags }} ..
shell: bash
- name: Build OCCT (Windows)

View File

@@ -33,7 +33,9 @@ runs:
response=$(curl -s \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=${{ github.event.pull_request.base.ref }}&status=success")
latest_run_id=$(echo "$response" | jq -r '.workflow_runs[] | select(.name=="Build and Test OCCT on Multiple Platforms") | .id' | head -n 1)
latest_run_id=$(echo "$response" | jq -r \
--arg repo "${{ github.repository }}" \
'.workflow_runs[] | select(.name=="Build and Test OCCT on Multiple Platforms" and .head_repository.full_name==$repo) | .id' | head -n 1)
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
shell: bash

View File

@@ -14,13 +14,15 @@ on:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
group: ${{ github.event_name == 'pull_request'
&& format('{0}-{1}', github.workflow, github.event.pull_request.number)
|| format('{0}-{1}', github.workflow, github.run_id) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' && !(github.head_ref == 'IR' && github.repository == 'Open-Cascade-SAS/OCCT') && true || false }}
jobs:
clang-format:
name: Check code formatting
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -35,7 +37,7 @@ jobs:
documentation:
name: Build Documentation
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -46,7 +48,7 @@ jobs:
prepare-and-build-windows-x64:
name: Prepare and Build on Windows with MSVC (x64)
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -61,7 +63,7 @@ jobs:
prepare-and-build-windows-clang-x64:
name: Prepare and Build on Windows with Clang (x64)
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -120,6 +122,25 @@ jobs:
compiler: clang
artifact-name: install-linux-clang-x64
prepare-and-build-macos-clang-no-pch:
name: Prepare and Build on macOS with Clang (No PCH)
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Build OCCT
uses: ./.github/actions/build-occt
with:
platform: macos
compiler: clang
artifact-name: install-macos-clang-no-pch
build-use-pch: 'false'
build-opt-profile: 'Default'
additional-cmake-flags: '-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" -D CMAKE_C_FLAGS="-Werror -Wall -Wextra"'
cmake-build-type: 'Debug'
prepare-and-build-linux-gcc-x64:
name: Prepare and Build on Ubuntu with GCC (x64)
runs-on: ubuntu-24.04
@@ -138,7 +159,7 @@ jobs:
build-inspector-windows:
name: Build TInspector on Windows
needs: prepare-and-build-windows-x64
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -168,7 +189,7 @@ jobs:
build-csharp-windows:
name: Build CSharp Sample on Windows
needs: prepare-and-build-windows-x64
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -183,7 +204,7 @@ jobs:
build-mfc-windows:
name: Build MFC Sample on Windows
needs: prepare-and-build-windows-x64
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -198,7 +219,7 @@ jobs:
build-qt-windows:
name: Build Qt Sample on Windows
needs: prepare-and-build-windows-x64
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -227,7 +248,7 @@ jobs:
test-windows-x64:
name: Test on Windows (x64)
runs-on: windows-2022
runs-on: windows-2025
needs: prepare-and-build-windows-x64
steps:
@@ -245,7 +266,7 @@ jobs:
retest-windows-x64:
name: Regression Test on Windows (x64)
runs-on: windows-2022
runs-on: windows-2025
needs: test-windows-x64
steps:
@@ -263,7 +284,7 @@ jobs:
test-windows-clang-x64:
name: Test on Windows with Clang (x64)
runs-on: windows-2022
runs-on: windows-2025
needs: prepare-and-build-windows-clang-x64
steps:
@@ -281,7 +302,7 @@ jobs:
retest-windows-clang-x64:
name: Regression Test on Windows with Clang (x64)
runs-on: windows-2022
runs-on: windows-2025
needs: test-windows-clang-x64
steps:
@@ -444,7 +465,7 @@ jobs:
run-gtest-windows-x64:
name: Run GTest on Windows with MSVC (x64)
needs: prepare-and-build-windows-x64
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository
@@ -461,7 +482,7 @@ jobs:
run-gtest-windows-clang-x64:
name: Run GTest on Windows with Clang (x64)
needs: prepare-and-build-windows-clang-x64
runs-on: windows-2022
runs-on: windows-2025
steps:
- name: Checkout repository

View File

@@ -16,7 +16,7 @@ concurrency:
jobs:
main_job:
name: Windows MinGW validation
runs-on: windows-2022
runs-on: windows-2025
strategy:
matrix:

View File

@@ -16,7 +16,7 @@ concurrency:
jobs:
main_job:
name: Windows MSVC/Clang validation
runs-on: windows-2022
runs-on: windows-2025
strategy:
matrix:

View File

@@ -25,7 +25,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, windows-2022, windows-2019, macos-15, macos-14, macos-13]
os: [ubuntu-24.04, ubuntu-22.04, windows-2022, windows-2025, macos-15, macos-14, macos-13, ubuntu-24.04-arm, ubuntu-22.04-arm]
build_type: [Debug, Release]
steps:

View File

@@ -65,27 +65,21 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
# set using C++ standard
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
set (BUILD_CPP_STANDARD "C++17" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++17" "C++20" "C++23 C++26")
# Set desired C++ standard
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
set (CMAKE_CXX_STANDARD 11)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
set (CMAKE_CXX_STANDARD 14)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
set (CMAKE_CXX_STANDARD 17)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
set (CMAKE_CXX_STANDARD 20)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
set (CMAKE_CXX_STANDARD 23)
else ()
message (FATAL_ERROR, "misprint in c++ standard name")
endif()
if (DEFINED BUILD_GTEST AND BUILD_GTEST AND CMAKE_CXX_STANDARD LESS 14)
set (CMAKE_CXX_STANDARD 14)
message (STATUS "Info: C++14 standard is required for GTest. Set to C++14.")
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++26")
set (CMAKE_CXX_STANDARD 26)
else()
message (WARNING "C++ standard is not set or invalid. Set to C++17.")
set (CMAKE_CXX_STANDARD 17)
endif()
set (CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -490,10 +484,18 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
set (OCCT_3RDPARTY_CMAKE_LIST)
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
# Tcl (mandatory for Draw Harness)
if (USE_TCL)
message (STATUS "Info: TCL is used by OCCT")
OCCT_ADD_VCPKG_FEATURE ("tcl")
if (CAN_USE_TK AND USE_TK)
OCCT_ADD_VCPKG_FEATURE ("tcltk")
else()
OCCT_ADD_VCPKG_FEATURE ("tcl")
OCCT_UNSET_VCPKG_FEATURE ("tcltk")
endif()
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/tcl")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
@@ -504,7 +506,6 @@ endif()
# Tk (optional for Draw Harness)
if (CAN_USE_TK AND USE_TK)
message (STATUS "Info: TK is used by OCCT")
OCCT_ADD_VCPKG_FEATURE ("tk")
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/tk")
else()
if (NOT CAN_USE_TK)
@@ -512,7 +513,6 @@ else()
endif()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
OCCT_UNSET_VCPKG_FEATURE ("tk")
endif()
# Xlib
@@ -785,9 +785,6 @@ file(COPY ${CMAKE_SOURCE_DIR}/.clang-format DESTINATION ${CMAKE_SOURCE_DIR})
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
# do not define INSTALL_DIR_BIN for win.
# Leave library structure for win: <prefix>/win64/vc10/bin(d)
if (NOT DEFINED INSTALL_DIR_BIN)

View File

@@ -151,15 +151,27 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
# /GL (whole program optimization) is similar to -flto (Link Time Optimization) in GCC/Clang.
# /GF (eliminate duplicate strings) doesn't have a direct equivalent in GCC/Clang, but the compilers do string pooling automatically.
# /Gy (enable function-level linking) is similar to -ffunction-sections in GCC/Clang.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer -flto -ffunction-sections")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fomit-frame-pointer -flto -ffunction-sections")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
# Apply LTO optimization on all platforms
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
# Apply function sections only on non-macOS platforms
if (NOT APPLE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections")
endif()
# Link-Time Code Generation(LTCG) is requared for Whole Program Optimisation(GL)
# Link-Time Code Generation (LTCG) is required for Whole Program Optimization
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto")
if (NOT WIN32)
# Add garbage collection sections only on Linux (not on macOS or Windows)
if (NOT WIN32 AND NOT APPLE)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")

View File

@@ -72,24 +72,9 @@ endmacro()
macro (OCCT_MAKE_COMPILER_SHORT_NAME)
if (MSVC)
if (MSVC_VERSION LESS 1914)
message (AUTHOR_WARNING "Microsoft Visual C++ 19.14 (VS 2017 15.7) or newer is required for C++17 support")
message (FATAL_ERROR "Microsoft Visual C++ 19.14 (VS 2017 15.7) or newer is required for C++17 support")
endif()
if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310))
set (COMPILER vc7)
elseif (MSVC_VERSION EQUAL 1400)
set (COMPILER vc8)
elseif (MSVC_VERSION EQUAL 1500)
set (COMPILER vc9)
elseif (MSVC_VERSION EQUAL 1600)
set (COMPILER vc10)
elseif (MSVC_VERSION EQUAL 1700)
set (COMPILER vc11)
elseif (MSVC_VERSION EQUAL 1800)
set (COMPILER vc12)
elseif (MSVC_VERSION EQUAL 1900)
set (COMPILER vc14)
elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
if ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
# Since Visual Studio 15 (2017), its version diverged from version of
# compiler which is 14.1; as that compiler uses the same run-time as 14.0,
# we keep its id as "vc14" to be compatible
@@ -99,28 +84,28 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
endif()
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support")
message (FATAL_ERROR "GCC version 8.0 or newer is required for C++17 support")
endif()
set (COMPILER gcc)
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support")
message (FATAL_ERROR "GCC version 8.0 or newer is required for C++17 support")
endif()
set (COMPILER gxx)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
if(APPLE)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0)
message (AUTHOR_WARNING "Apple Clang version 11.0.0 or newer is required for C++17 support")
message (FATAL_ERROR "Apple Clang version 11.0.0 or newer is required for C++17 support")
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message (AUTHOR_WARNING "Clang version 7.0 or newer is required for C++17 support")
message (FATAL_ERROR "Clang version 7.0 or newer is required for C++17 support")
endif()
endif()
set (COMPILER clang)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.1.1)
message (AUTHOR_WARNING "Intel C++ Compiler version 17.1.1 or newer is required for C++17 support")
message (FATAL_ERROR "Intel C++ Compiler version 17.1.1 or newer is required for C++17 support")
endif()
set (COMPILER icc)
else()
@@ -381,6 +366,11 @@ function (COLLECT_AND_INSTALL_OCCT_HEADER_FILES THE_ROOT_TARGET_OCCT_DIR THE_OCC
list (FILTER HEADER_FILES_FILTERING INCLUDE REGEX ".+[.](h|g|p|lxx|hxx|pxx|hpp|gxx)$")
list (APPEND OCCT_HEADER_FILES_COMPLETE ${HEADER_FILES_FILTERING})
endforeach()
# parse root of the toolkit file
EXTRACT_PACKAGE_FILES (${THE_RELATIVE_PATH} ${OCCT_TOOLKIT} ALL_FILES _)
set (HEADER_FILES_FILTERING ${ALL_FILES})
list (FILTER HEADER_FILES_FILTERING INCLUDE REGEX ".+[.](h|g|p|lxx|hxx|pxx|hpp|gxx)$")
list (APPEND OCCT_HEADER_FILES_COMPLETE ${HEADER_FILES_FILTERING})
endforeach()
# Check that copying is done and match the include installation type.
@@ -438,10 +428,12 @@ function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER THE_IS_PRIVATE)
if (NOT BUILD_USE_PCH)
return()
endif()
# Angular bracket syntax is achieved using $<ANGLE-R> for closing bracket
if (${THE_IS_PRIVATE})
target_precompile_headers(${INPUT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
target_precompile_headers(${INPUT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:<${PRECOMPILED_HEADER}$<ANGLE-R>>")
else()
target_precompile_headers(${INPUT_TARGET} PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
target_precompile_headers(${INPUT_TARGET} PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:<${PRECOMPILED_HEADER}$<ANGLE-R>>")
endif()
endfunction()
@@ -836,12 +828,12 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME)
foreach (RELEASE_DIR ${FOUND_RELEASE_DIRS})
get_filename_component(RELEASE_DIR_ABS "${RELEASE_DIR}" ABSOLUTE)
target_link_directories(${TARGET_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${RELEASE_DIR_ABS}>;$<$<CONFIG:RELWITHDEBINFO>:${RELEASE_DIR_ABS}>")
target_link_directories(${TARGET_NAME} PRIVATE "$<$<CONFIG:RELEASE>:${RELEASE_DIR_ABS}>;$<$<CONFIG:RELWITHDEBINFO>:${RELEASE_DIR_ABS}>")
endforeach()
foreach (DEBUG_DIR ${FOUND_DEBUG_DIRS})
get_filename_component(DEBUG_DIR_ABS "${DEBUG_DIR}" ABSOLUTE)
target_link_directories(${TARGET_NAME} PUBLIC "$<$<CONFIG:DEBUG>:${DEBUG_DIR_ABS}>")
target_link_directories(${TARGET_NAME} PRIVATE "$<$<CONFIG:DEBUG>:${DEBUG_DIR_ABS}>")
endforeach()
endfunction()
macro(OCCT_ADD_VCPKG_FEATURE THE_FEATURE)

View File

@@ -281,14 +281,14 @@ if(IS_VTK_9XX)
string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}")
endif()
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
target_link_libraries (${PROJECT_NAME} PUBLIC ${USED_TOOLKITS_BY_CURRENT_PROJECT} PRIVATE ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
if (USE_QT)
foreach (PROJECT_LIBRARY_DEBUG ${PROJECT_LIBRARIES_DEBUG})
target_link_libraries (${PROJECT_NAME} debug ${PROJECT_LIBRARY_DEBUG})
target_link_libraries (${PROJECT_NAME} PRIVATE debug ${PROJECT_LIBRARY_DEBUG})
endforeach()
foreach (PROJECT_LIBRARY_RELEASE ${PROJECT_LIBRARIES_RELEASE})
target_link_libraries (${PROJECT_NAME} optimized ${PROJECT_LIBRARY_RELEASE})
target_link_libraries (${PROJECT_NAME} PRIVATE optimized ${PROJECT_LIBRARY_RELEASE})
endforeach()
endif()

View File

@@ -18,11 +18,11 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
endif()
# if (BUILD_USE_VCPKG)
# set (3RDPARTY_TK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tk" FORCE)
# set (3RDPARTY_TCLTK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcltk" FORCE)
# set (3RDPARTY_TK_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tk" FORCE)
# endif()
if (BUILD_USE_VCPKG)
set (3RDPARTY_TK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tk" FORCE)
set (3RDPARTY_TCLTK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcltk" FORCE)
set (3RDPARTY_TK_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tk" FORCE)
endif()
if (BUILD_SHARED_LIBS)
# tk library file (with absolute path)

View File

@@ -166,10 +166,8 @@ if not "%CSF_OCCTBinPath%" == "" (
set "PATH=%CSF_OCCTBinPath%;%PATH%"
)
if not ["%TK_DIR%"] == ["%TCL_DIR%"] (
if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%"
if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%"
)
if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%"
if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%"
rem ----- Set envoronment variables used by OCCT -----
set CSF_LANGUAGE=us

View File

@@ -1,25 +0,0 @@
diff --git a/configure b/configure
index 89af70d..405680e 100755
--- a/configure
+++ b/configure
@@ -5480,15 +5480,17 @@ case $target_os in
;;
win32|win64)
disable symver
- if enabled shared; then
+# if enabled shared; then
# Link to the import library instead of the normal static library
# for shared libs.
LD_LIB='%.lib'
# Cannot build both shared and static libs with MSVC or icl.
- disable static
- fi
+# disable static
+# fi
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
shlibdir_default="$bindir_default"
+ LIBPREF=""
+ LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'

View File

@@ -1,13 +0,0 @@
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index fe424b6..2df70df 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -60,6 +60,8 @@
#include <sys/resource.h>
#endif
#ifdef _WIN32
+#define _WIN32_WINNT 0x0502
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

View File

@@ -1,40 +0,0 @@
diff --git a/configure b/configure
index 405680e..cc5bf29 100755
--- a/configure
+++ b/configure
@@ -4111,6 +4111,9 @@ for opt do
--libfuzzer=*)
libfuzzer_path="$optval"
;;
+ --debug)
+ enable debug_configure
+ ;;
*)
optname="${opt%%=*}"
optname="${optname#--}"
@@ -6316,7 +6319,11 @@ fi
enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
check_lib zlib zlib.h zlibVersion -lz; }
-enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
+if enabled debug_configure; then
+ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2d
+else
+ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
+fi
enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
# On some systems dynamic loading requires no extra linker flags
@@ -6434,7 +6441,11 @@ enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8
enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
-enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+if enabled debug_configure; then
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+else
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+fi
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init

View File

@@ -1,49 +0,0 @@
diff --git a/configure b/configure
index cc5bf29..ee26559 100755
--- a/configure
+++ b/configure
@@ -6406,7 +6406,8 @@ if enabled libmfx; then
fi
enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
-enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
+enabled libmp3lame && { check_lib libmp3lame lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs ||
+ require libmp3lame lame/lame.h lame_set_VBR_quality -llibmp3lame-static -llibmpghip-static $libm_extralibs; }
enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei ||
@@ -6446,7 +6447,7 @@ if enabled debug_configure; then
else
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
fi
-enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
+enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr -lm
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
@@ -6527,6 +6528,8 @@ enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal"
enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
+ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -lAdvapi32 -lOle32 -lCfgmgr32||
+ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -pthread -ldl ||
die "ERROR: opencl not found"; } &&
{ test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
@@ -6550,6 +6553,7 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -lcrypt32 -lAdvapi32 -lUser32||
die "ERROR: openssl not found"; }
enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
@@ -6811,7 +6815,7 @@ enabled amf &&
if enabled libc_iconv; then
check_func_headers iconv.h iconv
elif enabled iconv; then
- check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
+ check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv || check_lib iconv iconv.h iconv -liconv -llibcharset
fi
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"

View File

@@ -1,15 +0,0 @@
diff --git a/configure b/configure
index ee26559..f2c83b7 100755
--- a/configure
+++ b/configure
@@ -4496,6 +4496,10 @@ msvc_common_flags(){
-march=*) ;;
-lz) echo zlib.lib ;;
-lx264) echo libx264.lib ;;
+ -lx265) echo libx265.lib ;;
+ -lmp3lame) echo libmp3lame.lib ;;
+ -liconv) echo iconv.lib ;;
+ -lm) ;;
-lstdc++) ;;
-l*) echo ${flag#-l}.lib ;;
-LARGEADDRESSAWARE) echo $flag ;;

View File

@@ -1,13 +0,0 @@
diff --git a/configure b/configure
index f2c83b7..5e42b12 100755
--- a/configure
+++ b/configure
@@ -6379,7 +6379,7 @@ enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
- { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
+ { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac -lm -lstdc++ &&
warn "using libfdk without pkg-config"; } }
flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs

View File

@@ -1,13 +0,0 @@
diff --git a/configure b/configure
index 5e42b12..d8f059f 100755
--- a/configure
+++ b/configure
@@ -6497,7 +6497,7 @@ enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
- { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
+ { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs -ldl" &&
warn "using libx264 without pkg-config"; } } &&
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
check_cpp_condition libx262 x264.h "X264_MPEG2"

View File

@@ -1,16 +0,0 @@
diff --git a/configure b/configure
index d8f059f..f3688ad 100755
--- a/configure
+++ b/configure
@@ -6501,7 +6501,10 @@ enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x
warn "using libx264 without pkg-config"; } } &&
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
check_cpp_condition libx262 x264.h "X264_MPEG2"
-enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
+enabled libx265 && { check_pkg_config libx265 x265 x265.h x265_api_get ||
+ { { check_lib libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++ -lgcc_s -lgcc -lrt -lnuma" ||
+ require libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++"; } &&
+ warn "using libx265 without pkg-config"; } } &&
require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get

View File

@@ -1,12 +0,0 @@
diff --git a/configure b/configure
index f3688ad..26e512e 100755
--- a/configure
+++ b/configure
@@ -6556,6 +6556,7 @@ enabled omx_rpi && { test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoR
enabled omx && require_headers OMX_Core.h
enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto $pthreads_extralibs -ldl ||
check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||

View File

@@ -1,16 +0,0 @@
diff --git a/libavcodec/mf_utils.c b/libavcodec/mf_utils.c
index eeabd0c..ea3a03b 100644
--- a/libavcodec/mf_utils.c
+++ b/libavcodec/mf_utils.c
@@ -22,6 +22,11 @@
#define _WIN32_WINNT 0x0602
#endif
+#if !defined(WINVER) || WINVER < 0x0602
+#undef WINVER
+#define WINVER 0x0602
+#endif
+
#include "mf_utils.h"
#include "libavutil/pixdesc.h"

View File

@@ -1,23 +0,0 @@
diff --git a/configure b/configure
index 26e512e..c0377b6 100755
--- a/configure
+++ b/configure
@@ -3674,6 +3674,18 @@ vpp_qsv_filter_select="qsvvpp"
xfade_opencl_filter_deps="opencl"
yadif_cuda_filter_deps="ffnvcodec"
yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+ametadata_filter_deps="avformat"
+metadata_filter_deps="avformat"
+headphone_filter_deps="avcodec"
+headphone_filter_select="fft"
+showspatial_filter_deps="avcodec"
+showspatial_filter_select="fft"
+superequalizer_filter_deps="avcodec"
+superequalizer_filter_select="rdft"
+surround_filter_deps="avcodec"
+surround_filter_select="rdft"
+sinc_filter_deps="avcodec"
+sinc_filter_select="rdft"
# examples
avio_list_dir_deps="avformat avutil"

View File

@@ -1,13 +0,0 @@
diff --git a/configure b/configure
index c0377b6..62753ef 100755
--- a/configure
+++ b/configure
@@ -6526,7 +6526,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z
enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
{ test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion
+enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion
enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||

View File

@@ -1,30 +0,0 @@
diff --git a/compat/cuda/ptx2c.sh b/compat/cuda/ptx2c.sh
index 48452379c2..1c486dc30e 100755
--- a/compat/cuda/ptx2c.sh
+++ b/compat/cuda/ptx2c.sh
@@ -26,9 +26,10 @@ OUT="$1"
IN="$2"
NAME="$(basename "$IN" | sed 's/\..*//')"
-printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
+printf "const char %s_ptx[] = {\\" "$NAME" > "$OUT"
echo >> "$OUT"
-sed -e "$(printf 's/\r//g')" -e 's/["\\]/\\&/g' -e "$(printf 's/^/\t"/')" -e 's/$/\\n"/' < "$IN" >> "$OUT"
-echo ";" >> "$OUT"
+xxd -i < "$IN" >> "$OUT"
+echo " ,0x00" >> "$OUT"
+echo "};" >> "$OUT"
exit 0
diff --git a/configure b/configure
index 6190d06b0b..48fb73738e 100755
--- a/configure
+++ b/configure
@@ -1046,6 +1046,7 @@ test_nvcc(){
tmpo_=$TMPO
[ -x "$(command -v cygpath)" ] && tmpcu_=$(cygpath -m $tmpcu_) && tmpo_=$(cygpath -m $tmpo_)
test_cmd $nvcc $nvccflags "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_
+ test_cmd xxd
}
check_nvcc() {

View File

@@ -1,13 +0,0 @@
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 1fc0a00..06b2ff0 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -224,7 +224,7 @@ static av_cold int aom_free(AVCodecContext *avctx)
static av_cold int av1_init(AVCodecContext *avctx)
{
- return aom_init(avctx, &aom_codec_av1_dx_algo);
+ return aom_init(avctx, aom_codec_av1_dx());
}
AVCodec ff_libaom_av1_decoder = {

View File

@@ -1,33 +0,0 @@
diff --git a/configure b/configure
index 62753ef..018764e 100755
--- a/configure
+++ b/configure
@@ -6508,11 +6508,8 @@ enabled libvpx && {
enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
- { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs -ldl" &&
- warn "using libx264 without pkg-config"; } } &&
- require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
- check_cpp_condition libx262 x264.h "X264_MPEG2"
+enabled libx264 && check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
+ require_cpp_condition libx264 x264.h "X264_BUILD >= 158"
enabled libx265 && { check_pkg_config libx265 x265 x265.h x265_api_get ||
{ { check_lib libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++ -lgcc_s -lgcc -lrt -lnuma" ||
require libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++"; } &&
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ddc497..0152d30 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -32,10 +32,6 @@
#include "packet_internal.h"
#include "atsc_a53.h"
-#if defined(_MSC_VER)
-#define X264_API_IMPORTS 1
-#endif
-
#include <x264.h>
#include <float.h>
#include <math.h>

View File

@@ -1,28 +0,0 @@
diff --git a/libswscale/aarch64/yuv2rgb_neon.S b/libswscale/aarch64/yuv2rgb_neon.S
index f4b220f..af677af 100644
--- a/libswscale/aarch64/yuv2rgb_neon.S
+++ b/libswscale/aarch64/yuv2rgb_neon.S
@@ -169,19 +169,19 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1
sqdmulh v26.8H, v26.8H, v0.8H // ((Y1*(1<<3) - y_offset) * y_coeff) >> 15
sqdmulh v27.8H, v27.8H, v0.8H // ((Y2*(1<<3) - y_offset) * y_coeff) >> 15
-.ifc \ofmt,argb // 1 2 3 0
+.ifc \ofmt,argb
compute_rgba v5.8B,v6.8B,v7.8B,v4.8B, v17.8B,v18.8B,v19.8B,v16.8B
.endif
-.ifc \ofmt,rgba // 0 1 2 3
+.ifc \ofmt,rgba
compute_rgba v4.8B,v5.8B,v6.8B,v7.8B, v16.8B,v17.8B,v18.8B,v19.8B
.endif
-.ifc \ofmt,abgr // 3 2 1 0
+.ifc \ofmt,abgr
compute_rgba v7.8B,v6.8B,v5.8B,v4.8B, v19.8B,v18.8B,v17.8B,v16.8B
.endif
-.ifc \ofmt,bgra // 2 1 0 3
+.ifc \ofmt,bgra
compute_rgba v6.8B,v5.8B,v4.8B,v7.8B, v18.8B,v17.8B,v16.8B,v19.8B
.endif

View File

@@ -1,43 +0,0 @@
From c534d9f72a89542ed639071b1ae15893aadf1f18 Mon Sep 17 00:00:00 2001
From: rcombs <rcombs@rcombs.me>
Date: Sat, 16 Apr 2022 03:41:29 -0500
Subject: [PATCH] lavc/h264_ps: always include the stop bit in [s|p]ps->data
The VideoToolbox hwaccel needs the entire NAL (including the stop bit),
but ff_h2645_packet_split may remove it. Detect this case by looking for
bit counts divisible by 8 and insert a stop-bit-only 0x80 byte.
Signed-off-by: rcombs <rcombs@rcombs.me>
---
libavcodec/h264_ps.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 051f06692c..e16da68dec 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -351,6 +351,10 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
}
memcpy(sps->data, gb->buffer, sps->data_size);
+ // Re-add the removed stop bit (may be used by hwaccels).
+ if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data))
+ sps->data[sps->data_size++] = 0x80;
+
profile_idc = get_bits(gb, 8);
constraint_set_flags |= get_bits1(gb) << 0; // constraint_set0_flag
constraint_set_flags |= get_bits1(gb) << 1; // constraint_set1_flag
@@ -775,6 +779,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
}
memcpy(pps->data, gb->buffer, pps->data_size);
+ // Re-add the removed stop bit (may be used by hwaccels).
+ if (!(bit_length & 7) && pps->data_size < sizeof(pps->data))
+ pps->data[pps->data_size++] = 0x80;
+
pps->sps_id = get_ue_golomb_31(gb);
if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
!ps->sps_list[pps->sps_id]) {
--
2.20.1

View File

@@ -1,22 +0,0 @@
Subject: [PATCH] fix d3d11
---
Index: qsv.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -383,7 +383,11 @@
int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
const char *load_plugins, int gpu_copy)
{
+#if CONFIG_D3D11VA
+ mfxIMPL impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;
+#else
mfxIMPL impl = MFX_IMPL_AUTO_ANY;
+#endif
mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };

View File

@@ -1,165 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License.
#
#.rst:
# FindFFMPEG
# --------
#
# Find the FFPMEG libraries
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# The following variables will be defined:
#
# ``FFMPEG_FOUND``
# True if FFMPEG found on the local system
#
# ``FFMPEG_INCLUDE_DIRS``
# Location of FFMPEG header files
#
# ``FFMPEG_LIBRARY_DIRS``
# Location of FFMPEG libraries
#
# ``FFMPEG_LIBRARIES``
# List of the FFMPEG libraries found
#
#
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
include(CMakeFindDependencyMacro)
if(NOT FFMPEG_FOUND)
# Compute the installation path relative to this file.
get_filename_component(SEARCH_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH)
get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH)
if(SEARCH_PATH STREQUAL "/")
set(SEARCH_PATH "")
endif()
set(FFMPEG_VERSION "@FFMPEG_VERSION@")
function(append_dependencies out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "DEBUG" "NAMES" "")
if(${arg_DEBUG})
set(config DEBUG)
set(path "${CURRENT_INSTALLED_DIR}/debug/lib/")
else()
set(config RELEASE)
set(path "${CURRENT_INSTALLED_DIR}/lib/")
endif()
foreach(lib_name ${arg_NAMES})
if("${lib_name}" STREQUAL "-pthread")
list(APPEND ${out} "-pthread")
elseif("${lib_name}" STREQUAL "-pthreads")
list(APPEND ${out} "-pthreads")
elseif("${lib_name}" STREQUAL "gcc")
list(APPEND ${out} "-lgcc")
elseif("${lib_name}" STREQUAL "gcc_s")
list(APPEND ${out} "-lgcc_s")
elseif("${lib_name}" STREQUAL "stdc++")
list(APPEND ${out} "-lstdc++")
else()
# first look in ${path} specifically to ensure we find the right release/debug variant
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" PATHS "${path}" NO_DEFAULT_PATH)
# if not found there, must be a system dependency, so look elsewhere
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" REQUIRED)
list(APPEND ${out} "${FFMPEG_DEPENDENCY_${lib_name}_${config}}")
endif()
endforeach()
set("${out}" "${${out}}" PARENT_SCOPE)
endfunction()
macro(FFMPEG_FIND varname shortname headername)
if(NOT FFMPEG_${varname}_INCLUDE_DIRS)
find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATHS ${SEARCH_PATH}/include NO_DEFAULT_PATH)
endif()
if(NOT FFMPEG_${varname}_LIBRARY)
find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATHS ${SEARCH_PATH}/lib/ NO_DEFAULT_PATH)
find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS ${SEARCH_PATH}/debug/lib/ NO_DEFAULT_PATH)
get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY)
get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY)
select_library_configurations(FFMPEG_${varname})
set(FFMPEG_${varname}_LIBRARY ${FFMPEG_${varname}_LIBRARY} CACHE STRING "")
endif()
if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS)
set(FFMPEG_${varname}_FOUND TRUE BOOL)
list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIRS})
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_${varname}_LIBRARY})
list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR})
endif()
endmacro(FFMPEG_FIND)
if(@ENABLE_AVDEVICE@)
FFMPEG_FIND(libavdevice avdevice avdevice.h)
endif()
if(@ENABLE_AVFILTER@)
FFMPEG_FIND(libavfilter avfilter avfilter.h)
endif()
if(@ENABLE_AVFORMAT@)
FFMPEG_FIND(libavformat avformat avformat.h)
endif()
if(@ENABLE_AVCODEC@)
FFMPEG_FIND(libavcodec avcodec avcodec.h)
endif()
if(@ENABLE_AVRESAMPLE@)
FFMPEG_FIND(libavresample avresample avresample.h)
endif()
if(@ENABLE_POSTPROC@)
FFMPEG_FIND(libpostproc postproc postprocess.h)
endif()
if(@ENABLE_SWRESAMPLE@)
FFMPEG_FIND(libswresample swresample swresample.h)
endif()
if(@ENABLE_SWSCALE@)
FFMPEG_FIND(libswscale swscale swscale.h)
endif()
FFMPEG_FIND(libavutil avutil avutil.h)
if (FFMPEG_libavutil_FOUND)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS)
set(FFMPEG_libavutil_VERSION "@LIBAVUTIL_VERSION@" CACHE STRING "")
if(FFMPEG_libavcodec_FOUND)
set(FFMPEG_libavcodec_VERSION "@LIBAVCODEC_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavdevice_FOUND)
set(FFMPEG_libavdevice_VERSION "@LIBAVDEVICE_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavfilter_FOUND)
set(FFMPEG_libavfilter_VERSION "@LIBAVFILTER_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavformat_FOUND)
set(FFMPEG_libavformat_VERSION "@LIBAVFORMAT_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavresample_FOUND)
set(FFMPEG_libavresample_VERSION "@LIBAVRESAMPLE_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libswresample_FOUND)
set(FFMPEG_libswresample_VERSION "@LIBSWRESAMPLE_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libswscale_FOUND)
set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "")
endif()
append_dependencies(FFMPEG_DEPS_LIBRARY_RELEASE NAMES "@FFMPEG_DEPENDENCIES_RELEASE@")
append_dependencies(FFMPEG_DEPS_LIBRARY_DEBUG NAMES "@FFMPEG_DEPENDENCIES_DEBUG@" DEBUG)
if(FFMPEG_DEPS_LIBRARY_RELEASE OR FFMPEG_DEPS_LIBRARY_DEBUG)
select_library_configurations(FFMPEG_DEPS)
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_DEPS_LIBRARY})
endif()
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})
set(FFMPEG_FOUND TRUE CACHE BOOL "")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "")
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "")
set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBRARY_DIRS} CACHE STRING "")
endif()
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS)
endif()

View File

@@ -1,126 +0,0 @@
#!/bin/sh
set -e
export PATH="/usr/bin:$PATH"
command -v cygpath >/dev/null && have_cygpath=1
cygpath() {
if [ -n "$have_cygpath" ]; then
command cygpath "$@"
else
eval _p='$'$#
printf '%s\n' "$_p"
fi
}
move_binary() {
SOURCE=$1
TARGET=$2
BINARY=$3
# run lipo over the command to check whether it really
# is a binary that we need to merge architectures
lipo $SOURCE/$BINARY -info &> /dev/null || return 0
# get the directory name the file is in
DIRNAME=$(dirname $BINARY)
# ensure the directory to move the binary to exists
mkdir -p $TARGET/$DIRNAME
# now finally move the binary
mv $SOURCE/$BINARY $TARGET/$BINARY
}
move_binaries() {
SOURCE=$1
TARGET=$2
[ ! -d $SOURCE ] && return 0
pushd $SOURCE
for BINARY in $(find . -type f); do
move_binary $SOURCE $TARGET $BINARY
done
popd
}
merge_binaries() {
TARGET=$1
SOURCE=$2
shift
shift
pushd $SOURCE/$1
BINARIES=$(find . -type f)
popd
for BINARY in $BINARIES; do
COMMAND="lipo -create -output $TARGET/$BINARY"
for ARCH in $@; do
COMMAND="$COMMAND -arch $ARCH $SOURCE/$ARCH/$BINARY"
done
$($COMMAND)
done
}
export PKG_CONFIG_PATH="$(cygpath -p "${PKG_CONFIG_PATH}")"
# Export HTTP(S)_PROXY as http(s)_proxy:
[ -n "$HTTP_PROXY" ] && export http_proxy="$HTTP_PROXY"
[ -n "$HTTPS_PROXY" ] && export https_proxy="$HTTPS_PROXY"
PATH_TO_BUILD_DIR=$( cygpath "@BUILD_DIR@")
PATH_TO_SRC_DIR=$( cygpath "@SOURCE_PATH@")
PATH_TO_PACKAGE_DIR=$(cygpath "@INST_PREFIX@")
JOBS=@VCPKG_CONCURRENCY@
OSX_ARCHS="@OSX_ARCHS@"
OSX_ARCH_COUNT=0@OSX_ARCH_COUNT@
# Default to hardware concurrency if unset.
: ${JOBS:=$(nproc)}
build_ffmpeg() {
echo "=== CONFIGURING ==="
sh "$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" "--cc=$CC" @CONFIGURE_OPTIONS@ $@
echo "=== BUILDING ==="
make -j${JOBS} V=1
echo "=== INSTALLING ==="
make install
}
cd "$PATH_TO_BUILD_DIR"
if [ $OSX_ARCH_COUNT -gt 1 ]; then
for ARCH in $OSX_ARCHS; do
echo "=== CLEANING FOR $ARCH ==="
make clean && make distclean
build_ffmpeg --enable-cross-compile --arch=$ARCH --extra-cflags=-arch --extra-cflags=$ARCH --extra-ldflags=-arch --extra-ldflags=$ARCH
echo "=== COLLECTING BINARIES FOR $ARCH ==="
move_binaries $PATH_TO_PACKAGE_DIR/lib $PATH_TO_BUILD_DIR/stage/$ARCH/lib
move_binaries $PATH_TO_PACKAGE_DIR/bin $PATH_TO_BUILD_DIR/stage/$ARCH/bin
done
echo "=== MERGING ARCHITECTURES ==="
merge_binaries $PATH_TO_PACKAGE_DIR $PATH_TO_BUILD_DIR/stage $OSX_ARCHS
else
build_ffmpeg
fi

View File

@@ -1,826 +0,0 @@
if(VCPKG_TARGET_IS_WINDOWS)
set(PATCHES 0017-Patch-for-ticket-9019-CUDA-Compile-Broken-Using-MSVC.patch) # https://trac.ffmpeg.org/ticket/9019
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ffmpeg/ffmpeg
REF n4.4.5
SHA512 09338a10b31f0e551735b9aa57e2c22ceae15bbbca1ee04535587ff55f181e187a77ede4e70d8cd0e1e7c85fb27a7e513c93b91848013e997263d58780b8fa49
HEAD_REF master
PATCHES
0001-create-lib-libraries.patch
0003-fix-windowsinclude.patch
0004-fix-debug-build.patch
0006-fix-StaticFeatures.patch
0007-fix-lib-naming.patch
0009-Fix-fdk-detection.patch
0010-Fix-x264-detection.patch
0011-Fix-x265-detection.patch
#0012-Fix-ssl-110-detection.patch
0013-define-WINVER.patch
0014-avfilter-dependency-fix.patch # https://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275819.html
0015-Fix-xml2-detection.patch
${PATCHES}
0018-libaom-Dont-use-aom_codec_av1_dx_algo.patch
0019-libx264-Do-not-explicitly-set-X264_API_IMPORTS.patch
0020-fix-aarch64-libswscale.patch
0022-fix-m1-hardware-decode-nal-bits.patch # remove in next version
0023-fix-qsv-init.patch # remove in next version (5.x)
)
if (SOURCE_PATH MATCHES " ")
message(FATAL_ERROR "Error: ffmpeg will not build with spaces in the path. Please use a directory with no spaces")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
# ffmpeg nasm build gives link error on x86, so fall back to yasm
vcpkg_find_acquire_program(YASM)
get_filename_component(YASM_EXE_PATH "${YASM}" DIRECTORY)
vcpkg_add_to_path("${YASM_EXE_PATH}")
else()
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
vcpkg_add_to_path("${NASM_EXE_PATH}")
endif()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
#We're assuming that if we're building for Windows we're using MSVC
set(INCLUDE_VAR "INCLUDE")
set(LIB_PATH_VAR "LIB")
else()
set(INCLUDE_VAR "CPATH")
set(LIB_PATH_VAR "LIBRARY_PATH")
endif()
set(OPTIONS "--enable-pic --disable-doc --enable-debug --enable-runtime-cpudetect")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(OPTIONS "${OPTIONS} --disable-asm --disable-x86asm")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(OPTIONS "${OPTIONS} --enable-asm --disable-x86asm")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(OPTIONS "${OPTIONS} --enable-asm --enable-x86asm")
endif()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_acquire_msys(MSYS_ROOT)
set(SHELL "${MSYS_ROOT}/usr/bin/bash.exe")
else()
set(SHELL /bin/sh)
endif()
if(VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
string(APPEND OPTIONS " --target-os=mingw32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
string(APPEND OPTIONS " --target-os=mingw64")
endif()
elseif(VCPKG_TARGET_IS_LINUX)
string(APPEND OPTIONS " --target-os=linux")
elseif(VCPKG_TARGET_IS_WINDOWS)
string(APPEND OPTIONS " --target-os=win32")
elseif(VCPKG_TARGET_IS_OSX)
string(APPEND OPTIONS " --target-os=darwin")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
string(APPEND OPTIONS " --target-os=android")
else()
endif()
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
if(VCPKG_DETECTED_MSVC)
set(OPTIONS "--toolchain=msvc ${OPTIONS}")
# This is required because ffmpeg depends upon optimizations to link correctly
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -O2")
string(REGEX REPLACE "(^| )-RTC1( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
string(REGEX REPLACE "(^| )-Od( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
string(REGEX REPLACE "(^| )-Ob0( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
endif()
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -I \"${CURRENT_INSTALLED_DIR}/include\"")
string(APPEND VCPKG_COMBINED_C_FLAGS_RELEASE " -I \"${CURRENT_INSTALLED_DIR}/include\"")
set(_csc_PROJECT_PATH ffmpeg)
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
set(FFMPEG_PKGCONFIG_MODULES libavutil)
if("nonfree" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-nonfree")
endif()
if("gpl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-gpl")
endif()
if("version3" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-version3")
endif()
if("amf" IN_LIST FEATURES)
# Do nothing
else()
set(OPTIONS "${OPTIONS} --disable-amf")
endif()
if("ffmpeg" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-ffmpeg")
else()
set(OPTIONS "${OPTIONS} --disable-ffmpeg")
endif()
if("ffplay" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-ffplay")
else()
set(OPTIONS "${OPTIONS} --disable-ffplay")
endif()
if("ffprobe" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-ffprobe")
else()
set(OPTIONS "${OPTIONS} --disable-ffprobe")
endif()
if (NOT "alsa" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --disable-alsa")
endif()
if("avcodec" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avcodec")
set(ENABLE_AVCODEC ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavcodec)
else()
set(OPTIONS "${OPTIONS} --disable-avcodec")
set(ENABLE_AVCODEC OFF)
endif()
if("avdevice" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avdevice")
set(ENABLE_AVDEVICE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavdevice)
else()
set(OPTIONS "${OPTIONS} --disable-avdevice")
set(ENABLE_AVDEVICE OFF)
endif()
if("avformat" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avformat")
set(ENABLE_AVFORMAT ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavformat)
else()
set(OPTIONS "${OPTIONS} --disable-avformat")
set(ENABLE_AVFORMAT OFF)
endif()
if("avfilter" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avfilter")
set(ENABLE_AVFILTER ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavfilter)
else()
set(OPTIONS "${OPTIONS} --disable-avfilter")
set(ENABLE_AVFILTER OFF)
endif()
if("postproc" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-postproc")
set(ENABLE_POSTPROC ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libpostproc)
else()
set(OPTIONS "${OPTIONS} --disable-postproc")
set(ENABLE_POSTPROC OFF)
endif()
if("swresample" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-swresample")
set(ENABLE_SWRESAMPLE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libswresample)
else()
set(OPTIONS "${OPTIONS} --disable-swresample")
set(ENABLE_SWRESAMPLE OFF)
endif()
if("swscale" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-swscale")
set(ENABLE_SWSCALE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libswscale)
else()
set(OPTIONS "${OPTIONS} --disable-swscale")
set(ENABLE_SWSCALE OFF)
endif()
set(ENABLE_AVRESAMPLE OFF)
if("avresample" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avresample")
set(ENABLE_AVRESAMPLE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavresample)
endif()
set(STATIC_LINKAGE OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(STATIC_LINKAGE ON)
endif()
if("aom" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libaom")
else()
set(OPTIONS "${OPTIONS} --disable-libaom")
endif()
if("ass" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libass")
else()
set(OPTIONS "${OPTIONS} --disable-libass")
endif()
if("avisynthplus" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avisynth")
else()
set(OPTIONS "${OPTIONS} --disable-avisynth")
endif()
if("bzip2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-bzlib")
else()
set(OPTIONS "${OPTIONS} --disable-bzlib")
endif()
if("dav1d" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libdav1d")
else()
set(OPTIONS "${OPTIONS} --disable-libdav1d")
endif()
if("fdk-aac" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfdk-aac")
else()
set(OPTIONS "${OPTIONS} --disable-libfdk-aac")
endif()
if("fontconfig" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfontconfig")
else()
set(OPTIONS "${OPTIONS} --disable-libfontconfig")
endif()
if("freetype" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfreetype")
else()
set(OPTIONS "${OPTIONS} --disable-libfreetype")
endif()
if("fribidi" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfribidi")
else()
set(OPTIONS "${OPTIONS} --disable-libfribidi")
endif()
if("iconv" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-iconv")
else()
set(OPTIONS "${OPTIONS} --disable-iconv")
endif()
if("ilbc" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libilbc")
else()
set(OPTIONS "${OPTIONS} --disable-libilbc")
endif()
if("lzma" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-lzma")
else()
set(OPTIONS "${OPTIONS} --disable-lzma")
endif()
if("mp3lame" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmp3lame")
else()
set(OPTIONS "${OPTIONS} --disable-libmp3lame")
endif()
if("modplug" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmodplug")
else()
set(OPTIONS "${OPTIONS} --disable-libmodplug")
endif()
if("nvcodec" IN_LIST FEATURES)
#Note: the --enable-cuda option does not actually require the cuda sdk or toolset port dependency as ffmpeg uses runtime detection and dynamic loading
set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-nvdec --enable-cuvid --enable-ffnvcodec")
else()
set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-nvdec --disable-cuvid --disable-ffnvcodec")
endif()
if("opencl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-opencl")
else()
set(OPTIONS "${OPTIONS} --disable-opencl")
endif()
if("opengl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-opengl")
else()
set(OPTIONS "${OPTIONS} --disable-opengl")
endif()
if("openh264" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenh264")
else()
set(OPTIONS "${OPTIONS} --disable-libopenh264")
endif()
if("openjpeg" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenjpeg")
else()
set(OPTIONS "${OPTIONS} --disable-libopenjpeg")
endif()
if("openmpt" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenmpt")
else()
set(OPTIONS "${OPTIONS} --disable-libopenmpt")
endif()
if("openssl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-openssl")
else()
set(OPTIONS "${OPTIONS} --disable-openssl")
endif()
if("opus" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopus")
else()
set(OPTIONS "${OPTIONS} --disable-libopus")
endif()
if("sdl2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-sdl2")
else()
set(OPTIONS "${OPTIONS} --disable-sdl2")
endif()
if("snappy" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsnappy")
else()
set(OPTIONS "${OPTIONS} --disable-libsnappy")
endif()
if("soxr" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsoxr")
else()
set(OPTIONS "${OPTIONS} --disable-libsoxr")
endif()
if("speex" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libspeex")
else()
set(OPTIONS "${OPTIONS} --disable-libspeex")
endif()
if("ssh" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libssh")
else()
set(OPTIONS "${OPTIONS} --disable-libssh")
endif()
if("tensorflow" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtensorflow")
else()
set(OPTIONS "${OPTIONS} --disable-libtensorflow")
endif()
if("tesseract" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtesseract")
else()
set(OPTIONS "${OPTIONS} --disable-libtesseract")
endif()
if("theora" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtheora")
else()
set(OPTIONS "${OPTIONS} --disable-libtheora")
endif()
if("vorbis" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libvorbis")
else()
set(OPTIONS "${OPTIONS} --disable-libvorbis")
endif()
if("vpx" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libvpx")
else()
set(OPTIONS "${OPTIONS} --disable-libvpx")
endif()
if("webp" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libwebp")
else()
set(OPTIONS "${OPTIONS} --disable-libwebp")
endif()
if("x264" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libx264")
else()
set(OPTIONS "${OPTIONS} --disable-libx264")
endif()
if("x265" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libx265")
else()
set(OPTIONS "${OPTIONS} --disable-libx265")
endif()
if("xml2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libxml2")
else()
set(OPTIONS "${OPTIONS} --disable-libxml2")
endif()
if("zlib" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-zlib")
else()
set(OPTIONS "${OPTIONS} --disable-zlib")
endif()
if ("srt" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsrt")
else()
set(OPTIONS "${OPTIONS} --disable-libsrt")
endif()
if ("qsv" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmfx --enable-encoder=h264_qsv --enable-decoder=h264_qsv")
endif()
if (VCPKG_TARGET_IS_OSX)
set(OPTIONS "${OPTIONS} --disable-vdpau") # disable vdpau in OSX
endif()
if(VCPKG_TARGET_IS_IOS)
set(OPTIONS "${OPTIONS} --disable-audiotoolbox") # disable AudioToolbox on iOS
endif()
set(OPTIONS_CROSS " --enable-cross-compile")
# ffmpeg needs --cross-prefix option to use appropriate tools for cross-compiling.
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
string(APPEND OPTIONS_CROSS " --cross-prefix=${CMAKE_MATCH_1}")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
string(APPEND OPTIONS_CROSS " --arch=x86_64")
else()
string(APPEND OPTIONS_CROSS " --arch=${VCPKG_TARGET_ARCHITECTURE}")
endif()
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_find_acquire_program(GASPREPROCESSOR)
foreach(GAS_PATH ${GASPREPROCESSOR})
get_filename_component(GAS_ITEM_PATH ${GAS_PATH} DIRECTORY)
set(ENV{PATH} "$ENV{PATH}${VCPKG_HOST_PATH_SEPARATOR}${GAS_ITEM_PATH}")
endforeach(GAS_PATH)
endif()
endif()
if(VCPKG_TARGET_IS_UWP)
set(ENV{LIBPATH} "$ENV{LIBPATH};$ENV{_WKITS10}references\\windows.foundation.foundationcontract\\2.0.0.0\\;$ENV{_WKITS10}references\\windows.foundation.universalapicontract\\3.0.0.0\\")
string(APPEND OPTIONS " --disable-programs")
string(APPEND OPTIONS " --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00")
string(APPEND OPTIONS " --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib")
endif()
# Note: --disable-optimizations can't be used due to https://ffmpeg.org/pipermail/libav-user/2013-March/003945.html
set(OPTIONS_DEBUG "--debug")
set(OPTIONS_RELEASE "")
set(OPTIONS "${OPTIONS} ${OPTIONS_CROSS}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPTIONS "${OPTIONS} --disable-static --enable-shared")
endif()
if(VCPKG_TARGET_IS_MINGW)
set(OPTIONS "${OPTIONS} --extra_cflags=-D_WIN32_WINNT=0x0601")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS "${OPTIONS} --extra-cflags=-DHAVE_UNISTD_H=0")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(OPTIONS "${OPTIONS} --pkg-config-flags=--static")
endif()
set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}")
get_filename_component(CC_path "${VCPKG_DETECTED_CMAKE_C_COMPILER}" DIRECTORY)
get_filename_component(CC_filename "${VCPKG_DETECTED_CMAKE_C_COMPILER}" NAME)
set(ENV{CC} "${CC_filename}")
if(CC_path)
vcpkg_add_to_path(PREPEND "${CC_path}")
endif()
message(STATUS "Building Options: ${OPTIONS}")
# Release build
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Building Release Options: ${OPTIONS_RELEASE}")
set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${VCPKG_HOST_PATH_SEPARATOR}${ENV_LIB_PATH}")
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
message(STATUS "Building ${_csc_PROJECT_PATH} for Release")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
# We use response files here as the only known way to handle spaces in paths
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/cflags.rsp")
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
set(ldrsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/ldflags.rsp")
file(WRITE "${ldrsp}" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}")
set(ENV{CFLAGS} "@${crsp}")
# All tools except the msvc arm{,64} assembler accept @... as response file syntax.
# For that assembler, there is no known way to pass in flags. We must hope that not passing flags will work acceptably.
if(NOT VCPKG_DETECTED_MSVC OR NOT VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
set(ENV{ASFLAGS} "@${crsp}")
endif()
set(ENV{LDFLAGS} "@${ldrsp}")
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_RELEASE}")
set(INST_PREFIX "${CURRENT_PACKAGES_DIR}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/build.sh.in" "${BUILD_DIR}/build.sh" @ONLY)
vcpkg_execute_required_process(
COMMAND "${SHELL}" ./build.sh
WORKING_DIRECTORY "${BUILD_DIR}"
LOGNAME "build-${TARGET_TRIPLET}-rel"
)
endif()
# Debug build
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Building Debug Options: ${OPTIONS_DEBUG}")
set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${VCPKG_HOST_PATH_SEPARATOR}${ENV_LIB_PATH}")
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig")
message(STATUS "Building ${_csc_PROJECT_PATH} for Debug")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/cflags.rsp")
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
set(ldrsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/ldflags.rsp")
file(WRITE "${ldrsp}" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
set(ENV{CFLAGS} "@${crsp}")
if(NOT VCPKG_DETECTED_MSVC OR NOT VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
set(ENV{ASFLAGS} "@${crsp}")
endif()
set(ENV{LDFLAGS} "@${ldrsp}")
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_DEBUG}")
set(INST_PREFIX "${CURRENT_PACKAGES_DIR}/debug")
configure_file("${CMAKE_CURRENT_LIST_DIR}/build.sh.in" "${BUILD_DIR}/build.sh" @ONLY)
vcpkg_execute_required_process(
COMMAND "${SHELL}" ./build.sh
WORKING_DIRECTORY "${BUILD_DIR}"
LOGNAME "build-${TARGET_TRIPLET}-dbg"
)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
file(GLOB DEF_FILES "${CURRENT_PACKAGES_DIR}/lib/*.def" "${CURRENT_PACKAGES_DIR}/debug/lib/*.def")
if(NOT VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(LIB_MACHINE_ARG /machine:ARM)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(LIB_MACHINE_ARG /machine:ARM64)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(LIB_MACHINE_ARG /machine:x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(LIB_MACHINE_ARG /machine:x64)
else()
message(FATAL_ERROR "Unsupported target architecture")
endif()
foreach(DEF_FILE ${DEF_FILES})
get_filename_component(DEF_FILE_DIR "${DEF_FILE}" DIRECTORY)
get_filename_component(DEF_FILE_NAME "${DEF_FILE}" NAME)
string(REGEX REPLACE "-[0-9]*\\.def" "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" OUT_FILE_NAME "${DEF_FILE_NAME}")
file(TO_NATIVE_PATH "${DEF_FILE}" DEF_FILE_NATIVE)
file(TO_NATIVE_PATH "${DEF_FILE_DIR}/${OUT_FILE_NAME}" OUT_FILE_NATIVE)
message(STATUS "Generating ${OUT_FILE_NATIVE}")
vcpkg_execute_required_process(
COMMAND lib.exe "/def:${DEF_FILE_NATIVE}" "/out:${OUT_FILE_NATIVE}" ${LIB_MACHINE_ARG}
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}"
LOGNAME "libconvert-${TARGET_TRIPLET}"
)
endforeach()
endif()
file(GLOB EXP_FILES "${CURRENT_PACKAGES_DIR}/lib/*.exp" "${CURRENT_PACKAGES_DIR}/debug/lib/*.exp")
file(GLOB LIB_FILES "${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" "${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
if(VCPKG_TARGET_IS_MINGW)
file(GLOB LIB_FILES_2 "${CURRENT_PACKAGES_DIR}/bin/*.lib" "${CURRENT_PACKAGES_DIR}/debug/bin/*.lib")
endif()
set(files_to_remove ${EXP_FILES} ${LIB_FILES} ${LIB_FILES_2} ${DEF_FILES})
if(files_to_remove)
file(REMOVE ${files_to_remove})
endif()
endif()
if("ffmpeg" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ffmpeg AUTO_CLEAN)
endif()
if("ffprobe" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ffprobe AUTO_CLEAN)
endif()
if("ffplay" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ffplay AUTO_CLEAN)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
vcpkg_copy_pdbs()
if (VCPKG_TARGET_IS_WINDOWS)
set(_dirs "/")
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
list(APPEND _dirs "/debug/")
endif()
foreach(_debug IN LISTS _dirs)
foreach(PKGCONFIG_MODULE IN LISTS FFMPEG_PKGCONFIG_MODULES)
set(PKGCONFIG_FILE "${CURRENT_PACKAGES_DIR}${_debug}lib/pkgconfig/${PKGCONFIG_MODULE}.pc")
# remove redundant cygwin style -libpath entries
execute_process(
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -u "${CURRENT_INSTALLED_DIR}"
OUTPUT_VARIABLE CYG_INSTALLED_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
vcpkg_replace_string("${PKGCONFIG_FILE}" "-libpath:${CYG_INSTALLED_DIR}${_debug}lib/pkgconfig/../../lib " "")
# transform libdir, includedir, and prefix paths from cygwin style to windows style
file(READ "${PKGCONFIG_FILE}" PKGCONFIG_CONTENT)
foreach(PATH_NAME prefix libdir includedir)
string(REGEX MATCH "${PATH_NAME}=[^\n]*" PATH_VALUE "${PKGCONFIG_CONTENT}")
string(REPLACE "${PATH_NAME}=" "" PATH_VALUE "${PATH_VALUE}")
if(NOT PATH_VALUE)
message(FATAL_ERROR "failed to find pkgconfig variable ${PATH_NAME}")
endif()
execute_process(
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -w "${PATH_VALUE}"
OUTPUT_VARIABLE FIXED_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
file(TO_CMAKE_PATH "${FIXED_PATH}" FIXED_PATH)
vcpkg_replace_string("${PKGCONFIG_FILE}" "${PATH_NAME}=${PATH_VALUE}" "${PATH_NAME}=${FIXED_PATH}")
endforeach()
# list libraries with -l flag (so pkgconf knows they are libraries and not just linker flags)
foreach(LIBS_ENTRY Libs Libs.private)
string(REGEX MATCH "${LIBS_ENTRY}: [^\n]*" LIBS_VALUE "${PKGCONFIG_CONTENT}")
if(NOT LIBS_VALUE)
message(FATAL_ERROR "failed to find pkgconfig entry ${LIBS_ENTRY}")
endif()
string(REPLACE "${LIBS_ENTRY}: " "" LIBS_VALUE "${LIBS_VALUE}")
if(LIBS_VALUE)
set(LIBS_VALUE_OLD "${LIBS_VALUE}")
string(REGEX REPLACE "([^ ]+)[.]lib" "-l\\1" LIBS_VALUE "${LIBS_VALUE}")
set(LIBS_VALUE_NEW "${LIBS_VALUE}")
vcpkg_replace_string("${PKGCONFIG_FILE}" "${LIBS_ENTRY}: ${LIBS_VALUE_OLD}" "${LIBS_ENTRY}: ${LIBS_VALUE_NEW}")
endif()
endforeach()
endforeach()
endforeach()
endif()
vcpkg_fixup_pkgconfig()
# Handle dependencies
x_vcpkg_pkgconfig_get_modules(PREFIX FFMPEG_PKGCONFIG MODULES ${FFMPEG_PKGCONFIG_MODULES} LIBS)
function(append_dependencies_from_libs out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "LIBS" "")
string(REGEX REPLACE "[ ]+" ";" contents "${arg_LIBS}")
list(FILTER contents EXCLUDE REGEX "^-framework$")
list(FILTER contents EXCLUDE REGEX "^-L.+")
list(FILTER contents EXCLUDE REGEX "^-libpath:.+")
list(TRANSFORM contents REPLACE "^-Wl,-framework," "-l")
list(FILTER contents EXCLUDE REGEX "^-Wl,.+")
list(TRANSFORM contents REPLACE "^-l" "")
list(FILTER contents EXCLUDE REGEX "^avresample$")
list(FILTER contents EXCLUDE REGEX "^avutil$")
list(FILTER contents EXCLUDE REGEX "^avcodec$")
list(FILTER contents EXCLUDE REGEX "^avdevice$")
list(FILTER contents EXCLUDE REGEX "^avfilter$")
list(FILTER contents EXCLUDE REGEX "^avformat$")
list(FILTER contents EXCLUDE REGEX "^postproc$")
list(FILTER contents EXCLUDE REGEX "^swresample$")
list(FILTER contents EXCLUDE REGEX "^swscale$")
list(FILTER contents EXCLUDE REGEX "^atomic$")
if(VCPKG_TARGET_IS_WINDOWS)
list(TRANSFORM contents TOLOWER)
endif()
if(contents)
list(APPEND "${out}" "${contents}")
set("${out}" "${${out}}" PARENT_SCOPE)
endif()
endfunction()
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_RELEASE LIBS "${FFMPEG_PKGCONFIG_LIBS_RELEASE}")
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_DEBUG LIBS "${FFMPEG_PKGCONFIG_LIBS_DEBUG}")
# must remove duplicates from the front to respect link order so reverse first
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_RELEASE)
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_DEBUG)
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
message(STATUS "Dependencies (release): ${FFMPEG_DEPENDENCIES_RELEASE}")
message(STATUS "Dependencies (debug): ${FFMPEG_DEPENDENCIES_DEBUG}")
# Handle version strings
function(extract_regex_from_file out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "FILE;REGEX" "")
file(READ "${arg_FILE}" contents)
if (contents MATCHES "${arg_REGEX}")
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
message(FATAL_ERROR "Could not identify match group in regular expression \"${arg_REGEX}\"")
endif()
else()
message(FATAL_ERROR "Could not find line matching \"${arg_REGEX}\" in file \"${arg_FILE}\"")
endif()
set("${out}" "${CMAKE_MATCH_1}" PARENT_SCOPE)
endfunction()
function(extract_version_from_component out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "COMPONENT" "")
string(TOLOWER "${arg_COMPONENT}" component_lower)
string(TOUPPER "${arg_COMPONENT}" component_upper)
extract_regex_from_file(major_version
FILE "${SOURCE_PATH}/${component_lower}/version.h"
REGEX "#define ${component_upper}_VERSION_MAJOR[ ]+([0-9]+)"
)
extract_regex_from_file(minor_version
FILE "${SOURCE_PATH}/${component_lower}/version.h"
REGEX "#define ${component_upper}_VERSION_MINOR[ ]+([0-9]+)"
)
extract_regex_from_file(micro_version
FILE "${SOURCE_PATH}/${component_lower}/version.h"
REGEX "#define ${component_upper}_VERSION_MICRO[ ]+([0-9]+)"
)
set("${out}" "${major_version}.${minor_version}.${micro_version}" PARENT_SCOPE)
endfunction()
extract_regex_from_file(FFMPEG_VERSION
FILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libavutil/ffversion.h"
REGEX "#define FFMPEG_VERSION[ ]+\"(.+)\""
)
extract_version_from_component(LIBAVUTIL_VERSION
COMPONENT libavutil)
extract_version_from_component(LIBAVCODEC_VERSION
COMPONENT libavcodec)
extract_version_from_component(LIBAVDEVICE_VERSION
COMPONENT libavdevice)
extract_version_from_component(LIBAVFILTER_VERSION
COMPONENT libavfilter)
extract_version_from_component( LIBAVFORMAT_VERSION
COMPONENT libavformat)
extract_version_from_component(LIBAVRESAMPLE_VERSION
COMPONENT libavresample)
extract_version_from_component(LIBSWRESAMPLE_VERSION
COMPONENT libswresample)
extract_version_from_component(LIBSWSCALE_VERSION
COMPONENT libswscale)
# Handle copyright
file(STRINGS "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-out.log" LICENSE_STRING REGEX "License: .*" LIMIT_COUNT 1)
if(LICENSE_STRING STREQUAL "License: LGPL version 2.1 or later")
set(LICENSE_FILE "COPYING.LGPLv2.1")
elseif(LICENSE_STRING STREQUAL "License: LGPL version 3 or later")
set(LICENSE_FILE "COPYING.LGPLv3")
elseif(LICENSE_STRING STREQUAL "License: GPL version 2 or later")
set(LICENSE_FILE "COPYING.GPLv2")
elseif(LICENSE_STRING STREQUAL "License: GPL version 3 or later")
set(LICENSE_FILE "COPYING.GPLv3")
elseif(LICENSE_STRING STREQUAL "License: nonfree and unredistributable")
set(LICENSE_FILE "COPYING.NONFREE")
file(WRITE "${SOURCE_PATH}/${LICENSE_FILE}" "${LICENSE_STRING}")
else()
message(FATAL_ERROR "Failed to identify license (${LICENSE_STRING})")
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/FindFFMPEG.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/FindFFMPEG.cmake" @ONLY)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/${LICENSE_FILE}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@@ -1,6 +0,0 @@
To use ffmpeg add the following to your CMake project:
find_package(FFMPEG REQUIRED)
target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES})

View File

@@ -1,8 +0,0 @@
set(FFMPEG_PREV_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
cmake_policy(SET CMP0012 NEW)
_find_package(${ARGS})
set(CMAKE_MODULE_PATH ${FFMPEG_PREV_MODULE_PATH})

View File

@@ -1,676 +0,0 @@
{
"name": "ffmpeg",
"version": "4.4.5",
"port-version": 0,
"description": [
"a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
],
"homepage": "https://ffmpeg.org",
"license": null,
"dependencies": [
{
"name": "vcpkg-cmake-get-vars",
"host": true
},
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
}
],
"default-features": [
"avcodec",
"avdevice",
"avfilter",
"avformat",
"swresample",
"swscale"
],
"features": {
"all": {
"description": "Build with all allowed dependencies selected that are compatible with the lgpl license",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avdevice",
"avfilter",
"avformat",
"avresample",
"bzip2",
"freetype",
"iconv",
"lzma",
"mp3lame",
"openjpeg",
"opus",
"snappy",
"soxr",
"speex",
"swresample",
"swscale",
"theora",
"vorbis",
"vpx",
"webp",
"xml2",
"zlib"
]
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"alsa"
],
"platform": "linux"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"sdl2"
],
"platform": "!osx"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"ass"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"fontconfig"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"fribidi"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"modplug"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"opencl"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"openh264"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"srt"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"ilbc"
],
"platform": "!(arm & uwp)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"ssh"
],
"platform": "!(uwp | arm)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"tensorflow"
],
"platform": "x64 & !static & !uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"aom"
],
"platform": "!(windows & arm & !uwp)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"dav1d"
],
"platform": "!(uwp | arm | x86 | osx)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"opengl"
],
"platform": "!uwp & !(arm64 & windows)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"tesseract"
],
"platform": "!(windows & arm) & !static & !uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"nvcodec"
],
"platform": "linux | (!osx & !uwp & !(arm64 & windows))"
}
]
},
"all-gpl": {
"description": "Build with all allowed dependencies selected that are compatible with the gpl license",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"all",
"gpl",
"postproc"
]
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"x264"
],
"platform": "!(arm & windows)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"x265"
],
"platform": "!uwp & !(arm & windows)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avisynthplus"
],
"platform": "windows & !arm & !uwp & !static"
}
]
},
"all-nonfree": {
"description": "Build with all allowed dependencies selected with a non-redistributable license",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"all-gpl",
"fdk-aac",
"nonfree",
"openssl"
]
}
]
},
"alsa": {
"description": "Enable ALSA support",
"dependencies": [
"alsa"
]
},
"amf": {
"description": "AMD AMF codec support",
"dependencies": [
"amd-amf"
]
},
"aom": {
"description": "AV1 video encoding/decoding via libaom support in ffmpeg",
"dependencies": [
"aom"
]
},
"ass": {
"description": "Libass subtitles rendering, needed for subtitles and ass filter support in ffmpeg",
"dependencies": [
"libass"
]
},
"avcodec": {
"description": "Build the avcodec library"
},
"avdevice": {
"description": "Build the avdevice library",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avformat"
]
}
]
},
"avfilter": {
"description": "Build the avfilter library"
},
"avformat": {
"description": "Build the avformat library",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec"
]
}
]
},
"avisynthplus": {
"description": "Reading of AviSynth script files",
"supports": "windows & !static",
"dependencies": [
"avisynthplus",
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
}
]
},
"avresample": {
"description": "Build the avresample library"
},
"bzip2": {
"description": "Bzip2 support",
"dependencies": [
"bzip2"
]
},
"dav1d": {
"description": "AV1 decoding via libdav1d",
"supports": "!osx",
"dependencies": [
"dav1d"
]
},
"fdk-aac": {
"description": "AAC de/encoding via libfdk-aac, **including GPL-incompatible patent-encumbered HE-AAC**. If you do not require HE-AAC, use the built-in FFmpeg AAC codec.",
"dependencies": [
{
"name": "fdk-aac",
"default-features": false,
"features": [
"he-aac"
]
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"nonfree"
]
}
]
},
"ffmpeg": {
"description": "Build the ffmpeg application",
"supports": "!uwp",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avfilter",
"avformat"
]
}
]
},
"ffplay": {
"description": "Build the ffplay application",
"supports": "!uwp",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avfilter",
"avformat",
"sdl2",
"swresample",
"swscale"
]
}
]
},
"ffprobe": {
"description": "Build the ffprobe application",
"supports": "!uwp",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avformat"
]
}
]
},
"fontconfig": {
"description": "Useful for drawtext filter",
"dependencies": [
"fontconfig"
]
},
"freetype": {
"description": "Needed for drawtext filter",
"dependencies": [
"freetype"
]
},
"fribidi": {
"description": "Improves drawtext filter",
"dependencies": [
"fribidi"
]
},
"gpl": {
"description": "Allow use of GPL code, the resulting libs and binaries will be under GPL"
},
"iconv": {
"description": "Iconv support",
"dependencies": [
"libiconv"
]
},
"ilbc": {
"description": "iLBC de/encoding via libilbc",
"dependencies": [
"libilbc"
]
},
"lzma": {
"description": "lzma support",
"dependencies": [
"liblzma"
]
},
"modplug": {
"description": "ModPlug via libmodplug",
"dependencies": [
"libmodplug"
]
},
"mp3lame": {
"description": "MP3 encoding via libmp3lame",
"dependencies": [
"mp3lame"
]
},
"nonfree": {
"description": "Allow use of nonfree code, the resulting libs and binaries will be unredistributable"
},
"nvcodec": {
"description": "Nvidia video decoding/encoding acceleration",
"supports": "linux | (!osx & !uwp & !(arm64 & windows))",
"dependencies": [
"ffnvcodec"
]
},
"opencl": {
"description": "OpenCL processing",
"supports": "!uwp",
"dependencies": [
"opencl"
]
},
"opengl": {
"description": "OpenGL rendering",
"supports": "!uwp",
"dependencies": [
"opengl",
"opengl-registry"
]
},
"openh264": {
"description": "H.264 de/encoding via openh264",
"dependencies": [
"openh264"
]
},
"openjpeg": {
"description": "JPEG 2000 de/encoding via OpenJPEG",
"dependencies": [
"openjpeg"
]
},
"openmpt": {
"description": "Decoding tracked files via libopenmpt",
"dependencies": [
"libopenmpt"
]
},
"openssl": {
"description": "Needed for https support if gnutls, libtls or mbedtls is not used",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"nonfree"
]
},
"openssl"
]
},
"opus": {
"description": "Opus de/encoding via libopus",
"dependencies": [
"opus"
]
},
"postproc": {
"description": "Build the postproc library",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
}
]
},
"qsv": {
"description": "Intel QSV Codec",
"dependencies": [
"mfx-dispatch"
]
},
"sdl2": {
"description": "Sdl2 support",
"dependencies": [
{
"name": "sdl2",
"default-features": false,
"features": [
"x11"
],
"platform": "linux"
},
{
"name": "sdl2",
"platform": "!linux"
}
]
},
"snappy": {
"description": "Snappy compression, needed for hap encoding",
"dependencies": [
"snappy"
]
},
"soxr": {
"description": "Include libsoxr resampling",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"swresample"
]
},
"soxr"
]
},
"speex": {
"description": "Speex de/encoding via libspeex",
"dependencies": [
"speex"
]
},
"srt": {
"description": "Haivision SRT protocol",
"supports": "!uwp",
"dependencies": [
"libsrt"
]
},
"ssh": {
"description": "SFTP protocol via libssh",
"dependencies": [
"libssh"
]
},
"swresample": {
"description": "Build the swresample library"
},
"swscale": {
"description": "Build the swscale library"
},
"tensorflow": {
"description": "TensorFlow as a DNN module backend for DNN based filters like sr",
"supports": "!static",
"dependencies": [
"tensorflow"
]
},
"tesseract": {
"description": "Tesseract, needed for ocr filter",
"supports": "!static",
"dependencies": [
"tesseract"
]
},
"theora": {
"description": "Theora encoding via libtheora",
"dependencies": [
"libtheora"
]
},
"version3": {
"description": "Upgrade (L)GPL to version 3"
},
"vorbis": {
"description": "Vorbis en/decoding via libvorbis, native implementation exists",
"dependencies": [
"libvorbis"
]
},
"vpx": {
"description": "VP8 and VP9 de/encoding via libvpx",
"dependencies": [
"libvpx"
]
},
"webp": {
"description": "WebP encoding via libwebp",
"dependencies": [
"libwebp"
]
},
"x264": {
"description": "H.264 encoding via x264",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
},
"x264"
]
},
"x265": {
"description": "HEVC encoding via x265",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
},
"x265"
]
},
"xml2": {
"description": "XML parsing using the C library libxml2, needed for dash demuxing support",
"dependencies": [
"libxml2"
]
},
"zlib": {
"description": "zlib support",
"dependencies": [
"zlib"
]
}
}
}

View File

@@ -1,13 +0,0 @@
diff --git a/configure.ac b/configure.ac
index f6d25f334..3115504e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1592,7 +1592,7 @@ fi
[enable_uaf_detection="0"]
)
if test "x$enable_uaf_detection" = "x1" ; then
- AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ])
+ AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ], ["enable UAF"])
fi
AC_SUBST([enable_uaf_detection])

View File

@@ -1,58 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO jemalloc/jemalloc
REF 54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
SHA512 527bfbf5db9a5c2b7b04df4785b6ae9d445cff8cb17298bf3e550c88890d2bd7953642d8efaa417580610508279b527d3a3b9e227d17394fd2013c88cb7ae75a
HEAD_REF master
PATCHES
fix-configure-ac.patch
preprocessor.patch
)
if(VCPKG_TARGET_IS_WINDOWS)
set(opts "ac_cv_search_log=none required" "--without-private-namespace")
endif()
set (opts "${opts}" "--disable-initial-exec-tls")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
NO_WRAPPERS
OPTIONS ${opts}
)
vcpkg_install_make()
if(VCPKG_TARGET_IS_WINDOWS)
file(COPY "${SOURCE_PATH}/include/msvc_compat/strings.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/jemalloc/msvc_compat")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/jemalloc/jemalloc.h" "<strings.h>" "\"msvc_compat/strings.h\"")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/jemalloc.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/jemalloc.dll" "${CURRENT_PACKAGES_DIR}/bin/jemalloc.dll")
endif()
if(NOT VCPKG_BUILD_TYPE)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/jemalloc.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/jemalloc.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/jemalloc.dll")
endif()
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/jemalloc.pc" "install_suffix=" "install_suffix=_s")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/jemalloc.pc" "install_suffix=" "install_suffix=_s")
endif()
endif()
endif()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@@ -1,12 +0,0 @@
diff --git a/configure.ac b/configure.ac
index 3115504e2..ffb504b08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -749,6 +749,7 @@ case "${host}" in
so="dll"
if test "x$je_cv_msvc" = "xyes" ; then
importlib="lib"
+ JE_APPEND_VS(CPPFLAGS, -DJEMALLOC_NO_PRIVATE_NAMESPACE)
DSO_LDFLAGS="-LD"
EXTRA_LDFLAGS="-link -DEBUG"
CTARGET='-Fo$@'

View File

@@ -1,8 +0,0 @@
{
"name": "jemalloc",
"version": "5.3.0",
"port-version": 1,
"description": "jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support",
"homepage": "https://jemalloc.net/",
"license": "BSD-2-Clause"
}

View File

@@ -0,0 +1,48 @@
diff --git a/win/makefile.vc b/win/makefile.vc
index c88c0ec3dc..6c9dd624d7 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -466,13 +466,13 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
# release - Everything that builds as part of a release
#---------------------------------------------------------------------
-release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs
+release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs tk-build
all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs
core: setup $(TCLLIB) $(TCLSTUBLIB)
shell: setup $(TCLSH)
dlls: setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll
tcltest: setup $(TCLTEST) dlls $(CAT32)
-install: install-binaries install-libraries install-docs install-pkgs
+install: install-binaries install-libraries install-docs install-pkgs tk-build tk-install
!if $(SYMBOLS)
install: install-pdbs
!endif
@@ -569,6 +569,24 @@ pkgs:
popd \
)
+tk-build:
+!if defined(TKDIR) && defined(INSTALLDIR)
+ @if exist "$(TKDIR)\win\makefile.vc" ( \
+ pushd "$(TKDIR)\win" & \
+ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) INSTALLDIR=$(INSTALLDIR) OPTS=$(OPTS) STATS=$(STATS) CHECKS=$(CHECKS) MACHINE=$(MACHINE) &\
+ popd \
+ )
+!endif
+
+tk-install:
+!if defined(TKDIR) && defined(INSTALLDIR)
+ @if exist "$(TKDIR)\win\makefile.vc" ( \
+ pushd "$(TKDIR)\win" & \
+ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) INSTALLDIR=$(INSTALLDIR) OPTS=$(OPTS) STATS=$(STATS) CHECKS=$(CHECKS) MACHINE=$(MACHINE) install &\
+ popd \
+ )
+!endif
+
test-pkgs:
@for /d %d in ($(PKGSDIR)\*) do \
@if exist "%~fd\win\makefile.vc" ( \
--
2.47.1.windows.2

View File

@@ -0,0 +1,51 @@
diff --git a/win/makefile.vc b/win/makefile.vc
index 6c9dd624d7..d29185feed 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -420,6 +420,7 @@ TCLSTUBOBJS = \
### the left side of implicit rules.
TOMMATHDIR = $(ROOT)\libtommath
PKGSDIR = $(ROOT)\pkgs
+WINDIR = $(ROOT)\win
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
@@ -438,6 +439,7 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif
+
#---------------------------------------------------------------------
# Project specific targets
# There are 4 primary build configurations to consider from the combination
@@ -466,18 +468,24 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
# release - Everything that builds as part of a release
#---------------------------------------------------------------------
-release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs tk-build
-all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs
+release: setup $(TCLSH) $(TCLSTUBLIB) dlls setpath pkgs tk-build
+all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) setpath pkgs
core: setup $(TCLLIB) $(TCLSTUBLIB)
shell: setup $(TCLSH)
dlls: setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll
tcltest: setup $(TCLTEST) dlls $(CAT32)
-install: install-binaries install-libraries install-docs install-pkgs tk-build tk-install
+install: setpath install-binaries install-libraries install-docs install-pkgs tk-build tk-install
!if $(SYMBOLS)
install: install-pdbs
!endif
setup: default-setup
+# Add TCL win directory to PATH for current session
+setpath:
+ @echo Adding $(WINDIR) to PATH
+ @set PATH=$(WINDIR);$(PATH)
+ @echo PATH updated for current session
+
test: test-core test-pkgs
test-core: setup $(TCLTEST) dlls $(CAT32)
set TCL_LIBRARY=$(ROOT:\=/)/library
--
2.47.1.windows.2

View File

@@ -0,0 +1,119 @@
From 34a5ac55260871875c3ad678df8c21ef31500d21 Mon Sep 17 00:00:00 2001
From: dpasukhi <dpasukhi@opencascade.com>
Date: Sun, 22 Jun 2025 14:18:19 +0100
Subject: [PATCH] Add Tk build and install support to Makefile; include
automatic clean and distclean steps
---
unix/Makefile.in | 69 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/unix/Makefile.in b/unix/Makefile.in
index bc743b3892..7464e3f930 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -95,6 +95,12 @@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
# Tcl Module default path roots (TIP189).
TCL_MODULE_PATH = @TCL_MODULE_PATH@
+# Tk-related directories and settings
+# These can be overridden on the command line or set via environment
+TKDIR = @TKDIR@
+TK_BUILD_TOP = $(TKDIR)/unix
+TK_SRC_DIR = $(TKDIR)
+
# warning flags
CFLAGS_WARNING = @CFLAGS_WARNING@
@@ -623,6 +629,34 @@ SRCS = $(GENERIC_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \
#--------------------------------------------------------------------------
all: binaries libraries doc packages
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \
+ echo "TKDIR detected - automatically building Tk..."; \
+ echo "========== TK BUILD PARAMETERS =========="; \
+ echo "TKDIR=$(TKDIR)"; \
+ echo "TCLDIR=$(TOP_DIR)"; \
+ echo "prefix=$(prefix)"; \
+ echo "exec_prefix=$(exec_prefix)"; \
+ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}"; \
+ echo "=========================================="; \
+ if test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "Building Tk using existing Makefile..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE)) || exit $$?; \
+ elif test -f "$(TK_SRC_DIR)/unix/configure"; then \
+ echo "Configuring and building Tk..."; \
+ mkdir -p "$(TK_BUILD_TOP)"; \
+ (cd "$(TK_BUILD_TOP)" && \
+ "$(TK_SRC_DIR)/unix/configure" \
+ --prefix="$(prefix)" \
+ --exec-prefix="$(exec_prefix)" \
+ --with-tcl="$(CONFIG_INSTALL_DIR)" && \
+ $(MAKE)) || exit $$?; \
+ else \
+ echo "ERROR: Tk configure script not found at $(TK_SRC_DIR)/unix/configure"; \
+ exit 1; \
+ fi; \
+ else \
+ echo "TKDIR not set or directory does not exist - skipping Tk build"; \
+ fi
binaries: ${LIB_FILE} ${TCL_EXE}
@@ -671,11 +705,25 @@ clean: clean-packages
errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \
minizip${HOST_EXEEXT} *.${HOST_OBJEXT} *.zip *.vfs
(cd dltest ; $(MAKE) clean)
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "TKDIR detected - automatically cleaning Tk..."; \
+ echo "Cleaning Tk build..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) clean) || exit $$?; \
+ else \
+ echo "TKDIR not set, directory does not exist, or no Tk build to clean"; \
+ fi
distclean: distclean-packages clean
rm -rf Makefile config.status config.cache config.log tclConfig.sh \
tclConfig.h *.plist Tcl.framework tcl.pc tclUuid.h
(cd dltest ; $(MAKE) distclean)
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "TKDIR detected - automatically distcleaning Tk..."; \
+ echo "Distcleaning Tk build..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) distclean) || exit $$?; \
+ else \
+ echo "TKDIR not set, directory does not exist, or no Tk build to distclean"; \
+ fi
depend:
makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
@@ -796,6 +844,27 @@ INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_T
$(INSTALL_PACKAGE_TARGETS) $(INSTALL_EXTRA_TARGETS)
install: $(INSTALL_TARGETS)
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \
+ echo "TKDIR detected - automatically installing Tk..."; \
+ echo "========== TK INSTALL PARAMETERS =========="; \
+ echo "TKDIR=$(TKDIR)"; \
+ echo "TCLDIR=$(TOP_DIR)"; \
+ echo "prefix=$(prefix)"; \
+ echo "exec_prefix=$(exec_prefix)"; \
+ echo "DESTDIR=$(INSTALL_ROOT)"; \
+ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}"; \
+ echo "==========================================="; \
+ if test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "Installing Tk..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) install DESTDIR="$(INSTALL_ROOT)") || exit $$?; \
+ else \
+ echo "ERROR: Tk Makefile not found at $(TK_BUILD_TOP)/Makefile"; \
+ echo "Please run 'make all' first to build Tk"; \
+ exit 1; \
+ fi; \
+ else \
+ echo "TKDIR not set or directory does not exist - skipping Tk install"; \
+ fi
install-strip:
$(MAKE) $(INSTALL_TARGETS) \
--
2.47.1.windows.2

View File

@@ -0,0 +1,117 @@
From bf55f8558b8ca6603f6539c6421391f26ab6139a Mon Sep 17 00:00:00 2001
From: dpasukhi <dpasukhi@opencascade.com>
Date: Sun, 22 Jun 2025 15:20:03 +0100
Subject: [PATCH] Add Tk build and install automation to Makefile; include
clean and distclean targets
---
win/Makefile.in | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/win/Makefile.in b/win/Makefile.in
index 8dd107670f..f0cf267329 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -129,6 +129,11 @@ ROOT_DIR_WIN_NATIVE = $(shell cd '$(ROOT_DIR)' ; pwd -W 2>/dev/null || pwd -P)
ZLIB_DIR_NATIVE = $(shell $(CYGPATH) '$(ZLIB_DIR)')
TOMMATH_DIR_NATIVE = $(shell $(CYGPATH) '$(TOMMATH_DIR)')
+# Tk-related directories (TKDIR can be set by user)
+TK_SRC_DIR = $(TKDIR)
+TK_BUILD_TOP = $(TKDIR)/win
+CONFIG_INSTALL_DIR = $(LIB_INSTALL_DIR)
+
# Fully qualify library path so that `make test`
# does not depend on the current directory.
LIBRARY_DIR1 = $(shell cd '$(ROOT_DIR_NATIVE)/library' ; pwd -P)
@@ -432,6 +437,34 @@ TCL_OBJS = ${GENERIC_OBJS} ${WIN_OBJS} @ZLIB_OBJS@ $(TOMMATH_OBJS)
TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
all: binaries libraries doc packages
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \
+ echo "TKDIR detected - automatically building Tk..."; \
+ echo "========== TK BUILD PARAMETERS =========="; \
+ echo "TKDIR=$(TKDIR)"; \
+ echo "TCLDIR=$(TOP_DIR)"; \
+ echo "prefix=$(prefix)"; \
+ echo "exec_prefix=$(exec_prefix)"; \
+ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VER)${EXESUFFIX}"; \
+ echo "=========================================="; \
+ if test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "Building Tk using existing Makefile..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE)) || exit $$?; \
+ elif test -f "$(TK_SRC_DIR)/win/configure"; then \
+ echo "Configuring and building Tk..."; \
+ mkdir -p "$(TK_BUILD_TOP)"; \
+ (cd "$(TK_BUILD_TOP)" && \
+ "$(TK_SRC_DIR)/win/configure" \
+ --prefix="$(prefix)" \
+ --exec-prefix="$(exec_prefix)" \
+ --with-tcl="$(CONFIG_INSTALL_DIR)" && \
+ $(MAKE)) || exit $$?; \
+ else \
+ echo "ERROR: Tk configure script not found at $(TK_SRC_DIR)/win/configure"; \
+ exit 1; \
+ fi; \
+ else \
+ echo "TKDIR not set or directory does not exist - skipping Tk build"; \
+ fi
# Test-suite helper (can be used to test Tcl from build directory with all expected modules).
# To start from windows shell use:
@@ -648,6 +681,27 @@ gentommath_h:
> "$(GENERIC_DIR_NATIVE)/tclTomMath.h"
install: all install-binaries install-libraries install-doc install-packages
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \
+ echo "TKDIR detected - automatically installing Tk..."; \
+ echo "========== TK INSTALL PARAMETERS =========="; \
+ echo "TKDIR=$(TKDIR)"; \
+ echo "TCLDIR=$(TOP_DIR)"; \
+ echo "prefix=$(prefix)"; \
+ echo "exec_prefix=$(exec_prefix)"; \
+ echo "DESTDIR=$(INSTALL_ROOT)"; \
+ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VER)${EXESUFFIX}"; \
+ echo "==========================================="; \
+ if test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "Installing Tk..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) install DESTDIR="$(INSTALL_ROOT)") || exit $$?; \
+ else \
+ echo "ERROR: Tk Makefile not found at $(TK_BUILD_TOP)/Makefile"; \
+ echo "Please run 'make all' first to build Tk"; \
+ exit 1; \
+ fi; \
+ else \
+ echo "TKDIR not set or directory does not exist - skipping Tk install"; \
+ fi
install-binaries: binaries
@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)"; \
@@ -848,10 +902,24 @@ clean: cleanhelp clean-packages
$(RM) $(TCLSH) $(CAT32) $(TEST_EXE_FILE) $(TEST_DLL_FILE) tcltest.cmd tcltest.sh
$(RM) *.pch *.ilk *.pdb *.zip
$(RMDIR) *.vfs
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "TKDIR detected - automatically cleaning Tk..."; \
+ echo "Cleaning Tk build..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) clean) || exit $$?; \
+ else \
+ echo "TKDIR not set, directory does not exist, or no Tk build to clean"; \
+ fi
distclean: distclean-packages clean
$(RM) Makefile config.status config.cache config.log tclConfig.sh \
tcl.hpj config.status.lineno tclsh.exe.manifest tclUuid.h
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "TKDIR detected - automatically distcleaning Tk..."; \
+ echo "Distcleaning Tk build..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) distclean) || exit $$?; \
+ else \
+ echo "TKDIR not set, directory does not exist, or no Tk build to distclean"; \
+ fi
#
# Bundled package targets
--
2.47.1.windows.2

View File

@@ -1,20 +1,56 @@
vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO tcl/Tcl
REF 8.6.15
FILENAME tcl8.6.15-src.tar.gz
SHA512 9ae652823084899091467744da5a35d0fdfb453c055baea96af1bb181d161abe58b83382315cc3abee5fd57acc4ad5028df486a3e53645a28d1467e9c8d1d23e
REF 8.6.16
FILENAME tcl8.6.16-src.tar.gz
SHA512 434c92f8181fb8dca6bc065b0f1f5078779086f19adf008818c90a3108596c63465ef43e9f3c1cfb3d4151a9de244d0bf0e6ee5b40e714b1ddca4a78eb43050b
PATCHES
0001-Add-tk-build.patch
0002-Add-setpath-target.patch
0003-Update-unix-build.patch
0004-Update-mingw-build.patch
)
if (VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(USE_TCL_TK OFF)
if ("tk" IN_LIST FEATURES)
vcpkg_from_sourceforge(
OUT_SOURCE_PATH TK_SOURCE_PATH
REPO tcl/Tcl
REF 8.6.16
FILENAME tk8.6.16-src.tar.gz
SHA512 b7d37bee25f826f156137a04859ac756c682f1dd155ec9629119dc3690509ce1b6e308e23b291f2debbc10f3b1650993fea66463e5445c505860a10acac901d0
)
# Copy TK to TCL package source path (SOURCE_PATH/extra/tk) if TK is used
if (NOT EXISTS "${SOURCE_PATH}/extra/tk.8.6.16-src")
file(MAKE_DIRECTORY "${SOURCE_PATH}/extra/tk.8.6.16-src")
file(COPY ${TK_SOURCE_PATH}/ DESTINATION "${SOURCE_PATH}/extra/tk.8.6.16-src")
endif()
set (USE_TCL_TK ON)
endif()
# Copy TK to TCL package source path if TK is used
# Use Windows NMAKE build for MSVC, but Unix build for MinGW
if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(TCL_BUILD_MACHINE_STR MACHINE=AMD64)
else()
set(TCL_BUILD_ARCH_STR ARCH=AMD64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(TCL_BUILD_MACHINE_STR MACHINE=ARM64)
set(TCL_BUILD_ARCH_STR ARCH=ARM64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(TCL_BUILD_MACHINE_STR MACHINE=IX86)
set(TCL_BUILD_ARCH_STR ARCH=IX86)
else()
# Default fallback for unknown architectures
set(TCL_BUILD_MACHINE_STR MACHINE=IX86)
set(TCL_BUILD_ARCH_STR ARCH=IX86)
endif()
# Handle features
set(TCL_BUILD_OPTS OPTS=pdbs)
set(TCL_BUILD_OPTS OPTS=)
set(TCL_BUILD_STATS STATS=none)
set(TCL_BUILD_CHECKS CHECKS=none)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
@@ -42,109 +78,47 @@ if (VCPKG_TARGET_IS_WINDOWS)
PROJECT_SUBPATH win
OPTIONS
${TCL_BUILD_MACHINE_STR}
${TCL_BUILD_ARCH_STR}
${TCL_BUILD_STATS}
${TCL_BUILD_CHECKS}
TKDIR=../extra/tk.8.6.16-src
OPTIONS_DEBUG
${TCL_BUILD_OPTS},symbols
${TCL_BUILD_OPTS},symbols,pdbs
INSTALLDIR=${CURRENT_PACKAGES_DIR}/debug
SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0
OPTIONS_RELEASE
release
${TCL_BUILD_OPTS}
INSTALLDIR=${CURRENT_PACKAGES_DIR}
SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0
)
# Install
# Note: tcl shell requires it to be in a folder adjacent to the /lib/ folder, i.e. in a /bin/ folder
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
file(GLOB_RECURSE TOOL_BIN
"${CURRENT_PACKAGES_DIR}/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/bin/*.dll"
)
file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/bin/")
# Remove .exes only after copying
file(GLOB_RECURSE TOOL_EXES
${CURRENT_PACKAGES_DIR}/bin/*.exe
)
file(REMOVE ${TOOL_EXES})
file(GLOB_RECURSE TOOLS
"${CURRENT_PACKAGES_DIR}/lib/dde1.4/*"
"${CURRENT_PACKAGES_DIR}/lib/nmake/*"
"${CURRENT_PACKAGES_DIR}/lib/reg1.3/*"
"${CURRENT_PACKAGES_DIR}/lib/tcl8/*"
"${CURRENT_PACKAGES_DIR}/lib/tcl8.6/*"
"${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0/*"
)
foreach(TOOL ${TOOLS})
get_filename_component(DST_DIR ${TOOL} PATH)
file(COPY "${TOOL}" DESTINATION ${DST_DIR})
endforeach()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/dde1.4"
"${CURRENT_PACKAGES_DIR}/lib/nmake"
"${CURRENT_PACKAGES_DIR}/lib/reg1.3"
"${CURRENT_PACKAGES_DIR}/lib/tcl8"
"${CURRENT_PACKAGES_DIR}/lib/tcl8.6"
"${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0"
)
file(CHMOD_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/tzdata"
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ WORLD_WRITE
)
endif()
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
file(GLOB_RECURSE TOOL_BIN
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.dll"
)
file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/bin/")
# Remove .exes only after copying
file(GLOB_RECURSE EXES
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
)
file(REMOVE ${EXES})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/dde1.4"
"${CURRENT_PACKAGES_DIR}/debug/lib/nmake"
"${CURRENT_PACKAGES_DIR}/debug/lib/reg1.3"
"${CURRENT_PACKAGES_DIR}/debug/lib/tcl8"
"${CURRENT_PACKAGES_DIR}/debug/lib/tcl8.6"
"${CURRENT_PACKAGES_DIR}/debug/lib/tdbcsqlite31.1.0"
)
file(CHMOD_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/tzdata"
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ WORLD_WRITE
)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file (REMOVE ${CURRENT_PACKAGES_DIR}/bin/zlib1.dll)
file (REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/zlib1.dll)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
else()
set (TCL_PROJECT_SUBPATH unix)
if (VCPKG_TARGET_IS_MINGW)
set (TCL_PROJECT_SUBPATH win)
endif()
file(REMOVE "${SOURCE_PATH}/${TCL_PROJECT_SUBPATH}/configure")
# For MinGW and other Unix-like environments on Windows, use unix build path
# MinGW can use either win/ (with MinGW-compatible Makefiles) or unix/ (with autotools)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH unix
PROJECT_SUBPATH ${TCL_PROJECT_SUBPATH}
OPTIONS
TKDIR=${SOURCE_PATH}/extra/tk.8.6.16-src
)
vcpkg_install_make()
vcpkg_install_make(
OPTIONS
TKDIR=${SOURCE_PATH}/extra/tk.8.6.16-src
)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
@@ -153,4 +127,9 @@ endif()
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tclConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tclConfig.sh")
# Remove TK configuration files if TK was built
if(USE_TCL_TK)
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tkConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tkConfig.sh")
endif()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.terms")

View File

@@ -20,6 +20,9 @@
},
"utfmax": {
"description": "Forces Tcl_UniChar to be a 32-bit quantity in stead of 16-bits"
},
"tk" : {
"description": "Enables optional usage of Tk. Part of the module-foundation-classes."
}
}
}

View File

@@ -26,7 +26,7 @@
},
{
"name": "angle",
"platform": "uwp"
"platform": "uwp"
},
{
"name": "opengl",
@@ -52,6 +52,17 @@
"tcl"
]
},
"tcltk": {
"description": "Enables optional usage of TclTk. Part of the module-foundation-classes.",
"dependencies": [
{
"name": "tcl",
"features": [
"tk"
]
}
]
},
"freeimage": {
"description": "Enables optional usage of FreeImage. Part of the module-visualization.",
"dependencies": [

View File

@@ -118,7 +118,7 @@ The following table gives the full list of environment variables used at the con
| BUILD_INCLUDE_SYMLINK | Boolean | Use symbolic links instead of copies for header files in build directory |
| BUILD_MODULE_<MODULE>| Boolean | Indicates whether the corresponding OCCT module should be built |
| BUILD_LIBRARY_TYPE | String | Specifies library type ("Shared" or "Static") |
| BUILD_CPP_STANDARD | String | Select C++ standard (C++11, C++14, C++17, C++20, C++23) |
| BUILD_CPP_STANDARD | String | Select C++ standard (C++17, C++20, C++23, C++26) |
| 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products|
| 3RDPARTY_FREETYPE_* | Path | Path to FreeType binaries |
| 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |

View File

@@ -28,6 +28,9 @@ if { [info exists env(DRAWHOME) ] } {
} else {
if { [info exists env(CASROOT) ] } {
set dir [file join $env(CASROOT) src DrawResources]
if { ! [file isdirectory $dir] } {
set dir [file join $env(CASROOT) resources DrawResources]
}
} else {
puts "Warning: CASROOT is not defined, some features may not load correctly"
set dir [file dirname [info script]]

View File

@@ -110,6 +110,7 @@ LDOMBasicString::LDOMBasicString(const LDOMBasicString& anOther)
break;
case LDOM_Integer:
myVal.i = anOther.myVal.i;
break;
default:;
}
}
@@ -167,7 +168,9 @@ LDOMBasicString& LDOMBasicString::operator=(const LDOMBasicString& anOther)
break;
case LDOM_Integer:
myVal.i = anOther.myVal.i;
default:;
break;
default:
break;
}
return *this;
}

View File

@@ -74,7 +74,8 @@ void LDOM_BasicElement::RemoveNodes()
aTxt = NULL;
break;
}
default:;
default:
break;
}
aNode = aNext;
}

View File

@@ -57,6 +57,7 @@ void PCDM_ReadWriter::Open(const Handle(Storage_BaseDriver)& aDriver,
break;
case Storage_VSAlreadyOpen:
aMsg << "; file was already opened";
break;
default:
break;
}

View File

@@ -28,6 +28,7 @@
#include <RWGltf_GltfLatePrimitiveArray.hxx>
#include <TDocStd_Document.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_ShapeMapTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>

View File

@@ -278,6 +278,23 @@ TCollection_AsciiString RWGltf_CafWriter::formatName(RWMesh_NameFormat theFormat
//=================================================================================================
TopAbs_ShapeEnum RWGltf_CafWriter::getShapeType(const TopoDS_Shape& theShape) const
{
TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
if (aShapeType == TopAbs_COMPOUND)
{
// Compounds are created in the case of merged faces.
// Assuming that all shapes in the compound are of the same type
TopoDS_Iterator it(theShape);
Standard_ProgramError_Raise_if(!it.More(), "Empty compound");
aShapeType = it.Value().ShapeType();
}
return aShapeType;
}
//=================================================================================================
Standard_Boolean RWGltf_CafWriter::toSkipShape(const RWMesh_ShapeIterator& theShapeIter) const
{
return theShapeIter.IsEmpty();
@@ -287,19 +304,17 @@ Standard_Boolean RWGltf_CafWriter::toSkipShape(const RWMesh_ShapeIterator& theSh
Standard_Boolean RWGltf_CafWriter::hasTriangulation(const RWGltf_GltfFace& theGltfFace) const
{
switch (theGltfFace.Shape.ShapeType())
TopAbs_ShapeEnum shapeType = getShapeType(theGltfFace.Shape);
switch (shapeType)
{
case TopAbs_COMPOUND:
case TopAbs_COMPSOLID:
case TopAbs_SOLID:
case TopAbs_SHELL:
case TopAbs_FACE:
return true;
case TopAbs_WIRE:
case TopAbs_EDGE:
case TopAbs_VERTEX:
default:
return false;
default:
throw Standard_ProgramError("Unsupported shape type");
}
}
@@ -499,21 +514,29 @@ void RWGltf_CafWriter::saveTriangleIndices(RWGltf_GltfFace& theGltfFac
void RWGltf_CafWriter::saveEdgeIndices(RWGltf_GltfFace& theGltfFace,
std::ostream& theBinFile,
const RWMesh_EdgeIterator& theFaceIter)
const RWMesh_EdgeIterator& theEdgeIter)
{
const Standard_Integer aNodeFirst = theGltfFace.NbIndexedNodes - theFaceIter.ElemLower();
theGltfFace.NbIndexedNodes += theFaceIter.NbNodes();
theGltfFace.Indices.Count += theFaceIter.NbNodes();
for (Standard_Integer anElemIter = theFaceIter.ElemLower(); anElemIter <= theFaceIter.ElemUpper();
++anElemIter)
const Standard_Integer aNodeFirst = theGltfFace.NbIndexedNodes;
theGltfFace.NbIndexedNodes += theEdgeIter.NbNodes();
const Standard_Integer numSegments = Max(0, theEdgeIter.NbNodes() - 1);
// each segment writes two indices
theGltfFace.Indices.Count += numSegments * 2;
for (Standard_Integer i = 0; i < numSegments; ++i)
{
Standard_Integer i0 = aNodeFirst + i;
Standard_Integer i1 = aNodeFirst + i + 1;
if (theGltfFace.Indices.ComponentType == RWGltf_GltfAccessorCompType_UInt16)
{
writeVertex(theBinFile, (uint16_t)(anElemIter + aNodeFirst));
writeVertex(theBinFile, (uint16_t)i0);
writeVertex(theBinFile, (uint16_t)i1);
}
else
{
writeVertex(theBinFile, anElemIter + aNodeFirst);
writeVertex(theBinFile, i0);
writeVertex(theBinFile, i1);
}
}
}
@@ -522,12 +545,13 @@ void RWGltf_CafWriter::saveEdgeIndices(RWGltf_GltfFace& theGltfFace,
void RWGltf_CafWriter::saveVertexIndices(RWGltf_GltfFace& theGltfFace,
std::ostream& theBinFile,
const RWMesh_VertexIterator& theFaceIter)
const RWMesh_VertexIterator& theVertexIter)
{
const Standard_Integer aNodeFirst = theGltfFace.NbIndexedNodes - theFaceIter.ElemLower();
theGltfFace.NbIndexedNodes += theFaceIter.NbNodes();
theGltfFace.Indices.Count += theFaceIter.NbNodes();
for (Standard_Integer anElemIter = theFaceIter.ElemLower(); anElemIter <= theFaceIter.ElemUpper();
const Standard_Integer aNodeFirst = theGltfFace.NbIndexedNodes - theVertexIter.ElemLower();
theGltfFace.NbIndexedNodes += theVertexIter.NbNodes();
theGltfFace.Indices.Count += theVertexIter.NbNodes();
for (Standard_Integer anElemIter = theVertexIter.ElemLower();
anElemIter <= theVertexIter.ElemUpper();
++anElemIter)
{
if (theGltfFace.Indices.ComponentType == RWGltf_GltfAccessorCompType_UInt16)
@@ -545,7 +569,7 @@ void RWGltf_CafWriter::saveVertexIndices(RWGltf_GltfFace& theGltfFac
void RWGltf_CafWriter::saveIndices(RWGltf_GltfFace& theGltfFace,
std::ostream& theBinFile,
const RWMesh_ShapeIterator& theFaceIter,
const RWMesh_ShapeIterator& theShapeIter,
Standard_Integer& theAccessorNb,
const std::shared_ptr<RWGltf_CafWriter::Mesh>& theMesh)
{
@@ -574,17 +598,18 @@ void RWGltf_CafWriter::saveIndices(RWGltf_GltfFace&
}
}
if (const RWMesh_FaceIterator* aFaceIter = dynamic_cast<const RWMesh_FaceIterator*>(&theFaceIter))
if (const RWMesh_FaceIterator* aFaceIter =
dynamic_cast<const RWMesh_FaceIterator*>(&theShapeIter))
{
saveTriangleIndices(theGltfFace, theBinFile, *aFaceIter, theMesh);
}
else if (const RWMesh_EdgeIterator* anEdgeIter =
dynamic_cast<const RWMesh_EdgeIterator*>(&theFaceIter))
dynamic_cast<const RWMesh_EdgeIterator*>(&theShapeIter))
{
saveEdgeIndices(theGltfFace, theBinFile, *anEdgeIter);
}
else if (const RWMesh_VertexIterator* aVertexIter =
dynamic_cast<const RWMesh_VertexIterator*>(&theFaceIter))
dynamic_cast<const RWMesh_VertexIterator*>(&theShapeIter))
{
saveVertexIndices(theGltfFace, theBinFile, *aVertexIter);
}
@@ -963,7 +988,9 @@ bool RWGltf_CafWriter::writeBinData(const Handle(TDocStd_Document)& theDocument,
aWrittenPrimData.Bind(aGltfFace->Shape, aGltfFace);
Standard_Boolean wasWrittenNonFace = Standard_False;
switch (aGltfFace->Shape.ShapeType())
TopAbs_ShapeEnum shapeType = getShapeType(aGltfFace->Shape);
switch (shapeType)
{
case TopAbs_EDGE: {
RWMesh_EdgeIterator anIter(aGltfFace->Shape, aGltfFace->Style);
@@ -2027,7 +2054,10 @@ void RWGltf_CafWriter::writePrimArray(const RWGltf_GltfFace& theGltfFace
}
myWriter->Key("mode");
switch (theGltfFace.Shape.ShapeType())
TopAbs_ShapeEnum shapeType = getShapeType(theGltfFace.Shape);
switch (shapeType)
{
case TopAbs_EDGE:
myWriter->Int(RWGltf_GltfPrimitiveMode_Lines);

View File

@@ -209,6 +209,9 @@ protected:
const Message_ProgressRange& theProgress);
protected:
//! Returns the underlying shape in case of a compound.
Standard_EXPORT virtual TopAbs_ShapeEnum getShapeType(const TopoDS_Shape& theShape) const;
//! Return TRUE if face shape should be skipped (e.g. because it is invalid or empty).
Standard_EXPORT virtual Standard_Boolean toSkipShape(
const RWMesh_ShapeIterator& theShapeIter) const;

View File

@@ -276,7 +276,7 @@ bool RWGltf_ExtrasParser::parseArray(const RWGltf_JsonValue& theValue,
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(0, theValue.Size());
for (size_t anIndex = 0; anIndex < theValue.Size(); ++anIndex)
{
anArray->SetValue(static_cast<Standard_Integer>(anIndex), theValue[0].GetInt());
anArray->SetValue(static_cast<Standard_Integer>(anIndex), theValue[anIndex].GetInt());
}
getResult()->SetArrayOfIntegers(theValueName.c_str(), anArray);
return true;
@@ -287,7 +287,7 @@ bool RWGltf_ExtrasParser::parseArray(const RWGltf_JsonValue& theValue,
Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(0, theValue.Size());
for (size_t anIndex = 0; anIndex < theValue.Size(); ++anIndex)
{
anArray->SetValue(static_cast<Standard_Integer>(anIndex), theValue[0].GetDouble());
anArray->SetValue(static_cast<Standard_Integer>(anIndex), theValue[anIndex].GetDouble());
}
getResult()->SetArrayOfReals(theValueName.c_str(), anArray);
return true;
@@ -302,7 +302,7 @@ bool RWGltf_ExtrasParser::parseArray(const RWGltf_JsonValue& theValue,
const std::string aSeparator = ";";
for (size_t i = 0; i < theValue.Size(); ++i)
{
anArrayString = anArrayString + aSeparator + theValue[0].GetString();
anArrayString = anArrayString + aSeparator + theValue[i].GetString();
}
getResult()->SetString(theValueName.c_str(), anArrayString.c_str());
return true;

View File

@@ -3,4 +3,4 @@ project(TKDEIGES)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKDEIGES "${CMAKE_CURRENT_SOURCE_DIR}/TKDEIGES_pch.hxx" TRUE)
ADD_PRECOMPILED_HEADER(TKDEIGES "TKDEIGES_pch.hxx" TRUE)

View File

@@ -126,4 +126,4 @@ public:
// clang-format on
};
#endif // _DESTEP_Parameters_HeaderFile
#endif // _DEIGES_Parameters_HeaderFile

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDEIGES_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDEIGES_FILES
EXTERNLIB
PACKAGES
TKDEIGES_pch.hxx
)

View File

@@ -3,6 +3,6 @@ project(TKDESTEP)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKDESTEP "${CMAKE_CURRENT_SOURCE_DIR}/TKDESTEP_pch.hxx" TRUE)
ADD_PRECOMPILED_HEADER(TKDESTEP "TKDESTEP_pch.hxx" TRUE)
FLEX_AND_BISON_TARGET_APPLY ("StepFile" src)

View File

@@ -200,6 +200,8 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
aScope);
InternalParameters.CleanDuplicates =
theResource->BooleanVal("write.cleanduplicates", InternalParameters.CleanDuplicates, aScope);
InternalParameters.WriteScalingTrsf =
theResource->BooleanVal("write.scaling.trsf", InternalParameters.WriteScalingTrsf, aScope);
return DE_ShapeFixConfigurationNode::Load(theResource);
}
@@ -589,6 +591,13 @@ TCollection_AsciiString DESTEP_ConfigurationNode::Save() const
aResult += aScope + "write.cleanduplicates :\t " + InternalParameters.CleanDuplicates + "\n";
aResult += "!\n";
aResult += "!\n";
aResult +=
"!Defines export scaling factor in transformation as Cartesian Operator (On) or skip(Off)";
aResult += "!Default value: 1(\"On\"). Available values: 0(\"OFF\"), 1(\"On\")\n";
aResult += aScope + "write.scaling.trsf :\t " + InternalParameters.WriteScalingTrsf + "\n";
aResult += "!\n";
aResult += DE_ShapeFixConfigurationNode::Save();
aResult += "!*****************************************************************************\n";

View File

@@ -203,6 +203,7 @@ public:
bool WriteVisMaterial = false; //<! VisMaterialMode is used to indicate write Visual Material or not
STEPControl_StepModelType WriteModelType = STEPControl_AsIs; //<! Gives you the choice of translation mode for an Open CASCADE shape that is being translated to STEP
bool CleanDuplicates = false; //<! Indicates whether to remove duplicate entities from the STEP file
bool WriteScalingTrsf = true; //<! Indicates if scaling should be written as Cartesian Operator or skipped
// clang-format on
};

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDESTEP_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDESTEP_FILES
EXTERNLIB
PACKAGES
TKDESTEP_pch.hxx
)

View File

@@ -14,6 +14,7 @@
#ifndef _StepTidy_BaseTestFixture_HeaderFile
#define _StepTidy_BaseTestFixture_HeaderFile
#include <gp_XYZ.hxx>
#include <STEPControl_Controller.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_CartesianPoint.hxx>

View File

@@ -25,6 +25,8 @@ set(OCCT_GeomToStep_FILES
GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx
GeomToStep_MakeCartesianPoint.cxx
GeomToStep_MakeCartesianPoint.hxx
GeomToStep_MakeCartesianTransformationOperator.cxx
GeomToStep_MakeCartesianTransformationOperator.hxx
GeomToStep_MakeCircle.cxx
GeomToStep_MakeCircle.hxx
GeomToStep_MakeCircle_gen.pxx

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <GeomToStep_MakeCartesianTransformationOperator.hxx>
#include <GeomToStep_MakeCartesianPoint.hxx>
#include <GeomToStep_MakeDirection.hxx>
#include <gp_Trsf.hxx>
#include <StepGeom_CartesianTransformationOperator3d.hxx>
//=============================================================================
GeomToStep_MakeCartesianTransformationOperator::GeomToStep_MakeCartesianTransformationOperator(
const gp_Trsf& theTrsf,
const StepData_Factors& theLocalFactors)
{
gp_Trsf anInvTrsf = theTrsf;
anInvTrsf.Invert();
Standard_Real aScale = anInvTrsf.ScaleFactor();
gp_Mat anInvMat = anInvTrsf.HVectorialPart();
gp_Mat aMat = theTrsf.HVectorialPart();
gp_XYZ aTranslation = anInvTrsf.TranslationPart().Multiplied(aMat);
aTranslation.Reverse();
GeomToStep_MakeCartesianPoint aMkPoint(aTranslation, theLocalFactors.LengthFactor());
GeomToStep_MakeDirection aMkDir1(anInvMat.Row(1));
GeomToStep_MakeDirection aMkDir2(anInvMat.Row(2));
GeomToStep_MakeDirection aMkDir3(anInvMat.Row(3));
myTrsfOp = new StepGeom_CartesianTransformationOperator3d();
myTrsfOp->SetName(new TCollection_HAsciiString(""));
myTrsfOp->SetAxis1(aMkDir1.Value());
myTrsfOp->SetAxis2(aMkDir2.Value());
myTrsfOp->SetAxis3(aMkDir3.Value());
myTrsfOp->SetLocalOrigin(aMkPoint.Value());
myTrsfOp->SetScale(aScale);
done = Standard_True;
}

View File

@@ -0,0 +1,53 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _GeomToStep_MakeCartesianTransformationOperator_HeaderFile
#define _GeomToStep_MakeCartesianTransformationOperator_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx>
#include <StepData_StepModel.hxx>
#include <StepGeom_CartesianTransformationOperator3d.hxx>
class gp_Trsf;
//! This class creates a cartesian_transformation_operator from gp_Trsf.
//! This entity is used in OCCT to implement a transformation with scaling.
//! In case of other inputs without scaling use Axis2Placement3d.
class GeomToStep_MakeCartesianTransformationOperator : public GeomToStep_Root
{
public:
DEFINE_STANDARD_ALLOC
//! Main constructor.
//! @param[in] theTrsf Transformation to create the operator from it.
//! @param[in] theLocalFactors Unit scale factors
Standard_EXPORT GeomToStep_MakeCartesianTransformationOperator(
const gp_Trsf& theTrsf,
const StepData_Factors& theLocalFactors = StepData_Factors());
//! Returns the created entity.
//! @return The created value.
inline const Handle(StepGeom_CartesianTransformationOperator3d)& Value() const
{
return myTrsfOp;
}
private:
Handle(StepGeom_CartesianTransformationOperator3d) myTrsfOp;
};
#endif // _GeomToStep_MakeCartesianTransformationOperator_HeaderFile

View File

@@ -14,6 +14,7 @@ set(OCCT_RWStepBasic_FILES
RWStepBasic_RWActionRequestSolution.pxx
RWStepBasic_RWAddress.cxx
RWStepBasic_RWAddress.pxx
RWStepBasic_RWAheadOrBehind.pxx
RWStepBasic_RWApplicationContext.cxx
RWStepBasic_RWApplicationContext.pxx
RWStepBasic_RWApplicationContextElement.cxx
@@ -208,6 +209,7 @@ set(OCCT_RWStepBasic_FILES
RWStepBasic_RWSecurityClassification.pxx
RWStepBasic_RWSecurityClassificationLevel.cxx
RWStepBasic_RWSecurityClassificationLevel.pxx
RWStepBasic_RWSiPrefix.pxx
RWStepBasic_RWSiUnit.cxx
RWStepBasic_RWSiUnit.pxx
RWStepBasic_RWSiUnitAndAreaUnit.cxx
@@ -228,10 +230,12 @@ set(OCCT_RWStepBasic_FILES
RWStepBasic_RWSiUnitAndTimeUnit.pxx
RWStepBasic_RWSiUnitAndVolumeUnit.cxx
RWStepBasic_RWSiUnitAndVolumeUnit.pxx
RWStepBasic_RWSiUnitName.pxx
RWStepBasic_RWSolidAngleMeasureWithUnit.cxx
RWStepBasic_RWSolidAngleMeasureWithUnit.pxx
RWStepBasic_RWSolidAngleUnit.cxx
RWStepBasic_RWSolidAngleUnit.pxx
RWStepBasic_RWSource.pxx
RWStepBasic_RWThermodynamicTemperatureUnit.cxx
RWStepBasic_RWThermodynamicTemperatureUnit.pxx
RWStepBasic_RWUncertaintyMeasureWithUnit.cxx

View File

@@ -0,0 +1,71 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepBasic_RWAheadOrBehind_HeaderFile
#define _RWStepBasic_RWAheadOrBehind_HeaderFile
#include <StepBasic_AheadOrBehind.hxx>
#include <Standard_CString.hxx>
namespace RWStepBasic_RWAheadOrBehind
{
static constexpr char aobAhead[] = ".AHEAD.";
static constexpr char aobExact[] = ".EXACT.";
static constexpr char aobBehind[] = ".BEHIND.";
//! Convert StepBasic_AheadOrBehind to string
//! @param theSourceEnum The StepBasic_AheadOrBehind value to convert
//! @return The corresponding string representation or nullptr if not found
inline const char* ConvertToString(const StepBasic_AheadOrBehind theSourceEnum)
{
switch (theSourceEnum)
{
case StepBasic_aobAhead:
return aobAhead;
case StepBasic_aobExact:
return aobExact;
case StepBasic_aobBehind:
return aobBehind;
}
return nullptr;
}
//! Convert string to StepBasic_AheadOrBehind
//! @param theAheadOrBehindStr The string to convert
//! @param theResultEnum The corresponding StepBasic_AheadOrBehind value
//! @return Standard_True if the conversion was successful, Standard_False otherwise
inline bool ConvertToEnum(const Standard_CString theAheadOrBehindStr,
StepBasic_AheadOrBehind& theResultEnum)
{
if (IsEqual(theAheadOrBehindStr, aobAhead))
{
theResultEnum = StepBasic_aobAhead;
}
else if (IsEqual(theAheadOrBehindStr, aobExact))
{
theResultEnum = StepBasic_aobExact;
}
else if (IsEqual(theAheadOrBehindStr, aobBehind))
{
theResultEnum = StepBasic_aobBehind;
}
else
{
return Standard_False;
}
return Standard_True;
}
} // namespace RWStepBasic_RWAheadOrBehind
#endif // _RWStepBasic_RWAheadOrBehind_HeaderFile

View File

@@ -17,10 +17,7 @@
#include <StepData_StepWriter.hxx>
#include <TCollection_AsciiString.hxx>
// --- Enum : AheadOrBehind ---
static TCollection_AsciiString aobAhead(".AHEAD.");
static TCollection_AsciiString aobExact(".EXACT.");
static TCollection_AsciiString aobBehind(".BEHIND.");
#include "RWStepBasic_RWAheadOrBehind.pxx"
RWStepBasic_RWCoordinatedUniversalTimeOffset::RWStepBasic_RWCoordinatedUniversalTimeOffset() {}
@@ -63,14 +60,10 @@ void RWStepBasic_RWCoordinatedUniversalTimeOffset::ReadStep(
if (data->ParamType(num, 3) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 3);
if (aobAhead.IsEqual(text))
aSense = StepBasic_aobAhead;
else if (aobExact.IsEqual(text))
aSense = StepBasic_aobExact;
else if (aobBehind.IsEqual(text))
aSense = StepBasic_aobBehind;
else
if (!RWStepBasic_RWAheadOrBehind::ConvertToEnum(text, aSense))
{
ach->AddFail("Enumeration ahead_or_behind has not an allowed value");
}
}
else
ach->AddFail("Parameter #3 (sense) is not an enumeration");
@@ -103,16 +96,5 @@ void RWStepBasic_RWCoordinatedUniversalTimeOffset::WriteStep(
// --- own field : sense ---
switch (ent->Sense())
{
case StepBasic_aobAhead:
SW.SendEnum(aobAhead);
break;
case StepBasic_aobExact:
SW.SendEnum(aobExact);
break;
case StepBasic_aobBehind:
SW.SendEnum(aobBehind);
break;
}
SW.SendEnum(RWStepBasic_RWAheadOrBehind::ConvertToString(ent->Sense()));
}

View File

@@ -20,10 +20,7 @@
#include <StepData_StepWriter.hxx>
#include <TCollection_AsciiString.hxx>
// --- Enum : Source ---
static TCollection_AsciiString sBought(".BOUGHT.");
static TCollection_AsciiString sNotKnown(".NOT_KNOWN.");
static TCollection_AsciiString sMade(".MADE.");
#include "RWStepBasic_RWSource.pxx"
RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::
RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource()
@@ -66,14 +63,10 @@ void RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::ReadStep(
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (sBought.IsEqual(text))
aMakeOrBuy = StepBasic_sBought;
else if (sNotKnown.IsEqual(text))
aMakeOrBuy = StepBasic_sNotKnown;
else if (sMade.IsEqual(text))
aMakeOrBuy = StepBasic_sMade;
else
if (!RWStepBasic_RWSource::ConvertToEnum(text, aMakeOrBuy))
{
ach->AddFail("Enumeration source has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (make_or_buy) is not an enumeration");
@@ -102,18 +95,7 @@ void RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::WriteStep(
// --- own field : makeOrBuy ---
switch (ent->MakeOrBuy())
{
case StepBasic_sBought:
SW.SendEnum(sBought);
break;
case StepBasic_sNotKnown:
SW.SendEnum(sNotKnown);
break;
case StepBasic_sMade:
SW.SendEnum(sMade);
break;
}
SW.SendEnum(RWStepBasic_RWSource::ConvertToString(ent->MakeOrBuy()));
}
void RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::Share(

View File

@@ -0,0 +1,161 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepBasic_RWSiPrefix_HeaderFile
#define _RWStepBasic_RWSiPrefix_HeaderFile
#include <StepBasic_SiPrefix.hxx>
#include <Standard_CString.hxx>
namespace RWStepBasic_RWSiPrefix
{
static constexpr char spExa[] = ".EXA.";
static constexpr char spPico[] = ".PICO.";
static constexpr char spMega[] = ".MEGA.";
static constexpr char spFemto[] = ".FEMTO.";
static constexpr char spAtto[] = ".ATTO.";
static constexpr char spCenti[] = ".CENTI.";
static constexpr char spNano[] = ".NANO.";
static constexpr char spHecto[] = ".HECTO.";
static constexpr char spMicro[] = ".MICRO.";
static constexpr char spTera[] = ".TERA.";
static constexpr char spGiga[] = ".GIGA.";
static constexpr char spMilli[] = ".MILLI.";
static constexpr char spPeta[] = ".PETA.";
static constexpr char spDeci[] = ".DECI.";
static constexpr char spKilo[] = ".KILO.";
static constexpr char spDeca[] = ".DECA.";
//! Convert StepBasic_SiPrefix to string
//! @param theSourceEnum The StepBasic_SiPrefix value to convert
//! @return The corresponding string representation or nullptr if not found
inline const char* ConvertToString(const StepBasic_SiPrefix theSourceEnum)
{
switch (theSourceEnum)
{
case StepBasic_spExa:
return spExa;
case StepBasic_spPico:
return spPico;
case StepBasic_spMega:
return spMega;
case StepBasic_spFemto:
return spFemto;
case StepBasic_spAtto:
return spAtto;
case StepBasic_spCenti:
return spCenti;
case StepBasic_spNano:
return spNano;
case StepBasic_spHecto:
return spHecto;
case StepBasic_spMicro:
return spMicro;
case StepBasic_spTera:
return spTera;
case StepBasic_spGiga:
return spGiga;
case StepBasic_spMilli:
return spMilli;
case StepBasic_spPeta:
return spPeta;
case StepBasic_spDeci:
return spDeci;
case StepBasic_spKilo:
return spKilo;
case StepBasic_spDeca:
return spDeca;
}
return nullptr; // Default value
}
//! Convert string to StepBasic_SiPrefix
//! @param thePrefixStr The string to convert
//! @param theResultEnum The corresponding StepBasic_SiPrefix value
//! @return Standard_True if the conversion was successful, Standard_False otherwise
inline bool ConvertToEnum(const Standard_CString thePrefixStr, StepBasic_SiPrefix& theResultEnum)
{
if (IsEqual(thePrefixStr, spExa))
{
theResultEnum = StepBasic_spExa;
}
else if (IsEqual(thePrefixStr, spPico))
{
theResultEnum = StepBasic_spPico;
}
else if (IsEqual(thePrefixStr, spMega))
{
theResultEnum = StepBasic_spMega;
}
else if (IsEqual(thePrefixStr, spFemto))
{
theResultEnum = StepBasic_spFemto;
}
else if (IsEqual(thePrefixStr, spAtto))
{
theResultEnum = StepBasic_spAtto;
}
else if (IsEqual(thePrefixStr, spCenti))
{
theResultEnum = StepBasic_spCenti;
}
else if (IsEqual(thePrefixStr, spNano))
{
theResultEnum = StepBasic_spNano;
}
else if (IsEqual(thePrefixStr, spHecto))
{
theResultEnum = StepBasic_spHecto;
}
else if (IsEqual(thePrefixStr, spMicro))
{
theResultEnum = StepBasic_spMicro;
}
else if (IsEqual(thePrefixStr, spTera))
{
theResultEnum = StepBasic_spTera;
}
else if (IsEqual(thePrefixStr, spGiga))
{
theResultEnum = StepBasic_spGiga;
}
else if (IsEqual(thePrefixStr, spMilli))
{
theResultEnum = StepBasic_spMilli;
}
else if (IsEqual(thePrefixStr, spPeta))
{
theResultEnum = StepBasic_spPeta;
}
else if (IsEqual(thePrefixStr, spDeci))
{
theResultEnum = StepBasic_spDeci;
}
else if (IsEqual(thePrefixStr, spKilo))
{
theResultEnum = StepBasic_spKilo;
}
else if (IsEqual(thePrefixStr, spDeca))
{
theResultEnum = StepBasic_spDeca;
}
else
{
return Standard_False;
}
return Standard_True;
}
} // namespace RWStepBasic_RWSiPrefix
#endif // _RWStepBasic_RWSiPrefix_HeaderFile

View File

@@ -18,53 +18,8 @@
#include <StepData_StepWriter.hxx>
#include <TCollection_AsciiString.hxx>
// --- Enum : SiPrefix ---
static TCollection_AsciiString spExa(".EXA.");
static TCollection_AsciiString spPico(".PICO.");
static TCollection_AsciiString spMega(".MEGA.");
static TCollection_AsciiString spFemto(".FEMTO.");
static TCollection_AsciiString spAtto(".ATTO.");
static TCollection_AsciiString spCenti(".CENTI.");
static TCollection_AsciiString spNano(".NANO.");
static TCollection_AsciiString spHecto(".HECTO.");
static TCollection_AsciiString spMicro(".MICRO.");
static TCollection_AsciiString spTera(".TERA.");
static TCollection_AsciiString spGiga(".GIGA.");
static TCollection_AsciiString spMilli(".MILLI.");
static TCollection_AsciiString spPeta(".PETA.");
static TCollection_AsciiString spDeci(".DECI.");
static TCollection_AsciiString spKilo(".KILO.");
static TCollection_AsciiString spDeca(".DECA.");
// --- Enum : SiUnitName ---
static TCollection_AsciiString sunHertz(".HERTZ.");
static TCollection_AsciiString sunDegreeCelsius(".DEGREE_CELSIUS.");
static TCollection_AsciiString sunSiemens(".SIEMENS.");
static TCollection_AsciiString sunSievert(".SIEVERT.");
static TCollection_AsciiString sunLux(".LUX.");
static TCollection_AsciiString sunWatt(".WATT.");
static TCollection_AsciiString sunOhm(".OHM.");
static TCollection_AsciiString sunSecond(".SECOND.");
static TCollection_AsciiString sunBecquerel(".BECQUEREL.");
static TCollection_AsciiString sunPascal(".PASCAL.");
static TCollection_AsciiString sunHenry(".HENRY.");
static TCollection_AsciiString sunTesla(".TESLA.");
static TCollection_AsciiString sunVolt(".VOLT.");
static TCollection_AsciiString sunJoule(".JOULE.");
static TCollection_AsciiString sunKelvin(".KELVIN.");
static TCollection_AsciiString sunAmpere(".AMPERE.");
static TCollection_AsciiString sunGram(".GRAM.");
static TCollection_AsciiString sunSteradian(".STERADIAN.");
static TCollection_AsciiString sunMole(".MOLE.");
static TCollection_AsciiString sunLumen(".LUMEN.");
static TCollection_AsciiString sunGray(".GRAY.");
static TCollection_AsciiString sunCandela(".CANDELA.");
static TCollection_AsciiString sunFarad(".FARAD.");
static TCollection_AsciiString sunRadian(".RADIAN.");
static TCollection_AsciiString sunNewton(".NEWTON.");
static TCollection_AsciiString sunMetre(".METRE.");
static TCollection_AsciiString sunWeber(".WEBER.");
static TCollection_AsciiString sunCoulomb(".COULOMB.");
#include "RWStepBasic_RWSiPrefix.pxx"
#include "RWStepBasic_RWSiUnitName.pxx"
RWStepBasic_RWSiUnit::RWStepBasic_RWSiUnit() {}
@@ -90,12 +45,16 @@ void RWStepBasic_RWSiUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
hasAprefix = DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
}
}
else
{
ach->AddFail("Parameter #2 (prefix) is not an enumeration");
}
}
// --- own field : name ---
@@ -103,8 +62,10 @@ void RWStepBasic_RWSiUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
if (data->ParamType(num, 3) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 3);
if (!DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
}
}
else
ach->AddFail("Parameter #3 (name) is not an enumeration");
@@ -123,218 +84,10 @@ void RWStepBasic_RWSiUnit::WriteStep(StepData_StepWriter& SW,
// --- own field : prefix ---
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- own field : name ---
SW.SendEnum(EncodeName(ent->Name()));
}
Standard_Boolean RWStepBasic_RWSiUnit::DecodePrefix(StepBasic_SiPrefix& aPrefix,
const Standard_CString text) const
{
if (spExa.IsEqual(text))
aPrefix = StepBasic_spExa;
else if (spPico.IsEqual(text))
aPrefix = StepBasic_spPico;
else if (spMega.IsEqual(text))
aPrefix = StepBasic_spMega;
else if (spFemto.IsEqual(text))
aPrefix = StepBasic_spFemto;
else if (spAtto.IsEqual(text))
aPrefix = StepBasic_spAtto;
else if (spCenti.IsEqual(text))
aPrefix = StepBasic_spCenti;
else if (spNano.IsEqual(text))
aPrefix = StepBasic_spNano;
else if (spHecto.IsEqual(text))
aPrefix = StepBasic_spHecto;
else if (spMicro.IsEqual(text))
aPrefix = StepBasic_spMicro;
else if (spTera.IsEqual(text))
aPrefix = StepBasic_spTera;
else if (spGiga.IsEqual(text))
aPrefix = StepBasic_spGiga;
else if (spMilli.IsEqual(text))
aPrefix = StepBasic_spMilli;
else if (spPeta.IsEqual(text))
aPrefix = StepBasic_spPeta;
else if (spDeci.IsEqual(text))
aPrefix = StepBasic_spDeci;
else if (spKilo.IsEqual(text))
aPrefix = StepBasic_spKilo;
else if (spDeca.IsEqual(text))
aPrefix = StepBasic_spDeca;
else
return Standard_False;
return Standard_True;
}
Standard_Boolean RWStepBasic_RWSiUnit::DecodeName(StepBasic_SiUnitName& aName,
const Standard_CString text) const
{
if (sunHertz.IsEqual(text))
aName = StepBasic_sunHertz;
else if (sunDegreeCelsius.IsEqual(text))
aName = StepBasic_sunDegreeCelsius;
else if (sunSiemens.IsEqual(text))
aName = StepBasic_sunSiemens;
else if (sunSievert.IsEqual(text))
aName = StepBasic_sunSievert;
else if (sunLux.IsEqual(text))
aName = StepBasic_sunLux;
else if (sunWatt.IsEqual(text))
aName = StepBasic_sunWatt;
else if (sunOhm.IsEqual(text))
aName = StepBasic_sunOhm;
else if (sunSecond.IsEqual(text))
aName = StepBasic_sunSecond;
else if (sunBecquerel.IsEqual(text))
aName = StepBasic_sunBecquerel;
else if (sunPascal.IsEqual(text))
aName = StepBasic_sunPascal;
else if (sunHenry.IsEqual(text))
aName = StepBasic_sunHenry;
else if (sunTesla.IsEqual(text))
aName = StepBasic_sunTesla;
else if (sunVolt.IsEqual(text))
aName = StepBasic_sunVolt;
else if (sunJoule.IsEqual(text))
aName = StepBasic_sunJoule;
else if (sunKelvin.IsEqual(text))
aName = StepBasic_sunKelvin;
else if (sunAmpere.IsEqual(text))
aName = StepBasic_sunAmpere;
else if (sunGram.IsEqual(text))
aName = StepBasic_sunGram;
else if (sunSteradian.IsEqual(text))
aName = StepBasic_sunSteradian;
else if (sunMole.IsEqual(text))
aName = StepBasic_sunMole;
else if (sunLumen.IsEqual(text))
aName = StepBasic_sunLumen;
else if (sunGray.IsEqual(text))
aName = StepBasic_sunGray;
else if (sunCandela.IsEqual(text))
aName = StepBasic_sunCandela;
else if (sunFarad.IsEqual(text))
aName = StepBasic_sunFarad;
else if (sunRadian.IsEqual(text))
aName = StepBasic_sunRadian;
else if (sunNewton.IsEqual(text))
aName = StepBasic_sunNewton;
else if (sunMetre.IsEqual(text))
aName = StepBasic_sunMetre;
else if (sunWeber.IsEqual(text))
aName = StepBasic_sunWeber;
else if (sunCoulomb.IsEqual(text))
aName = StepBasic_sunCoulomb;
else
return Standard_False;
return Standard_True;
}
TCollection_AsciiString RWStepBasic_RWSiUnit::EncodePrefix(const StepBasic_SiPrefix aPrefix) const
{
switch (aPrefix)
{
case StepBasic_spExa:
return spExa;
case StepBasic_spPico:
return spPico;
case StepBasic_spMega:
return spMega;
case StepBasic_spFemto:
return spFemto;
case StepBasic_spAtto:
return spAtto;
case StepBasic_spCenti:
return spCenti;
case StepBasic_spNano:
return spNano;
case StepBasic_spHecto:
return spHecto;
case StepBasic_spMicro:
return spMicro;
case StepBasic_spTera:
return spTera;
case StepBasic_spGiga:
return spGiga;
case StepBasic_spMilli:
return spMilli;
case StepBasic_spPeta:
return spPeta;
case StepBasic_spDeci:
return spDeci;
case StepBasic_spKilo:
return spKilo;
case StepBasic_spDeca:
return spDeca;
}
return TCollection_AsciiString("");
}
TCollection_AsciiString RWStepBasic_RWSiUnit::EncodeName(const StepBasic_SiUnitName aName) const
{
switch (aName)
{
case StepBasic_sunHertz:
return sunHertz;
case StepBasic_sunDegreeCelsius:
return sunDegreeCelsius;
case StepBasic_sunSiemens:
return sunSiemens;
case StepBasic_sunSievert:
return sunSievert;
case StepBasic_sunLux:
return sunLux;
case StepBasic_sunWatt:
return sunWatt;
case StepBasic_sunOhm:
return sunOhm;
case StepBasic_sunSecond:
return sunSecond;
case StepBasic_sunBecquerel:
return sunBecquerel;
case StepBasic_sunPascal:
return sunPascal;
case StepBasic_sunHenry:
return sunHenry;
case StepBasic_sunTesla:
return sunTesla;
case StepBasic_sunVolt:
return sunVolt;
case StepBasic_sunJoule:
return sunJoule;
case StepBasic_sunKelvin:
return sunKelvin;
case StepBasic_sunAmpere:
return sunAmpere;
case StepBasic_sunGram:
return sunGram;
case StepBasic_sunSteradian:
return sunSteradian;
case StepBasic_sunMole:
return sunMole;
case StepBasic_sunLumen:
return sunLumen;
case StepBasic_sunGray:
return sunGray;
case StepBasic_sunCandela:
return sunCandela;
case StepBasic_sunFarad:
return sunFarad;
case StepBasic_sunRadian:
return sunRadian;
case StepBasic_sunNewton:
return sunNewton;
case StepBasic_sunMetre:
return sunMetre;
case StepBasic_sunWeber:
return sunWeber;
case StepBasic_sunCoulomb:
return sunCoulomb;
}
return TCollection_AsciiString("");
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
}

View File

@@ -47,16 +47,6 @@ public:
Standard_HIDDEN void WriteStep(StepData_StepWriter& SW,
const Handle(StepBasic_SiUnit)& ent) const;
Standard_HIDDEN Standard_Boolean DecodePrefix(StepBasic_SiPrefix& aPrefix,
const Standard_CString text) const;
Standard_HIDDEN Standard_Boolean DecodeName(StepBasic_SiUnitName& aName,
const Standard_CString text) const;
Standard_HIDDEN TCollection_AsciiString EncodePrefix(const StepBasic_SiPrefix aPrefix) const;
Standard_HIDDEN TCollection_AsciiString EncodeName(const StepBasic_SiUnitName aName) const;
protected:
private:
};

View File

@@ -14,13 +14,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndAreaUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiUnitAndAreaUnit.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
RWStepBasic_RWSiUnitAndAreaUnit::RWStepBasic_RWSiUnitAndAreaUnit() {}
void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
@@ -48,15 +50,14 @@ void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderD
if (!data->CheckNbParams(num, 2, ach, "si_unit"))
return;
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -74,7 +75,7 @@ void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderD
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -99,12 +100,11 @@ void RWStepBasic_RWSiUnitAndAreaUnit::WriteStep(
SW.Send(ent->Dimensions());
SW.StartEntity("SI_UNIT");
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
}

View File

@@ -13,7 +13,6 @@
// pdn 24.12.98 t3d_opt.stp: treatment of unsorted uncertanties
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndLengthUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -22,6 +21,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
RWStepBasic_RWSiUnitAndLengthUnit::RWStepBasic_RWSiUnitAndLengthUnit() {}
void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(
@@ -59,15 +61,14 @@ void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -86,7 +87,7 @@ void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -121,13 +122,12 @@ void RWStepBasic_RWSiUnitAndLengthUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndMassUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
//=================================================================================================
RWStepBasic_RWSiUnitAndMassUnit::RWStepBasic_RWSiUnitAndMassUnit() {}
@@ -60,15 +62,14 @@ void RWStepBasic_RWSiUnitAndMassUnit::ReadStep(const Handle(StepData_StepReaderD
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -87,7 +88,7 @@ void RWStepBasic_RWSiUnitAndMassUnit::ReadStep(const Handle(StepData_StepReaderD
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -122,13 +123,12 @@ void RWStepBasic_RWSiUnitAndMassUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndPlaneAngleUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
RWStepBasic_RWSiUnitAndPlaneAngleUnit::RWStepBasic_RWSiUnitAndPlaneAngleUnit() {}
void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(
@@ -50,15 +52,14 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -77,7 +78,7 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -111,13 +112,12 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndRatioUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
RWStepBasic_RWSiUnitAndRatioUnit::RWStepBasic_RWSiUnitAndRatioUnit() {}
void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep(
@@ -51,15 +53,14 @@ void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep(
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -78,7 +79,7 @@ void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep(
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -112,13 +113,12 @@ void RWStepBasic_RWSiUnitAndRatioUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndSolidAngleUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
RWStepBasic_RWSiUnitAndSolidAngleUnit::RWStepBasic_RWSiUnitAndSolidAngleUnit() {}
void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep(
@@ -45,15 +47,14 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep(
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -72,7 +73,7 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep(
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -108,15 +109,14 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
// --- Instance of plex component SolidAngleUnit ---
SW.StartEntity("SOLID_ANGLE_UNIT");

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
//=================================================================================================
RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::
@@ -52,15 +54,14 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::ReadStep(
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -79,7 +80,7 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::ReadStep(
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -117,15 +118,14 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
// --- Instance of plex component SolidAngleUnit ---
SW.StartEntity("THERMODYNAMIC_TEMPERATURE_UNIT");

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndTimeUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
//=================================================================================================
RWStepBasic_RWSiUnitAndTimeUnit::RWStepBasic_RWSiUnitAndTimeUnit() {}
@@ -48,15 +50,14 @@ void RWStepBasic_RWSiUnitAndTimeUnit::ReadStep(const Handle(StepData_StepReaderD
return;
// --- field : prefix ---
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -75,7 +76,7 @@ void RWStepBasic_RWSiUnitAndTimeUnit::ReadStep(const Handle(StepData_StepReaderD
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -117,15 +118,14 @@ void RWStepBasic_RWSiUnitAndTimeUnit::WriteStep(
SW.StartEntity("SI_UNIT");
// --- field : prefix ---
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
// --- field : name ---
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
// --- Instance of plex component TimeUnit ---
SW.StartEntity("TIME_UNIT");

View File

@@ -14,13 +14,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "RWStepBasic_RWSiUnit.pxx"
#include "RWStepBasic_RWSiUnitAndVolumeUnit.pxx"
#include <StepBasic_DimensionalExponents.hxx>
#include <StepBasic_SiUnitAndVolumeUnit.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include "RWStepBasic_RWSiUnitName.pxx"
#include "RWStepBasic_RWSiPrefix.pxx"
RWStepBasic_RWSiUnitAndVolumeUnit::RWStepBasic_RWSiUnitAndVolumeUnit() {}
void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(
@@ -45,15 +47,14 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(
if (!data->CheckNbParams(num, 2, ach, "si_unit"))
return;
RWStepBasic_RWSiUnit reader;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
StepBasic_SiPrefix aPrefix = StepBasic_spExa;
Standard_Boolean hasAprefix = Standard_False;
if (data->IsParamDefined(num, 1))
{
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
hasAprefix = reader.DecodePrefix(aPrefix, text);
hasAprefix = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
if (!hasAprefix)
{
ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -71,7 +72,7 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(
if (data->ParamType(num, 2) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 2);
if (!reader.DecodeName(aName, text))
if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
{
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
@@ -99,13 +100,12 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::WriteStep(
SW.Send(ent->Dimensions());
SW.StartEntity("SI_UNIT");
RWStepBasic_RWSiUnit writer;
Standard_Boolean hasAprefix = ent->HasPrefix();
Standard_Boolean hasAprefix = ent->HasPrefix();
if (hasAprefix)
SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
else
SW.SendUndef();
SW.SendEnum(writer.EncodeName(ent->Name()));
SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
SW.StartEntity("VOLUME_UNIT");
}

View File

@@ -0,0 +1,244 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepBasic_RWSiUnitName_HeaderFile
#define _RWStepBasic_RWSiUnitName_HeaderFile
#include <StepBasic_SiUnitName.hxx>
#include <Standard_CString.hxx>
namespace RWStepBasic_RWSiUnitName
{
static constexpr char sunHertz[] = ".HERTZ.";
static constexpr char sunDegreeCelsius[] = ".DEGREE_CELSIUS.";
static constexpr char sunSiemens[] = ".SIEMENS.";
static constexpr char sunSievert[] = ".SIEVERT.";
static constexpr char sunLux[] = ".LUX.";
static constexpr char sunWatt[] = ".WATT.";
static constexpr char sunOhm[] = ".OHM.";
static constexpr char sunSecond[] = ".SECOND.";
static constexpr char sunBecquerel[] = ".BECQUEREL.";
static constexpr char sunPascal[] = ".PASCAL.";
static constexpr char sunHenry[] = ".HENRY.";
static constexpr char sunTesla[] = ".TESLA.";
static constexpr char sunVolt[] = ".VOLT.";
static constexpr char sunJoule[] = ".JOULE.";
static constexpr char sunKelvin[] = ".KELVIN.";
static constexpr char sunAmpere[] = ".AMPERE.";
static constexpr char sunGram[] = ".GRAM.";
static constexpr char sunSteradian[] = ".STERADIAN.";
static constexpr char sunMole[] = ".MOLE.";
static constexpr char sunLumen[] = ".LUMEN.";
static constexpr char sunGray[] = ".GRAY.";
static constexpr char sunCandela[] = ".CANDELA.";
static constexpr char sunFarad[] = ".FARAD.";
static constexpr char sunRadian[] = ".RADIAN.";
static constexpr char sunNewton[] = ".NEWTON.";
static constexpr char sunMetre[] = ".METRE.";
static constexpr char sunWeber[] = ".WEBER.";
static constexpr char sunCoulomb[] = ".COULOMB.";
//! Convert StepBasic_SiUnitName to string
//! @param theNameEnum The StepBasic_SiUnitName value to convert
//! @return The corresponding string representation
inline const char* ConvertToString(const StepBasic_SiUnitName theNameEnum)
{
switch (theNameEnum)
{
case StepBasic_sunHertz:
return sunHertz;
case StepBasic_sunDegreeCelsius:
return sunDegreeCelsius;
case StepBasic_sunSiemens:
return sunSiemens;
case StepBasic_sunSievert:
return sunSievert;
case StepBasic_sunLux:
return sunLux;
case StepBasic_sunWatt:
return sunWatt;
case StepBasic_sunOhm:
return sunOhm;
case StepBasic_sunSecond:
return sunSecond;
case StepBasic_sunBecquerel:
return sunBecquerel;
case StepBasic_sunPascal:
return sunPascal;
case StepBasic_sunHenry:
return sunHenry;
case StepBasic_sunTesla:
return sunTesla;
case StepBasic_sunVolt:
return sunVolt;
case StepBasic_sunJoule:
return sunJoule;
case StepBasic_sunKelvin:
return sunKelvin;
case StepBasic_sunAmpere:
return sunAmpere;
case StepBasic_sunGram:
return sunGram;
case StepBasic_sunSteradian:
return sunSteradian;
case StepBasic_sunMole:
return sunMole;
case StepBasic_sunLumen:
return sunLumen;
case StepBasic_sunGray:
return sunGray;
case StepBasic_sunCandela:
return sunCandela;
case StepBasic_sunFarad:
return sunFarad;
case StepBasic_sunRadian:
return sunRadian;
case StepBasic_sunNewton:
return sunNewton;
case StepBasic_sunMetre:
return sunMetre;
case StepBasic_sunWeber:
return sunWeber;
case StepBasic_sunCoulomb:
return sunCoulomb;
}
return nullptr; // Default value
}
//! Convert string to StepBasic_SiUnitName
//! @param theNameStr The string to convert
//! @param theResultEnum The corresponding StepBasic_SiUnitName value
//! @return Standard_True if the conversion was successful, Standard_False otherwise
inline bool ConvertToEnum(const Standard_CString theNameStr, StepBasic_SiUnitName& theResultEnum)
{
if (IsEqual(theNameStr, sunHertz))
{
theResultEnum = StepBasic_sunHertz;
}
else if (IsEqual(theNameStr, sunDegreeCelsius))
{
theResultEnum = StepBasic_sunDegreeCelsius;
}
else if (IsEqual(theNameStr, sunSiemens))
{
theResultEnum = StepBasic_sunSiemens;
}
else if (IsEqual(theNameStr, sunSievert))
{
theResultEnum = StepBasic_sunSievert;
}
else if (IsEqual(theNameStr, sunLux))
{
theResultEnum = StepBasic_sunLux;
}
else if (IsEqual(theNameStr, sunWatt))
{
theResultEnum = StepBasic_sunWatt;
}
else if (IsEqual(theNameStr, sunOhm))
{
theResultEnum = StepBasic_sunOhm;
}
else if (IsEqual(theNameStr, sunSecond))
{
theResultEnum = StepBasic_sunSecond;
}
else if (IsEqual(theNameStr, sunBecquerel))
{
theResultEnum = StepBasic_sunBecquerel;
}
else if (IsEqual(theNameStr, sunPascal))
{
theResultEnum = StepBasic_sunPascal;
}
else if (IsEqual(theNameStr, sunHenry))
{
theResultEnum = StepBasic_sunHenry;
}
else if (IsEqual(theNameStr, sunTesla))
{
theResultEnum = StepBasic_sunTesla;
}
else if (IsEqual(theNameStr, sunVolt))
{
theResultEnum = StepBasic_sunVolt;
}
else if (IsEqual(theNameStr, sunJoule))
{
theResultEnum = StepBasic_sunJoule;
}
else if (IsEqual(theNameStr, sunKelvin))
{
theResultEnum = StepBasic_sunKelvin;
}
else if (IsEqual(theNameStr, sunAmpere))
{
theResultEnum = StepBasic_sunAmpere;
}
else if (IsEqual(theNameStr, sunGram))
{
theResultEnum = StepBasic_sunGram;
}
else if (IsEqual(theNameStr, sunSteradian))
{
theResultEnum = StepBasic_sunSteradian;
}
else if (IsEqual(theNameStr, sunMole))
{
theResultEnum = StepBasic_sunMole;
}
else if (IsEqual(theNameStr, sunLumen))
{
theResultEnum = StepBasic_sunLumen;
}
else if (IsEqual(theNameStr, sunGray))
{
theResultEnum = StepBasic_sunGray;
}
else if (IsEqual(theNameStr, sunCandela))
{
theResultEnum = StepBasic_sunCandela;
}
else if (IsEqual(theNameStr, sunFarad))
{
theResultEnum = StepBasic_sunFarad;
}
else if (IsEqual(theNameStr, sunRadian))
{
theResultEnum = StepBasic_sunRadian;
}
else if (IsEqual(theNameStr, sunNewton))
{
theResultEnum = StepBasic_sunNewton;
}
else if (IsEqual(theNameStr, sunMetre))
{
theResultEnum = StepBasic_sunMetre;
}
else if (IsEqual(theNameStr, sunWeber))
{
theResultEnum = StepBasic_sunWeber;
}
else if (IsEqual(theNameStr, sunCoulomb))
{
theResultEnum = StepBasic_sunCoulomb;
}
else
{
return Standard_False;
}
return Standard_True;
}
} // namespace RWStepBasic_RWSiUnitName
#endif // _RWStepBasic_RWSiUnitName_HeaderFile

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepBasic_RWSource_HeaderFile
#define _RWStepBasic_RWSource_HeaderFile
#include <StepBasic_Source.hxx>
#include <Standard_CString.hxx>
namespace RWStepBasic_RWSource
{
static constexpr char sBought[] = ".BOUGHT.";
static constexpr char sNotKnown[] = ".NOT_KNOWN.";
static constexpr char sMade[] = ".MADE.";
//! Convert StepBasic_Source to string
//! @param theSourceEnum The StepBasic_Source value to convert
//! @return The corresponding string representation or nullptr if not found
inline const char* ConvertToString(const StepBasic_Source theSourceEnum)
{
switch (theSourceEnum)
{
case StepBasic_sBought:
return sBought;
case StepBasic_sNotKnown:
return sNotKnown;
case StepBasic_sMade:
return sMade;
}
return nullptr;
}
//! Convert string to StepBasic_Source
//! @param theSourceStr The string to convert
//! @param theResultEnum The corresponding StepBasic_Source value
//! @return Standard_True if the conversion was successful, Standard_False otherwise
inline bool ConvertToEnum(const Standard_CString theSourceStr, StepBasic_Source& theResultEnum)
{
if (IsEqual(theSourceStr, sBought))
{
theResultEnum = StepBasic_sBought;
}
else if (IsEqual(theSourceStr, sNotKnown))
{
theResultEnum = StepBasic_sNotKnown;
}
else if (IsEqual(theSourceStr, sMade))
{
theResultEnum = StepBasic_sMade;
}
else
{
return Standard_False;
}
return Standard_True;
}
} // namespace RWStepBasic_RWSource
#endif // _RWStepBasic_RWSource_HeaderFile

View File

@@ -25,12 +25,14 @@ set(OCCT_RWStepGeom_FILES
RWStepGeom_RWBSplineCurve.cxx
RWStepGeom_RWBSplineCurve.pxx
RWStepGeom_RWBSplineCurveWithKnots.cxx
RWStepGeom_RWBSplineCurveForm.pxx
RWStepGeom_RWBSplineCurveWithKnots.pxx
RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve.cxx
RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve.pxx
RWStepGeom_RWBSplineSurface.cxx
RWStepGeom_RWBSplineSurface.pxx
RWStepGeom_RWBSplineSurfaceWithKnots.cxx
RWStepGeom_RWBSplineSurfaceForm.pxx
RWStepGeom_RWBSplineSurfaceWithKnots.pxx
RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx
RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.pxx
@@ -86,6 +88,7 @@ set(OCCT_RWStepGeom_FILES
RWStepGeom_RWHyperbola.pxx
RWStepGeom_RWIntersectionCurve.cxx
RWStepGeom_RWIntersectionCurve.pxx
RWStepGeom_RWKnotType.pxx
RWStepGeom_RWLine.cxx
RWStepGeom_RWLine.pxx
RWStepGeom_RWOffsetCurve3d.cxx
@@ -114,6 +117,7 @@ set(OCCT_RWStepGeom_FILES
RWStepGeom_RWPointReplica.pxx
RWStepGeom_RWPolyline.cxx
RWStepGeom_RWPolyline.pxx
RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx
RWStepGeom_RWQuasiUniformCurve.cxx
RWStepGeom_RWQuasiUniformCurve.pxx
RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve.cxx
@@ -156,6 +160,7 @@ set(OCCT_RWStepGeom_FILES
RWStepGeom_RWSweptSurface.pxx
RWStepGeom_RWToroidalSurface.cxx
RWStepGeom_RWToroidalSurface.pxx
RWStepGeom_RWTransitionCode.pxx
RWStepGeom_RWTrimmedCurve.cxx
RWStepGeom_RWTrimmedCurve.pxx
RWStepGeom_RWUniformCurve.cxx

View File

@@ -22,13 +22,7 @@
#include <StepGeom_HArray1OfCartesianPoint.hxx>
#include <TCollection_AsciiString.hxx>
// --- Enum : BSplineCurveForm ---
static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
#include "RWStepGeom_RWBSplineCurveForm.pxx"
RWStepGeom_RWBSplineCurve::RWStepGeom_RWBSplineCurve() {}
@@ -83,20 +77,10 @@ void RWStepGeom_RWBSplineCurve::ReadStep(const Handle(StepData_StepReaderData)&
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (bscfEllipticArc.IsEqual(text))
aCurveForm = StepGeom_bscfEllipticArc;
else if (bscfPolylineForm.IsEqual(text))
aCurveForm = StepGeom_bscfPolylineForm;
else if (bscfParabolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfParabolicArc;
else if (bscfCircularArc.IsEqual(text))
aCurveForm = StepGeom_bscfCircularArc;
else if (bscfUnspecified.IsEqual(text))
aCurveForm = StepGeom_bscfUnspecified;
else if (bscfHyperbolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfHyperbolicArc;
else
if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
{
ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -141,27 +125,7 @@ void RWStepGeom_RWBSplineCurve::WriteStep(StepData_StepWriter& S
// --- own field : curveForm ---
switch (ent->CurveForm())
{
case StepGeom_bscfEllipticArc:
SW.SendEnum(bscfEllipticArc);
break;
case StepGeom_bscfPolylineForm:
SW.SendEnum(bscfPolylineForm);
break;
case StepGeom_bscfParabolicArc:
SW.SendEnum(bscfParabolicArc);
break;
case StepGeom_bscfCircularArc:
SW.SendEnum(bscfCircularArc);
break;
case StepGeom_bscfUnspecified:
SW.SendEnum(bscfUnspecified);
break;
case StepGeom_bscfHyperbolicArc:
SW.SendEnum(bscfHyperbolicArc);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
// --- own field : closedCurve ---

View File

@@ -0,0 +1,91 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepGeom_RWBSplineCurveForm_HeaderFile
#define _RWStepGeom_RWBSplineCurveForm_HeaderFile
#include <StepGeom_BSplineCurveForm.hxx>
#include <Standard_CString.hxx>
namespace RWStepGeom_RWBSplineCurveForm
{
static constexpr char bscfEllipticArc[] = ".ELLIPTIC_ARC.";
static constexpr char bscfPolylineForm[] = ".POLYLINE_FORM.";
static constexpr char bscfParabolicArc[] = ".PARABOLIC_ARC.";
static constexpr char bscfCircularArc[] = ".CIRCULAR_ARC.";
static constexpr char bscfUnspecified[] = ".UNSPECIFIED.";
static constexpr char bscfHyperbolicArc[] = ".HYPERBOLIC_ARC.";
//! Convert StepGeom_BSplineCurveForm to string
//! @param theSourceEnum The StepGeom_BSplineCurveForm value to convert
//! @return The corresponding string representation or nullptr if not found
inline const char* ConvertToString(const StepGeom_BSplineCurveForm theSourceEnum)
{
switch (theSourceEnum)
{
case StepGeom_bscfEllipticArc:
return bscfEllipticArc;
case StepGeom_bscfPolylineForm:
return bscfPolylineForm;
case StepGeom_bscfParabolicArc:
return bscfParabolicArc;
case StepGeom_bscfCircularArc:
return bscfCircularArc;
case StepGeom_bscfUnspecified:
return bscfUnspecified;
case StepGeom_bscfHyperbolicArc:
return bscfHyperbolicArc;
}
return nullptr;
}
//! Convert string to StepGeom_BSplineCurveForm
//! @param theFormString The string to convert
//! @param theResultEnum The corresponding StepGeom_BSplineCurveForm value
//! @return Standard_True if the conversion was successful, Standard_False otherwise
inline bool ConvertToEnum(const Standard_CString theFormString,
StepGeom_BSplineCurveForm& theResultEnum)
{
if (IsEqual(theFormString, bscfEllipticArc))
{
theResultEnum = StepGeom_bscfEllipticArc;
}
else if (IsEqual(theFormString, bscfPolylineForm))
{
theResultEnum = StepGeom_bscfPolylineForm;
}
else if (IsEqual(theFormString, bscfParabolicArc))
{
theResultEnum = StepGeom_bscfParabolicArc;
}
else if (IsEqual(theFormString, bscfCircularArc))
{
theResultEnum = StepGeom_bscfCircularArc;
}
else if (IsEqual(theFormString, bscfUnspecified))
{
theResultEnum = StepGeom_bscfUnspecified;
}
else if (IsEqual(theFormString, bscfHyperbolicArc))
{
theResultEnum = StepGeom_bscfHyperbolicArc;
}
else
{
return Standard_False;
}
return Standard_True;
}
} // namespace RWStepGeom_RWBSplineCurveForm
#endif // _RWStepGeom_RWBSplineCurveForm_HeaderFile

View File

@@ -25,19 +25,8 @@
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
// --- Enum : KnotType ---
static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
// --- Enum : BSplineCurveForm ---
static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
#include "RWStepGeom_RWBSplineCurveForm.pxx"
#include "RWStepGeom_RWKnotType.pxx"
RWStepGeom_RWBSplineCurveWithKnots::RWStepGeom_RWBSplineCurveWithKnots() {}
@@ -98,20 +87,10 @@ void RWStepGeom_RWBSplineCurveWithKnots::ReadStep(
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (bscfEllipticArc.IsEqual(text))
aCurveForm = StepGeom_bscfEllipticArc;
else if (bscfPolylineForm.IsEqual(text))
aCurveForm = StepGeom_bscfPolylineForm;
else if (bscfParabolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfParabolicArc;
else if (bscfCircularArc.IsEqual(text))
aCurveForm = StepGeom_bscfCircularArc;
else if (bscfUnspecified.IsEqual(text))
aCurveForm = StepGeom_bscfUnspecified;
else if (bscfHyperbolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfHyperbolicArc;
else
if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
{
ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -168,16 +147,10 @@ void RWStepGeom_RWBSplineCurveWithKnots::ReadStep(
if (data->ParamType(num, 9) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 9);
if (ktUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktUniformKnots;
else if (ktQuasiUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktQuasiUniformKnots;
else if (ktPiecewiseBezierKnots.IsEqual(text))
aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
else if (ktUnspecified.IsEqual(text))
aKnotSpec = StepGeom_ktUnspecified;
else
if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
{
ach->AddFail("Enumeration knot_type has not an allowed value");
}
}
else
ach->AddFail("Parameter #9 (knot_spec) is not an enumeration");
@@ -219,27 +192,7 @@ void RWStepGeom_RWBSplineCurveWithKnots::WriteStep(
// --- inherited field curveForm ---
switch (ent->CurveForm())
{
case StepGeom_bscfEllipticArc:
SW.SendEnum(bscfEllipticArc);
break;
case StepGeom_bscfPolylineForm:
SW.SendEnum(bscfPolylineForm);
break;
case StepGeom_bscfParabolicArc:
SW.SendEnum(bscfParabolicArc);
break;
case StepGeom_bscfCircularArc:
SW.SendEnum(bscfCircularArc);
break;
case StepGeom_bscfUnspecified:
SW.SendEnum(bscfUnspecified);
break;
case StepGeom_bscfHyperbolicArc:
SW.SendEnum(bscfHyperbolicArc);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
// --- inherited field closedCurve ---
@@ -269,21 +222,7 @@ void RWStepGeom_RWBSplineCurveWithKnots::WriteStep(
// --- own field : knotSpec ---
switch (ent->KnotSpec())
{
case StepGeom_ktUniformKnots:
SW.SendEnum(ktUniformKnots);
break;
case StepGeom_ktQuasiUniformKnots:
SW.SendEnum(ktQuasiUniformKnots);
break;
case StepGeom_ktPiecewiseBezierKnots:
SW.SendEnum(ktPiecewiseBezierKnots);
break;
case StepGeom_ktUnspecified:
SW.SendEnum(ktUnspecified);
break;
}
SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
}
void RWStepGeom_RWBSplineCurveWithKnots::Share(const Handle(StepGeom_BSplineCurveWithKnots)& ent,

View File

@@ -30,19 +30,8 @@
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
// --- Enum : BSplineCurveForm ---
static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
// --- Enum : KnotType ---
static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
#include "RWStepGeom_RWBSplineCurveForm.pxx"
#include "RWStepGeom_RWKnotType.pxx"
RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::
RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve()
@@ -102,20 +91,10 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::ReadStep(
if (data->ParamType(num, 3) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 3);
if (bscfEllipticArc.IsEqual(text))
aCurveForm = StepGeom_bscfEllipticArc;
else if (bscfPolylineForm.IsEqual(text))
aCurveForm = StepGeom_bscfPolylineForm;
else if (bscfParabolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfParabolicArc;
else if (bscfCircularArc.IsEqual(text))
aCurveForm = StepGeom_bscfCircularArc;
else if (bscfUnspecified.IsEqual(text))
aCurveForm = StepGeom_bscfUnspecified;
else if (bscfHyperbolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfHyperbolicArc;
else
if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
{
ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #3 (curve_form) is not an enumeration");
@@ -180,16 +159,10 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::ReadStep(
if (data->ParamType(num, 3) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 3);
if (ktUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktUniformKnots;
else if (ktQuasiUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktQuasiUniformKnots;
else if (ktPiecewiseBezierKnots.IsEqual(text))
aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
else if (ktUnspecified.IsEqual(text))
aKnotSpec = StepGeom_ktUnspecified;
else
if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
{
ach->AddFail("Enumeration knot_type has not an allowed value");
}
}
else
ach->AddFail("Parameter #3 (knot_spec) is not an enumeration");
@@ -286,27 +259,8 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::WriteStep(
SW.CloseSub();
// --- field : curveForm ---
switch (ent->CurveForm())
{
case StepGeom_bscfEllipticArc:
SW.SendEnum(bscfEllipticArc);
break;
case StepGeom_bscfPolylineForm:
SW.SendEnum(bscfPolylineForm);
break;
case StepGeom_bscfParabolicArc:
SW.SendEnum(bscfParabolicArc);
break;
case StepGeom_bscfCircularArc:
SW.SendEnum(bscfCircularArc);
break;
case StepGeom_bscfUnspecified:
SW.SendEnum(bscfUnspecified);
break;
case StepGeom_bscfHyperbolicArc:
SW.SendEnum(bscfHyperbolicArc);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
// --- field : closedCurve ---
SW.SendLogical(ent->ClosedCurve());
@@ -335,21 +289,7 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::WriteStep(
SW.CloseSub();
// --- field : knotSpec ---
switch (ent->KnotSpec())
{
case StepGeom_ktUniformKnots:
SW.SendEnum(ktUniformKnots);
break;
case StepGeom_ktQuasiUniformKnots:
SW.SendEnum(ktQuasiUniformKnots);
break;
case StepGeom_ktPiecewiseBezierKnots:
SW.SendEnum(ktPiecewiseBezierKnots);
break;
case StepGeom_ktUnspecified:
SW.SendEnum(ktUnspecified);
break;
}
SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
// --- Instance of plex component Curve ---

View File

@@ -22,18 +22,7 @@
#include <StepGeom_HArray2OfCartesianPoint.hxx>
#include <TCollection_AsciiString.hxx>
// --- Enum : BSplineSurfaceForm ---
static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
RWStepGeom_RWBSplineSurface::RWStepGeom_RWBSplineSurface() {}
@@ -102,30 +91,10 @@ void RWStepGeom_RWBSplineSurface::ReadStep(const Handle(StepData_StepReaderData)
if (data->ParamType(num, 5) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 5);
if (bssfSurfOfLinearExtrusion.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
else if (bssfPlaneSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfPlaneSurf;
else if (bssfGeneralisedCone.IsEqual(text))
aSurfaceForm = StepGeom_bssfGeneralisedCone;
else if (bssfToroidalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfToroidalSurf;
else if (bssfConicalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfConicalSurf;
else if (bssfSphericalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfSphericalSurf;
else if (bssfUnspecified.IsEqual(text))
aSurfaceForm = StepGeom_bssfUnspecified;
else if (bssfRuledSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfRuledSurf;
else if (bssfSurfOfRevolution.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfRevolution;
else if (bssfCylindricalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfCylindricalSurf;
else if (bssfQuadricSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfQuadricSurf;
else
if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
{
ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -194,42 +163,7 @@ void RWStepGeom_RWBSplineSurface::WriteStep(StepData_StepWriter&
// --- own field : surfaceForm ---
switch (ent->SurfaceForm())
{
case StepGeom_bssfSurfOfLinearExtrusion:
SW.SendEnum(bssfSurfOfLinearExtrusion);
break;
case StepGeom_bssfPlaneSurf:
SW.SendEnum(bssfPlaneSurf);
break;
case StepGeom_bssfGeneralisedCone:
SW.SendEnum(bssfGeneralisedCone);
break;
case StepGeom_bssfToroidalSurf:
SW.SendEnum(bssfToroidalSurf);
break;
case StepGeom_bssfConicalSurf:
SW.SendEnum(bssfConicalSurf);
break;
case StepGeom_bssfSphericalSurf:
SW.SendEnum(bssfSphericalSurf);
break;
case StepGeom_bssfUnspecified:
SW.SendEnum(bssfUnspecified);
break;
case StepGeom_bssfRuledSurf:
SW.SendEnum(bssfRuledSurf);
break;
case StepGeom_bssfSurfOfRevolution:
SW.SendEnum(bssfSurfOfRevolution);
break;
case StepGeom_bssfCylindricalSurf:
SW.SendEnum(bssfCylindricalSurf);
break;
case StepGeom_bssfQuadricSurf:
SW.SendEnum(bssfQuadricSurf);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
// --- own field : uClosed ---

View File

@@ -0,0 +1,126 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWStepGeom_RWBSplineSurfaceForm_HeaderFile
#define _RWStepGeom_RWBSplineSurfaceForm_HeaderFile
#include <StepGeom_BSplineSurfaceForm.hxx>
#include <Standard_CString.hxx>
namespace RWStepGeom_RWBSplineSurfaceForm
{
static constexpr char bssfSurfOfLinearExtrusion[] = (".SURF_OF_LINEAR_EXTRUSION.");
static constexpr char bssfPlaneSurf[] = (".PLANE_SURF.");
static constexpr char bssfGeneralisedCone[] = (".GENERALISED_CONE.");
static constexpr char bssfToroidalSurf[] = (".TOROIDAL_SURF.");
static constexpr char bssfConicalSurf[] = (".CONICAL_SURF.");
static constexpr char bssfSphericalSurf[] = (".SPHERICAL_SURF.");
static constexpr char bssfUnspecified[] = (".UNSPECIFIED.");
static constexpr char bssfRuledSurf[] = (".RULED_SURF.");
static constexpr char bssfSurfOfRevolution[] = (".SURF_OF_REVOLUTION.");
static constexpr char bssfCylindricalSurf[] = (".CYLINDRICAL_SURF.");
static constexpr char bssfQuadricSurf[] = (".QUADRIC_SURF.");
//! Convert StepGeom_BSplineSurfaceForm to string
//! @param theSourceEnum The StepGeom_BSplineSurfaceForm value to convert
//! @return The corresponding string representation or nullptr if not found
inline const char* ConvertToString(const StepGeom_BSplineSurfaceForm theSourceEnum)
{
switch (theSourceEnum)
{
case StepGeom_bssfSurfOfLinearExtrusion:
return bssfSurfOfLinearExtrusion;
case StepGeom_bssfPlaneSurf:
return bssfPlaneSurf;
case StepGeom_bssfGeneralisedCone:
return bssfGeneralisedCone;
case StepGeom_bssfToroidalSurf:
return bssfToroidalSurf;
case StepGeom_bssfConicalSurf:
return bssfConicalSurf;
case StepGeom_bssfSphericalSurf:
return bssfSphericalSurf;
case StepGeom_bssfUnspecified:
return bssfUnspecified;
case StepGeom_bssfRuledSurf:
return bssfRuledSurf;
case StepGeom_bssfSurfOfRevolution:
return bssfSurfOfRevolution;
case StepGeom_bssfCylindricalSurf:
return bssfCylindricalSurf;
case StepGeom_bssfQuadricSurf:
return bssfQuadricSurf;
}
return nullptr;
}
//! Convert string to StepGeom_BSplineSurfaceForm
//! @param theFormString The string to convert
//! @param theResultEnum The corresponding StepGeom_BSplineSurfaceForm value
//! @return Standard_True if the conversion was successful, Standard_False otherwise
inline bool ConvertToEnum(const Standard_CString theFormString,
StepGeom_BSplineSurfaceForm& theResultEnum)
{
if (IsEqual(theFormString, bssfSurfOfLinearExtrusion))
{
theResultEnum = StepGeom_bssfSurfOfLinearExtrusion;
}
else if (IsEqual(theFormString, bssfPlaneSurf))
{
theResultEnum = StepGeom_bssfPlaneSurf;
}
else if (IsEqual(theFormString, bssfGeneralisedCone))
{
theResultEnum = StepGeom_bssfGeneralisedCone;
}
else if (IsEqual(theFormString, bssfToroidalSurf))
{
theResultEnum = StepGeom_bssfToroidalSurf;
}
else if (IsEqual(theFormString, bssfConicalSurf))
{
theResultEnum = StepGeom_bssfConicalSurf;
}
else if (IsEqual(theFormString, bssfSphericalSurf))
{
theResultEnum = StepGeom_bssfSphericalSurf;
}
else if (IsEqual(theFormString, bssfUnspecified))
{
theResultEnum = StepGeom_bssfUnspecified;
}
else if (IsEqual(theFormString, bssfRuledSurf))
{
theResultEnum = StepGeom_bssfRuledSurf;
}
else if (IsEqual(theFormString, bssfSurfOfRevolution))
{
theResultEnum = StepGeom_bssfSurfOfRevolution;
}
else if (IsEqual(theFormString, bssfCylindricalSurf))
{
theResultEnum = StepGeom_bssfCylindricalSurf;
}
else if (IsEqual(theFormString, bssfQuadricSurf))
{
theResultEnum = StepGeom_bssfQuadricSurf;
}
else
{
return Standard_False;
}
return Standard_True;
}
} // namespace RWStepGeom_RWBSplineSurfaceForm
#endif // _RWStepGeom_RWBSplineSurfaceForm_HeaderFile

View File

@@ -25,24 +25,8 @@
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
// --- Enum : KnotType ---
static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
// --- Enum : BSplineSurfaceForm ---
static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
#include "RWStepGeom_RWKnotType.pxx"
RWStepGeom_RWBSplineSurfaceWithKnots::RWStepGeom_RWBSplineSurfaceWithKnots() {}
@@ -112,30 +96,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::ReadStep(
if (data->ParamType(num, 5) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 5);
if (bssfSurfOfLinearExtrusion.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
else if (bssfPlaneSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfPlaneSurf;
else if (bssfGeneralisedCone.IsEqual(text))
aSurfaceForm = StepGeom_bssfGeneralisedCone;
else if (bssfToroidalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfToroidalSurf;
else if (bssfConicalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfConicalSurf;
else if (bssfSphericalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfSphericalSurf;
else if (bssfUnspecified.IsEqual(text))
aSurfaceForm = StepGeom_bssfUnspecified;
else if (bssfRuledSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfRuledSurf;
else if (bssfSurfOfRevolution.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfRevolution;
else if (bssfCylindricalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfCylindricalSurf;
else if (bssfQuadricSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfQuadricSurf;
else
if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
{
ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -232,16 +196,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::ReadStep(
if (data->ParamType(num, 13) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 13);
if (ktUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktUniformKnots;
else if (ktQuasiUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktQuasiUniformKnots;
else if (ktPiecewiseBezierKnots.IsEqual(text))
aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
else if (ktUnspecified.IsEqual(text))
aKnotSpec = StepGeom_ktUnspecified;
else
if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
{
ach->AddFail("Enumeration knot_type has not an allowed value");
}
}
else
ach->AddFail("Parameter #13 (knot_spec) is not an enumeration");
@@ -298,42 +256,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::WriteStep(
// --- inherited field surfaceForm ---
switch (ent->SurfaceForm())
{
case StepGeom_bssfSurfOfLinearExtrusion:
SW.SendEnum(bssfSurfOfLinearExtrusion);
break;
case StepGeom_bssfPlaneSurf:
SW.SendEnum(bssfPlaneSurf);
break;
case StepGeom_bssfGeneralisedCone:
SW.SendEnum(bssfGeneralisedCone);
break;
case StepGeom_bssfToroidalSurf:
SW.SendEnum(bssfToroidalSurf);
break;
case StepGeom_bssfConicalSurf:
SW.SendEnum(bssfConicalSurf);
break;
case StepGeom_bssfSphericalSurf:
SW.SendEnum(bssfSphericalSurf);
break;
case StepGeom_bssfUnspecified:
SW.SendEnum(bssfUnspecified);
break;
case StepGeom_bssfRuledSurf:
SW.SendEnum(bssfRuledSurf);
break;
case StepGeom_bssfSurfOfRevolution:
SW.SendEnum(bssfSurfOfRevolution);
break;
case StepGeom_bssfCylindricalSurf:
SW.SendEnum(bssfCylindricalSurf);
break;
case StepGeom_bssfQuadricSurf:
SW.SendEnum(bssfQuadricSurf);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
// --- inherited field uClosed ---
@@ -385,21 +308,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::WriteStep(
// --- own field : knotSpec ---
switch (ent->KnotSpec())
{
case StepGeom_ktUniformKnots:
SW.SendEnum(ktUniformKnots);
break;
case StepGeom_ktQuasiUniformKnots:
SW.SendEnum(ktQuasiUniformKnots);
break;
case StepGeom_ktPiecewiseBezierKnots:
SW.SendEnum(ktPiecewiseBezierKnots);
break;
case StepGeom_ktUnspecified:
SW.SendEnum(ktUnspecified);
break;
}
SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
}
void RWStepGeom_RWBSplineSurfaceWithKnots::Share(

View File

@@ -29,24 +29,8 @@
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray2OfReal.hxx>
// --- Enum : BSplineSurfaceForm ---
static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
// --- Enum : KnotType ---
static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
#include "RWStepGeom_RWKnotType.pxx"
RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::
RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface()
@@ -117,30 +101,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep(
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (bssfSurfOfLinearExtrusion.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
else if (bssfPlaneSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfPlaneSurf;
else if (bssfGeneralisedCone.IsEqual(text))
aSurfaceForm = StepGeom_bssfGeneralisedCone;
else if (bssfToroidalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfToroidalSurf;
else if (bssfConicalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfConicalSurf;
else if (bssfSphericalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfSphericalSurf;
else if (bssfUnspecified.IsEqual(text))
aSurfaceForm = StepGeom_bssfUnspecified;
else if (bssfRuledSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfRuledSurf;
else if (bssfSurfOfRevolution.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfRevolution;
else if (bssfCylindricalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfCylindricalSurf;
else if (bssfQuadricSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfQuadricSurf;
else
if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
{
ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (surface_form) is not an enumeration");
@@ -242,16 +206,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep(
if (data->ParamType(num, 5) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 5);
if (ktUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktUniformKnots;
else if (ktQuasiUniformKnots.IsEqual(text))
aKnotSpec = StepGeom_ktQuasiUniformKnots;
else if (ktPiecewiseBezierKnots.IsEqual(text))
aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
else if (ktUnspecified.IsEqual(text))
aKnotSpec = StepGeom_ktUnspecified;
else
if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
{
ach->AddFail("Enumeration knot_type has not an allowed value");
}
}
else
ach->AddFail("Parameter #5 (knot_spec) is not an enumeration");
@@ -367,43 +325,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::WriteStep(
}
SW.CloseSub();
// --- field : surfaceForm ---
switch (ent->SurfaceForm())
{
case StepGeom_bssfSurfOfLinearExtrusion:
SW.SendEnum(bssfSurfOfLinearExtrusion);
break;
case StepGeom_bssfPlaneSurf:
SW.SendEnum(bssfPlaneSurf);
break;
case StepGeom_bssfGeneralisedCone:
SW.SendEnum(bssfGeneralisedCone);
break;
case StepGeom_bssfToroidalSurf:
SW.SendEnum(bssfToroidalSurf);
break;
case StepGeom_bssfConicalSurf:
SW.SendEnum(bssfConicalSurf);
break;
case StepGeom_bssfSphericalSurf:
SW.SendEnum(bssfSphericalSurf);
break;
case StepGeom_bssfUnspecified:
SW.SendEnum(bssfUnspecified);
break;
case StepGeom_bssfRuledSurf:
SW.SendEnum(bssfRuledSurf);
break;
case StepGeom_bssfSurfOfRevolution:
SW.SendEnum(bssfSurfOfRevolution);
break;
case StepGeom_bssfCylindricalSurf:
SW.SendEnum(bssfCylindricalSurf);
break;
case StepGeom_bssfQuadricSurf:
SW.SendEnum(bssfQuadricSurf);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
// --- field : uClosed ---
SW.SendLogical(ent->UClosed());
@@ -451,21 +373,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::WriteStep(
SW.CloseSub();
// --- field : knotSpec ---
switch (ent->KnotSpec())
{
case StepGeom_ktUniformKnots:
SW.SendEnum(ktUniformKnots);
break;
case StepGeom_ktQuasiUniformKnots:
SW.SendEnum(ktQuasiUniformKnots);
break;
case StepGeom_ktPiecewiseBezierKnots:
SW.SendEnum(ktPiecewiseBezierKnots);
break;
case StepGeom_ktUnspecified:
SW.SendEnum(ktUnspecified);
break;
}
SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
// --- Instance of plex component GeometricRepresentationItem ---

View File

@@ -21,13 +21,7 @@
#include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_HArray1OfCartesianPoint.hxx>
// --- Enum : BSplineCurveForm ---
static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
#include "RWStepGeom_RWBSplineCurveForm.pxx"
RWStepGeom_RWBezierCurve::RWStepGeom_RWBezierCurve() {}
@@ -82,20 +76,10 @@ void RWStepGeom_RWBezierCurve::ReadStep(const Handle(StepData_StepReaderData)& d
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (bscfEllipticArc.IsEqual(text))
aCurveForm = StepGeom_bscfEllipticArc;
else if (bscfPolylineForm.IsEqual(text))
aCurveForm = StepGeom_bscfPolylineForm;
else if (bscfParabolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfParabolicArc;
else if (bscfCircularArc.IsEqual(text))
aCurveForm = StepGeom_bscfCircularArc;
else if (bscfUnspecified.IsEqual(text))
aCurveForm = StepGeom_bscfUnspecified;
else if (bscfHyperbolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfHyperbolicArc;
else
if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
{
ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -140,27 +124,7 @@ void RWStepGeom_RWBezierCurve::WriteStep(StepData_StepWriter& SW,
// --- inherited field curveForm ---
switch (ent->CurveForm())
{
case StepGeom_bscfEllipticArc:
SW.SendEnum(bscfEllipticArc);
break;
case StepGeom_bscfPolylineForm:
SW.SendEnum(bscfPolylineForm);
break;
case StepGeom_bscfParabolicArc:
SW.SendEnum(bscfParabolicArc);
break;
case StepGeom_bscfCircularArc:
SW.SendEnum(bscfCircularArc);
break;
case StepGeom_bscfUnspecified:
SW.SendEnum(bscfUnspecified);
break;
case StepGeom_bscfHyperbolicArc:
SW.SendEnum(bscfHyperbolicArc);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
// --- inherited field closedCurve ---

View File

@@ -22,13 +22,7 @@
#include <StepGeom_HArray1OfCartesianPoint.hxx>
#include <TColStd_HArray1OfReal.hxx>
// --- Enum : BSplineCurveForm ---
static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
#include "RWStepGeom_RWBSplineCurveForm.pxx"
RWStepGeom_RWBezierCurveAndRationalBSplineCurve::RWStepGeom_RWBezierCurveAndRationalBSplineCurve()
{
@@ -94,20 +88,10 @@ void RWStepGeom_RWBezierCurveAndRationalBSplineCurve::ReadStep(
if (data->ParamType(num, 3) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 3);
if (bscfEllipticArc.IsEqual(text))
aCurveForm = StepGeom_bscfEllipticArc;
else if (bscfPolylineForm.IsEqual(text))
aCurveForm = StepGeom_bscfPolylineForm;
else if (bscfParabolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfParabolicArc;
else if (bscfCircularArc.IsEqual(text))
aCurveForm = StepGeom_bscfCircularArc;
else if (bscfUnspecified.IsEqual(text))
aCurveForm = StepGeom_bscfUnspecified;
else if (bscfHyperbolicArc.IsEqual(text))
aCurveForm = StepGeom_bscfHyperbolicArc;
else
if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
{
ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #3 (curve_form) is not an enumeration");
@@ -212,28 +196,7 @@ void RWStepGeom_RWBezierCurveAndRationalBSplineCurve::WriteStep(
}
SW.CloseSub();
// --- field : curveForm ---
switch (ent->CurveForm())
{
case StepGeom_bscfEllipticArc:
SW.SendEnum(bscfEllipticArc);
break;
case StepGeom_bscfPolylineForm:
SW.SendEnum(bscfPolylineForm);
break;
case StepGeom_bscfParabolicArc:
SW.SendEnum(bscfParabolicArc);
break;
case StepGeom_bscfCircularArc:
SW.SendEnum(bscfCircularArc);
break;
case StepGeom_bscfUnspecified:
SW.SendEnum(bscfUnspecified);
break;
case StepGeom_bscfHyperbolicArc:
SW.SendEnum(bscfHyperbolicArc);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
// --- field : closedCurve ---
SW.SendLogical(ent->ClosedCurve());

View File

@@ -21,18 +21,7 @@
#include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_HArray2OfCartesianPoint.hxx>
// --- Enum : BSplineSurfaceForm ---
static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
RWStepGeom_RWBezierSurface::RWStepGeom_RWBezierSurface() {}
@@ -101,30 +90,11 @@ void RWStepGeom_RWBezierSurface::ReadStep(const Handle(StepData_StepReaderData)&
if (data->ParamType(num, 5) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 5);
if (bssfSurfOfLinearExtrusion.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
else if (bssfPlaneSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfPlaneSurf;
else if (bssfGeneralisedCone.IsEqual(text))
aSurfaceForm = StepGeom_bssfGeneralisedCone;
else if (bssfToroidalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfToroidalSurf;
else if (bssfConicalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfConicalSurf;
else if (bssfSphericalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfSphericalSurf;
else if (bssfUnspecified.IsEqual(text))
aSurfaceForm = StepGeom_bssfUnspecified;
else if (bssfRuledSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfRuledSurf;
else if (bssfSurfOfRevolution.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfRevolution;
else if (bssfCylindricalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfCylindricalSurf;
else if (bssfQuadricSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfQuadricSurf;
else
if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
{
ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -193,42 +163,7 @@ void RWStepGeom_RWBezierSurface::WriteStep(StepData_StepWriter&
// --- inherited field surfaceForm ---
switch (ent->SurfaceForm())
{
case StepGeom_bssfSurfOfLinearExtrusion:
SW.SendEnum(bssfSurfOfLinearExtrusion);
break;
case StepGeom_bssfPlaneSurf:
SW.SendEnum(bssfPlaneSurf);
break;
case StepGeom_bssfGeneralisedCone:
SW.SendEnum(bssfGeneralisedCone);
break;
case StepGeom_bssfToroidalSurf:
SW.SendEnum(bssfToroidalSurf);
break;
case StepGeom_bssfConicalSurf:
SW.SendEnum(bssfConicalSurf);
break;
case StepGeom_bssfSphericalSurf:
SW.SendEnum(bssfSphericalSurf);
break;
case StepGeom_bssfUnspecified:
SW.SendEnum(bssfUnspecified);
break;
case StepGeom_bssfRuledSurf:
SW.SendEnum(bssfRuledSurf);
break;
case StepGeom_bssfSurfOfRevolution:
SW.SendEnum(bssfSurfOfRevolution);
break;
case StepGeom_bssfCylindricalSurf:
SW.SendEnum(bssfCylindricalSurf);
break;
case StepGeom_bssfQuadricSurf:
SW.SendEnum(bssfQuadricSurf);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
// --- inherited field uClosed ---

View File

@@ -22,18 +22,7 @@
#include <StepGeom_HArray2OfCartesianPoint.hxx>
#include <TColStd_HArray2OfReal.hxx>
// --- Enum : BSplineSurfaceForm ---
static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface::
RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface()
@@ -113,30 +102,10 @@ void RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface::ReadStep(
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (bssfSurfOfLinearExtrusion.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
else if (bssfPlaneSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfPlaneSurf;
else if (bssfGeneralisedCone.IsEqual(text))
aSurfaceForm = StepGeom_bssfGeneralisedCone;
else if (bssfToroidalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfToroidalSurf;
else if (bssfConicalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfConicalSurf;
else if (bssfSphericalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfSphericalSurf;
else if (bssfUnspecified.IsEqual(text))
aSurfaceForm = StepGeom_bssfUnspecified;
else if (bssfRuledSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfRuledSurf;
else if (bssfSurfOfRevolution.IsEqual(text))
aSurfaceForm = StepGeom_bssfSurfOfRevolution;
else if (bssfCylindricalSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfCylindricalSurf;
else if (bssfQuadricSurf.IsEqual(text))
aSurfaceForm = StepGeom_bssfQuadricSurf;
else
if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
{
ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (surface_form) is not an enumeration");
@@ -267,42 +236,8 @@ void RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface::WriteStep(
SW.CloseSub();
// --- field : surfaceForm ---
switch (ent->SurfaceForm())
{
case StepGeom_bssfSurfOfLinearExtrusion:
SW.SendEnum(bssfSurfOfLinearExtrusion);
break;
case StepGeom_bssfPlaneSurf:
SW.SendEnum(bssfPlaneSurf);
break;
case StepGeom_bssfGeneralisedCone:
SW.SendEnum(bssfGeneralisedCone);
break;
case StepGeom_bssfToroidalSurf:
SW.SendEnum(bssfToroidalSurf);
break;
case StepGeom_bssfConicalSurf:
SW.SendEnum(bssfConicalSurf);
break;
case StepGeom_bssfSphericalSurf:
SW.SendEnum(bssfSphericalSurf);
break;
case StepGeom_bssfUnspecified:
SW.SendEnum(bssfUnspecified);
break;
case StepGeom_bssfRuledSurf:
SW.SendEnum(bssfRuledSurf);
break;
case StepGeom_bssfSurfOfRevolution:
SW.SendEnum(bssfSurfOfRevolution);
break;
case StepGeom_bssfCylindricalSurf:
SW.SendEnum(bssfCylindricalSurf);
break;
case StepGeom_bssfQuadricSurf:
SW.SendEnum(bssfQuadricSurf);
break;
}
SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
// --- field : uClosed ---
SW.SendLogical(ent->UClosed());

View File

@@ -20,12 +20,7 @@
#include <StepGeom_TransitionCode.hxx>
#include <TCollection_AsciiString.hxx>
// --- Enum : TransitionCode ---
static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
static TCollection_AsciiString tcContSameGradientSameCurvature(
".CONT_SAME_GRADIENT_SAME_CURVATURE.");
static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
static TCollection_AsciiString tcContinuous(".CONTINUOUS.");
#include "RWStepGeom_RWTransitionCode.pxx"
RWStepGeom_RWCompositeCurveSegment::RWStepGeom_RWCompositeCurveSegment() {}
@@ -47,16 +42,10 @@ void RWStepGeom_RWCompositeCurveSegment::ReadStep(
if (data->ParamType(num, 1) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 1);
if (tcDiscontinuous.IsEqual(text))
aTransition = StepGeom_tcDiscontinuous;
else if (tcContSameGradientSameCurvature.IsEqual(text))
aTransition = StepGeom_tcContSameGradientSameCurvature;
else if (tcContSameGradient.IsEqual(text))
aTransition = StepGeom_tcContSameGradient;
else if (tcContinuous.IsEqual(text))
aTransition = StepGeom_tcContinuous;
else
if (!RWStepGeom_RWTransitionCode::ConvertToEnum(text, aTransition))
{
ach->AddFail("Enumeration transition_code has not an allowed value");
}
}
else
ach->AddFail("Parameter #1 (transition) is not an enumeration");
@@ -85,21 +74,7 @@ void RWStepGeom_RWCompositeCurveSegment::WriteStep(
// --- own field : transition ---
switch (ent->Transition())
{
case StepGeom_tcDiscontinuous:
SW.SendEnum(tcDiscontinuous);
break;
case StepGeom_tcContSameGradientSameCurvature:
SW.SendEnum(tcContSameGradientSameCurvature);
break;
case StepGeom_tcContSameGradient:
SW.SendEnum(tcContSameGradient);
break;
case StepGeom_tcContinuous:
SW.SendEnum(tcContinuous);
break;
}
SW.SendEnum(RWStepGeom_RWTransitionCode::ConvertToString(ent->Transition()));
// --- own field : sameSense ---

View File

@@ -20,10 +20,7 @@
#include <StepGeom_PcurveOrSurface.hxx>
#include <StepGeom_PreferredSurfaceCurveRepresentation.hxx>
// --- Enum : PreferredSurfaceCurveRepresentation ---
static TCollection_AsciiString pscrPcurveS2(".PCURVE_S2.");
static TCollection_AsciiString pscrPcurveS1(".PCURVE_S1.");
static TCollection_AsciiString pscrCurve3d(".CURVE_3D.");
#include "RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx"
RWStepGeom_RWIntersectionCurve::RWStepGeom_RWIntersectionCurve() {}
@@ -73,14 +70,11 @@ void RWStepGeom_RWIntersectionCurve::ReadStep(const Handle(StepData_StepReaderDa
if (data->ParamType(num, 4) == Interface_ParamEnum)
{
Standard_CString text = data->ParamCValue(num, 4);
if (pscrPcurveS2.IsEqual(text))
aMasterRepresentation = StepGeom_pscrPcurveS2;
else if (pscrPcurveS1.IsEqual(text))
aMasterRepresentation = StepGeom_pscrPcurveS1;
else if (pscrCurve3d.IsEqual(text))
aMasterRepresentation = StepGeom_pscrCurve3d;
else
if (!RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToEnum(text,
aMasterRepresentation))
{
ach->AddFail("Enumeration preferred_surface_curve_representation has not an allowed value");
}
}
else
ach->AddFail("Parameter #4 (master_representation) is not an enumeration");
@@ -113,18 +107,8 @@ void RWStepGeom_RWIntersectionCurve::WriteStep(StepData_StepWriter&
// --- inherited field masterRepresentation ---
switch (ent->MasterRepresentation())
{
case StepGeom_pscrPcurveS2:
SW.SendEnum(pscrPcurveS2);
break;
case StepGeom_pscrPcurveS1:
SW.SendEnum(pscrPcurveS1);
break;
case StepGeom_pscrCurve3d:
SW.SendEnum(pscrCurve3d);
break;
}
SW.SendEnum(
RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToString(ent->MasterRepresentation()));
}
void RWStepGeom_RWIntersectionCurve::Share(const Handle(StepGeom_IntersectionCurve)& ent,

Some files were not shown because too many files have changed in this diff Show More