[cmake-developers] [PATCH for bug 15253] Ninja: Pass only the flags relevant to the language.
Brian Smith
brian at briansmith.org
Thu Jan 29 03:12:39 EST 2015
Brad King <brad.king at kitware.com> wrote:
> The original issue could have been worded to explain that nasm/yasm
> dependencies are not handled correctly, so I'd like to treat it that
> way.
OK.
> If these tools have the -M flag then a "deptype = gcc" code path
> should work.
yasm has an -M flag that causes it to write the dependencies to stdout
WITHOUT doing the assembly. nasm additionally has -MD <file>, which
causes it to write the dependencies to <file> AND do the assembly.
yasm does NOT have -MD. I don't see how to make CMake execute yasm -M
-o <x>.obj <x>.asm > $DEP_FILE and then execute yasm -o <x>.obj
<x>.asm to do the actual assembly.
Instead, I decided to try to add -MD to yasm. See the attached patch,
which is a very rough draft.
> The usingMSVC boolean should be updated to be false
> for lang != C|CXX|RC so that the "else" code path is taken. Then
>
> CMAKE_DEPFILE_FLAGS_<LANG>
>
> should be added to the platform modules for these toolchains.
I think I understood what you meant, and I've attached a patch that does that.
With my patch, cmake -GNinja generates a rule like this:
rule ASM_NASM_COMPILER
depfile = $DEP_FILE
deps = gcc
command = c:\<path-to-yasm>yasm.exe $FLAGS -MD $DEP_FILE -f win32 -o $out $in
description = Building ASM_NASM object $out
That looks right to me.
But, when I execute ninja and it executes the rule, it never provides
a value for $DEP_FILE. Instead, the executed command looks like this:
10/358] Building ASM_NASM object cryp...\CMakeFiles\sha.dir\sha512-586.asm.obj
FAILED: c:\<path-to-yasm>\yasm.exe -I..\crypto\.
-I..\crypto\..\include -I..\crypto\sha\. -I..\crypto\sha\..
-I..\crypto\sha\..\..\include -MD -f win32 -o
crypto\sha\CMakeFiles\sha.dir\sha512-586.asm.obj crypto\sh
\sha512-586.asm
asm: option `-MD' needs an argument!
Notice that the empty string was substituted for $DEP_FILE.
It seems like solving this requires more understanding of how CMake
works than I currently have. Any ideas?
Thanks for your help on this.
Cheers,
Brian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-an-MD-option-for-generating-dependency-file-duri.patch
Type: application/octet-stream
Size: 11852 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150129/d5fe39e8/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-dependency-generation-for-ASM_NASM-Ninja.patch
Type: application/octet-stream
Size: 3061 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150129/d5fe39e8/attachment-0003.obj>
More information about the cmake-developers
mailing list