Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
126 Views

How to Distinguish Full Debug from Min Debug in a Pre-Build Event

Hello all,

I have a PSXE 19.1 Fortran DLL project developed in Visual Studio 2017 Community that incorporates a Pre-Build Event, which consists of launching a small Fortran application that edits the DLL stringtable prior to the build. The calling arguments to this pre-build application include "$(ProjectDir)", "$(ProjectName)", "$(PlatformName)", and "$(Configuration)". The "$(Configuration)" variable simply contains "Debug" when either of the /debug:full or /debug:minimal are in effect for the DLL project. Is there some other environment or project setting variable that I can pass as an argument to the pre-build app that will allow it to determine whether full debug vs. min debug is in effect? Thanks for any info!

0 Kudos
8 Replies
Highlighted
Black Belt
126 Views

If the difference is material to you, create two different configurations (e.g. DebugFull versus DebugMinimal) for the DLL.

(edit to note that option is just as valid for release builds too... - so maybe you have ReleaseDebugFull and ReleaseDebugMinimal!)

The COMPILER_OPTIONS() function in ISO_FORTRAN_ENV was added with F2008.  For ifort, it provides information on the options used to compile the source file for the particular reference to the function (programs may be made up of multiple source files, with different command line options for each file).

(That option seems an a little "trivial" on its own to be bundling into some sort of DLL version report.)

0 Kudos
Highlighted
Beginner
126 Views

The Compiler_Options() function certainly seems to be what I'm looking for, but it's eluding me how to use it in this situation. When I call Compiler_Options() from the application (say, VersionInfo.exe) that launches in the pre-build event, it gives me the compiler options for VersionInfo rather than for the DLL which is about to build. Is it possible for VersionInfo to query the compiler options for the current Fortran DLL project rather than its own?

I'm embarrassed to reveal I didn't realize there was such a thing as a combined ReleaseDebugFull build. I gather it produces all the symbolic debug information as well as all code execution optimizations. I'm curious what the advantage/disadvantage is relative to a traditional FullDebug build.

Thanks for your input, as always-

0 Kudos
Highlighted
Black Belt Retired Employee
126 Views

No. COMPILER_OPTIONS() is a standard Fortran intrinsic that tells you how the Fortran source that calls it was compiled. The compiler fills this in based on how it was invoked.

You can create separate configurations for the different build types and specify an argument to your pre-build program that identifies the configuration in whatever way you want.

0 Kudos
Highlighted
Beginner
126 Views

FWIW, I found it is possible (if clumsy) to do what the topic title refers to, i.e., determine in a VS pre-build event whether the current (and about-to-be-built) DLL project is Full Debug versus Minimal Debug. It basically consists of a batch file in the pre-build event that uses the Windows FINDSTR command to query the Fortran project (,vfproj) file for the presence of "debugEnabled" vs. "debugLineInfoOnly". Thanks for the replies, I'll consider this one closed-

0 Kudos
Highlighted
Black Belt Retired Employee
126 Views

That seems rather fail-prone to me, since the .vfproj contains all of the configurations for the project, including Release. The only way I could see this working is if you wanted to know if any of the configurations had this property.

0 Kudos
Highlighted
126 Views

FWIW....

My preference is to create different projects. In one solution I have:

  Debug
  DebugFast
  DebugOpenMPFast
  DebugOpenMPFastUSE_AVX
  Release
  ReleaseF87

Disk space is so cheap now, it makes little sense to have one (or two) configurations that you manually tweak the settings between builds.

Also note that within a single configuration, individual source files may have different compiler options (debug, optimizatons, language, etc...).

IOW a single project can potentially have both  "debugEnabled" and "debugLineInfoOnly".

Jim Dempsey

0 Kudos
Highlighted
Beginner
126 Views

@Steve,

You're right, that's the step I didn't mention, and it's what makes the scheme somewhat clumsy... for this set of DLL projects (all in one solution), I have edited the .vfproj files to contain only the configuration I want for that project. That basically means I can't use the VS Project Properties to switch a given project from, say, FullDebug to MinDebug, because that will insert the new configuration back into the .vfproj file (while leaving the original one), resulting in exactly the ambiguity you mention. So basically, I need to have multiple projects hardwired to a specific configuration, rather than switching between the various available configurations from a single project. I think this is something like what Jim is describing above.

0 Kudos
Highlighted
126 Views

Here is another suggestion.

In your project, define a macro "DebugMethod=full" or "DebugMethod=minimal"

Then in additional options, use the macro:

    /debug:$(DebugMethod)

The macro can also be expanded in your code for use in action selection..

Jim Dempsey

0 Kudos