Skip to content

Commit b5e7a7d

Browse files
authored
Configuration - Add VCPKG port opencascade (Open-Cascade-SAS#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
1 parent efd12a1 commit b5e7a7d

File tree

4 files changed

+89
-3
lines changed

4 files changed

+89
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (BUILD_USE_VCPKG)
3131
message(FATAL_ERROR "VCPKG_ROOT is not defined. Please set it to the path of vcpkg root directory.")
3232
endif()
3333

34-
set (VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/adm/vcpkg")
34+
set (VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/adm/vcpkg/ports/opencascade")
3535

3636
# Disable default features for vcpkg manifest
3737
set (VCPKG_MANIFEST_NO_DEFAULT_FEATURES 1)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Get git information for ABI validation
2+
execute_process(
3+
COMMAND git rev-parse --short HEAD
4+
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../.."
5+
OUTPUT_VARIABLE GIT_COMMIT_HASH
6+
OUTPUT_STRIP_TRAILING_WHITESPACE
7+
ERROR_QUIET
8+
RESULT_VARIABLE GIT_RESULT
9+
)
10+
11+
if(NOT GIT_RESULT EQUAL 0)
12+
set(GIT_COMMIT_HASH "unknown")
13+
endif()
14+
15+
set(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
16+
17+
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
18+
set(BUILD_TYPE "Shared")
19+
else()
20+
set(BUILD_TYPE "Static")
21+
endif()
22+
23+
set (BUILD_CPP_STANDARD "C++17")
24+
if ("cpp20" IN_LIST FEATURES)
25+
set (BUILD_CPP_STANDARD "C++20")
26+
elseif ("cpp23" IN_LIST FEATURES)
27+
set (BUILD_CPP_STANDARD "C++23")
28+
endif()
29+
30+
set (BUILD_OPT_PROFILE "Default")
31+
if ("optimized" IN_LIST FEATURES)
32+
set (BUILD_OPT_PROFILE "Production")
33+
endif()
34+
35+
set (BUILD_MODULE_Draw OFF)
36+
if ("tcl" IN_LIST FEATURES OR "tcltk" IN_LIST FEATURES)
37+
set (BUILD_MODULE_Draw ON)
38+
endif()
39+
40+
set (USE_MMGR_TYPE "NATIVE")
41+
if ("jemalloc" IN_LIST FEATURES)
42+
set (USE_MMGR_TYPE "JEMALLOC")
43+
endif()
44+
45+
# Feature mapping to CMake options
46+
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
47+
FEATURES
48+
angle USE_GLES2
49+
opengl USE_OPENGL
50+
freeimage USE_FREEIMAGE
51+
freetype USE_FREETYPE
52+
rapidjson USE_RAPIDJSON
53+
tbb USE_TBB
54+
vtk USE_VTK
55+
tcltk USE_TK
56+
draco USE_DRACO
57+
ffmpeg USE_FFMPEG
58+
openvr USE_OPENVR
59+
gtest BUILD_GTEST
60+
pch BUILD_USE_PCH
61+
d3d USE_D3D
62+
docs BUILD_DOC_Overview
63+
)
64+
65+
vcpkg_cmake_configure(
66+
SOURCE_PATH "${SOURCE_PATH}"
67+
OPTIONS
68+
${FEATURE_OPTIONS}
69+
-DBUILD_LIBRARY_TYPE=${BUILD_TYPE}
70+
-DINSTALL_DIR_LAYOUT=Vcpkg
71+
-DBUILD_USE_VCPKG=ON
72+
-DBUILD_CPP_STANDARD=${BUILD_CPP_STANDARD}
73+
-DBUILD_OPT_PROFILE=${BUILD_OPT_PROFILE}
74+
-DBUILD_MODULE_Draw=${BUILD_MODULE_Draw}
75+
-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}
76+
MAYBE_UNUSED_VARIABLES
77+
-DUSE_HASH=${GIT_COMMIT_HASH}
78+
)
79+
80+
vcpkg_cmake_install()
81+
82+
vcpkg_install_copyright(
83+
FILE_LIST
84+
"${SOURCE_PATH}/LICENSE_LGPL_21.txt"
85+
"${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt"
86+
)

adm/vcpkg/vcpkg-configuration.json renamed to adm/vcpkg/ports/opencascade/vcpkg-configuration.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
}
1414
],
1515
"overlay-ports": [
16-
"./ports"
16+
"../../ports"
1717
],
1818
"overlay-triplets": [
19-
"./triplets"
19+
"../../triplets"
2020
]
2121
}
File renamed without changes.

0 commit comments

Comments
 (0)