A solution is a collection of projects and configurations. Organizing your projects into a solution allows you to build all the projects in a solution with a single keystroke, load them onto the target ready for debugging with another.
Projects in a solution can can reside in the same or different directories. Project directories are always relative to the directory of the solution file which enables you to move or share project file hierarchies on different computers.
The Project Explorer organizes your projects and files and provides quick access to the commands that operate on them. A tool bar at the top of the window offers quick access to commonly used commands for the item selected in the Project Explorer.
Solutions
When you have created a solution it is stored in a project file. Project files are text files with the file extension hzp that contain an XML description of your project. See ide project file format for a description of project file format.
Projects
The projects you create within a solution have a project type which CrossStudio uses to determine how to build the project. The project type is selected when you use the New Project dialog. The particular set of project types can vary depending upon the variant of CrossWorks you are using, however the following project types are standard to most CrossWorks variants:
- Executable — a program that can be loaded and executed.
- Externally Built Executable — an executable that is not built by CrossWorks.
- Library — a group of object files that collected into a single file (sometimes called an archive).
- Object File — the result of a single compilation.
- Staging — a project that can be used to apply a user defined command (for example cp) to each file in a project.
- Combining — a project that can be used to apply a user defined command when any files in a project have changed.
Properties and configurations
Properties are data that are attached to project nodes. They are usually used in the build process for example to define C preprocessor symbols. You can have different values of the same property based on a configuration, for example you can change the value of a C preprocessor symbol for a release or a debug build.
Folders
Projects can contain folders which are used to group related files together. This grouping can be done using the file extension of the file or it can be done by explicitly creating a file within a folder. Note that folders do not map onto directories in the file store they are solely used to structure the project explorer display.
Files
The source files of your project can be placed either in folders or directly in the project. Ideally files placed in project should be relative to the project directory, however there are cases when you might want to refer to a file in an absolute location and this is supported by the project system.
When you add a file to a project the project system detects if the file is in the project directory. If a file is not in the project directory then the project system tries to make a relative path from the file to the project directory. If the file isn't relative to the project directory then the project system detects if the file is relative to the $(StudioDir) directory. If the file is relative to $(StudioDir) directory then the filename is defined using $(StudioDir). If a file is not relative to the project directory or to $(StudioDir) then the full filename is used.
The project system will allow (with a warning) duplicate files to be put into a project.
The project system uses the extension of the file to determine the appropriate build action to perform on the file. So
- a file with the extension .c will be compiled by a C compiler.
- a file with the extension .s or .asm will be compiled an assembler.
- a file with the extension .cpp or .cxx will be compiled by a C++ compiler.
- a file with the object file extension .o or .hzo will be linked.
- a file with the library file extension .a or .hza will be linked.
- a file with the extension .xml will be opened and it’s file type determined by the XML document type.
- other file extensions will not be compiled/linked with.
You can modify this behaviour by setting the File Type property of the file with the Common configuration selected in the properties window which enables files with non-standard extensions to be compiled by the project system.
Solution links
You can create links to existing project files from a solution which enables you to create hierarchical builds. For example you could have a solution that builds a library together with a stub test driver executable. You can then link to this solution (by right clicking on the solution node of the project explorer and selecting Add Existing Project) to be able to use the library from a project in the current solution.
Session files
When you exit CrossWorks, details of your current session are stored in a session file. Session files are text files with the file extension hzs that contain details such as files you have opened in the editor and breakpoints you set in the breakpoint window.