STRIDE Extensions for Visual Studio: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 10: | Line 10: | ||
== Creating Off-Target App Projects == | == Creating Off-Target App Projects == | ||
The following instructions describe the steps required to create sandbox target applications on windows. You will likely need additional source code and project settings as required to make your specific application code build | The following instructions describe the steps required to create sandbox target applications on windows. You will likely need additional source code and project settings as required to make your specific application code build. | ||
<ol> | <ol> |
Revision as of 21:20, 29 January 2010
Introduction
If you are using the STRIDE Framework for windows, an alternative to the standard method of building target apps (using make) is to use the STRIDE Rules file for Visual Studio.
Prerequisites
- Visual Studio 2005 or later (an express distribution is fine)
- recent version of perl must be in your path
- a recent version of the STRIDE Framework installed and a static library version of the runtime must be built using the source files included in the Framework. This is accomplished by just running make on the makefile that we provide in the SDK\Windows\src directory (the default makefile target builds the runtime library).
- create a system environment variable called STRIDE_DIR that points to the directory in which you installed the stride framework (e.g. c:\stride)
Creating Off-Target App Projects
The following instructions describe the steps required to create sandbox target applications on windows. You will likely need additional source code and project settings as required to make your specific application code build.
- Create a new C/C++ Win32 Console application project. All versions of Visual Studio provide a project wizard to do this. If you are given an option to use precompiled headers in the project, select No.
- Assign the stride rules file to this project. Select the Custom Build Rules... menu item to launch a dialog to import this rules file located at stride\SDK\Windows\settings\stride.rules. After associating the stride rules file with your project, make sure you also enable the rule for your project (typically by selecting the check-box next to it's name).
- Add your application, test and SCL source code to the project. Any header files that are in the project will be automatically processed by the STRIDE SCL compiler. If there are some header files that contain no SCL statements, then we recommend disabling the build step for these files. This is typically done via the properties dialog for a file by setting the "General" | "Exclude from build" property to "Yes".
- Change the C/C++ Properties for the project:
- Disable detection of 64-bit portability issues [typically found in the General section].
- set the runtime library to Multi-threaded DLL (/MD) [typically found in the Code Generation section].
- Add Additional Include Directories to your project [typically found in the Preprocessor section]:
$(STRIDE_DIR)\SDK\Runtime $(STRIDE_DIR)\SDK\Windows\src [path(s) to other application and test source headers]
- Add the following to the preprocessor definitions [typically found in the Preprocessor section]:
STANDALONE_TESTAPP STRIDE_ENABLED STRIDE_STATIC
- Disable precompiled headers for the project (or selectively disable them for STRIDE-generated files) [typically found in the Precompiled Headers section].
- Change the Linker Properties for the project:
- Add Additional Library Directories [typically found in the General section]:
$(STRIDE_DIR)\SDK\Windows\out\lib
- Add Additional (linker) Dependency [typically found in the Input section]:
stride.lib ws2_32.lib winmm.lib
- Add Additional Library Directories [typically found in the General section]:
- Set the STRIDE Compile-Instrument properties for the project:
- Set the Compile Options File to $(STRIDE_DIR)\SDK\Windows\settings\stride.s2scompile. This file provides basic options for windows off-target apps. If you require different or additional parameters to be passed to the STRIDE SCL compiler, then we recommend that you make a local copy of the provided settings file and set this property to your private (and modified) version. The size and alignment settings in the provided file are correct for standard 32 bit Windows platforms.
- The default Intercept generation assumes STUB settings for all captured functions. If you require different settings for any of your interfaces, you should create a text file containing the additional settings to assign the path to this file for the Intercept Options File property.
- Add directories to the Include Directory property as needed to allow the STRIDE SCL compiler to process your source code. You can often use the same values here that you have previously set in the C/C++ compiler settings for your project.
- Add preprocessor defines to the Defines property as needed to allow the STRIDE SCL compiler to process your source code. You can often use the same values here that you have previously set in the C/C++ compiler settings for your project.
- Repeat steps 4-6 for all project configurations you want to build (e.g., Debug, Release).
- Build your project once to generate the STRIDE intercept module source files. You will get linker errors during this build since you have not yet added the generated STRIDE intercept code.
- Add the generated source file - strideIM.cpp - to your project. This file will be located in the $(ProjectDir) directory. If you are using the STRIDE rules file (as described in step 2 above), you also need to add the following generated header files to your project: strideIM.h and strideIMEntry.h. Since these header files are generated, we do not want the STRIDE rule to attempt to process them (rather, they are in the project so that Visual Studio can properly calculate dependencies). As such, you should also set the Excluded from build property on these two header files to yes (this property is accessible by right clicking on the header file in the solution explorer view and selecting Properties)
- Rebuild your project and resolve any compiler errors/warnings. NOTE: As you add more header source files to the project, they will be automatically processed by the stride compiler unless you explicitly exclude them from the build. As you add sources, you will likely also need to add additional include and preprocessor defines to the STRIDE compile-instrument settings in order to successfully build.