如何在bazel中包含特定于平台的标志?
假设我们有一个我们想要更改定义的跨平台库。
我们可以这样做:
<?php
session_start();
//your connection
$link = mysqli_connect("localhost","root","","dbname") or die("Couldn't make connection.");
//assuming $userID is user id of logged in user
$userID = $_SESSION['userid'];
//table of user who has logged in
$query_loguser = mysqli_query($link,"SELECT * FROM `user` WHERE userid = '$userID'");
$row_loguser = mysqli_fetch_assoc($query_loguser);
//department of logged in user
$department = $row_loguser['department'];
//users from same department as logged in user
$query_depuser = mysqli_query($link,"SELECT * FROM `user` WHERE `department` = '$department'");
$row_depuser = mysqli_fetch_assoc($query_depuser);
?>
<?php do { ?>
<?php echo $row_depuser['userName']; //list all users who are from same department as logged in user ?><br />
<?php } while ($row_depuser = mysqli_fetch_assoc($query_depuser)); ?>
另请注意,此概念可以应用于其他内容,例如包含,cflags,源代码,标题等。
答案 0 :(得分:3)
有两种选择。首先是使用select function。使用select,您可以根据当前配置有条件地设置属性的值。
第二个选项是调整CROSSTOOL配置文件,根据工具链放置一个会发出不同标志的特定feature。然后,您可以在features属性中的cc_library中启用该功能。
第一个选项更简单,第二个选项更健壮,封装更多。