The simplest thing would probably be to create a number different build configurations (i.e. beyond the default Debug and Release build configs). To do this, right click on the project in the Project Explorer view, and select the menu:
- Build Configurations -> Manage
Another approach might be to have a project for each build variant that you want, which then use "linked resources" to link to another "master project" that contains your sensor sources. Linked resources allow you to link a folder in one project into a folder in another. This is similar to a linux symbolic link. You can have a many linked folders as you need - there is no limit.
By using a master project plus "secondary" projects with linked folder, you get a single copy of your sources (editable from both projects) but with different project (and MCU) settings. It is fully compatible with source code control systems, such as Git or SVN. Details on linked resources can be found in the Help (Help->Help Contents and search for Linked Resources).
With regards to the master project, as this is really just a container of files rather than something you actually want to build, you might want to create it just using the
- File -> New -> Project -> General -> Project
A simple way to create your secondary projects with a linked folder is as follows:
- Use the New Project Wizard to create a project with the appropriate settings
- delete the src folder
- Right-click on the project and File->New->Folder
- Enter src into the Folder name
- Press the Advanced>> button
- Click on "Link to alternate location (Linked folder)"
- Press "Variables"
- In the new Dialog, select the WORKSPACE entry
- press the Extend button
- a Browser is shown - browse to the src folder in your 'master' project
- Press OK
- Press Finish
You new project will now have a src folder that is linked to the src folder in your master project. You can make changes to your secondary project(s) to provide different build options (e.g. defines).
Another possibility might be to consider using a library project, with build configs for each of your sensor options. Then have a project for each sensor type - which contains any project specific code, but also links to the appropriate build config of the central library project. I suspect that this is probably the most complex option though.
Regards,
MCUXpresso IDE Support