mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-15 16:25:46 -04:00
Build: Add Mac dependencies and fix packaging
This commit is contained in:
@ -196,34 +196,31 @@ if(APPLE)
|
||||
MACOSX_BUNDLE true
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
|
||||
OUTPUT_NAME DuckStation
|
||||
)
|
||||
)
|
||||
|
||||
# Copy qt.conf into the bundle
|
||||
target_sources(duckstation-qt PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/qt.conf" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
# Use macdeployqt to inject Qt into the bundle.
|
||||
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
|
||||
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
|
||||
find_program(MACDEPLOYQT_EXE macdeployqt HINTS "${QT_BINARY_DIRECTORY}")
|
||||
add_custom_target(duckstation-postprocess-bundle ALL
|
||||
COMMAND "${MACDEPLOYQT_EXE}" "${BUNDLE_PATH}"
|
||||
)
|
||||
add_dependencies(duckstation-postprocess-bundle duckstation-qt)
|
||||
|
||||
# Copy icon into the bundle
|
||||
target_sources(duckstation-qt PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns")
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
|
||||
# Copy Qt plugins into the bundle
|
||||
get_target_property(qtcocoa_location Qt6::QCocoaIntegrationPlugin LOCATION)
|
||||
target_sources(duckstation-qt PRIVATE "${qtcocoa_location}")
|
||||
set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms)
|
||||
|
||||
get_target_property(qtmacstyle_location Qt6::QMacStylePlugin LOCATION)
|
||||
target_sources(duckstation-qt PRIVATE "${qtmacstyle_location}")
|
||||
set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles)
|
||||
|
||||
# Copy resources into the bundle
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/data")
|
||||
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/data" "${CMAKE_SOURCE_DIR}/data/*")
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/data/resources")
|
||||
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/data/resources" "${CMAKE_SOURCE_DIR}/data/resources/*")
|
||||
foreach(res ${resources})
|
||||
target_sources(duckstation-qt PRIVATE "${CMAKE_SOURCE_DIR}/data/${res}")
|
||||
message(STATUS "Resource: ${res}")
|
||||
target_sources(duckstation-qt PRIVATE "${CMAKE_SOURCE_DIR}/data/resources/${res}")
|
||||
get_filename_component(resdir "${res}" DIRECTORY)
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/data/${res}" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "MacOS/${resdir}")
|
||||
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/data/${res}")
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/data/resources/${res}" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
|
||||
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/data/resources/${res}")
|
||||
endforeach()
|
||||
|
||||
# Copy translations into the bundle
|
||||
@ -233,16 +230,17 @@ if(APPLE)
|
||||
COMMAND cp ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations/*.qm $<TARGET_FILE_DIR:duckstation-qt>/translations)
|
||||
|
||||
# Copy MoltenVK into the bundle
|
||||
target_sources(duckstation-qt PRIVATE "${CMAKE_SOURCE_DIR}/dep/mac/MoltenVK/libvulkan.dylib")
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/dep/mac/MoltenVK/libvulkan.dylib" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
||||
|
||||
# Update library references to make the bundle portable
|
||||
include(DolphinPostprocessBundle)
|
||||
dolphin_postprocess_bundle(duckstation-qt)
|
||||
# Fix rpath
|
||||
add_custom_command(TARGET duckstation-qt
|
||||
POST_BUILD COMMAND
|
||||
${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/"
|
||||
$<TARGET_FILE:duckstation-qt>)
|
||||
unset(MOLTENVK_PATH CACHE)
|
||||
find_file(MOLTENVK_PATH NAMES
|
||||
libMoltenVK.dylib
|
||||
lib/libMoltenVK.dylib
|
||||
)
|
||||
if (MOLTENVK_PATH)
|
||||
target_sources(duckstation-qt PRIVATE "${MOLTENVK_PATH}")
|
||||
set_source_files_properties("${MOLTENVK_PATH}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
||||
message(STATUS "Using MoltenVK from ${MOLTENVK_PATH}")
|
||||
else()
|
||||
message(WARNING "MoltenVK not found in path, it will depend on the target system having it.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Reference in New Issue
Block a user