This topic explains how to add a definition for your cross-compiler to C++test so that you can use it in all projects which you normally compile with this compiler.
Sections include:
In general, a custom compiler should be defined when:
By defining a custom compiler, you can modify compiler/linker names and the specific patterns for how C++test uses the compiler and linker.
Different approaches to adding custom compiler definitions are recommended for different C++test installation scenarios:
Once you have a new definition of your custom compiler, you can use it in all projects that you normally compile with this compiler. When we discuss "building the test harness for target platform," it is assumed that you are using the suitable compiler definition. This is a part of defining the test flow.
To add a custom compiler definition to C++test.
By default, the custom compiler definition files are saved in <workspace>\metadata\.plugins\com.parasoft.xtest.checkers.eclipse.core.cpp/compilers
.
Choose File> New> Other, choose C++test> Custom compiler, then click Next.The New Custom Compiler dialog will open.
Select Add custom compiler, then click Next.
In the next page, specify the following custom compiler settings:
Compiler name: The unique name that will be used to identify this custom compiler in the C++test GUI.
Compiler family: The family of compilers which corresponds to your actual compiler (if you are not sure, choose one of the GCC compilers).
Compiler identifier: The unique name that will be used to identify the directory in which its configuration settings are stored. This name should conform to all limitations that your OS file system imposes on directory names.
C compiler executable: The C compiler executable.
C++ compiler executable: The C++ compiler executable.
Linker executable: The linker executable. The compiler and linker settings must be consistent.
(Optional) If you want to see the paths to configuration files created for your new custom compiler, click Next.
Click Finish.
When a new compiler definition is added, C++test creates a set of configuration files which can be customized. These files include:
Compiler definition file: This file stores details about the configuration of compiler executables and command line patterns which should be used when compiling the test harness.
ImportantWhen dealing with a cross compiler, most users typically need to alter the linker command line by removing the references to the following precompiled version of the C++test runtime library that is used in the linker command lines by default: “ $(CPPTEST_LIB_DIR)/cpptestruntime.lib“ They should be replaced with references to the custom, cross-compiled version of the runtime library. For example: “linkerCmdLine=$(exe) $(filtered_opts) $(input) $(HOME)/cpptest/ppc603/cpptestruntime.a -o $(output)” For details on how to build runtime library, see Working with the C/C++test Runtime Library. |
c.psrc.
cpp.psrc.
Any custom compiler definitions that are available in the designated Custom Compilers location will be loaded automatically upon startup, and available for use. Thus, one way to "import" definitions is to save them in the Custom Compiler location. By default, the custom compiler definition files are saved in<workspace>\.metadata\.plugins\com.parasoft.xtest.checkers.eclipse.core.cpp/compilers.To change this location, choose Parasoft> Preferences, select Parasoft> Configurations, then enable Custom directories> Custom compilers and enter the location in the appropriate field .
To import a custom compiler definition that is stored in another location:
Choose File> New> Other, choose C++test> Custom compiler, then click Next. The New Custom Compiler dialog will open.
After adding a custom compiler, ensure that your Project Options’ Build Settings are set properly:
In the project tree, right-click the project node, then choose Properties from the shortcut menu.
${cpptest:original_options}
${cpptest:original_options} "C:\cygwin\home\<user_name>\Custom_Compiler\source\target\libcpptestruntime.a"
Tips
|