Skip to content
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

Fix osx build #29

Merged
merged 1 commit into from
Sep 28, 2023
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
9 changes: 2 additions & 7 deletions .github/scripts/.package.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,13 @@ ${_usage_host:-}"
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"

if (( package )) {
if [[ ! -f ${project_root}/build_macos/installer-macos.generated.pkgproj ]] {
log_error 'Packages project file not found. Run the build script or the CMake build and install procedures first.'
if [[ ! -f ${project_root}/release/${config}/${product_name}.pkg ]] {
log_error 'Installer Package not found. Run the build script or the CMake build and install procedures first.'
return 2
}

check_packages

log_group "Packaging ${product_name}..."
pushd ${project_root}
packagesbuild \
--build-folder ${project_root}/release/${config} \
${project_root}/build_macos/installer-macos.generated.pkgproj

if (( codesign )) {
read_codesign_installer
Expand Down
62 changes: 0 additions & 62 deletions .github/scripts/utils.zsh/check_packages

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pr-pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths-ignore:
- '**.md'
branches: [master, main]
types: [ opened, synchronize, reopened, labeled, unlabeled ]
types: [ opened, synchronize, reopened ]
permissions:
contents: read
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion cmake/common/compiler_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include_guard(GLOBAL)

# Set C and C++ language standards to C17 and C++17
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
set(CMAKE_C_STANDARD 17)
else()
set(CMAKE_C_STANDARD 11)
Expand Down
3 changes: 2 additions & 1 deletion cmake/macos/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ function(set_target_properties_plugin target)
CONFIGURATIONS Release
DESTINATION .
OPTIONAL)
configure_file(cmake/macos/resources/create-package.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake")
configure_file(cmake/macos/resources/distribution.in "${CMAKE_CURRENT_BINARY_DIR}/distribution" @ONLY)
configure_file(cmake/macos/resources/create-package.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake" @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake")
endfunction()

Expand Down
42 changes: 35 additions & 7 deletions cmake/macos/resources/create-package.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
set(CMAKE_PROJECT_NAME ${CMAKE_PROJECT_NAME})
set(CMAKE_PROJECT_VERSION ${CMAKE_PROJECT_VERSION})
set(MACOS_BUNDLEID ${MACOS_BUNDLEID})
set(UUID_PACKAGE ${UUID_PACKAGE})
set(UUID_INSTALLER ${UUID_INSTALLER})
configure_file(cmake/macos/resources/installer-macos.pkgproj.in
"${CMAKE_CURRENT_BINARY_DIR}/installer-macos.generated.pkgproj")
make_directory("$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins")

if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]")
file(INSTALL DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins"
TYPE DIRECTORY FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]" USE_SOURCE_PERMISSIONS)

if(CMAKE_INSTALL_CONFIG_NAME MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$" OR CMAKE_INSTALL_CONFIG_NAME MATCHES "^([Mm][Ii][Nn][Ss][Ii][Zz][Ee][Rr][Ee][Ll])$")
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]")
file(INSTALL DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins" TYPE DIRECTORY FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]" USE_SOURCE_PERMISSIONS)
endif()
endif()
endif()

make_directory("$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp")

execute_process(
COMMAND /usr/bin/pkgbuild
--identifier '@MACOS_BUNDLEID@'
--version '@CMAKE_PROJECT_VERSION@'
--root "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package"
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp/@[email protected]"
COMMAND_ERROR_IS_FATAL ANY
)

execute_process(
COMMAND /usr/bin/productbuild
--distribution "@CMAKE_CURRENT_BINARY_DIR@/distribution"
--package-path "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp"
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]"
COMMAND_ERROR_IS_FATAL ANY)

if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@[email protected]")
file(REMOVE_RECURSE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp")
file(REMOVE_RECURSE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package")
endif()
33 changes: 33 additions & 0 deletions cmake/macos/resources/distribution.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1.0">
<options
rootVolumeOnly="true"
hostArchitectures="arm64,x86_64"
customize="never"
allow-external-scripts="no" />
<domains enable_currentUserHome="true" enable_anywhere="false" enable_localSystem="false" />
<title>@CMAKE_PROJECT_NAME@</title>
<choices-outline>
<line choice="obs-plugin" />
</choices-outline>
<choice id="obs-plugin" title="@CMAKE_PROJECT_NAME@" description="">
<pkg-ref id="@MACOS_BUNDLEID@" />
</choice>
<pkg-ref id="@MACOS_BUNDLEID@" version="@CMAKE_PROJECT_VERSION@">#@[email protected]</pkg-ref>
<installation-check script="installCheck();" />
<script>
function installCheck() {
var macOSVersion = system.version.ProductVersion

if (system.compareVersions(macOSVersion, '@CMAKE_OSX_DEPLOYMENT_TARGET@') == -1) {
my.result.title = system.localizedStandardStringWithFormat(
'InstallationCheckError',
system.localizedString('DISTRIBUTION_TITLE')
);
my.result.message = ' ';
my.result.type = 'Fatal';
return false;
}
}
</script>
</installer-gui-script>