Skip to content

Switch to upstream vcpkg with an overlay port #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:

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

jobs:
static:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Install vcpkg packages
run: >
vcpkg install --triplet x64-windows-static
vcpkg install --overlay-ports=ports --triplet x64-windows-static
boost-geometry
boost-iostreams
boost-program-options
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:

- name: Install vcpkg packages
run: >
vcpkg install --triplet x64-windows
vcpkg install --overlay-ports=ports --triplet x64-windows
boost-geometry
boost-iostreams
boost-program-options
Expand Down
91 changes: 91 additions & 0 deletions ports/openmw-osg/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)

set(OSG_VER 3.6.5)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openmw/osg
REF 673f30ad3820faf2a5e901ffe403b5246b8918fe
SHA512 a75c5092f653d56ef216fd38eb84793816654bb16423bbb3b82c97d9ece98c72fcd8e30f109e5fa4563423c1b113ca1d790c5ab30803f6bfee48662d1e6ac9e8
HEAD_REF 3.6
)

file(REMOVE
"${SOURCE_PATH}/CMakeModules/FindFontconfig.cmake"
"${SOURCE_PATH}/CMakeModules/FindFreetype.cmake"
"${SOURCE_PATH}/CMakeModules/Findilmbase.cmake"
"${SOURCE_PATH}/CMakeModules/FindOpenEXR.cmake"
"${SOURCE_PATH}/CMakeModules/FindSDL2.cmake"
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" OSG_DYNAMIC)

set(OPTIONS "")

# Skip try_run checks
if(VCPKG_TARGET_IS_MINGW)
list(APPEND OPTIONS -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED=0 -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS=1)
elseif(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED=1 -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS=0)
elseif(VCPKG_TARGET_IS_IOS)
# handled by osg
elseif(VCPKG_CROSSCOMPILING)
message(WARNING "Atomics detection may fail for cross builds. You can set osg cmake variables in a custom triplet.")
endif()

# The package osg can be configured to use different OpenGL profiles via a custom triplet file:
# Possible values are GLCORE, GL2, GL3, GLES1, GLES2, GLES3, and GLES2+GLES3
if(NOT DEFINED osg_OPENGL_PROFILE)
set(osg_OPENGL_PROFILE "GL2")
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC}
-DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC}
-DOSG_MSVC_VERSIONED_DLL=OFF
-DOSG_DETERMINE_WIN_VERSION=OFF
-DOSG_FIND_3RD_PARTY_DEPS=OFF
-DOPENGL_PROFILE=${osg_OPENGL_PROFILE}
-DBUILD_DASHBOARD_REPORTS=OFF
-DCMAKE_CXX_STANDARD=11
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON
-DBUILD_OSG_PLUGINS_BY_DEFAULT=OFF
-DBUILD_OSG_PLUGIN_OSG=ON
-DBUILD_OSG_PLUGIN_DDS=ON
-DBUILD_OSG_PLUGIN_TGA=ON
-DBUILD_OSG_PLUGIN_BMP=ON
-DBUILD_OSG_PLUGIN_JPEG=ON
-DBUILD_OSG_PLUGIN_PNG=ON
-DBUILD_OSG_PLUGIN_FREETYPE=ON
-DBUILD_OSG_PLUGIN_DAE=ON
-DBUILD_OSG_PLUGIN_KTX=ON
-DBUILD_OSG_DEPRECATED_SERIALIZERS=OFF
-DBUILD_OSG_APPLICATIONS=OFF
-DBUILD_OSG_EXAMPLES=OFF
-DBUILD_DOCUMENTATION=OFF
${OPTIONS}
MAYBE_UNUSED_VARIABLES
OSG_DETERMINE_WIN_VERSION
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(APPEND "${CURRENT_PACKAGES_DIR}/include/osg/Config" "#ifndef OSG_LIBRARY_STATIC\n#define OSG_LIBRARY_STATIC 1\n#endif\n")
endif()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/openscenegraph.pc" "\\\n" " ")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/openscenegraph.pc" "\\\n" " ")
endif()
vcpkg_fixup_pkgconfig()

file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
4 changes: 4 additions & 0 deletions ports/openmw-osg/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package osg can be configured to use different OpenGL profiles via a custom triplet file.
Possible values are GLCORE, GL2, GL3, GLES1, GLES2, GLES3 and GLES2+GLES3.
The default value is GL3.
set(osg_OPENGL_PROFILE GL2)
28 changes: 28 additions & 0 deletions ports/openmw-osg/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "openmw-osg",
"version": "3.6.5",
"port-version": 1,
"description": "Fork of OpenSceneGraph for OpenMW-specific performance improvements.",
"homepage": "https://github.com/openmw/osg",
"license": null,
"supports": "!uwp",
"dependencies": [
"collada-dom",
"freetype",
"libiconv",
"libjpeg-turbo",
"libpng",
"libxml2",
"opengl-registry",
"tiff",
"zlib",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
Loading