diff mbox series

meson: Restrict Cocoa framework check to macOS

Message ID 20210126132637.3175037-1-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series meson: Restrict Cocoa framework check to macOS | expand

Commit Message

Philippe Mathieu-Daudé Jan. 26, 2021, 1:26 p.m. UTC
Do not check for Cocoa framework if the OS is not macOS.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Peter Maydell Jan. 26, 2021, 1:28 p.m. UTC | #1
On Tue, 26 Jan 2021 at 13:26, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Do not check for Cocoa framework if the OS is not macOS.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  meson.build | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 35a9eddf5cf..9a9ee5408b9 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -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

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
Philippe Mathieu-Daudé Jan. 26, 2021, 1:47 p.m. UTC | #2
On 1/26/21 2:28 PM, Peter Maydell wrote:
> On Tue, 26 Jan 2021 at 13:26, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Do not check for Cocoa framework if the OS is not macOS.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  meson.build | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 35a9eddf5cf..9a9ee5408b9 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -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
> 
> What difference does this change make?

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

> 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.

> 
> thanks
> -- PMM
>
Paolo Bonzini Jan. 26, 2021, 2:08 p.m. UTC | #3
On 26/01/21 14:47, Philippe Mathieu-Daudé wrote:
>>>
>>> -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.
> 

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
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 35a9eddf5cf..9a9ee5408b9 100644
--- a/meson.build
+++ b/meson.build
@@ -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