问题标签 [ninja]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
21613 浏览

cmake - Installing only one target (and its dependencies) out of a complex project with cmake (open to better solutions)

Let's say I have a project made of several subprojects A, B, C, D... All subprojects depends on A, which changes rather frequently. Plus, there might be some further dependencies: in this example, D depends on B.

Now: many people are working on these projects. The main CMakeLists.txt file should include all directories, so that the build all builds everything. But people would like also to be able to work only on one of these projects, and not having to build/install everything everytime.

If I am working on D, I can easily build "only" D by calling

or

This will also build A and B if something for them has changed. Perfect.

But how can I call install only for D without triggering build all? I would like that if I call:

it only built D (and dependencies) and then installed only D and its dependencies (A and B). Instead, it builds the target all and install all.

I would like to keep that the target all keep building everything. So EXCLUDE_FROM_ALL wouldn't be an option. But going in that direction I couldn't find any solution.

So I am thinking of the following strategy:

  • Apart from subproject A, all other targets are set to EXCLUDE_FROM_ALL, and OPTIONAL at installation.
  • I add one extra subproject that simply depends from all other sub-projects (maybe I make each target publish its name by using some variable set at PARENT_SCOPE), and people will have to call that when they want to build and install everything.

Is it going to work? Is there any better solution?

We would like to avoid that everybody has to edit the main CMakeLists.txt file to exclude projects he is not interested in. The solution should be portable to different OSs.

Edit:

I tried the strategy I proposed, but it didn't work: in my case, putting an install statement for a target (even if specified as OPTIONAL) will make ineffective EXCLUDE_FROM_ALL. Reading better in the documentation I found out that:

I also get this warning:

Edit 2:

I tried putting EXCLUDE_FROM_ALL as an option of add_subdirectory (instead of add_library/add_executable), but then all the install statements in those sub-directory seem to be ignored: only install statements in non excluded-from-all subdirectories will be installed.

Edit 3:

Even if I activate CMAKE_SKIP_INSTALL_ALL_DEPENDENCY:

in the main CMakeLists.txt file, and I omit all EXCLUDE_FROM_ALL, put installation of as many targets as I want optional (in my case, all but A), and if building of specific targets precede installation, yet the command:

for some reason will fail, stating that C (whose installation was set to OPTIONAL) does not exist (it was not created because D depended only on A and B)...

Edit 4:

It looks like a cmake bug to me. (I am using 2.8.11 under Windows, also tested 2.8.10) This INSTALL command

is converted in the cmake_install.cmake as:

FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/." TYPE SHARED_LIBRARY FILES *path_to_dll*)

IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/./" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/./*dll_name*")

with the command FILE missing OPTIONAL! If I add OPTIONAL manually, it works! (note: I have edited here to put *dll_name* and *path_to_dll* placeholders)

Edit 5:

I confirm it's a bug of cmake, or at least wrong documentation. I will report this. The situation solved either putting a more simple

(but this in my case will also install .lib.a files that I don't want)

or moving in front the OPTIONAL flag:

What one understands from the cmake documentation is that OPTIONAL should be put as last option.

0 投票
1 回答
3413 浏览

git - Getting cmake to run before building after pulling from git

There is this project kept in a git repository, which we build with cmake and ninja. We are using globbing expressions/functions to collect all the source files to be compiled. That means that every time a file is added/removed, cmake has to be called to re-parse the directories.

We have seen this is bringing some time loss when somebody pulls after somebody has pushed some new file, without modifications to any of the cmake files. I say this last thing because a modification to any of the cmake files would trigger a call to cmake (by ninja), and everything would be fine.

How can I obtain that cmake is called before/when I start building again my project after pulling? (Note: it does not matter if cmake is run a little bit more than necessary, as long as it is not always)

I am building out of source, furthermore using several build directory where for example I test different compilers.

I am exploring some solutions. One using git hooks script, namely post-merge (but how can I guarantee I will retrieve the path to source/CMakeLists.txt to touch it? Can I commit the script so that it runs for everybody? It is not a public project). I don't know if it is relevant, we mainly use git through graphic interface (TortoiseGit).

The other possible solution would be using in cmake a custom target dependent on the content of .git\refs\heads directory, but I cannot think of a combination that could really work...

Some links:

  1. http://git-scm.com/book/en/Customizing-Git-Git-Hooks
  2. https://www.kernel.org/pub/software/scm/git/docs/githooks.html

CMake commands: http://www.cmake.org/cmake/help/v2.8.11/cmake.html

0 投票
0 回答
34 浏览

jquery - 如何让 NinjaUI 与 WordPress 一起使用?

我尝试在我的 WordPress 页面中显示一些元素,发现每当我尝试添加一个包含 HTML 的 NinjaUI 元素时,WordPress 都会把它搞砸。例如,如果我这样说:

然后 WordPress 在 '. 我看不出这是非常相关的,但在 Safari 中,我可以看到 WordPress 与我的格式混淆,但在 Firefox 中,页面只是永远加载,我什至无法查看源代码或检查元素。

我尝试了各种元素并且能够显示星形图标但没有其他图标。(???)我可以显示一个按钮,我可以将其显示为选中或未选中,但这基本上是我所能做的......

一个按钮和 1 个图标,仅此而已:(

我尝试添加

到我的 header.php 文件,就在我的一些其他脚本下方和 jquery 脚本之后,但这导致我根本无法使用 NinjaUI。通过简单地在 header.php 中添加 jquery 并将 ninjaui 直接添加到我的页面,然后除了不是 WordPress 之外,它对我放置在标签中的内容具有格式化魔法。

在大多数情况下,我发现如果我在 WP 页面中添加标签,那么只要我的整个脚本没有空行,我就可以使用 JavaScript。只要我添加一个空行,整个脚本部分就会被格式化为 DIV 和 P 标记等等。

似乎出于某种原因,NinjaUI 也破坏了我的一些其他插件。

那是我什至在我的项目中没有的编码,但它会像那样混淆页面的描述,所以我假设 NinjaUI 想要将页面的描述设置为动态的,但因为它不是为与 WP 一起工作而设计的反而弄乱了描述。

总而言之,我认为这个工具包根本与 WordPress 不兼容,我应该在 WP 或这个之间做出选择,但不要同时使用这两者......这是一个准确的假设还是有人可以帮助我理解这实际上是如何作品。

我还应该指出,我是一个 jquery 菜鸟。我已经编程近 2 年了,所以我明白我在读什么,但正因为如此,我对我的一些实验感到非常困惑。似乎如果我将按钮创建为变量,那么请执行以下操作:

...然后一个按钮出现,但另一个没有。如果我复制粘贴整个 SCRIPT 部分并声明 $button 3 次,那么我会在屏幕上获得 3 个按钮。当我尝试这样做时

...它也没有显示第二项。从我的实验来看,我的 .ready 中似乎只能有 1 行代码,否则 firefox 只会永远加载我的页面。此外,更令人困惑的是,如果我在同一个 SCRIPT 部分中创建按钮和图标,但在我的 .ready 中,我只附加按钮并且完全不使用我声明的图标,那么按钮也不会显示? ?

从我的实验来看,我似乎需要为我想在页面上显示的每个元素创建一个单独的 SCRIPT 部分,并且在每个 SCRIPT 部分中我只能将 1 个变量添加到一个页面元素,然后我需要关闭我的 SCRIPT 并创建一个新的......我不明白为什么需要这样做,但这是我能让任何东西真正出现的唯一方法。

显然我需要一些帮助,所以任何反馈都将不胜感激。

谢谢

0 投票
0 回答
1232 浏览

windows - CMake 使用 Ninja Generator 路径问题

我在 Windows 中使用 cmake 和 ninja 生成器。但似乎生成的路径包含一个美元符号。当cmake在这里创建build.ninja时,变量似乎将包含一个美元符号,是带有美元符号的示例生成CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG路径,CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE

我无法建造,因为忍者总是说找不到路径。

请指教。

0 投票
1 回答
1008 浏览

chromium - Chromium Ninja 构建失败(非法指令输出)

我按照Linux 构建说明进行操作,当我尝试运行“ninja -C out/Debug chrome”时,我只得到输出“Illegal Instruction (core dumped)”。现在,我希望我能真正找到核心转储的位置,看看那里是否有更具体的信息......

作为参考,我正在尝试在 Ubuntu 13.10 上运行 Ninja。

有没有其他人在构建 Chromium 或尝试使用 Ninja 构建其他任何东西时经历过这种情况?另外,我在哪里可以找到核心转储?

0 投票
2 回答
698 浏览

cmake - CMake add_custom_target:忍者在命令完成之前抑制输出,因此无法进行用户交互

如果我添加

接着

目录内容仅在休眠终止后才可视化。我知道这种机制有一个有价值的特性,即允许 Ninja 显示非常整洁/连续的输出,即使在并行执行多个作业时也是如此。

但是,在以下实际案例中这是一个问题:我的 realadd_custom_target会执行一个程序,该程序在某些时候会提示用户输入密码,但 Ninja 基本上会阻止任何交互。

有解决方法吗?

注意:使用-v选项(详细)没有帮助,而且-j 1(一次只能完成一项工作)。

另一个例子:

和:

一些提示:
ninja-build > 从构建规则启动交互式应用程序

0 投票
0 回答
563 浏览

python - 构建 Chrome 测试外壳 APK 时出现 Ninja 错误

我正在 Ubuntu 10.04.4 LTS 上构建 Chrome 32 测试外壳。我收到以下错误;

0 投票
1 回答
3538 浏览

jenkins - 具有并行构建的 Jenkins

我有一个小型 Jenkins 虚拟机在为我们的商店运行,它时刻关注着大约十几个 github 项目。它目前配置了 3 个执行器(它只是一个 4-cpu 的 VM),并且可以愉快地运行。

但是,其中 2 个项目非常大(90 分钟的编译和测试周期)。在工作站上,我们通常使用“make -j6”或 Ninja 来加快速度,而且效果非常好。我想在 Jenkins 上执行此操作,但我找不到让单个作业消耗多个执行器的方法。

我想要的是能够配置多个 Executor 分配给一个作业,这样我就不会同时运行这两个怪物作业,但仍然将所有其他较小的作业留给一个-executor 每个,以便它们可以并行运行。

有任何想法吗?

0 投票
2 回答
11528 浏览

build - WebRTC:忍者构建不起作用

我在 UBUNTU 环境中构建 webRTC 所遵循的步骤。

查看代码:

生成忍者makefile:

cd后备箱

android_gyp 的结果:

构建和安装演示应用程序:

如果我有任何步骤错误,请告诉我。我认为 android_gyp 有问题,但不要。

注意:我在我的 Windows 操作系统上使用 Ubuntu(VMware)

0 投票
2 回答
318 浏览

integration-testing - 构建 Chromium webui 测试而不重建所有 browser_tests

我添加了一个简单的 JavaScript 测试/src/chrome/test/data/webui/并将文件包含在/src/chrome/chrome_tests.gypi.

我是这样建造的:ninja -C out/Debug browser_tests. 不过这需要一段时间。有没有办法只重建我的测试,而不构建所有其他浏览器测试?