MacOS companion changes for dullahan 1.21 including package structure and linkage fixes

master
Rye 2025-08-27 23:05:40 -04:00
parent e629bf05d6
commit 536c821c09
14 changed files with 49 additions and 139 deletions

View File

@ -162,6 +162,9 @@ endif (LINUX)
if (DARWIN)
# Use rpath loading on macos
set(CMAKE_MACOSX_RPATH TRUE)
# Warnings should be fatal -- thanks, Nicky Perian, for spotting reversed default
set(CLANG_DISABLE_FATAL_WARNINGS OFF)
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")

View File

@ -29,7 +29,6 @@ elseif (DARWIN)
${ARCH_PREBUILT_DIRS_RELEASE}/libcef_dll_wrapper.a
${ARCH_PREBUILT_DIRS_RELEASE}/libdullahan.a
${APPKIT_LIBRARY}
"-F ${CEF_LIBRARY}"
)
elseif (LINUX)

View File

@ -1,5 +1,7 @@
# -*- cmake -*-
include(OpenGL)
add_library( ll::pluginlibraries INTERFACE IMPORTED )
if (WINDOWS)
@ -13,4 +15,6 @@ if (WINDOWS)
)
endif (WINDOWS)
target_link_libraries( ll::pluginlibraries INTERFACE OpenGL::GL)
target_include_directories( ll::pluginlibraries INTERFACE ${CMAKE_SOURCE_DIR}/llimage ${CMAKE_SOURCE_DIR}/llrender)

View File

@ -149,7 +149,7 @@ LLDir_Mac::LLDir_Mac()
mWorkingDir = getCurPath();
mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin";
mLLPluginDir = mAppRODataDir + mDirDelimiter + "SLPlugin.app" + mDirDelimiter + "Contents" + mDirDelimiter + "Frameworks";
}
}

View File

@ -43,6 +43,6 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
add_library (llplugin ${llplugin_SOURCE_FILES})
target_include_directories( llplugin INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries( llplugin llcommon llmath llrender llmessage )
target_link_libraries( llplugin llcommon llmath llmessage llxml )
add_subdirectory(slplugin)

View File

@ -29,7 +29,6 @@
#ifndef LL_LLPLUGINCLASSMEDIA_H
#define LL_LLPLUGINCLASSMEDIA_H
#include "llgltypes.h"
#include "llpluginprocessparent.h"
#include "llrect.h"
#include "llpluginclassmediaowner.h"
@ -365,9 +364,9 @@ protected:
bool mTextureParamsReceived; // the mRequestedTexture* fields are only valid when this is true
S32 mRequestedTextureDepth;
LLGLenum mRequestedTextureInternalFormat;
LLGLenum mRequestedTextureFormat;
LLGLenum mRequestedTextureType;
U32 mRequestedTextureInternalFormat;
U32 mRequestedTextureFormat;
U32 mRequestedTextureType;
bool mRequestedTextureSwapBytes;
bool mRequestedTextureCoordsOpenGL;

View File

@ -30,18 +30,6 @@ add_executable(SLPlugin
${SLPlugin_SOURCE_FILES}
)
if (WINDOWS)
set_target_properties(SLPlugin
PROPERTIES
LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMTD\""
)
else ()
set_target_properties(SLPlugin
PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist
)
endif ()
target_link_libraries(SLPlugin
llplugin
llmessage
@ -49,7 +37,19 @@ target_link_libraries(SLPlugin
ll::pluginlibraries
)
if (DARWIN)
if (WINDOWS)
set_target_properties(SLPlugin
PROPERTIES
LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMTD\""
)
elseif (DARWIN)
set_target_properties(SLPlugin
PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
INSTALL_RPATH "@executable_path/../../../../Frameworks;@executable_path/../Frameworks;@executable_path/../Frameworks/plugins"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist
)
# Make sure the app bundle has a Resources directory (it will get populated by viewer-manifest.py later)
add_custom_command(
TARGET SLPlugin POST_BUILD
@ -58,7 +58,7 @@ if (DARWIN)
-p
${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/SLPlugin.app/Contents/Resources
)
endif (DARWIN)
endif ()
if (LL_TESTS)
ll_deploy_sharedlibs_command(SLPlugin)

View File

@ -34,5 +34,5 @@ add_library(media_plugin_base
${media_plugin_base_SOURCE_FILES}
)
target_link_libraries( media_plugin_base llplugin )
target_link_libraries( media_plugin_base llplugin ll::pluginlibraries)
target_include_directories( media_plugin_base INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -77,16 +77,8 @@ if (DARWIN)
PROPERTIES
PREFIX ""
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path"
INSTALL_RPATH "@executable_path/../Frameworks"
LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp"
)
add_custom_command(TARGET media_plugin_cef
POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "@executable_path/Chromium Embedded Framework"
"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
"$<TARGET_FILE:media_plugin_cef>"
VERBATIM
COMMENT "Fixing path to CEF Framework"
)
endif (DARWIN)

View File

@ -47,7 +47,7 @@ if (DARWIN)
PROPERTIES
PREFIX ""
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path"
INSTALL_RPATH "@executable_path/../Frameworks"
LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp"
)

View File

@ -50,7 +50,7 @@ if (DARWIN)
PROPERTIES
PREFIX ""
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path"
INSTALL_RPATH "@executable_path/../Frameworks"
LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp"
)

View File

@ -174,7 +174,7 @@ void MediaPluginLibVLC::initVLC()
};
#if LL_DARWIN
setenv("VLC_PLUGIN_PATH", ".", 1);
setenv("VLC_PLUGIN_PATH", "./plugins", 1);
#endif
int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);

View File

@ -2156,10 +2156,8 @@ if (DARWIN)
PROPERTIES
OUTPUT_NAME "${product}"
# From Contents/MacOS/SecondLife, look in Contents/Frameworks
INSTALL_RPATH "@loader_path/../Frameworks"
# SIGH, as of 2018-05-24 (cmake 3.11.1) the INSTALL_RPATH property simply
# does not work. Try this:
LINK_FLAGS "-rpath @loader_path/../Frameworks"
BUILD_WITH_INSTALL_RPATH 1
INSTALL_RPATH "@executable_path/../Frameworks"
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}"
)

View File

@ -865,9 +865,6 @@ class Darwin_x86_64_Manifest(ViewerManifest):
# CEF framework goes inside Contents/Frameworks.
# Remember where we parked this car.
with self.prefix(src="", dst="Frameworks"):
CEF_framework = "Chromium Embedded Framework.framework"
self.path2basename(relpkgdir, CEF_framework)
CEF_framework = self.dst_path_of(CEF_framework)
if self.args.get('bugsplat'):
self.path2basename(relpkgdir, "BugsplatMac.framework")
@ -1065,113 +1062,31 @@ class Darwin_x86_64_Manifest(ViewerManifest):
# Dullahan helper apps go inside SLPlugin.app
with self.prefix(dst=os.path.join(
"SLPlugin.app", "Contents", "Frameworks")):
frameworkname = 'Chromium Embedded Framework'
# This code constructs a relative symlink from the
# target framework folder back to the real CEF framework.
# It needs to be relative so that the symlink still works when
# (as is normal) the user moves the app bundle out of the DMG
# and into the /Applications folder. Note we pass catch=False,
# letting the uncaught exception terminate the process, since
# without this symlink, Second Life web media can't possibly work.
# It might seem simpler just to symlink Frameworks back to
# the parent of Chromimum Embedded Framework.framework. But
# that would create a symlink cycle, which breaks our
# packaging step. So make a symlink from Chromium Embedded
# Framework.framework to the directory of the same name, which
# is NOT an ancestor of the symlink.
# from SLPlugin.app/Contents/Frameworks/Chromium Embedded
# Framework.framework back to
# $viewer_app/Contents/Frameworks/Chromium Embedded Framework.framework
SLPlugin_framework = self.relsymlinkf(CEF_framework, catch=False)
# for all the multiple CEF/Dullahan (as of CEF 76) helper app bundles we need:
for helper in (
"DullahanHelper",
"DullahanHelper (GPU)",
"DullahanHelper (Renderer)",
"DullahanHelper (Plugin)",
):
# app is the directory name of the app bundle, with app/Contents/MacOS/helper as the executable
app = helper + ".app"
# copy DullahanHelper.app
self.path2basename(relpkgdir, app)
# and fix that up with a Frameworks/CEF symlink too
with self.prefix(dst=os.path.join(
app, 'Contents', 'Frameworks')):
# from Dullahan Helper *.app/Contents/Frameworks/Chromium Embedded
# Framework.framework back to
# SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework
# Since SLPlugin_framework is itself a
# symlink, don't let relsymlinkf() resolve --
# explicitly call relpath(symlink=True) and
# create that symlink here.
helper_framework = \
self.symlinkf(self.relpath(SLPlugin_framework, symlink=True), catch=False)
# change_command includes install_name_tool, the
# -change subcommand and the old framework rpath
# stamped into the executable. To use it with
# run_command(), we must still append the new
# framework path and the pathname of the
# executable to change.
change_command = [
'install_name_tool', '-change',
'@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework']
with self.prefix(dst=os.path.join(
app, 'Contents', 'MacOS')):
# Now self.get_dst_prefix() is, at runtime,
# @executable_path. Locate the helper app
# framework (which is a symlink) from here.
newpath = os.path.join(
'@executable_path',
self.relpath(helper_framework, symlink=True),
frameworkname)
# and restamp the Dullahan Helper executable itself
self.run_command(
change_command +
[newpath, self.dst_path_of(helper)])
# SLPlugin plugins
with self.prefix(dst="llplugin"):
dylibexecutable = 'media_plugin_cef.dylib'
# copy CEF plugin
self.path2basename("../media_plugins/cef/" + self.args['configuration'],
dylibexecutable)
"media_plugin_cef.dylib")
# Do this install_name_tool *after* media plugin is copied over.
# Locate the framework lib executable -- relative to
# SLPlugin.app/Contents/MacOS, which will be our
# @executable_path at runtime!
newpath = os.path.join(
'@executable_path',
self.relpath(SLPlugin_framework, executable_path["SLPlugin.app"],
symlink=True),
frameworkname)
# restamp media_plugin_cef.dylib
self.run_command(
change_command +
[newpath, self.dst_path_of(dylibexecutable)])
# copy LibVLC plugin
self.path2basename("../media_plugins/libvlc/" + self.args['configuration'],
"media_plugin_libvlc.dylib")
# copy LibVLC plugin itself
dylibexecutable = 'media_plugin_libvlc.dylib'
self.path2basename("../media_plugins/libvlc/" + self.args['configuration'], dylibexecutable)
# add @rpath for the correct LibVLC subfolder
self.run_command(['install_name_tool', '-add_rpath', '@loader_path/lib', self.dst_path_of(dylibexecutable)])
# CEF framework and vlc libraries goes inside Contents/Frameworks.
with self.prefix(src=os.path.join(pkgdir, 'lib', 'release')):
self.path("Chromium Embedded Framework.framework")
self.path("DullahanHelper.app")
self.path("DullahanHelper (Alerts).app")
self.path("DullahanHelper (GPU).app")
self.path("DullahanHelper (Renderer).app")
self.path("DullahanHelper (Plugin).app")
# copy LibVLC dynamic libraries
with self.prefix(src=relpkgdir, dst="lib"):
# Copy libvlc
self.path( "libvlc*.dylib*" )
# copy LibVLC plugins folder
with self.prefix(src='plugins', dst=""):
with self.prefix(src='plugins', dst="plugins"):
self.path( "*.dylib" )
self.path( "plugins.dat" )
def package_finish(self):
imagename = self.installer_base_name()
self.set_github_output('imagename', imagename)