aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Borges de Freitas <92enen@gmail.com>2023-08-04 15:09:37 +0100
committerMiguel Borges de Freitas <92enen@gmail.com>2023-08-07 11:19:18 +0100
commit751a4ba2b30c3131a6d24309ea0c8cffbe01c193 (patch)
treedb8cb71e16524c8107f81b0adadf712294b4b890
parent7879f2a037f411448afd018d091ee2ced60fd673 (diff)
[cmake][macOS] Allow building without xbmchelper - default for arm64
-rw-r--r--cmake/scripts/osx/ArchSetup.cmake11
-rw-r--r--cmake/scripts/osx/ExtraTargets.cmake6
-rw-r--r--system/settings/darwin.xml3
-rw-r--r--tools/EventClients/Clients/OSXRemote/CMakeLists.txt36
-rwxr-xr-xtools/darwin/packaging/osx/mkdmg-osx.sh.in4
-rw-r--r--xbmc/application/Application.cpp4
-rw-r--r--xbmc/network/NetworkServices.cpp4
-rw-r--r--xbmc/platform/darwin/osx/CMakeLists.txt11
-rw-r--r--xbmc/platform/darwin/osx/PlatformDarwinOSX.cpp4
-rw-r--r--xbmc/settings/SettingConditions.cpp4
-rw-r--r--xbmc/settings/Settings.cpp6
11 files changed, 63 insertions, 30 deletions
diff --git a/cmake/scripts/osx/ArchSetup.cmake b/cmake/scripts/osx/ArchSetup.cmake
index bd8ad398cb..0e712926e8 100644
--- a/cmake/scripts/osx/ArchSetup.cmake
+++ b/cmake/scripts/osx/ArchSetup.cmake
@@ -24,6 +24,17 @@ else()
endif()
endif()
+# xbmchelper (old apple IR remotes) only make sense for x86
+# last macs featuring the IR receiver are those of mid 2012
+# which are still able to run Mojave (10.14). Drop all together
+# when the sdk requirement is bumped.
+if(CPU STREQUAL arm64)
+ set(ENABLE_XBMCHELPER OFF)
+else()
+ set(ENABLE_XBMCHELPER ON)
+ list(APPEND SYSTEM_DEFINES -DHAS_XBMCHELPER)
+endif()
+
# m1 macs can execute x86_64 code via rosetta
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" AND
CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
diff --git a/cmake/scripts/osx/ExtraTargets.cmake b/cmake/scripts/osx/ExtraTargets.cmake
index 28c1e742f7..a21eb335f3 100644
--- a/cmake/scripts/osx/ExtraTargets.cmake
+++ b/cmake/scripts/osx/ExtraTargets.cmake
@@ -1,3 +1,5 @@
# XBMCHelper
-add_subdirectory(${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper)
-add_dependencies(${APP_NAME_LC} XBMCHelper)
+if(ENABLE_XBMCHELPER)
+ add_subdirectory(${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper)
+ add_dependencies(${APP_NAME_LC} XBMCHelper)
+endif()
diff --git a/system/settings/darwin.xml b/system/settings/darwin.xml
index 55c98ad490..3d80d7501e 100644
--- a/system/settings/darwin.xml
+++ b/system/settings/darwin.xml
@@ -28,6 +28,7 @@
<category id="input">
<group id="3">
<setting id="input.appleremotemode" type="integer" label="13600" help="36416">
+ <requirement>HAS_XBMCHELPER</requirement>
<level>1</level>
<default>1</default> <!-- APPLE_REMOTE_STANDARD -->
<constraints>
@@ -41,6 +42,7 @@
<control type="list" format="string"/>
</setting>
<setting id="input.appleremotealwayson" type="boolean" label="13602" help="36417">
+ <requirement>HAS_XBMCHELPER</requirement>
<level>4</level>
<default>false</default>
<dependencies>
@@ -49,6 +51,7 @@
<control type="toggle" />
</setting>
<setting id="input.appleremotesequencetime" type="integer" label="13603" help="36418">
+ <requirement>HAS_XBMCHELPER</requirement>
<level>1</level>
<default>500</default>
<constraints>
diff --git a/tools/EventClients/Clients/OSXRemote/CMakeLists.txt b/tools/EventClients/Clients/OSXRemote/CMakeLists.txt
index 7579ec458c..46952ba374 100644
--- a/tools/EventClients/Clients/OSXRemote/CMakeLists.txt
+++ b/tools/EventClients/Clients/OSXRemote/CMakeLists.txt
@@ -1,20 +1,22 @@
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
+if(ENABLE_XBMCHELPER)
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
-set(SOURCES xbmcclientwrapper.mm
- xbmchelper_main.mm
- XBMCHelper.m
- HIDRemote/HIDRemote.m)
+ set(SOURCES xbmcclientwrapper.mm
+ xbmchelper_main.mm
+ XBMCHelper.m
+ HIDRemote/HIDRemote.m)
-set(HEADERS XBMCDebugHelpers.h)
+ set(HEADERS XBMCDebugHelpers.h)
-add_executable(XBMCHelper ${SOURCES} ${HEADERS})
-set_target_properties(XBMCHelper PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tools/darwin/runtime
- RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/tools/darwin/runtime
- RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/tools/darwin/runtime
- FOLDER Tools)
-target_link_libraries(XBMCHelper
- PRIVATE ${SYSTEM_LDFLAGS}
- "-framework IOKit"
- "-framework Carbon"
- "-framework Cocoa")
+ add_executable(XBMCHelper ${SOURCES} ${HEADERS})
+ set_target_properties(XBMCHelper PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tools/darwin/runtime
+ RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/tools/darwin/runtime
+ RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/tools/darwin/runtime
+ FOLDER Tools)
+ target_link_libraries(XBMCHelper
+ PRIVATE ${SYSTEM_LDFLAGS}
+ "-framework IOKit"
+ "-framework Carbon"
+ "-framework Cocoa")
+endif()
diff --git a/tools/darwin/packaging/osx/mkdmg-osx.sh.in b/tools/darwin/packaging/osx/mkdmg-osx.sh.in
index 8d8533c80c..cded94d728 100755
--- a/tools/darwin/packaging/osx/mkdmg-osx.sh.in
+++ b/tools/darwin/packaging/osx/mkdmg-osx.sh.in
@@ -38,7 +38,9 @@ if [ "$EXPANDED_CODE_SIGN_IDENTITY_NAME" ]; then
# execute codesign script
"$DIRNAME/Codesign.command"
# sign helper tool
- codesign --verbose=4 --sign "$EXPANDED_CODE_SIGN_IDENTITY_NAME" --force --options runtime --timestamp --entitlements Kodi.entitlements "$APP/Contents/Resources/Kodi/tools/darwin/runtime/XBMCHelper"
+ if [ -f "$APP/Contents/Resources/Kodi/tools/darwin/runtime/XBMCHelper" ]; then
+ codesign --verbose=4 --sign "$EXPANDED_CODE_SIGN_IDENTITY_NAME" --force --options runtime --timestamp --entitlements Kodi.entitlements "$APP/Contents/Resources/Kodi/tools/darwin/runtime/XBMCHelper"
+ fi
# perform top-level signing (Xcode does it automatically when signing settings are configured)
codesign --verbose=4 --sign "$EXPANDED_CODE_SIGN_IDENTITY_NAME" --force --options runtime --timestamp --entitlements Kodi.entitlements "$APP"
fi
diff --git a/xbmc/application/Application.cpp b/xbmc/application/Application.cpp
index 970a3299b3..1b381206a4 100644
--- a/xbmc/application/Application.cpp
+++ b/xbmc/application/Application.cpp
@@ -154,8 +154,10 @@
#ifdef TARGET_DARWIN_OSX
#include "platform/darwin/osx/CocoaInterface.h"
+#ifdef HAS_XBMCHELPER
#include "platform/darwin/osx/XBMCHelper.h"
#endif
+#endif
#ifdef TARGET_DARWIN
#include "platform/darwin/DarwinUtils.h"
#endif
@@ -2162,7 +2164,7 @@ bool CApplication::Stop(int exitCode)
smb.Deinit();
#endif
-#if defined(TARGET_DARWIN_OSX)
+#if defined(TARGET_DARWIN_OSX) and defined(HAS_XBMCHELPER)
if (XBMCHelper::GetInstance().IsAlwaysOn() == false)
XBMCHelper::GetInstance().Stop();
#endif
diff --git a/xbmc/network/NetworkServices.cpp b/xbmc/network/NetworkServices.cpp
index 40094335b9..1d137360ee 100644
--- a/xbmc/network/NetworkServices.cpp
+++ b/xbmc/network/NetworkServices.cpp
@@ -74,7 +74,7 @@
#endif
#endif
-#if defined(TARGET_DARWIN_OSX)
+#if defined(TARGET_DARWIN_OSX) and defined(HAS_XBMCHELPER)
#include "platform/darwin/osx/XBMCHelper.h"
#endif
@@ -432,7 +432,7 @@ bool CNetworkServices::OnSettingChanging(const std::shared_ptr<const CSetting>&
return false;
}
-#if defined(TARGET_DARWIN_OSX)
+#if defined(TARGET_DARWIN_OSX) and defined(HAS_XBMCHELPER)
// reconfigure XBMCHelper for port changes
XBMCHelper::GetInstance().Configure();
#endif // TARGET_DARWIN_OSX
diff --git a/xbmc/platform/darwin/osx/CMakeLists.txt b/xbmc/platform/darwin/osx/CMakeLists.txt
index 125135b610..4e3a41de98 100644
--- a/xbmc/platform/darwin/osx/CMakeLists.txt
+++ b/xbmc/platform/darwin/osx/CMakeLists.txt
@@ -2,14 +2,17 @@ set(SOURCES CocoaInterface.mm
CPUInfoOsx.cpp
HotKeyController.m
PlatformDarwinOSX.cpp
- smc.c
- XBMCHelper.cpp)
+ smc.c)
set(HEADERS CocoaInterface.h
CPUInfoOsx.h
HotKeyController.h
PlatformDarwinOSX.h
- smc.h
- XBMCHelper.h)
+ smc.h)
+
+if(ENABLE_XBMCHELPER)
+ list(APPEND SOURCES XBMCHelper.cpp)
+ list(APPEND HEADERS XBMCHelper.h)
+endif()
core_add_library(platform_osx)
diff --git a/xbmc/platform/darwin/osx/PlatformDarwinOSX.cpp b/xbmc/platform/darwin/osx/PlatformDarwinOSX.cpp
index a5d9db273e..f1b24a964d 100644
--- a/xbmc/platform/darwin/osx/PlatformDarwinOSX.cpp
+++ b/xbmc/platform/darwin/osx/PlatformDarwinOSX.cpp
@@ -14,7 +14,9 @@
#include "windowing/osx/OpenGL/WinSystemOSXGL.h"
#endif
+#if defined(HAS_XBMCHELPER)
#include "platform/darwin/osx/XBMCHelper.h"
+#endif
#include "platform/darwin/osx/powermanagement/CocoaPowerSyscall.h"
#include <stdlib.h>
@@ -48,7 +50,9 @@ bool CPlatformDarwinOSX::InitStageOne()
bool CPlatformDarwinOSX::InitStageTwo()
{
// Configure and possible manually start the helper.
+#if defined(HAS_XBMCHELPER)
XBMCHelper::GetInstance().Configure();
+#endif
return true;
}
diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp
index fab12ab700..d9710c0e0c 100644
--- a/xbmc/settings/SettingConditions.cpp
+++ b/xbmc/settings/SettingConditions.cpp
@@ -455,6 +455,10 @@ void CSettingConditions::Initialize()
m_simpleConditions.emplace("has_optical_drive");
#endif
+#ifdef HAS_XBMCHELPER
+ m_simpleConditions.emplace("has_xbmchelper");
+#endif
+
// add complex conditions
m_complexConditions.emplace("addonhassettings", AddonHasSettings);
m_complexConditions.emplace("checkmasterlock", CheckMasterLock);
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index 14a1479325..7f30770710 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -26,7 +26,7 @@
#endif // defined(TARGET_POSIX)
#include "network/upnp/UPnPSettings.h"
#include "network/WakeOnAccess.h"
-#if defined(TARGET_DARWIN_OSX)
+#if defined(TARGET_DARWIN_OSX) and defined(HAS_XBMCHELPER)
#include "platform/darwin/osx/XBMCHelper.h"
#endif // defined(TARGET_DARWIN_OSX)
#if defined(TARGET_DARWIN_TVOS)
@@ -619,7 +619,7 @@ void CSettings::InitializeISettingCallbacks()
GetSettingsManager()->RegisterCallback(&g_timezone, settingSet);
#endif
-#if defined(TARGET_DARWIN_OSX)
+#if defined(TARGET_DARWIN_OSX) and defined(HAS_XBMCHELPER)
settingSet.clear();
settingSet.insert(CSettings::SETTING_INPUT_APPLEREMOTEMODE);
settingSet.insert(CSettings::SETTING_INPUT_APPLEREMOTEALWAYSON);
@@ -664,7 +664,7 @@ void CSettings::UninitializeISettingCallbacks()
#if defined(TARGET_LINUX)
GetSettingsManager()->UnregisterCallback(&g_timezone);
#endif // defined(TARGET_LINUX)
-#if defined(TARGET_DARWIN_OSX)
+#if defined(TARGET_DARWIN_OSX) and defined(HAS_XBMCHELPER)
GetSettingsManager()->UnregisterCallback(&XBMCHelper::GetInstance());
#endif
GetSettingsManager()->UnregisterCallback(&CWakeOnAccess::GetInstance());