Skip to content

Commit

Permalink
Env var for custom C++ compilation flags (#145)
Browse files Browse the repository at this point in the history
Resolve #144
  • Loading branch information
fushar committed Jun 6, 2017
1 parent a45fcd4 commit ea6d3e4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/topic-guides/spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ A spec file is compiled into a runner program using the following **tcframe** co

The above command will compile ``spec.cpp`` into an executable ``runner`` program in the problem package directory.

It is also possible to specify additional compilation flags, by setting the ``$TCFRAME_CXX_FLAGS`` environment variable. For example:

::

export TCFRAME_CXX_FLAGS="-Wall -O2"

----

Runner program
Expand Down
2 changes: 1 addition & 1 deletion scripts/tcframe
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build() {
exit 1
fi

g++ -std=c++11 -D__TCFRAME_SPEC_FILE__="\"$SPEC_FILE\"" -I "$TCFRAME_HOME/include" -o $RUNNER_EXEC "$TCFRAME_HOME/src/tcframe/runner.cpp"
g++ -std=c++11 -D__TCFRAME_SPEC_FILE__="\"$SPEC_FILE\"" -I "$TCFRAME_HOME/include" $TCFRAME_CXX_FLAGS -o $RUNNER_EXEC "$TCFRAME_HOME/src/tcframe/runner.cpp"
}

version() {
Expand Down
1 change: 1 addition & 0 deletions test/ete/resources/library/library.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#pragma once
1 change: 1 addition & 0 deletions test/ete/resources/normal/spec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <tcframe/spec.hpp>
#include <library/library.hpp>

using namespace tcframe;

Expand Down
1 change: 1 addition & 0 deletions test/ete/resources/scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -ex

export TCFRAME_HOME=../../tcframe
export TCFRAME_CXX_FLAGS="-I .."

g++ -o solution solution.cpp
$TCFRAME_HOME/scripts/tcframe build
Expand Down

0 comments on commit ea6d3e4

Please sign in to comment.