last updated on: 6/30/2008
Send updates, additions, and corrections to faq@ociweb.com



General


Q:

The tao_idl compiler generates testS_T.* from test.idl. How can I tell MPC not to put them in my project?

Q:

I have a root location for my project, $PROJECT_ROOT. How do I get MPC to replace $(PROJECT_ROOT) in my project files?

Q:

Can I change the names of the project files as they are being generated?

Q:

I want a workspace at every directory level. Can MPC do that?

Q:

In what order are base projects processed?

Q:

It appears that I have to explicitly list the IDL generated files in MPC (such as LPGameC.cpp under client). Is this is correct?

Q:

Is it possible to set a default type or change the default include path for MPC?

Q:

How do I get MPC to not print out so much information?

Q:

How do I get more information about what's going on from MPC?

Q:

How do I tell MPC not to look in a particular directory when searching for mwc or mpc files?

Q:

How do I use -value_template inside of a workspace?

Q:

Is there a way to include a source file into a project on Solaris, but not on Linux?

Q:

Is there any way to add options to the compiler command line?

Q:

I want to mix static and dynamic projects in the same workspace. How do I do that?

Q:

I have a custom definition and my tool is able to generate files into a different directory. I provided the option to the tool, but when I build, the command is run every time I compile even if the build is up-to-date.

Q:

I want a certain set of options for one custom input file, but a different set for another custom input file. Is that possible?

Q:

Is there any way to specify, in an mpc file, that a library MUST be static? Some libraries cannot be used as dynamic libraries.

Q:

Can I compile C code with Makefiles generated by MPC?


Windows Specific


Q:

MPC seems to add d.lib to all the libs, but the external libraries I'm using don't have that a 'd' at the end of the name. Is there any way to turn this off fo

Q:

I am generating static projects for vc6 and vc71. Why are there no project dependencies?

Q:

When I build my source code based on TAO, Visual C++ 6 complains about not being able to build c:\projects\cmd\src\%ACE_ROOT%\bin\tao_idl.exe. Everything builds correctly, but why does this happen?

Q:

I have just generated my vc6 projects and when I load it in Visual C++ nothing shows up. What's going on?

Q:

Is there any way to suppress the 's' decorator on a static library's name without suppressing the 'd' on the debug version?

Q:

The vc71 projects generated by MPC put executables in the 'Release' directory for Release builds, but puts executables in the '.' for Debug builds. How do I make it put the executables in the 'Debug' directory.

Q:

I want to generate MFC configurations for Windows. How do I do that?




General


Q:

The tao_idl compiler generates testS_T.* from test.idl. How can I tell MPC not to put them in my project?

A:

If you don't want the *S_T.* files in your project, then you should add the -Sc option to your idlflags. After adding the -Sc option, remove the generated *S_T.* files and regenerate your projects.

Q:

I have a root location for my project, $PROJECT_ROOT. How do I get MPC to replace $(PROJECT_ROOT) in my project files?

A:

As long as the variable is set in your environment at project generation time and the variable name ends in _ROOT, it happens automatically. If this isn't the case, you can use the -relative option when you generate your project files.
  mwc.pl -relative PROJECT_BASE=$PROJECT_BASE


Q:

Can I change the names of the project files as they are being generated?

A:

Yes, use the -name_modifier option to modify the names of the project files as MPC generates them. If you want the project names to be modified also, add the -apply_project option.
  mwc.pl -static -type vc6 -name_modifier *_Static -apply_project
When using these options, all workspace and project files as well as project names will end in _Static.

Q:

I want a workspace at every directory level. Can MPC do that?

A:

Yes, use the -hierarchy option when you run mwc.pl. It will generate a workspace at every directory level between the main workspace and the mpc generated projects. This is the default for all 'make' based workspaces.

Q:

In what order are base projects processed?

A:

Base projects are processed in the order in which they are specified in the inheritance list. However, each base project is processed in a depth first manner and will only be read once per project.

Q:

It appears that I have to explicitly list the IDL generated files in MPC (such as LPGameC.cpp under client). Is this is correct?

A:

If you only want to compile the *C.cpp files, then you must explicitly list it under Source_Files. However, if you want both *S.cpp and *C.cpp you do not need to explicitly list either of them. They will be added automatically for you.

Q:

Is it possible to set a default type or change the default include path for MPC?

A:

Yes, you can create an MPC.cfg file to specify default command line options such as -type and -include. The command_line setting can contain any option that can be passed to MPC and will be processed each time mpc.pl or mwc.pl is run.

Q:

How do I get MPC to not print out so much information?

A:

Set logging to empty in the MPC.cfg file.

Q:

How do I get more information about what's going on from MPC?

A:

Set the logging variable in the MPC.cfg file (See the MPC/docs/USAGE for more details). You can also set the verbose_ordering variable to get information about project ordering.

Q:

How do I tell MPC not to look in a particular directory when searching for mwc or mpc files?

A:

The -exclude option is used to exclude directories from MPC's search. You must provide a path relative to the directory from which MPC was run.
  mwc.pl -exclude this_dir,this_dir_too,and_another_dir


Q:

How do I use -value_template inside of a workspace?

A:

You can use most of the mwc.pl command line options within an mwc file. Assign command line options to the 'cmdline' keyword. If the command line options need to retain spacing, they must be enclosed in double quotes.
workspace {
// Set the command line value to change the configurations with vc6,
// vc71 and vc8
cmdline += -value_template "configurations='MFC Release' 'MFC Debug'"
}


Q:

Is there a way to include a source file into a project on Solaris, but not on Linux?

A:

Yes. You must define a base project that uses an MPC "feature". In the following example source1.cpp and source2.cpp will only be added to the project if the 'solaris_only' feature is enabled. By default, all features are enabled but in this example we explicitly disable the 'solaris_only' feature.
// config/default.features
solaris_only = 0


// some_base.mpb
feature(solaris_only) {
Source_Files {
source1.cpp
source2.cpp
}
}


// your_project.mpc
project: some_base {
Source_Files {
source3.cpp
source4.cpp
}
}


Q:

Is there any way to add options to the compiler command line?

A:

Yes, you can use 'specific' to specify additional compiler options.
project {

specific(make) {
compile_flags += -fcheck-new
}

specific(vc71) {
compile_flags += /wd4103
}
}


Q:

I want to mix static and dynamic projects in the same workspace. How do I do that?

A:

Within your mwc file, set up a scoped section that adds -static to the command line options:
workspace {
// These projects will be static
some_scope_name {
cmdline += -static
my_projects_dir
my_other_projects_dir
}

// Anything outside the scope will have the command line options
// provided at the start of mwc.pl
another_dir
}


Q:

I have a custom definition and my tool is able to generate files into a different directory. I provided the option to the tool, but when I build, the command is run every time I compile even if the build is up-to-date.

A:

You have instructed the tool to put the generated files in a particular location (with a -o option for example). Now you need to tell MPC where the generated files will be with 'gendir'.
Define_Custom(FOO) {
command = foo
inputext = .foo
source_outputext = .cpp
}

FOO_Files {
commandflags += -o generated
gendir = generated
foo_files/*.foo
}


Q:

I want a certain set of options for one custom input file, but a different set for another custom input file. Is that possible?

A:

Yes, you will create multiple sections for the custom input files and set the options within those sections. The example below assumes that you have a custom build type named FOO.
project: foo {
FOO_Files {
foo.file
}

FOO_Files {
commandflags += -QR
bar.file
}
}


Q:

Is there any way to specify, in an mpc file, that a library MUST be static? Some libraries cannot be used as dynamic libraries.

A:

Yes, set staticname to the library name and set sharedname to empty.
project {
sharedname =
staticname = foo
}


Q:

Can I compile C code with Makefiles generated by MPC?

A:

Yes. When generating Makefiles using the 'make' project type, pass the following additional option:
-value_template cxx=[C compiler name]



Windows Specific


Q:

MPC seems to add d.lib to all the libs, but the external libraries I'm using don't have that a 'd' at the end of the name. Is there any way t

A:

Use 'lit_libs' in your mpc file instead of 'libs'.

Q:

I am generating static projects for vc6 and vc71. Why are there no project dependencies?

A:

When generating static projects, inter-project dependencies will not be generated for libraries within vc6, em3, vc7 or vc71 workspaces. The reason is due to the fact that each static library that depended upon another would be combined at the library creation stage, resulting in extremely large libraries.

This behavior can be modified by setting the MPC_DEPENDENCY_COMBINED_STATIC_LIBRARY environment variable. It will force MPC to generate inter-project dependencies for static libraries within a single workspace.

Q:

When I build my source code based on TAO, Visual C++ 6 complains about not being able to build c:\projects\cmd\src\%ACE_ROOT%\bin\tao_idl.exe. Everything builds correctly, but why does this happen?

A:

Each of the files generated from your .idl file is dependent upon tao_idl. When a project file is relative to %ACE_ROOT%, the location of tao_idl is expanded out and Visual C++ 6 is happy. Since your project resides outside of %ACE_ROOT%, MPC can not expand %ACE_ROOT% to a relative path and so it sets the dependency to %ACE_ROOT%\bin\tao_idl.exe. Visual C++ 6 apparently prepends the current working directory to this value and emits the warning you're seeing.

Q:

I have just generated my vc6 projects and when I load it in Visual C++ nothing shows up. What's going on?

A:

This sort of thing can happen if you have used Perl from Cygwin with an older version of MPC. You should update to the latest version of MPC.

Q:

Is there any way to suppress the 's' decorator on a static library's name without suppressing the 'd' on the debug version?

A:

Yes, you can set the lib_modifier using the configuration as a scope modifier. In the following example, assume that the -static option has been passed to MPC.
project {
// Override the values of 's' and 'sd' respectively.
specific {
Release::lib_modifier =
Debug::lib_modifier = d
}
}


Q:

The vc71 projects generated by MPC put executables in the 'Release' directory for Release builds, but puts executables in the '.' for Debug builds. How do I make it put the executables in the 'Debug' directory.

A:

Add this to your MPC project:
project {                    
  specific {
    windows_style =1
  }
}
or add this to your command line:
-value_template windows_style=1


Q:

I want to generate MFC configurations for Windows. How do I do that?

A:

Add this to your MPC command line:
-value_template "configurations='MFC Release' 'MFC Debug'"
You can use this to set the configurations for the em3, nmake, vc6, vc7, vc71 and vc8 project types. You will have to enable the 'mfc' feature either through a feature file or the -features option.


Copyright © 2006 Object Computing, Inc. All rights reserved. | Privacy Policy