fix debug not recompiling
This commit is contained in:
+6
-1
@@ -2,7 +2,12 @@
|
||||
set -e
|
||||
|
||||
# Test cppipe functions
|
||||
cppipe test/test.cpp
|
||||
OKs=$(cppipe test/functions_test.cppipe | grep OK | wc -l)
|
||||
if ! [ $OKs = 12 ]
|
||||
then
|
||||
echo "EXPECTED 1 OKs, got $OKs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test on a C file
|
||||
echo OK | cppipe test/c_file.c
|
||||
|
||||
+8
-16
@@ -281,35 +281,27 @@ void compile_src_file()
|
||||
// Only compile if the source is newer then the bin
|
||||
if(preprocess_and_compare() || !fs::exists(bin))
|
||||
{
|
||||
string preprocessed_file = cache_dir / src_file.stem() +=
|
||||
(src_type == SrcType::C ? ".i" : ".ii"); // todo: duplicates with old_pp_path
|
||||
string preprocessed_file = cache_dir / (debug ? DEBUG_PREFIX : "") += src_file.stem()
|
||||
+= (src_type == SrcType::C ? ".i" : ".ii"); // todo: duplicates with old_pp_path (std::optional?)
|
||||
|
||||
Cmd compile(
|
||||
src_type == SrcType::C ? CC : CXX,
|
||||
preprocessed_file.c_str(),
|
||||
"-o", bin.c_str()
|
||||
);
|
||||
|
||||
if(src_type == SrcType::C)
|
||||
{
|
||||
for(const char* flag: { CFLAGS })
|
||||
compile += flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(const char* flag: { CXXFLAGS })
|
||||
compile += flag;
|
||||
}
|
||||
|
||||
if(src_type == SrcType::C)
|
||||
compile.append_args({ CFLAGS });
|
||||
else
|
||||
compile.append_args({ CXXFLAGS });
|
||||
|
||||
|
||||
if(debug)
|
||||
{
|
||||
compile.append_args({ DEBUG_FLAGS });
|
||||
}
|
||||
else
|
||||
{
|
||||
compile.append_args({ RELEASE_FLAGS });
|
||||
}
|
||||
|
||||
|
||||
if( !compile() ) // if failed to compile
|
||||
exit(1);
|
||||
|
||||
@@ -22,8 +22,8 @@ int main(int argc, char* argv[])
|
||||
Cmd echo("echo");
|
||||
Cmd rm("rm");
|
||||
|
||||
string out1 = $(ll | grep + "cpp" | grep + "child");
|
||||
if(out1.find("childProcess.cpp") != string::npos)
|
||||
string out1 = $(ll + "src" | grep + "inl" | grep + "child");
|
||||
if(out1.find("childProcess.inl") != string::npos)
|
||||
cout << "OK 0/11" << endl;
|
||||
|
||||
string out2 = $(echo + "abc" + "def");
|
||||
|
||||
Reference in New Issue
Block a user