-n option
This commit is contained in:
+14
-3
@@ -70,6 +70,8 @@ fs::path bin; // cache bins to avoid recompiles
|
|||||||
bool debug = false;
|
bool debug = false;
|
||||||
// just compare timestamps of the source and bin, don't preprocess
|
// just compare timestamps of the source and bin, don't preprocess
|
||||||
bool quick = false;
|
bool quick = false;
|
||||||
|
// Just compile, don't run
|
||||||
|
bool dont_run = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +93,9 @@ int main(int argc, char* argv[])
|
|||||||
compile_src_file();
|
compile_src_file();
|
||||||
|
|
||||||
// Run the src file without forking
|
// Run the src file without forking
|
||||||
|
if(dont_run)
|
||||||
|
return 0;
|
||||||
|
|
||||||
Cmd run;
|
Cmd run;
|
||||||
if(debug) // debug it with gdb
|
if(debug) // debug it with gdb
|
||||||
{
|
{
|
||||||
@@ -101,6 +106,7 @@ int main(int argc, char* argv[])
|
|||||||
run += bin.c_str();
|
run += bin.c_str();
|
||||||
for(int i = src_arg+1; i < argc; ++i)
|
for(int i = src_arg+1; i < argc; ++i)
|
||||||
run += argv[i];
|
run += argv[i];
|
||||||
|
|
||||||
exec(run);
|
exec(run);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,11 +129,12 @@ int parse_args_until_src(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
print_usage();
|
print_usage();
|
||||||
cout << "Compile and run C/C++ source FILE\n"
|
cout << "Compile and run C/C++ source FILE\n"
|
||||||
"Pass the ARGUMENTS to the compiled binary\n"
|
"Pass the ARGUMENT to the compiled binary\n"
|
||||||
"The binaries are cached and recompiled only if the source or it's headers have changed\n\n"
|
"The binaries are cached and recompiled only if the source or it's headers have changed\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"-g debug the binary, asserts are also enabled\n"
|
"-g debug the binary, asserts are also enabled\n"
|
||||||
"-q quicker, just compare source and binary time stamps, if included files were updated a recompile WON'T occur!\n\n"
|
"-q quicker, just compare source and binary time stamps, if included files were updated a recompile WON'T occur!\n"
|
||||||
|
"-n don't run, just compile the file without running it\n\n"
|
||||||
"Environment variables:\n"
|
"Environment variables:\n"
|
||||||
"CPPIPEPATH - ':'-separated list of directories to prepend to the FILE search path\n";
|
"CPPIPEPATH - ':'-separated list of directories to prepend to the FILE search path\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -140,6 +147,10 @@ int parse_args_until_src(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
quick = true;
|
quick = true;
|
||||||
}
|
}
|
||||||
|
else if( arg == "-n" )
|
||||||
|
{
|
||||||
|
dont_run = true;
|
||||||
|
}
|
||||||
else // Then treat it as the src_arg
|
else // Then treat it as the src_arg
|
||||||
{
|
{
|
||||||
src_arg = i;
|
src_arg = i;
|
||||||
@@ -374,7 +385,7 @@ void compile_src_file()
|
|||||||
|
|
||||||
void print_usage()
|
void print_usage()
|
||||||
{
|
{
|
||||||
cout << "Usage: cppipe [OPTION]... FILE [ARGUMENTS]...\n";
|
cout << "Usage: cppipe [OPTION]... FILE [ARGUMENT]...\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
SrcType find_src_type(const string_view p)
|
SrcType find_src_type(const string_view p)
|
||||||
|
|||||||
Reference in New Issue
Block a user