martine/ninja — pull request #391 by ClausKlein (2012-08-01 06:12:56+00:00)
Title: C make build support added, fix all build errors found!

Again, while merge with master, the build was broken on most platforms.

Which cmake, cpack can be used to create packages on all plattforms.

Tested on MACOS darwin 10.5, linux, cygwin, mysys, and with mingw32 cross

Examles:
=======

./ninja -V
ninja V0.1.3 ## CMakeBuildSupportAdded-080314c
rm -f -rf CMakeCache.txt CMakeFiles build/*
cd build && \
"/usr/local/bin/cmake" -G Ninja -DCMAKE_MAKE_PROGRAM:STRING="/Users/clausklein/Downloads/ninja/ninja" \
-DCMAKE_CXX_COMPILER:FILEPATH="/opt/local/libexec/ccache/g++" -Dgtest="gtest-1.6.0" .. && \
../ninja && ../ninja package
-- platform=unix
-- use ccache
-- The CXX compiler identification is GNU 4.7.1
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - no
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - no
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
--
-- Options:
-- -Dplatform=OFF (target platform (unix/windows/msys))
-- -Dcompiler=/opt/local/bin/g++ (compiler (default/clang))
-- -Ddebug=OFF (enable debugging flags)
-- -Dverbose=OFF (verbose output while building)
-- -Dgtest=gtest-1.6.0 (use gtest unpacked in given directory)
-- -Dmonolithic-test=ON (build tests into one binary)
--
-- Generate re2c src/depfile_parser.in.cc -o src/depfile_parser.cc
-- Generate re2c src/lexer.in.cc -o src/lexer.cc
-- Found PythonInterp: /opt/local/bin/python (found version "2.7.3")
-- Building dependency browser
--
-- Found gtest include dir: /Users/clausklein/Downloads/ninja/gtest-1.6.0/include
-- Adding test 'ninja_test'.
-- Adding test 'parser_perftest'.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Downloads/ninja/build
[39/39] Linking CXX executable ninja_test
[1/1] Run CPack packaging tool...
CPack: Create package using PackageMaker
CPack: Install projects
CPack: - Install project: ninja
CPack: Create package
CPack: - package: /Users/clausklein/Downloads/ninja/build/ninja-0.1.3-Darwin.dmg generated.
export CC=i386-mingw32-cc CXX=i386-mingw32-c++ AR=i386-mingw32-ar; \
./configure.py --platform=msys && ./ninja
wrote build.ninja.
[20/20] LINK ninja.exe
rm -f -rf CMakeCache.txt CMakeFiles build/*
/Users/clausklein/.cmake/cmake-cross.sh -Dgtest="/Users/clausklein/Downloads/ninja/gtest-1.6.0" -Dplatform=windows
+ test -d build
+ rm -rf 'build/*'
+ mkdir -p build
+ cd build
+ /usr/local/bin/cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=/Users/clausklein/.cmake/Toolchain-cross-mingw32-linux.cmake -Dgtest=/Users/clausklein/Downloads/ninja/gtest-1.6.0 -Dplatform=windows ..
-- cross compile
-- cross=/opt/local/bin/i386-mingw32
-- The CXX compiler identification is GNU 3.4.5
-- Check for working CXX compiler: /opt/local/bin/i386-mingw32-g++
-- Check for working CXX compiler: /opt/local/bin/i386-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
--
-- Options:
-- -Dplatform=windows (target platform (unix/windows/msys))
-- -Dcompiler=/opt/local/bin/i386-mingw32-g++ (compiler (default/clang))
-- -Ddebug=OFF (enable debugging flags)
-- -Dverbose=OFF (verbose output while building)
-- -Dgtest=/Users/clausklein/Downloads/ninja/gtest-1.6.0 (use gtest unpacked in given directory)
-- -Dmonolithic-test=ON (build tests into one binary)
--
-- Generate re2c src/depfile_parser.in.cc -o src/depfile_parser.cc
-- Generate re2c src/lexer.in.cc -o src/lexer.cc
-- Found PythonInterp: /opt/local/bin/python (found version "2.7.3")
-- Found gtest include dir: /Users/clausklein/Downloads/ninja/gtest-1.6.0/include
-- Adding test 'ninja_test'.
-- Adding test 'parser_perftest'.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Downloads/ninja/build
+ /usr/local/bin/cmake --version
cmake version 2.8.8.20120712-gfdc2-dirty
+ /opt/local/bin/gmake
...