Skip to content

Commit 5323782

Browse files
committed
Switch to upstream vcpkg with an overlay port
1 parent 7f54e89 commit 5323782

File tree

4 files changed

+127
-4
lines changed

4 files changed

+127
-4
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66

77
env:
88
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
9-
VCPKG_REPOSITORY: https://github.com/OpenMW/vcpkg.git
10-
VCPKG_REVISION: ab5f50f1a7b54a6f4d6239677cba9d730e6ab152
9+
VCPKG_REPOSITORY: https://github.com/microsoft/vcpkg.git
10+
VCPKG_REVISION: 137197a8f85e6c6cf1843ef024af7d9c28bb0bde
1111

1212
jobs:
1313
static:
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Install vcpkg packages
4848
run: >
49-
vcpkg install --triplet x64-windows-static
49+
vcpkg install --overlay-ports=ports --triplet x64-windows-static
5050
boost-geometry
5151
boost-iostreams
5252
boost-program-options
@@ -133,7 +133,7 @@ jobs:
133133

134134
- name: Install vcpkg packages
135135
run: >
136-
vcpkg install --triplet x64-windows
136+
vcpkg install --overlay-ports=ports --triplet x64-windows
137137
boost-geometry
138138
boost-iostreams
139139
boost-program-options

ports/openmw-osg/portfile.cmake

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)
2+
3+
set(OSG_VER 3.6.5)
4+
5+
vcpkg_from_github(
6+
OUT_SOURCE_PATH SOURCE_PATH
7+
REPO openmw/osg
8+
REF 673f30ad3820faf2a5e901ffe403b5246b8918fe
9+
SHA512 a75c5092f653d56ef216fd38eb84793816654bb16423bbb3b82c97d9ece98c72fcd8e30f109e5fa4563423c1b113ca1d790c5ab30803f6bfee48662d1e6ac9e8
10+
HEAD_REF 3.6
11+
)
12+
13+
file(REMOVE
14+
"${SOURCE_PATH}/CMakeModules/FindFontconfig.cmake"
15+
"${SOURCE_PATH}/CMakeModules/FindFreetype.cmake"
16+
"${SOURCE_PATH}/CMakeModules/Findilmbase.cmake"
17+
"${SOURCE_PATH}/CMakeModules/FindOpenEXR.cmake"
18+
"${SOURCE_PATH}/CMakeModules/FindSDL2.cmake"
19+
)
20+
21+
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" OSG_DYNAMIC)
22+
23+
set(OPTIONS "")
24+
25+
# Skip try_run checks
26+
if(VCPKG_TARGET_IS_MINGW)
27+
list(APPEND OPTIONS -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED=0 -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS=1)
28+
elseif(VCPKG_TARGET_IS_WINDOWS)
29+
list(APPEND OPTIONS -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED=1 -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS=0)
30+
elseif(VCPKG_TARGET_IS_IOS)
31+
# handled by osg
32+
elseif(VCPKG_CROSSCOMPILING)
33+
message(WARNING "Atomics detection may fail for cross builds. You can set osg cmake variables in a custom triplet.")
34+
endif()
35+
36+
# The package osg can be configured to use different OpenGL profiles via a custom triplet file:
37+
# Possible values are GLCORE, GL2, GL3, GLES1, GLES2, GLES3, and GLES2+GLES3
38+
if(NOT DEFINED osg_OPENGL_PROFILE)
39+
set(osg_OPENGL_PROFILE "GL2")
40+
endif()
41+
42+
vcpkg_cmake_configure(
43+
SOURCE_PATH "${SOURCE_PATH}"
44+
OPTIONS
45+
-DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC}
46+
-DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC}
47+
-DOSG_MSVC_VERSIONED_DLL=OFF
48+
-DOSG_DETERMINE_WIN_VERSION=OFF
49+
-DOSG_FIND_3RD_PARTY_DEPS=OFF
50+
-DOPENGL_PROFILE=${osg_OPENGL_PROFILE}
51+
-DBUILD_DASHBOARD_REPORTS=OFF
52+
-DCMAKE_CXX_STANDARD=11
53+
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON
54+
-DBUILD_OSG_PLUGINS_BY_DEFAULT=OFF
55+
-DBUILD_OSG_PLUGIN_OSG=ON
56+
-DBUILD_OSG_PLUGIN_DDS=ON
57+
-DBUILD_OSG_PLUGIN_TGA=ON
58+
-DBUILD_OSG_PLUGIN_BMP=ON
59+
-DBUILD_OSG_PLUGIN_JPEG=ON
60+
-DBUILD_OSG_PLUGIN_PNG=ON
61+
-DBUILD_OSG_PLUGIN_FREETYPE=ON
62+
-DBUILD_OSG_PLUGIN_DAE=ON
63+
-DBUILD_OSG_PLUGIN_KTX=ON
64+
-DBUILD_OSG_DEPRECATED_SERIALIZERS=OFF
65+
-DBUILD_OSG_APPLICATIONS=OFF
66+
-DBUILD_OSG_EXAMPLES=OFF
67+
-DBUILD_DOCUMENTATION=OFF
68+
${OPTIONS}
69+
MAYBE_UNUSED_VARIABLES
70+
OSG_DETERMINE_WIN_VERSION
71+
)
72+
vcpkg_cmake_install()
73+
vcpkg_copy_pdbs()
74+
75+
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
76+
file(APPEND "${CURRENT_PACKAGES_DIR}/include/osg/Config" "#ifndef OSG_LIBRARY_STATIC\n#define OSG_LIBRARY_STATIC 1\n#endif\n")
77+
endif()
78+
79+
file(REMOVE_RECURSE
80+
"${CURRENT_PACKAGES_DIR}/debug/include"
81+
"${CURRENT_PACKAGES_DIR}/debug/share"
82+
)
83+
84+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/openscenegraph.pc" "\\\n" " ")
85+
if(NOT VCPKG_BUILD_TYPE)
86+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/openscenegraph.pc" "\\\n" " ")
87+
endif()
88+
vcpkg_fixup_pkgconfig()
89+
90+
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
91+
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

ports/openmw-osg/usage

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The package osg can be configured to use different OpenGL profiles via a custom triplet file.
2+
Possible values are GLCORE, GL2, GL3, GLES1, GLES2, GLES3 and GLES2+GLES3.
3+
The default value is GL3.
4+
set(osg_OPENGL_PROFILE GL2)

ports/openmw-osg/vcpkg.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "openmw-osg",
3+
"version": "3.6.5",
4+
"port-version": 1,
5+
"description": "Fork of OpenSceneGraph for OpenMW-specific performance improvements.",
6+
"homepage": "https://github.com/openmw/osg",
7+
"license": null,
8+
"supports": "!uwp",
9+
"dependencies": [
10+
"collada-dom",
11+
"freetype",
12+
"libiconv",
13+
"libjpeg-turbo",
14+
"libpng",
15+
"libxml2",
16+
"opengl-registry",
17+
"tiff",
18+
"zlib",
19+
{
20+
"name": "vcpkg-cmake",
21+
"host": true
22+
},
23+
{
24+
"name": "vcpkg-cmake-config",
25+
"host": true
26+
}
27+
]
28+
}

0 commit comments

Comments
 (0)