Skip to content

Commit 5c2cde2

Browse files
committed
Merge branch 'master' into release
2 parents ed7f670 + 9ddd3c9 commit 5c2cde2

31 files changed

+322
-156
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ AllowShortLoopsOnASingleLine: false
2323
ConstructorInitializerAllOnOneLineOrOnePerLine: false
2424
Cpp11BracedListStyle: false
2525
IndentCaseLabels: false
26+
DerivePointerBinding: false

.github/workflows/linux.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ jobs:
1212
container:
1313
image: centos:7
1414
steps:
15-
- uses: actions/checkout@v1
15+
- uses: actions/checkout@v2
1616
- name: Install dependencies
1717
run: |
18-
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2-Linux-x86_64.sh
19-
chmod +x cmake-3.16.2-Linux-x86_64.sh
20-
./cmake-3.16.2-Linux-x86_64.sh --skip-license --prefix=/usr/local
18+
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.sh
19+
chmod +x cmake-3.16.4-Linux-x86_64.sh
20+
./cmake-3.16.4-Linux-x86_64.sh --skip-license --prefix=/usr/local
2121
curl -L -O https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/p7zip-16.02-10.el7.x86_64.rpm
2222
curl -L -O https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/p7zip-plugins-16.02-10.el7.x86_64.rpm
2323
rpm -U --quiet p7zip-16.02-10.el7.x86_64.rpm
2424
rpm -U --quiet p7zip-plugins-16.02-10.el7.x86_64.rpm
2525
yum install -y make gcc-c++
26+
2627
- name: Build ninja
2728
shell: bash
2829
run: |
29-
mkdir build && cd build
30-
cmake -DCMAKE_BUILD_TYPE=Release ..
31-
cmake --build . --parallel --config Release
32-
ctest -vv
33-
strip ninja
30+
cmake -DCMAKE_BUILD_TYPE=Release -B build
31+
cmake --build build --parallel --config Release
32+
strip build/ninja
33+
34+
- name: Test ninja
35+
run: ./ninja_test
36+
working-directory: build
37+
3438
- name: Create ninja archive
3539
run: |
3640
mkdir artifact

.github/workflows/macos.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ jobs:
1111
runs-on: macOS-latest
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v2
1515

1616
- name: Install dependencies
1717
run: brew install re2c p7zip cmake
1818

1919
- name: Build ninja
2020
shell: bash
21+
env:
22+
MACOSX_DEPLOYMENT_TARGET: 10.12
2123
run: |
22-
mkdir build && cd build
23-
cmake -DCMAKE_BUILD_TYPE=Release ..
24-
cmake --build . --parallel --config Release
25-
ctest -vv
24+
cmake -DCMAKE_BUILD_TYPE=Release -B build
25+
cmake --build build --parallel --config Release
26+
27+
- name: Test ninja
28+
run: ctest -vv
29+
working-directory: build
2630

2731
- name: Create ninja archive
2832
shell: bash

.github/workflows/windows.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ jobs:
1111
runs-on: windows-latest
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v2
1515

1616
- name: Install dependencies
1717
run: choco install re2c
1818

1919
- name: Build ninja
2020
shell: bash
2121
run: |
22-
mkdir build && cd build
23-
cmake -DCMAKE_BUILD_TYPE=Release ..
24-
cmake --build . --parallel --config Release
25-
ctest -vv
22+
cmake -DCMAKE_BUILD_TYPE=Release -B build
23+
cmake --build build --parallel --config Release
24+
25+
- name: Test ninja
26+
run: .\ninja_test.exe
27+
working-directory: build/Release
2628

2729
- name: Create ninja archive
2830
shell: bash

CMakeLists.txt

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
cmake_minimum_required(VERSION 3.15)
2-
cmake_policy(SET CMP0091 NEW)
32
project(ninja)
43

4+
# --- optional link-time optimization
55
if(CMAKE_BUILD_TYPE MATCHES "Release")
6-
cmake_policy(SET CMP0069 NEW)
76
include(CheckIPOSupported)
87
check_ipo_supported(RESULT lto_supported OUTPUT error)
98

@@ -15,13 +14,23 @@ if(CMAKE_BUILD_TYPE MATCHES "Release")
1514
endif()
1615
endif()
1716

17+
# --- compiler flags
1818
if(MSVC)
1919
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
20-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /GR- /Zc:__cplusplus")
20+
string(APPEND CMAKE_CXX_FLAGS " /W4 /GR- /Zc:__cplusplus")
2121
else()
22-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -fdiagnostics-color")
22+
include(CheckCXXCompilerFlag)
23+
check_cxx_compiler_flag(-Wno-deprecated flag_no_deprecated)
24+
if(flag_no_deprecated)
25+
string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated")
26+
endif()
27+
check_cxx_compiler_flag(-fdiagnostics-color flag_color_diag)
28+
if(flag_color_diag)
29+
string(APPEND CMAKE_CXX_FLAGS " -fdiagnostics-color")
30+
endif()
2331
endif()
2432

33+
# --- optional re2c
2534
find_program(RE2C re2c)
2635
if(RE2C)
2736
# the depfile parser and ninja lexers are generated using re2c.
@@ -30,9 +39,9 @@ if(RE2C)
3039
COMMAND ${RE2C} -b -i --no-generation-date -o ${OUT} ${IN}
3140
)
3241
endfunction()
33-
re2c(${CMAKE_SOURCE_DIR}/src/depfile_parser.in.cc ${CMAKE_BINARY_DIR}/depfile_parser.cc)
34-
re2c(${CMAKE_SOURCE_DIR}/src/lexer.in.cc ${CMAKE_BINARY_DIR}/lexer.cc)
35-
add_library(libninja-re2c OBJECT ${CMAKE_BINARY_DIR}/depfile_parser.cc ${CMAKE_BINARY_DIR}/lexer.cc)
42+
re2c(${PROJECT_SOURCE_DIR}/src/depfile_parser.in.cc ${PROJECT_BINARY_DIR}/depfile_parser.cc)
43+
re2c(${PROJECT_SOURCE_DIR}/src/lexer.in.cc ${PROJECT_BINARY_DIR}/lexer.cc)
44+
add_library(libninja-re2c OBJECT ${PROJECT_BINARY_DIR}/depfile_parser.cc ${PROJECT_BINARY_DIR}/lexer.cc)
3645
else()
3746
message(WARNING "re2c was not found; changes to src/*.in.cc will not affect your build.")
3847
add_library(libninja-re2c OBJECT src/depfile_parser.cc src/lexer.cc)
@@ -127,3 +136,5 @@ endforeach()
127136

128137
enable_testing()
129138
add_test(NinjaTest ninja_test)
139+
140+
install(TARGETS ninja DESTINATION bin)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ resulting ninja binary. However, to enable features like Bash
1616
completion and Emacs and Vim editing modes, some files in misc/ must be
1717
copied to appropriate locations.
1818

19-
If you're interested in making changes to Ninja, read CONTRIBUTING.md first.
19+
If you're interested in making changes to Ninja, read
20+
[CONTRIBUTING.md](CONTRIBUTING.md) first.
2021

2122
## Building Ninja itself
2223

@@ -31,7 +32,7 @@ via CMake. For more details see
3132
```
3233

3334
This will generate the `ninja` binary and a `build.ninja` file you can now use
34-
to built Ninja with itself.
35+
to build Ninja with itself.
3536

3637
### CMake
3738

bootstrap.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def has_re2c():
649649
command='$doxygen_mainpage_generator $in > $out',
650650
description='DOXYGEN_MAINPAGE $out')
651651
mainpage = n.build(built('doxygen_mainpage'), 'doxygen_mainpage',
652-
['README', 'COPYING'],
652+
['README.md', 'COPYING'],
653653
implicit=['$doxygen_mainpage_generator'])
654654
n.build('doxygen', 'doxygen', doc('doxygen.config'),
655655
implicit=mainpage)

doc/manual.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ tool takes in account the +-v+ and the +-n+ options (note that +-n+
273273
implies +-v+).
274274
275275
`cleandead`:: remove files produced by previous builds that are no longer in the
276-
manifest. _Available since Ninja 1.10._
276+
build file. _Available since Ninja 1.10._
277277
278278
`compdb`:: given a list of rules, each of which is expected to be a
279279
C family language compiler rule whose first input is the name of the
@@ -900,7 +900,7 @@ set environment variables.
900900
On Windows, commands are strings, so Ninja passes the `command` string
901901
directly to `CreateProcess`. (In the common case of simply executing
902902
a compiler this means there is less overhead.) Consequently the
903-
quoting rules are deterimined by the called program, which on Windows
903+
quoting rules are determined by the called program, which on Windows
904904
are usually provided by the C library. If you need shell
905905
interpretation of the command (such as the use of `&&` to chain
906906
multiple commands), make the command execute the Windows shell by
@@ -936,7 +936,7 @@ There are three types of build dependencies which are subtly different.
936936

937937
1. _Explicit dependencies_, as listed in a build line. These are
938938
available as the `$in` variable in the rule. Changes in these files
939-
cause the output to be rebuilt; if these file are missing and
939+
cause the output to be rebuilt; if these files are missing and
940940
Ninja doesn't know how to build them, the build is aborted.
941941
+
942942
This is the standard form of dependency to be used e.g. for the

misc/ninja_syntax.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/usr/bin/python
22

3+
# Copyright 2011 Google Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
317
"""Python module for generating .ninja files.
418
519
Note that this is emphatically not a required piece of Ninja; it's

0 commit comments

Comments
 (0)