Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

version: 2.1
jobs:
build-test:
docker:
- image: cimg/base:current

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for extra credit you can build your own image, but for this hw, this is ok

steps:
# Checkout the code as the first step.
- checkout
- run:
name: InstallPreq
command: |
echo "Installing clang-tidy"
sudo apt-get update && sudo apt-get install -y clang-tidy
echo "Installed"
- run:
name: Build
command: |
echo "Building"
mkdir build && cd build
cmake -S ..
make -j $(nproc)
cd ../
echo "Built"
- run:
name: ninjaTest
command: |
cd build
./ninja_test --gtest_output=XML
echo "Testing Done"
- store_test_results:
path: build
- run:
name: ctest
command: |
echo "Start Testing"
cd build
ctest --output-junit results.xml
echo "Testing Done"
- store_test_results:
path: build/results.xml
- run:
name: Run Performance Tests
command: |
cd build
for test in build_log_perftest canon_perftest clparser_perftest elide_middle_perftest hash_collision_bench; do
echo "Running $test"
./$test
done

workflows:
build-test-workflow:
jobs:
- build-test
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ cmake_minimum_required(VERSION 3.15)
include(CheckSymbolExists)
include(CheckIPOSupported)

find_program(CLANG_TIDY_EXE NAMES clang-tidy)
if(CLANG_TIDY_EXE)
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
else()
message(WARNING "clang-tidy not found!")
endif()

option(NINJA_BUILD_BINARY "Build ninja binary" ON)
option(NINJA_FORCE_PSELECT "Use pselect() even on platforms that provide ppoll()" OFF)

Expand Down Expand Up @@ -312,6 +319,7 @@ if(BUILD_TESTING)
endif()

add_test(NAME NinjaTest COMMAND ninja_test)

endif()

if(NINJA_BUILD_BINARY)
Expand Down
124 changes: 33 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,42 @@
# Ninja

Ninja is a small build system with a focus on speed.
https://ninja-build.org/

See [the manual](https://ninja-build.org/manual.html) or
`doc/manual.asciidoc` included in the distribution for background
and more details.

Binaries for Linux, Mac and Windows are available on
[GitHub](https://github.com/ninja-build/ninja/releases).
Run `./ninja -h` for Ninja help.

Installation is not necessary because the only required file is the
resulting ninja binary. However, to enable features like Bash
completion and Emacs and Vim editing modes, some files in misc/ must be
copied to appropriate locations.

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

## Building Ninja itself

You can either build Ninja via the custom generator script written in Python or
via CMake. For more details see
[the wiki](https://github.com/ninja-build/ninja/wiki).

### Python

```
./configure.py --bootstrap
```

This will generate the `ninja` binary and a `build.ninja` file you can now use
to build Ninja with itself.

If you have a GoogleTest source directory, you can build the tests
by passing its path with `--gtest-source-dir=PATH` option, or the
`GTEST_SOURCE_DIR` environment variable, e.g.:

```
./configure.py --bootstrap --gtest-source-dir=/path/to/googletest
./ninja all # build ninja_test and other auxiliary binaries
./ninja_test` # run the unit-test suite.
```

Use the CMake build below if you want to use a preinstalled binary
version of the library.

### CMake

```
cmake -Bbuild-cmake
cmake --build build-cmake
# Shadowdash

Shadowdash is a lightweight build system based on Ninja, focused on increasing build speed.

## CMake
1. Build Shadowdash and move ninja executable file to your local/bin:
```bash
mkdir build && cd build
cmake -S ..
make -j $(nproc)
sudo cp ninja /usr/local/bin/
ninja --version
```
2. Build Clang-Tidy from source code:
```bash
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -G "Ninja" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release ../llvm
ninja clang-tidy
export PATH=$PATH:/path/to/your/llvm-project/build/bin
clang-tidy --version
```
Alternative Installation via Package Manager (Debian-based Systems):
If you’re using a Debian-based distribution like Ubuntu, you can install Clang-Tidy using the following command:
```bash
sudo apt-get install -y clang-tidy
```
3. Test:
```bash
cd build
ctest
```

The `ninja` binary will now be inside the `build-cmake` directory (you can
choose any other name you like).

To run the unit tests:

```
./build-cmake/ninja_test
```

## Generating documentation

### Ninja Manual

You must have `asciidoc` and `xsltproc` in your PATH, then do:

```
./configure.py
ninja manual doc/manual.pdf
```

Which will generate `doc/manual.html`.

To generate the PDF version of the manual, you must have `dblatext` in your PATH then do:

```
./configure.py # only if you didn't do it previously.
ninja doc/manual.pdf
```

Which will generate `doc/manual.pdf`.

### Doxygen documentation

If you have `doxygen` installed, you can build documentation extracted from C++
declarations and comments to help you navigate the code. Note that Ninja is a standalone
executable, not a library, so there is no public API, all details exposed here are
internal.

```
./configure.py # if needed
ninja doxygen
```

Then open `doc/doxygen/html/index.html` in a browser to look at it.
11 changes: 0 additions & 11 deletions doc/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions doc/dblatex.xsl

This file was deleted.

34 changes: 0 additions & 34 deletions doc/docbook.xsl

This file was deleted.

Loading