cbp2make icon indicating copy to clipboard operation
cbp2make copied to clipboard

When include files ues environment constants slash escaping fails

Open airbagi opened this issue 2 years ago • 5 comments

I have such example of include dirs:

INC = -I$(WXWIN)\include -I$(PYTHONHOME)\include -I$(WXCURL)\include

where environmental constants are used. As we see here, backslash is not escaped. Must be:

INC = -I$(WXWIN)\\include -I$(PYTHONHOME)\\include -I$(WXCURL)\\include

airbagi avatar Nov 21 '21 14:11 airbagi

Could you please attach a sample .cbp project with such paths/variables?

mirai-computing avatar Nov 21 '21 21:11 mirai-computing

I've compiled version from git - there is no such problem there. But... Codeblocks clears "lib" prefix and ".a" extension. For example, if I have such list:

	                <Add library="libversion.a" />
			<Add library="libole32.a" />
			<Add library="libkernel32.a" />
			<Add library="libuser32.a" />
			<Add library="libgdi32.a" />
			<Add library="libwinspool.a" />

you script will not work. I've fixed that, added some additional properties.

Another thing, that matters, the order of libs. I couldn't determine whether your script takes it in account (target libs BEFORE, or AFTER main libs).

And the last problem I have, I can't understand why includes in some cases not work from make. But if I do:

make release > run.cmd

and then

run.cmd

it works ok. What the hell it can be?

airbagi avatar Nov 22 '21 21:11 airbagi

I don't know offhand, this requires a little investigation. Anyway, I need a complete .cbp file to feed it to cbp2make and also cbp2make.cfg (if you have made any changes to it) and your command line for running cbp2make.

The initial issue about library prefixes may either indicate a real bug or may be related to incorrect Platform/OS option. If you want a Windows makefile, you must use -windows option. Considering the order of libraries, I can't tell for sure, I know this feature is definitely implemented for project options, maybe I have implemented this for libraries too.

mirai-computing avatar Nov 24 '21 10:11 mirai-computing

-windows option not help, this is not included into functionality of your software. I added a function and also made several changes to your software and now everything compiles ok.

erasing "lib" prefix function:

CString EraseLib(const CString& FileName, const CString& strLib) {
  CString strPath = "";
  CString strFileName = FileName;
  strPath = ExtractFilePath(FileName);
  strFileName = ExtractFileName(FileName);
  if (0 == FindStr(strFileName, strLib))
{
    if (0 == strPath.GetLength())
      return SubStr(strFileName, 3, FileName.GetLength());
    else
      return IncludeTrailingPathDelimiter(strPath) +
             SubStr(strFileName, 3, FileName.GetLength());
}
  else
    return FileName;
}

if you need whole patch, let me know.

Thank you

airbagi avatar Nov 28 '21 16:11 airbagi

Hi, can you retest a recent revision of cbp2make against your case? The logic behind library options is following:

  1. if a library path is not empty, i.e. points exactly to a particular file, this library name must be included as-is; otherwise
  2. if a library extension is known, clear both prefix (e.g. "lib") and extension (e.g. ".a",".so",".dll");
  3. include only base library name via link switch;

mirai-computing avatar Dec 13 '23 09:12 mirai-computing