This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 96baad9
Showing
13 changed files
with
4,088 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "include/rw"] | ||
path = include/rw | ||
url = git@github.com:raywan/rw.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# THIS FILE IS GENERATED BY configure.py | ||
# EDITS WILL BE OVERWRITTEN | ||
|
||
ninja_required_version = 1.9 | ||
cc = g++ | ||
cflags = -std=c++11 -O3 -pthread -march=native -Iinclude | ||
project_name = toy | ||
src_dir = src | ||
bin_dir = bin | ||
build_dir = build | ||
|
||
rule compile | ||
command = $cc $cflags -c $in -o $out -MMD -MF $out.d | ||
depfile = $out.d | ||
rule link | ||
command = $cc $in -o $bin_dir/$out | ||
rule clean_all | ||
command = rm -rf $build_dir $bin_dir $project_name | ||
rule make_dirs | ||
command = mkdir -p $build_dir $bin_dir | ||
rule create_sym_link | ||
command = ln -sf $bin_dir/$project_name $project_name | ||
|
||
build dirs: make_dirs | ||
build fresh: clean_all | ||
build sym: create_sym_link | ||
build build/mesh.o: compile src/mesh.cpp | ||
build build/main.o: compile src/main.cpp | ||
build toy: link build/mesh.o build/main.o | ||
|
||
default dirs | ||
default toy | ||
default sym |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/usr/bin/python | ||
|
||
import os | ||
import fnmatch | ||
from ninja_syntax import Writer | ||
|
||
PROJECT_NAME = "toy" | ||
|
||
CC = "g++" | ||
CFLAGS = [ | ||
"-std=c++11", | ||
"-O3", | ||
"-pthread", | ||
"-march=native", | ||
"-Iinclude", | ||
] | ||
|
||
SRC_DIR = "src" | ||
BUILD_DIR = "build" | ||
BIN_DIR = "bin" | ||
|
||
with open('build.ninja', 'w') as build_file: | ||
n = Writer(build_file) | ||
|
||
n.comment("THIS FILE IS GENERATED BY configure.py") | ||
n.comment("EDITS WILL BE OVERWRITTEN") | ||
n.newline() | ||
|
||
############################################################################# | ||
# VARIABLES | ||
############################################################################# | ||
|
||
n.variable(key="ninja_required_version", value="1.9"); | ||
|
||
n.variable(key="cc", value=CC); | ||
n.variable(key="cflags", value=' '.join(CFLAGS)) | ||
n.variable(key="project_name", value=PROJECT_NAME) | ||
n.variable(key="src_dir", value=SRC_DIR) | ||
n.variable(key="bin_dir", value=BIN_DIR) | ||
n.variable(key="build_dir", value=BUILD_DIR) | ||
|
||
n.newline() | ||
|
||
############################################################################# | ||
# RULES | ||
############################################################################# | ||
|
||
n.rule("compile", | ||
command="$cc $cflags -c $in -o $out -MMD -MF $out.d", | ||
depfile="$out.d" | ||
) | ||
|
||
n.rule("link", command="$cc $in -o $bin_dir/$out") | ||
|
||
n.rule("clean_all", command="rm -rf $build_dir $bin_dir $project_name") | ||
n.rule("make_dirs", command="mkdir -p $build_dir $bin_dir") | ||
n.rule("create_sym_link", command="ln -sf $bin_dir/$project_name $project_name") | ||
|
||
n.newline() | ||
|
||
############################################################################# | ||
# BUILDS | ||
############################################################################# | ||
|
||
n.build(outputs="dirs", rule="make_dirs") | ||
n.build(outputs="fresh", rule="clean_all") | ||
n.build(outputs="sym", rule="create_sym_link") | ||
|
||
sources = [] | ||
for root, dirnames, filenames in os.walk(SRC_DIR): | ||
for filename in fnmatch.filter(filenames, '*.cpp'): | ||
sources.append(os.path.join(root, filename)) | ||
|
||
for source in sources: | ||
n.build(outputs=source.replace(".cpp", ".o").replace('src', BUILD_DIR), | ||
rule="compile", | ||
inputs=source | ||
) | ||
|
||
o_files = [x.replace(".cpp", ".o").replace('src', BUILD_DIR) for x in sources] | ||
n.build(outputs=PROJECT_NAME, rule="link", inputs=o_files) | ||
|
||
n.newline() | ||
|
||
############################################################################# | ||
# DEFAULTS | ||
############################################################################# | ||
|
||
n.default("dirs") | ||
n.default(PROJECT_NAME) | ||
n.default("sym") |
Oops, something went wrong.