[Meson] Support macOS
authorWook Song <wook16.song@samsung.com>
Mon, 26 Aug 2019 02:29:28 +0000 (11:29 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 29 Aug 2019 01:19:51 +0000 (10:19 +0900)
In order to support macOS, this patch updates the meson build script in
the source root directory to pass macro definition, '__MACOS__', to the
compiler.

Signed-off-by: Wook Song <wook16.song@samsung.com>
meson.build

index d2b1660..f3dd45b 100644 (file)
@@ -17,6 +17,21 @@ add_project_arguments('-DVERSION="' + meson.project_version() + '"', language: [
 
 cc = meson.get_compiler('c')
 cxx = meson.get_compiler('cpp')
+build_platform = ''
+
+if get_option('enable-tizen')
+  # Pass __TIZEN__ to the compiler
+  add_project_arguments('-D__TIZEN__=1', language: ['c', 'cpp'])
+  build_platform = 'tizen'
+elif not meson.is_cross_build()
+  if cc.get_id() == 'clang' and cxx.get_id() == 'clang'
+    if build_machine.system() == 'darwin'
+      # Pass __MACOS__ to the compiler
+      add_project_arguments('-D__MACOS__=1', language: ['c', 'cpp'])
+      build_platform = 'macos'
+    endif
+  endif
+endif
 
 warning_flags = [
   '-Wredundant-decls',