citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit af2ce94802acb1005b0776a93610960209ca4af8
parent 6487d37dfcd7c70fad6d5801beed722181d575e5
Author: Kyle Milz <kyle@windows.krwm.net>
Date:   Tue,  3 Jan 2017 19:52:10 -0800

wrap: use newly introduced CITRUN_{LIB,COMPILERS}

Diffstat:
MJamfile | 9++++++++-
Minst_frontend.cc | 22+++++++++-------------
Mwrap.bat | 4++--
Mwrap.sh | 2+-
4 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/Jamfile b/Jamfile @@ -41,6 +41,10 @@ Library libcitrun : lib.c ; # citrun_check # Shell citrun_check : check.sh ; +actions ReplaceToken +{ + perl -p -i.bak -e "s/%CITRUN_COMPILERS%/$(CITRUN_COMPILERS)/" $(<) +} # # citrun_wrap @@ -48,8 +52,11 @@ Shell citrun_check : check.sh ; if $(NT) { File citrun_wrap.bat : wrap.bat ; Clean clean : citrun_wrap.bat ; -} else { + ReplaceToken citrun_wrap.bat ; +} +else { Shell citrun_wrap : wrap.sh ; + ReplaceToken citrun_wrap ; } # diff --git a/inst_frontend.cc b/inst_frontend.cc @@ -67,7 +67,7 @@ InstFrontend::InstFrontend(int argc, char *argv[], bool is_citrun_inst) : { log_identity(); - m_log << "CITRUN_SHARE = '" << CITRUN_SHARE << "'" << std::endl; + m_log << "CITRUN_COMPILERS = '" << CITRUN_COMPILERS << "'" << std::endl; #ifndef _WIN32 // Sometimes we're not called as citrun_inst so force that here. @@ -97,7 +97,7 @@ InstFrontend::log_identity() } // -// Tries to remove CITRUN_SHARE from PATH otherwise it exits easily. +// Tries to remove CITRUN_COMPILERS from PATH otherwise it exits easily. // void InstFrontend::clean_PATH() @@ -111,7 +111,7 @@ InstFrontend::clean_PATH() m_log << "PATH='" << path << "'" << std::endl; - // Filter CITRUN_SHARE out of PATH + // Filter CITRUN_COMPILERS out of PATH std::stringstream path_ss(path); std::ostringstream new_path; std::string component; @@ -119,7 +119,7 @@ InstFrontend::clean_PATH() bool found_citrun_path = 0; while (std::getline(path_ss, component, PATH_SEP)) { - if (component.compare(CITRUN_SHARE) == 0) { + if (component.compare(CITRUN_COMPILERS) == 0) { found_citrun_path = 1; continue; } @@ -127,13 +127,13 @@ InstFrontend::clean_PATH() if (first_component == 0) new_path << PATH_SEP; - // It wasn't CITRUN_SHARE, keep it + // It wasn't CITRUN_COMPILERS, keep it new_path << component; first_component = 0; } if (!found_citrun_path) { - m_log << "Error: CITRUN_SHARE not in PATH." << std::endl; + m_log << "Error: CITRUN_COMPILERS not in PATH." << std::endl; exit(1); } @@ -234,10 +234,6 @@ InstFrontend::if_link_add_runtime(bool object_arg, bool compile_arg) if (!linking) return; - - m_log << "Link detected, adding '" << CITRUN_SHARE "\\libcitrun.lib" - << "' to command line." << std::endl; - m_args.push_back(const_cast<char *>(CITRUN_SHARE "\\libcitrun.lib")); #else // _WIN32 bool linking = false; @@ -252,11 +248,11 @@ InstFrontend::if_link_add_runtime(bool object_arg, bool compile_arg) if (!linking) return; +#endif // _WIN32 - m_log << "Link detected, adding '"<< CITRUN_SHARE "/libcitrun.a" + m_log << "Link detected, adding '"<< CITRUN_LIB << "' to command line." << std::endl; - m_args.push_back(const_cast<char *>(CITRUN_SHARE "/libcitrun.a")); -#endif // _WIN32 + m_args.push_back(const_cast<char *>(CITRUN_LIB)); } // diff --git a/wrap.bat b/wrap.bat @@ -1,7 +1,7 @@ @ECHO off SETLOCAL -SET Path=C:\Users\kyle\citrun\compilers;%Path% +SET Path=%CITRUN_COMPILERS%;%Path% CALL %* -exit /B %ERRORLEVEL% +EXIT /B %ERRORLEVEL% ENDLOCAL diff --git a/wrap.sh b/wrap.sh @@ -3,5 +3,5 @@ if [[ ${1} = -* ]]; then exit 1 fi -export PATH="%CITRUN_SHARE%:$PATH" +export PATH="%CITRUN_COMPILERS%:$PATH" exec $@