Re: Build Solution From Command Line Visual Studio 2019

0 views
Skip to first unread message
Message has been deleted

Indira Rossetto

unread,
Jul 10, 2024, 8:02:19 AM7/10/24
to minadaho

The Solution properties pages show several different command lines, one for "Fortran," one for "Linker," one for "Resources," and one for MIDL. Can I combine these somehow as as argument to the ifort command so that one call to ifort builds the entire solution (equivalent to "Rebuild Solution" in Visual Studio)? If so, how? Just concatenate them, or something else?

Also, the documentation says that the source files need to be put in the correct order so that dependencies are resolved correctly. If I Rebuild Solution in Visual Studio, does the order of compilation as shown in the Output Window correspond to the appropriate ordering of the files on the command line?

build solution from command line visual studio 2019


Descargar archivo https://vlyyg.com/2yOyPD



If your project uses Fortran source files with many modules and USE statements, a batch file to recreate the EXE/DLL/LIB-s from scratch may not be of much use during development, unless the compilation time is insignificant. Instead, a makefile is needed that has enough information to enable recompiling only those sources that have been changed and their dependents. There are a number of third party Fortran module-aware tools that will scan your source, analyze dependencies and output a makefile. Search the Web with combinations of "make", "depend" and "Fortran".

First, the purpose of converting to command line is to be able to automate the building of dozens of variations of the output dll depending on preprocessor definitions and target architecture (SSE4.1 or AVX2). My goal is to make a big batch file to generate the necessary variants without intervention, where the batch file simply repeats the required command lines over and over with the necessary modifications in each one. Rebuilding each variant is OK because a rebuild takes less than a minute, so the whole build process with multiple builds should takes less than two hours.

So for each section of the batch file, do I just insert 11 invocations of ifort and one invocation of Link? If so, how do the temporary files RSP1.rsp get handled? If each section of the batch file just consists of 12 lines (11 invocations of ifort and one invocation of link), will the compiler create the RSP1.rsp files automatically such that the next invocation of ifort finds them?]

Finally, the build log shows no invocation of ifort before the first RSP1.rsp file is created. How is creation of the first RSP1.rsp achieved in the batch file? Assume that I will have pre-compiled the resource files, as there are several variants that must be linked depending on other build parameters, so it will not be necessary to invoke the resource compiler.

Typically you compile each source file using "ifort /c" and any other options you need. Then you link the executable using ifort (not link and without /c), naming all the object files. Most people use makefiles for this.

Are you saying that in my case, ifort should be invoked 70 times, one for each source file? (In the build log, it appears that the source files are grouped and ifort is invoked for the various groups.)

In the final invocation of ifort (to link the executable), does the order of the *.obj files matter? (Can I used the order shown in the build log?) And is the compiled resource file placed after all of the *.obj files, as it is in the build log?

Might I suggest that the compiler's documentation on the command line be updated to answer novice questions like the ones I have, as I dislike wasting people's time when I can find the answers quickly through documentation? The examples shown in the documentation are for very simple projects.

Also, I think it would be valuable if the Intel compiler included an makefile generator that could automatically translate a working Visual Studio Fortran project into a makefile. Makefile generation could just be an another build option in Visual Studio.

Are you saying that in my case, ifort should be invoked 70 times, one for each source file? (In the build file, it appears that the source files are grouped and ifort is invoked for the various groups.)

If you want to group the files, you can. You just need to make sure that you compile module sources before the sources that USE the modules. Note the use of /MP which compiles the sources in parallel, saving build time.

There are makefile generators for Fortran available. VS itself used to have one but Microsoft took it out. I will also comment that one can invoke devenv (VS) from the command line to build a project. This is an alternative to using a batch file or makefile and is a solution I like better.

We document how to use VS and how to use the command line. It isn't often that someone wants to convert from one to the other and trying to address all the possible issues and needs would be complex. Once you understand the basics of how command line builds work, it isn't difficult to make the translation.

After working through everything and finally getting it working, my only suggestions regarding the documentation would be (a) to add one more example that shows how to call the linker (including linker options) from an ifort command. The technique is explained but not illustrated, (b) to add a paragraph explaining how to edit the contents of BuildLog.htm to make a command line batch file, and (c) to explain how manifests are handled in the command line.

"The Intel Fortran Compiler supports manifests, a Visual Studio* feature. Manifests describe run-time dependencies of a built application. A manifest file can be embedded in the assembly, which is the default behavior, or can be a separate standalone file. You can use the Manifest Tool property pages, which are accessed through Project > Properties, to change project settings that affect the manifest."

I don't know if a manifest is needed to make the built dll work with the Intel redistributables, and there is nothing in the command line documentation about manifests. BuildLog.htm shows the following as the final step:

but I don't know if this happens automatically if I call the linker from ifort. I can say that the output of the command line build (as I have it so far) includes a file: output.dll.intermediate.manifest, but I want the dependency information to be built into the dll itself and I'm sure what I need to do in the command line: do I need to call mt.exe explicitly, or does calling the linker from ifort take care of this automatically?

>>First, the purpose of converting to command line is to be able to automate the building of dozens of variations of the output dll depending on preprocessor definitions and target architecture (SSE4.1 or AVX2).

An alternate way to do this is to create multiple Projects within the Solution. Each project having different output folders but same source files, and different compiler options and #defines. Then add an additional project that is dependent on all your DLL build projects, and which "packages" the .DLL outputs.

Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.

I create a lot of samples, demos, open source projects, etc. and I like to use the fairly standard repository layout of having a solution file in the root and project files in a src subfolder. Achieving this in Visual Studio is tedious, but fortunately this series of dotnet CLI commands quickly create the structure for you.

d3342ee215
Reply all
Reply to author
Forward
0 new messages