Skip to contentSkip to conversation

meson: Restrict Cocoa framework check to macOS

PATCH In review Philippe Mathieu-Daudé 3 participants 4 messages Jan 26, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: Restrict Cocoa framework check to macOS

Do not check for Cocoa framework if the OS is not macOS.

---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meson.build +4 -1
index 35a9eddf5cf..9a9ee5408b9 100644
@@ -369,7 +369,10 @@
   endif
 endif
 
-cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+cocoa = not_found
+if targetos == 'darwin'
+  cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+endif
 if cocoa.found() and get_option('sdl').enabled()
   error('Cocoa and SDL cannot be enabled at the same time')
 endif
Signature · 1 line
2.26.2
#1 lore raw
Quoted 14 lines · Philippe Mathieu-Daudé

Do not check for Cocoa framework if the OS is not macOS.

---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meson.build +0 -0
index 35a9eddf5cf..9a9ee5408b9 100644
@@ -369,7 +369,10 @@
   endif

meson.build line 378

Quoted 10 lines
meson.build +4 -1
 endif
 
-cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+cocoa = not_found
+if targetos == 'darwin'
+  cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+endif
 if cocoa.found() and get_option('sdl').enabled()
   error('Cocoa and SDL cannot be enabled at the same time')
 endif

What difference does this change make? Are there ever situations where the 'detect cocoa' test incorrectly finds cocoa on a non-macOS system and breaks something?

thanks
-- PMM

#2 lore raw
Quoted 17 lines · Peter Maydell
Quoted 16 lines · Philippe Mathieu-Daudé

Do not check for Cocoa framework if the OS is not macOS.

---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meson.build +0 -0
index 35a9eddf5cf..9a9ee5408b9 100644
@@ -369,7 +369,10 @@
   endif
 endif
 
Quoted 10 lines

meson.build line 378

Quoted 8 lines
meson.build +4 -1
-cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+cocoa = not_found
+if targetos == 'darwin'
+  cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+endif
 if cocoa.found() and get_option('sdl').enabled()
   error('Cocoa and SDL cannot be enabled at the same time')
 endif

What difference does this change make?

On my slow Fedora host it run cmake checks if it can build cocoa.

Quoted 3 lines

Are there ever
situations where the 'detect cocoa' test incorrectly finds cocoa on a non-macOS system and breaks something?

In my case it is not breaking, just slow. The host is slow anyway, making it more apparent.

Quoted 4 lines

thanks
-- PMM

#3 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 10 lines

meson.build line 378

Quoted 9 lines
meson.build +4 -1
-cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+cocoa = not_found
+if targetos == 'darwin'
+  cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+endif
  if cocoa.found() and get_option('sdl').enabled()
    error('Cocoa and SDL cannot be enabled at the same time')
  endif

What difference does this change make?

Quoted 2 lines

On my slow Fedora host it run cmake checks if it can build cocoa.

Can you send the meson-logs/meson-log.txt? On my machine (Meson 0.56.0) I see only

Run-time dependency appleframeworks found: NO (tried framework)

and no cmake in sight (in fact no process is spawned to do the check).

Paolo