Customizing code generation
Generated code (source and binaries) may contain particular information depending on company or project. In order to provide proper copyright and version information, one should change the default settings for several templates.
At the end of the coment part in generated class source and header file, the is a copyright section included, which informs about specific copyrights. After creating a new project, this information is copied from the ODE resource database as include file (header file) "CopyrightSource". In order to update the copyright information, one should edit the include file text by opening the file edit window via menu action
- Objects/Header Files
Select entry "CopyrightSource" from the list end change the text in the form on the right side.
In order to generate file information for binary files, a version header file will be generated, when generating library or executable resources. The version header file is generated from different project resources and might be included when creating windows resource files or other binary resource definitions. The template for the header file to be generated has been copied (BuildResources) when setting up the development database and might be replaced or updated by opening the header file list via main menu (Objects/Header files)
The variables generated into the header file are listed in the example below. The options referenced between %...% are resolved from following resources:
- __PRODUCT_NAME - Is the name of the module or project description (topic associated with the module/project definition)
- __INTERNAL_NAME - is the title of the module or project description (topic associated with the module/project definition)
- __FILENAME_STRING - Is the name (sys_ident) of the object the binary is build from (executable, implementation class)
- __FILE_DESCRIPTION - is the title of the object the binary is build from (executable, implementation class)
- __FILE_TYPE - is the type of the generated resource (VFT_APP for application files and VFT_DLL for dynamic link libraries.
- __PRODUCT_VERSION - The product version is the value stored in the VERSION file in the project template folder (tpl) after replacing dots (.) by comma (,).
- __PRODUCT_VERSION_STRING - The product version string is the value stored in the VERSION file in the project template folder (tpl).
- __BUILD_NUMBER - The build number is the build number from the resource from which the binary will be created
The template is used for creating a template file in the external project environment, which is used directly or after additional external modifications for creating library or executable information. In order to maintain the build number outside from ODE, we defined the build() parameter in the template, which will be replaced by the current build id (last +1) when linking an executable.
Usually, one may remove the build() tag in order to get a proper include file without further modification. When the variable content does not change, one may also set the values to fixed values.
The header fill is just created in order to provide default information for linking. In order to make use of this information, one has to include the generated definitions into the link or compile procedures. The win32_version.rc file in the header file list is an example for including the generated header file.
// ODC_Include("BuildResources")
#define RC_PRODUCT_NAME "%__PRODUCT_NAME%"
#define RC_INTERNAL_NAME "%__INTERNAL_NAME%"
#define RC_FILENAME_STRING "%__FILENAME_STRING%"
#define RC_FILE_DESCRIPTION "%__FILE_DESCRIPTION%"
#define RC_FILETYPE %__FILETYPE%
#define RC_PRODUCT_VERSION %__PRODUCT_VERSION%
#define RC_FILE_VERSION %__PRODUCT_VERSION%,build(%BUILD_NUMBER%)
#define RC_PRODUCT_VERSION_STRING "%__PRODUCT_VERSION_STRING%"
#define RC_FILE_VERSION_STRING "%__PRODUCT_VERSION_STRING%.build(%BUILD_NUMBER%)"