Skip to content
Snippets Groups Projects
Commit 035b37c2 authored by Stephan Schulz's avatar Stephan Schulz
Browse files

add preprocess tool to apply definitions (and includes)

parent b08f7a8b
Branches
Tags
1 merge request!15CMake projectconfig
#!/bin/bash
# Usage:
# $1: path to include directory
# $2..: additional flags to gcc
# Either run this script in the include directory, or pass the include
# directory as an additional argument ($1).
set -euo pipefail
#set -x
HEADERS="ALL_CustomExceptions.hpp
ALL_Defines.h
ALL_ForceBased.hpp
ALL_Functions.hpp
ALL_Histogram.hpp
ALL.hpp
ALL_LB.hpp
ALL_Point.hpp
ALL_Staggered.hpp
ALL_Tensor.hpp
ALL_Voronoi.hpp"
PROCESSED_DIR=`mktemp -d`
CWD="$1"
shift
for f in $HEADERS
do
cat $f | sed -e 's!#\s*include\s*<!// PPIGNORE <!' > "$PROCESSED_DIR/$f"
done
cd "$PROCESSED_DIR"
gcc -E -fdirectives-only "$@" -o ALL.ii ALL.hpp
cat ALL.ii | sed -e 's!// PPIGNORE <!#include <!' > "$CWD/ALL_pp.hpp"
rm -rf $PROCESSED_DIR
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment