single file compile

Added by Kevin Thacker over 4 years ago

When using the generated workspace, there is no right click menu option for "compile" on the cpp files.
It is greyed out. Is there a way to make this work?

In a normal made visual studio project you can right click and do compile.


Replies (4)

RE: single file compile - Added by Joshua Jensen over 4 years ago

Unfortunately, Visual Studio's makefile projects provide no method of setting up a compile for individual files. You are limited to building single projects.

Single files can be built from within Jam itself, though, unless you are using lump files.

It would take a Visual Studio add-in to pull this off.

-Josh

RE: single file compile - Added by Kevin Thacker over 4 years ago

Joshua Jensen wrote:

Unfortunately, Visual Studio's makefile projects provide no method of setting up a compile for individual files. You are limited to building single projects.

Single files can be built from within Jam itself, though, unless you are using lump files.

It would take a Visual Studio add-in to pull this off.

-Josh

yes, looking at it there are a few choices.

setup some custom build rules, involves a .targets and .xml file for visual studio 2010, set the cpp files to be a custom type "jam_file". Then it would work.

Another solution is to setup an "external build tool", but you have to infer everything from a limited number of variables that are allowed.

Or perhaps script it within visual studio where you should get a bit more available.

RE: single file compile - Added by Brian Ehlert over 4 years ago

Joshua Jensen wrote:

Single files can be built from within Jam itself, though, unless you are using lump files.

I've long wondered about this same thing myself. While I don't quite need to go as far as writing a Visual Studio plugin, I occasionally need to compile a single file with a different set of flags to see some compiler debug output (like after macro expansion, or with class layouts, etc.). Can you elaborate on how this is actually done within Jam?

I was thinking of just hacking up the project file to only include a single source file, change some flags, and then go back to Visual Studio and build the project. If there's a better way, I'd love to hear it.

RE: single file compile - Added by Joshua Jensen over 4 years ago

I've always just jumped into the Jamfile and done something like this:

C.ObjectC++Flags MyProject : myfile.cpp : /showincludes ;

If you have a real need of building a single file with different flags, you could use a variation on the above:

if $(EXTRA_FLAGS) {
    C.ObjectC++Flags MyProject : myfile.cpp : $(EXTRA_FLAGS) ;
}

and call Jam like this:

jam EXTRA_FLAGS=/showIncludes "<MyProject>myfile.obj" 

-Josh

(1-4/4)