WillAyd commented on code in PR #45793:
URL: https://github.com/apache/arrow/pull/45793#discussion_r1997182845


##########
cpp/src/arrow/meson.build:
##########
@@ -440,13 +440,44 @@ if needs_ipc
     }
 endif
 
-foreach key, val : arrow_tests
+if needs_tests
+    foreach key, val : arrow_tests
+        exc = executable(
+            key,
+            sources: val['sources'],
+            dependencies: [arrow_test_dep, val.get('dependencies', [])],
+        )
+        test(key, exc)
+    endforeach
+endif
+
+if needs_benchmarks
+    benchmark_dep = dependency(
+        'benchmark',
+        default_options: {'tests': 'disabled'},
+    )
+else
+    benchmark_dep = disabler()
+endif
+
+arrow_benchmarks = [
+    'builder_benchmark',
+    'chunk_resolver_benchmark',
+    'compare_benchmark',
+    'memory_pool_benchmark',
+    'type_benchmark',
+    'tensor_benchmark',
+]
+
+foreach benchmark : arrow_benchmarks

Review Comment:
   It wouldn't hurt but it is not necessary. Because that check is done on 
L454-L461, if the option is not set there then the `benchmark_dep` will be set 
to the Meson disabler() object. Since that is used as a dependency here, it 
will automatically skip building these targets if it is disabled.
   
   The gist of the disabler() object is that it prevents you from having to add 
a lot of `if <option>` checks in your code. But if that is confusing we can 
stick with the more traditional pattern



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to