summaryrefslogtreecommitdiff
path: root/patches/monero/0012-fix-iOS-depends-build.patch
blob: c61403f96e8e778e78b67ce15d86e1bcf70af089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
From d12831d35b6a7d181fb1669f0c7b9f5ccf6f5224 Mon Sep 17 00:00:00 2001
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
Date: Thu, 21 Nov 2024 06:05:03 -0500
Subject: [PATCH 12/17] fix iOS depends build

---
 CMakeLists.txt                      | 4 ----
 src/checkpoints/CMakeLists.txt      | 6 +++++-
 src/cryptonote_basic/CMakeLists.txt | 6 +++++-
 src/cryptonote_basic/miner.cpp      | 8 ++++----
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 303d17dcd..d3fda1975 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,10 +47,6 @@ if (POLICY CMP0077)
     cmake_policy(SET CMP0077 NEW)
 endif()
 
-if (IOS)
-    INCLUDE(CmakeLists_IOS.txt)
-endif()
-
 project(monero)
 
 option (USE_CCACHE "Use ccache if a usable instance is found" ON)
diff --git a/src/checkpoints/CMakeLists.txt b/src/checkpoints/CMakeLists.txt
index cc7f261ed..939aa3b90 100644
--- a/src/checkpoints/CMakeLists.txt
+++ b/src/checkpoints/CMakeLists.txt
@@ -28,7 +28,11 @@
 
 if(APPLE)
   if(DEPENDS)
-    list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
+      list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
+    else()
+      list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
+    endif()
   else()
     find_library(IOKIT_LIBRARY IOKit)
     mark_as_advanced(IOKIT_LIBRARY)
diff --git a/src/cryptonote_basic/CMakeLists.txt b/src/cryptonote_basic/CMakeLists.txt
index ed48c15e3..5ec366791 100644
--- a/src/cryptonote_basic/CMakeLists.txt
+++ b/src/cryptonote_basic/CMakeLists.txt
@@ -28,7 +28,11 @@
 
 if(APPLE)
   if(DEPENDS)
-    list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
+      list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
+    else()
+      list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
+    endif()
   else()
     find_library(IOKIT_LIBRARY IOKit)
     mark_as_advanced(IOKIT_LIBRARY)
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 258e782a2..e278da0b9 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -46,7 +46,7 @@
 #include "boost/logic/tribool.hpp"
 #include <boost/filesystem.hpp>
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(TARGET_OS_IPHONE)
   #include <sys/times.h>
   #include <IOKit/IOKitLib.h>
   #include <IOKit/ps/IOPSKeys.h>
@@ -885,7 +885,7 @@ namespace cryptonote
 
       return true;
 
-    #elif defined(__APPLE__)
+    #elif defined(__APPLE__) && !defined(TARGET_OS_IPHONE)
 
       mach_msg_type_number_t count;
       kern_return_t status;
@@ -951,7 +951,7 @@ namespace cryptonote
         return true;
       }
 
-    #elif (defined(__linux__) && defined(_SC_CLK_TCK)) || defined(__APPLE__) || defined(__FreeBSD__)
+    #elif (defined(__linux__) && defined(_SC_CLK_TCK)) || (defined(__APPLE__) && !defined(TARGET_OS_IPHONE)) || defined(__FreeBSD__)
 
       struct tms tms;
       if ( times(&tms) != (clock_t)-1 )
@@ -980,7 +980,7 @@ namespace cryptonote
         return boost::logic::tribool(power_status.ACLineStatus != 1);
     	}
 
-    #elif defined(__APPLE__) 
+    #elif defined(__APPLE__) && !defined(TARGET_OS_IPHONE)
       
       #if TARGET_OS_MAC && (!defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
         return boost::logic::tribool(IOPSGetTimeRemainingEstimate() != kIOPSTimeRemainingUnlimited);
-- 
2.51.0