Step 1: Prepare for Migration
Create group directories for different platforms under your project group directory, place separate project definition files for different platforms, and copy the current project definition text (. MMP ,. BLF) to different group directories. If your project definition file was previously in the group directory. In the new directory structure, you do not need to forget to modify the relative path in the project definition file. In general, modify '../' '../../'.
To achieve migration between different versions, we recommend that you store the environment variable parameters of each version through a header file to facilitate compilation between different versions. To generate different versions, you only need to modify the header file. Create a header file named projectenv. h and copy it to the directories of each project group.
#ifndef PROJECTENV_H_#define PROJECTENV_H_ //#define __S60__200 #define __S60__300 #ifdef __S60__ //do something #else //do somthing #endif #endif /*PROJECTENV_H_*/ At this time, your group directory structure should be similar to the following structure: │├─s60_2nd│ bld.inf│ YourProject.mmp│ projectenv.h│├─s60_3rd│ bld.inf│ YourProject.mmp│ projectenv.h At this time, the two groups of directories are copies of the project definition files under s60 version 2. The rest of the work is to modify the files on this basis. The project can be smoothly compiled in s60 version 2 and the third edition. [Edit] Step 2: modify the application framework PortalPrevious s60 versions of the second version of applications all exist in the form of multi-state DLL, and the third version of the application becomes an independent executable program. So the biggest change in code is that the entry of the application has changed. Find the entry source file of your program framework, usually yourprojectapp. cpp. The example after modification is as follows: ...#ifdef EKA2#include <eikstart.h>LOCAL_C CApaApplication* NewApplication() { return new CYourProjectApp(); } GLDEF_C TInt E32Main() { return EikStart::RunApplication(NewApplication); } #else EXPORT_C CApaApplication* NewApplication(){return new CYourProjectApp;} GLDEF_C TInt E32Dll( TDllReason ){return KErrNone;} #endif [Edit] Step 3: Compile the makefile that generates the application iconIn the third edition, the new map is saved as a regular map and a scalable map. The map file (.bmp) is compiled into an MBM file, and the vector image (. SVG) is compiled into a. MIF file. The bitmap is loaded from the old MBM file, and the zoom icon is loaded from the MIF file. In the third version, the mifconv tool is used to compile bitmap and vector graphs. Currently, this tool cannot be integrated into the makefile compiled by the project, we need a separate makefile to call the mifconv tool to compile graphics resources. This makefile is added to bld. the inf file is called by the gnumakefile tool. Edit icons_aif.mk and copy it to the s60_3rd directory. Here is an example of the icons_aif.mk file. # ==============================================================================# Name : icons_aif.mk# Part of :# Description : This is file for creating .mbm file # Version : ## ============================================================================== ifeq (WINS,$(findstring WINS, $(PLATFORM)))ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/ZelseZDIR=$(EPOCROOT)epoc32/data/zendif TARGETDIR=$(ZDIR)/RESOURCE/APPSICONTARGETFILENAME=$(TARGETDIR)/YourProject.mbm do_nothing :@rem do_nothing MAKMAKE : do_nothing BLD : do_nothing CLEAN : do_nothing LIB : do_nothing CLEANLIB : do_nothing RESOURCE :mifconv$(ICONTARGETFILENAME) /c24,1 ../aif/list_icon.bmp /c24,1 ../aif/context_pane_icon.bmp FREEZE : do_nothing SAVESPACE : do_nothing RELEASABLES :@echo $(ICONTARGETFILENAME) FINAL : do_nothing [Edit] Step 4: edit the bld. inf file[Edit] Version 2// Import the environment variable header file prj_exportsprojectenv.h prj_matrix files yourproject. MMP [Edit] Third Edition// Import the environment variable header file prj_exportsprojectenv.h prj_matrix files // compile the image resource gnumakefile icons_aif.mkyourproject.mmp [Edit] Step 5: Modify the resource file[Edit] Modifying the primary resource fileIn the third version, the main resource file of the application is basically unchanged. The only difference is that you need to add a local structure localisable_app_info to implement the application. The solution is as follows: Add the following code to the header of the resource file: ... // The environment variable header file we defined # include <projectenv. h> // added for SVG-T icon support. # If (_ s60 _> = 203) # include <appinfo. rh> # endif Add the following code to the end of the resource file: #if (__S60__ >= 300) RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info{short_caption = qtn_app_caption_string;caption_and_icon = CAPTION_AND_ICON_INFO{caption = qtn_app_caption_string; number_of_icons = 2; icon_file = "//resource//apps//YourProject.mbm"; };} #endif [Edit] Add an application to register resource filesThe third edition no longer supports AIF files. You must create a file named <yourproject> _ reg. RSS file (with _ reg. RSS is used to register an application, including the UID, startup options, icons, titles, and other Parameter options of the application. Edit yourproject_reg.rss as follows: # Include "yourproject. HRH "# include <appinfo. rh> # include <yourproject. RSG> uid2 region 0x0e9930b5 resource app_registration_info {app_file = "yourproject"; // name of the executable application program: "// resource // apps // yourproject"; localisable_resource_id = region; embeddability = kappnotembeddable; newfile = kappdoesnotsupportnewfile ;} [Edit] Step 6: Modify the project definition file (. MMP)The following lists several necessary changes for the second and third editions. [Edit] Target file type[Edit] Version 2TARGET YourProject.app TARGETTYPE app UID 0x100039CE 0x0E9930B5 TARGETPATH /system/apps/YourProject [Edit] Third EditionTARGET YourProject.exe TARGETTYPE exe UID 0x100039CE 0xE4DC9E88TARGETPATH /system/apps/YourProject In addition to the generated target type, the UID range also changes. For more uid information, seeHttp://www.symbiansigned.com/. [Edit] Resource file[Edit] Version 2RESOURCE YourProject.rss RESOURCE YourProject_caption.rss [Edit] Third EditionSTART RESOURCEYourProject.rssHEADERTARGET YourProject.rscTARGETPATH resource/appsEND //RESOURCE START RESOURCEyourproject_reg.rssTARGET project_reg.rscTARGETPATH /private/10003a3f/appsEND //RESOURCE [Edit] Application information fileThe third edition no longer supports the AIF file. In the. MMP file, remove the AIF file directly. [Edit] Version 2AIF YourProject.aif ../aif projectaif.rss c24 context_pane_icon.bmp context_pane_icon_mask.bmp list_icon.bmp list_icon_mask.bmp [Edit] Third EditionAIF yourproject. AIF ../AIF projectaif. RSS C24 context_pane_icon.bmp context_pane_icon_mask.bmp list_icon.bmp list_icon_mask.bmp In addition, there are some Optional options, such as capability, SecureID, vendorid, and epocstacksize. Generally, no additional settings are required for these options. [Edit] Compile and runAfter completing the above steps, we can go to different project definition file groups and use the command line or vs.2003, carbide and other ides to import the project definition file to compile and generate the target platform code. If you want your application to run smoothly on the device of the third edition, you may need some minor debugging work. |