From: Pasukhin Dmitry Date: Wed, 23 Jul 2025 14:22:55 +0000 (+0100) Subject: Configuration - Add VCPKG port opencascade (#638) X-Git-Tag: V8_0_0_rc2~11 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=b5e7a7d2aada90a64d3ed2b51085abaa7e421ea1;p=occt.git Configuration - Add VCPKG port opencascade (#638) - Restructures VCPKG manifest directory structure and updates path references accordingly - Implements a comprehensive portfile.cmake with feature detection, build configuration, and installation logic - Updates overlay port and triplet paths to reflect the new directory structure --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dbc415935..aaec43af87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ if (BUILD_USE_VCPKG) message(FATAL_ERROR "VCPKG_ROOT is not defined. Please set it to the path of vcpkg root directory.") endif() - set (VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/adm/vcpkg") + set (VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/adm/vcpkg/ports/opencascade") # Disable default features for vcpkg manifest set (VCPKG_MANIFEST_NO_DEFAULT_FEATURES 1) diff --git a/adm/vcpkg/ports/opencascade/portfile.cmake b/adm/vcpkg/ports/opencascade/portfile.cmake new file mode 100644 index 0000000000..ffdee061af --- /dev/null +++ b/adm/vcpkg/ports/opencascade/portfile.cmake @@ -0,0 +1,86 @@ +# Get git information for ABI validation +execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../.." + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + RESULT_VARIABLE GIT_RESULT +) + +if(NOT GIT_RESULT EQUAL 0) + set(GIT_COMMIT_HASH "unknown") +endif() + +set(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..") + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(BUILD_TYPE "Shared") +else() + set(BUILD_TYPE "Static") +endif() + +set (BUILD_CPP_STANDARD "C++17") +if ("cpp20" IN_LIST FEATURES) + set (BUILD_CPP_STANDARD "C++20") +elseif ("cpp23" IN_LIST FEATURES) + set (BUILD_CPP_STANDARD "C++23") +endif() + +set (BUILD_OPT_PROFILE "Default") +if ("optimized" IN_LIST FEATURES) + set (BUILD_OPT_PROFILE "Production") +endif() + +set (BUILD_MODULE_Draw OFF) +if ("tcl" IN_LIST FEATURES OR "tcltk" IN_LIST FEATURES) + set (BUILD_MODULE_Draw ON) +endif() + +set (USE_MMGR_TYPE "NATIVE") +if ("jemalloc" IN_LIST FEATURES) + set (USE_MMGR_TYPE "JEMALLOC") +endif() + +# Feature mapping to CMake options +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + angle USE_GLES2 + opengl USE_OPENGL + freeimage USE_FREEIMAGE + freetype USE_FREETYPE + rapidjson USE_RAPIDJSON + tbb USE_TBB + vtk USE_VTK + tcltk USE_TK + draco USE_DRACO + ffmpeg USE_FFMPEG + openvr USE_OPENVR + gtest BUILD_GTEST + pch BUILD_USE_PCH + d3d USE_D3D + docs BUILD_DOC_Overview +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DBUILD_LIBRARY_TYPE=${BUILD_TYPE} + -DINSTALL_DIR_LAYOUT=Vcpkg + -DBUILD_USE_VCPKG=ON + -DBUILD_CPP_STANDARD=${BUILD_CPP_STANDARD} + -DBUILD_OPT_PROFILE=${BUILD_OPT_PROFILE} + -DBUILD_MODULE_Draw=${BUILD_MODULE_Draw} + -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR} + MAYBE_UNUSED_VARIABLES + -DUSE_HASH=${GIT_COMMIT_HASH} +) + +vcpkg_cmake_install() + +vcpkg_install_copyright( + FILE_LIST + "${SOURCE_PATH}/LICENSE_LGPL_21.txt" + "${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt" +) diff --git a/adm/vcpkg/ports/opencascade/vcpkg-configuration.json b/adm/vcpkg/ports/opencascade/vcpkg-configuration.json new file mode 100644 index 0000000000..4e4500b4b2 --- /dev/null +++ b/adm/vcpkg/ports/opencascade/vcpkg-configuration.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", + "default-registry": { + "kind": "git", + "baseline": "2ddc10c8afa00a762a69f21f6427849fe906ede0", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ], + "overlay-ports": [ + "../../ports" + ], + "overlay-triplets": [ + "../../triplets" + ] +} \ No newline at end of file diff --git a/adm/vcpkg/ports/opencascade/vcpkg.json b/adm/vcpkg/ports/opencascade/vcpkg.json new file mode 100644 index 0000000000..17e09f67c2 --- /dev/null +++ b/adm/vcpkg/ports/opencascade/vcpkg.json @@ -0,0 +1,167 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "opencascade", + "version": "8.0.0", + "description": "Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE.", + "homepage": "https://github.com/Open-Cascade-SAS/OCCT", + "documentation": "https://dev.opencascade.org/doc/overview/html", + "license": "LGPL-2.1", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + { + "name": "tcl" + }, + { + "name": "freetype", + "platform": "!uwp" + }, + { + "name": "angle", + "platform": "uwp" + }, + { + "name": "opengl", + "platform": "!(android | ios | uwp | wasm32)" + } + ], + "features": { + "angle": { + "description": "Enables OpenGL ES 2.0 through ANGLE project. Required for 3D visualization in OCCT on UWP platform where desktop OpenGL is not available.", + "dependencies": [ + { + "name": "angle", + "platform": "!(linux & !static)" + } + ] + }, + "opengl": { + "description": "Enables OpenGL support for 3D visualization toolkit. Required for OCCT's OpenGL rendering pipeline and graphical display drivers.", + "dependencies": [ + "opengl" + ] + }, + "tcl": { + "description": "Enables Tcl scripting support for OCCT's DRAWEXE test harness and command-line interface. Provides access to OCCT's geometric algorithms through scripting.", + "dependencies": [ + "tcl" + ] + }, + "tcltk": { + "description": "Enables Tcl/Tk GUI support for DRAWEXE test harness. Provides windowed interface for OCCT's geometric modeling and visualization tools.", + "dependencies": [ + { + "name": "tcl", + "features": [ + "tk" + ] + }, + { + "name": "libx11", + "platform": "!windows" + } + ] + }, + "freeimage": { + "description": "Enables FreeImage support for advanced image file format handling (TIFF, PNG, JPEG, etc.) in OCCT's imaging and visualization components.", + "dependencies": [ + "freeimage" + ] + }, + "freetype": { + "description": "Enables FreeType font rendering engine for high-quality text display in OCCT's 3D visualization and technical drawing output.", + "supports": "!uwp", + "dependencies": [ + "fontconfig", + { + "name": "freetype", + "default-features": false + } + ] + }, + "rapidjson": { + "description": "Enables RapidJSON for efficient JSON parsing and serialization in OCCT's glTF 2.0 import/export functionality.", + "dependencies": [ + "rapidjson" + ] + }, + "tbb": { + "description": "Enables Intel Threading Building Blocks for optimized parallel computing. Replaces OCCT's default threading with TBB's task-based parallelism for better performance.", + "dependencies": [ + "tbb" + ] + }, + "vtk": { + "description": "Enables VTK (Visualization Toolkit) integration for advanced scientific visualization capabilities and mesh processing in OCCT.", + "dependencies": [ + { + "name": "vtk", + "default-features": false, + "features": [ + "opengl" + ] + } + ] + }, + "draco": { + "description": "Enables Google Draco geometry compression for efficient mesh storage and transmission in OCCT's glTF 2.0 import/export workflow.", + "dependencies": [ + "draco" + ] + }, + "ffmpeg": { + "description": "Enables FFmpeg multimedia framework for video encoding/decoding and animation export capabilities in OCCT's visualization pipeline.", + "dependencies": [ + "ffmpeg" + ] + }, + "openvr": { + "description": "Enables OpenVR SDK integration for virtual reality support in OCCT's 3D visualization, allowing immersive CAD model exploration.", + "dependencies": [ + "openvr" + ] + }, + "jemalloc": { + "description": "Enables jemalloc high-performance memory allocator as replacement for system malloc. Improves memory usage patterns for large-scale CAD operations.", + "dependencies": [ + "jemalloc" + ] + }, + "gtest": { + "description": "Enables Google Test framework for building OCCT's unit test suite. Required for running automated tests and validation of OCCT functionality.", + "dependencies": [ + "gtest" + ] + }, + "pch": { + "description": "Enables precompiled headers to improve compilation speed. Creates shared headers that are compiled once and reused across multiple source files." + }, + "cpp20": { + "description": "Enables C++20 standard compilation mode for OCCT. Provides access to latest C++20 features including concepts and modules." + }, + "cpp23": { + "description": "Enables C++23 standard compilation mode for OCCT. Provides access to the latest C++23 features including improved constexpr and new standard library components." + }, + "optimized": { + "description": "Enables production-level optimizations for maximum performance. Applies aggressive compiler optimizations and removes debug symbols." + }, + "d3d": { + "description": "Enables Direct3D support for 3D visualization on Windows. Provides alternative graphics backend to OpenGL for Windows-specific applications.", + "supports": "windows" + }, + "docs": { + "description": "Enables documentation generation using Doxygen. Creates HTML reference manual and overview documentation for OCCT API.", + "dependencies": [ + "doxygen" + ] + } + } +} \ No newline at end of file diff --git a/adm/vcpkg/vcpkg-configuration.json b/adm/vcpkg/vcpkg-configuration.json deleted file mode 100644 index 538de8425e..0000000000 --- a/adm/vcpkg/vcpkg-configuration.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", - "default-registry": { - "kind": "git", - "baseline": "2ddc10c8afa00a762a69f21f6427849fe906ede0", - "repository": "https://github.com/microsoft/vcpkg" - }, - "registries": [ - { - "kind": "artifact", - "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", - "name": "microsoft" - } - ], - "overlay-ports": [ - "./ports" - ], - "overlay-triplets": [ - "./triplets" - ] -} \ No newline at end of file diff --git a/adm/vcpkg/vcpkg.json b/adm/vcpkg/vcpkg.json deleted file mode 100644 index 17e09f67c2..0000000000 --- a/adm/vcpkg/vcpkg.json +++ /dev/null @@ -1,167 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "name": "opencascade", - "version": "8.0.0", - "description": "Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE.", - "homepage": "https://github.com/Open-Cascade-SAS/OCCT", - "documentation": "https://dev.opencascade.org/doc/overview/html", - "license": "LGPL-2.1", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } - ], - "default-features": [ - { - "name": "tcl" - }, - { - "name": "freetype", - "platform": "!uwp" - }, - { - "name": "angle", - "platform": "uwp" - }, - { - "name": "opengl", - "platform": "!(android | ios | uwp | wasm32)" - } - ], - "features": { - "angle": { - "description": "Enables OpenGL ES 2.0 through ANGLE project. Required for 3D visualization in OCCT on UWP platform where desktop OpenGL is not available.", - "dependencies": [ - { - "name": "angle", - "platform": "!(linux & !static)" - } - ] - }, - "opengl": { - "description": "Enables OpenGL support for 3D visualization toolkit. Required for OCCT's OpenGL rendering pipeline and graphical display drivers.", - "dependencies": [ - "opengl" - ] - }, - "tcl": { - "description": "Enables Tcl scripting support for OCCT's DRAWEXE test harness and command-line interface. Provides access to OCCT's geometric algorithms through scripting.", - "dependencies": [ - "tcl" - ] - }, - "tcltk": { - "description": "Enables Tcl/Tk GUI support for DRAWEXE test harness. Provides windowed interface for OCCT's geometric modeling and visualization tools.", - "dependencies": [ - { - "name": "tcl", - "features": [ - "tk" - ] - }, - { - "name": "libx11", - "platform": "!windows" - } - ] - }, - "freeimage": { - "description": "Enables FreeImage support for advanced image file format handling (TIFF, PNG, JPEG, etc.) in OCCT's imaging and visualization components.", - "dependencies": [ - "freeimage" - ] - }, - "freetype": { - "description": "Enables FreeType font rendering engine for high-quality text display in OCCT's 3D visualization and technical drawing output.", - "supports": "!uwp", - "dependencies": [ - "fontconfig", - { - "name": "freetype", - "default-features": false - } - ] - }, - "rapidjson": { - "description": "Enables RapidJSON for efficient JSON parsing and serialization in OCCT's glTF 2.0 import/export functionality.", - "dependencies": [ - "rapidjson" - ] - }, - "tbb": { - "description": "Enables Intel Threading Building Blocks for optimized parallel computing. Replaces OCCT's default threading with TBB's task-based parallelism for better performance.", - "dependencies": [ - "tbb" - ] - }, - "vtk": { - "description": "Enables VTK (Visualization Toolkit) integration for advanced scientific visualization capabilities and mesh processing in OCCT.", - "dependencies": [ - { - "name": "vtk", - "default-features": false, - "features": [ - "opengl" - ] - } - ] - }, - "draco": { - "description": "Enables Google Draco geometry compression for efficient mesh storage and transmission in OCCT's glTF 2.0 import/export workflow.", - "dependencies": [ - "draco" - ] - }, - "ffmpeg": { - "description": "Enables FFmpeg multimedia framework for video encoding/decoding and animation export capabilities in OCCT's visualization pipeline.", - "dependencies": [ - "ffmpeg" - ] - }, - "openvr": { - "description": "Enables OpenVR SDK integration for virtual reality support in OCCT's 3D visualization, allowing immersive CAD model exploration.", - "dependencies": [ - "openvr" - ] - }, - "jemalloc": { - "description": "Enables jemalloc high-performance memory allocator as replacement for system malloc. Improves memory usage patterns for large-scale CAD operations.", - "dependencies": [ - "jemalloc" - ] - }, - "gtest": { - "description": "Enables Google Test framework for building OCCT's unit test suite. Required for running automated tests and validation of OCCT functionality.", - "dependencies": [ - "gtest" - ] - }, - "pch": { - "description": "Enables precompiled headers to improve compilation speed. Creates shared headers that are compiled once and reused across multiple source files." - }, - "cpp20": { - "description": "Enables C++20 standard compilation mode for OCCT. Provides access to latest C++20 features including concepts and modules." - }, - "cpp23": { - "description": "Enables C++23 standard compilation mode for OCCT. Provides access to the latest C++23 features including improved constexpr and new standard library components." - }, - "optimized": { - "description": "Enables production-level optimizations for maximum performance. Applies aggressive compiler optimizations and removes debug symbols." - }, - "d3d": { - "description": "Enables Direct3D support for 3D visualization on Windows. Provides alternative graphics backend to OpenGL for Windows-specific applications.", - "supports": "windows" - }, - "docs": { - "description": "Enables documentation generation using Doxygen. Creates HTML reference manual and overview documentation for OCCT API.", - "dependencies": [ - "doxygen" - ] - } - } -} \ No newline at end of file