summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2019-02-03 01:49:06 +0100
committerNao Pross <naopross@thearcway.org>2019-02-03 01:49:06 +0100
commit151c93154bffd55efdab75157736044f6180efcb (patch)
treef51174cc9a8476093b9dd546830318bc8d2d150f
parentClean up code and comments, minor changes in signal_test (diff)
downloadflatland-151c93154bffd55efdab75157736044f6180efcb.tar.gz
flatland-151c93154bffd55efdab75157736044f6180efcb.zip
Add release build to configure.py, fix bug in debug.hpp
-rwxr-xr-xconfigure.py9
-rw-r--r--lib/include/debug.hpp2
-rw-r--r--ninja/release-rules.ninja42
3 files changed, 51 insertions, 2 deletions
diff --git a/configure.py b/configure.py
index 0a489bb..c62ff43 100755
--- a/configure.py
+++ b/configure.py
@@ -1,6 +1,7 @@
#! /usr/bin/env python3
import os
import re
+import sys
# -- helper functions --
@@ -15,6 +16,7 @@ def build_library(path, commands):
os.chdir(old_path)
+
def find_sources(path):
print("searching sources under {}".format(path))
@@ -77,7 +79,12 @@ def add_specific_test(bf, test_source, tested_sources):
with open("build.ninja", "w") as bf:
# include rules
- print("include ninja/rules.ninja", file=bf)
+ if "--release" in sys.argv:
+ print("creating release target!\n")
+ print("include ninja/release-rules.ninja", file=bf)
+ else:
+ print("include ninja/rules.ninja", file=bf)
+
print("\n", file=bf)
# build dependencies
diff --git a/lib/include/debug.hpp b/lib/include/debug.hpp
index eed774c..0b2711a 100644
--- a/lib/include/debug.hpp
+++ b/lib/include/debug.hpp
@@ -37,7 +37,7 @@ namespace _np {
#define npinspect(...); {}
namespace _np {
- template<typename.. Args>
+ template<typename... Args>
void debug(Args&... args) {}
template<typename Msg, typename Expr, typename... Args>
diff --git a/ninja/release-rules.ninja b/ninja/release-rules.ninja
new file mode 100644
index 0000000..6c05055
--- /dev/null
+++ b/ninja/release-rules.ninja
@@ -0,0 +1,42 @@
+includes = -I lib/include -I engine/include
+cflags = -pedantic -fPIC -std=c++17 -O3 $includes
+
+# brutal number of warning flags
+cflags = $cflags -Wall -Wextra -Wcast-qual -Wcast-align -Wstrict-aliasing
+cflags = $cflags -Wpointer-arith -Winit-self -Wshadow -Wswitch-enum
+cflags = $cflags -Wredundant-decls -Wfloat-equal -Wundef -Wvla
+cflags = $cflags -Wconversion
+
+libs = -lSDL2
+#lib/libmm/build/libmm.a lib/libwsdl2/build/libwsdl2.a
+lflags = $libs -fuse-ld=gold
+
+flags = -fdiagnostics-color
+
+rule mkdir
+ command = mkdir -p $out
+ description = creating directory $out
+
+rule clean
+ command = rm -r build/*
+ description = clean up builds
+
+rule cpp
+ command = g++ $flags $cflags -c $in -o $out
+ description = compiling $in
+
+rule link
+ command = g++ $flags $cflags -o $out $in $lflags
+ description = linking $out
+
+rule link-shared
+ command = g++ $flags $cflags -shared -o $out $in $lflags
+ description = linking shared object $out
+
+rule link-static
+ command = ar rvs $out $in
+ description = creating archive $out
+
+rule ninja
+ command = ninja -C $in
+ description = running ninja in subdirectory $in