On 31.01.2012 16:19, Peter Collingbourne wrote:
On Tue, Jan 31, 2012 at 12:15:59AM +0100, Peter Kümmel wrote:
I played a bit with the Ninja generator on Windows,
and added some hacks to make it a bit running:
https://github.com/syntheticpp/CMake/commit/0a55b61271106eb7c3319340f2c54f6bab3c0f8b
Here are the problems I found so far:
- Paths like 'c:\' - Ninja now supports colon escaping "c:" -> "c$:"
Is there a single place where the escaping could be done?
':' only needs to be escaped in identifiers. So
cmGlobalNinjaGenerator::EncodeIdent is the correct place.
Also the colons in drive names must be "escaped". For instance,
when you wanna configure ninja to build the tests with gtest
at C:\gtest-1.6.0, you have to call
python configure.py --with-gtest=c$:\gtest-1.6.0
this generates the rule:
build $builddir\gtest_main.o: cxx $
c$:\gtest-1.6.0\src/gtest_main.cc
Without the $: the build script does not work.
I don't think your changes to that function are correct though.
Yes, it was only a wild guess where I could escape the colon in paths.
The old code would have correctly "escaped" colons by placing them in a
variable -- perhaps it could be made smarter by doing the replacement
if the only non-identifier character in the string is ':' (or ' '
or some other ident-escapable characters).
So there is no pace where we know the string is a path and where we
can prepare it for the script?
- Finding the msvc compiler fails because TARGET_IMPLIB is empty
and to the linker /implib: is passed without an argument.
Why is TARGET_IMPLIB empty?
Probably because cmLocalGenerator::TargetImplib is not being
set. Look at how the makefile generator does it.
Do you think much win32 stuff is missing? I ask, because you've based
the ninja generator on a Makefile generator, or I'm wrong?
- Some targets have the .exe extension, but the rule misses the .exe.
Can you show an example of what you mean? The generator should be
using cmTarget::GetFullPath to build paths to targets which seems
to append CMAKE_EXECUTABLE_SUFFIX (i.e. ".exe" on Windows) where
necessary.
Is was a bug in my CMakeLists.txt because MSVC_IDE was set, even when I use
the Ninja generator.
Currently I use "CMAKE_GENERATOR STREQUAL Ninja" the check for the ninja
generator.
Is there a simpler way? Couldn't we set NINJA or CMAKE_NINJA?
- When&& is used for calling multiple command a 'cmd.exe /c' call is necessary.
Correct. That will need to be prepended in
cmLocalNinjaGenerator::BuildCommandLine if the vector contains more
than one command.
When there are no PRE and POST steps the cmd and && could be dropped completely
(also the "cd ." nop, which I've used instead of ":")
Peter
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers