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
47 changes: 47 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2.1

executors:
docker-executor:
docker:
- image: cimg/base:stable

jobs:
build:
executor: docker-executor
steps:
- checkout
- run:
name: Install Dependencies
command: |
sudo apt-get update
sudo apt-get install -y clang-tidy
- run:
name: Build Project
command: |
cmake -Bbuild-cmake
cmake --build build-cmake
cp -r ./misc ./build-cmake/
- persist_to_workspace:
root: .
paths:
- build-cmake

test:
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run Tests
command: |
./build-cmake/ninja_test

workflows:
version: 2
build_and_test:
jobs:
- build
- test:
requires:
- build
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ cmake_minimum_required(VERSION 3.15)
include(CheckSymbolExists)
include(CheckIPOSupported)

# Config clang-tidy
# 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 @@ -198,10 +206,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
add_compile_definitions(__STDC_FORMAT_MACROS)
endif()

set(SHADOWDASH_SPECIFIC_COMPILE_OPTIONS "-fPIC")

# Main executable is library plus main() function.
if(NINJA_BUILD_BINARY)
add_executable(ninja src/ninja.cc)
target_link_libraries(ninja PRIVATE libninja libninja-re2c)
add_executable(ninja_hello src/ninja_hello.cc)
target_link_libraries(ninja_hello PRIVATE libninja libninja-re2c)
add_executable(shadowdash src/shadowdash_build.cc)
target_link_libraries(shadowdash PRIVATE libninja libninja-re2c)
target_compile_options(shadowdash PRIVATE ${SHADOWDASH_SPECIFIC_COMPILE_OPTIONS})
target_link_libraries(shadowdash PRIVATE "/home/ShadowDash/convertor/output/libmanifest.so")

if(WIN32)
target_sources(ninja PRIVATE windows/ninja.manifest)
Expand Down
43 changes: 43 additions & 0 deletions convertor/bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import subprocess
import re

# folder = "/home/opensource/llvm-project/build"
folder = "/home/opensource/zlib"

envs = {"LD_LIBRARY_PATH": "/home/ShadowDash/convertor/output"}
shadowdash_cmd = """./shadowdash all -d stats -n""".split(" ")
ninja_cmd = """./ninja -d stats -n""".split(" ")

loop_count = 100

shadowdash_timer = 0
ninja_timer = 0

os.chdir(folder)

for i in range(loop_count):
result = subprocess.run(shadowdash_cmd, env=envs, capture_output=True, text=True, check=True)
output:str = result.stdout
for line in output.split("\n"):
if line.startswith(".shadowdash parse"):
res = re.split(r"\s+", line)[3]
try:
shadowdash_timer += float(res)
except:
print(line)
exit(1)
break
shadowdash_timer /= loop_count

for i in range(loop_count):
result = subprocess.run(ninja_cmd, capture_output=True, text=True, check=True)
output:str = result.stdout
for line in output.split("\n"):
if line.startswith(".ninja parse"):
res = re.split(r"\s+", line)[3]
ninja_timer += float(res)
break
ninja_timer /= loop_count

print(f"shadowdash: {shadowdash_timer}, ninja: {ninja_timer}")
1 change: 1 addition & 0 deletions convertor/convertor.py
Loading