POP Article V2.0 设为主页
收藏本站
首 页交流论坛留 言
您现在的位置:首 页 >> 数据库编程 >> 编程技术 >> 查看文章
Building SQLite3 with Visual Studio 2005 (1)
作者:tamsyn  来源:www.sqlite.com.cn  时间:2008-4-7  【 字体: 】 〖 双击滚屏 〗
Author: Rajinder Yadav
Date: Nov 24, 2007

Revised: Jan 12, 2008

I would like to thank George Rhoten and Roberto Padovani for taking the time to provide their feedback!

George Rhoten an ICU Developer gave me great feedback for making some corrections in my original article. As a result some project settings have been removed. He also suggests that the project setting for the ICU Library doesn't need to be changed, and one can simply tell the SQLite project where to find the libs. If you plan to keep up with the various ICU changes, then follow his advice.

I did things the way I did, because most likely you will download the source for ICU and SQLite so that your own project can use the SQLite database (I have a personal project that is using SQLite source before ICU was added as a requirement). Chances are slim you will keep updating the source for SQLite3 or ICU and risk your own project from breaking or have changes in these project introduce a bug in your project. Also you will not have to find and copy over the DLLs in order to be able to run your project's exe since my setup places all the DLLs into the same bin folder. Forgetting to copy over updated DLLs can be a source of needless debugging when things don't work right. The location for the bin and lib folders can be easily changed by making the changes to the environment variables.

Roberto Padovani provided me with some feedback for those using Visual C++ Express. If you plan to go this route he suggests you do these steps:

  1. download and install VC++ Express (free)
  2. download and install Microsoft Platform SDK (PSDK) (the Windows Server 2003 is ok for windows XP)
  3. setup the options in VC++ Express so that it knows in which directory the PSDK stored the .lib files
  4. follow your tutorial, plus adding the advapi32.lib in order to be able to build iuc*

(*) I do not use Visual Studio Express, so I am not the right person to ask for help on using this edition or getting setup. That's a topic outside the scope of this article.


The building of SQLite has gotten a bit more involved. You not only have to download the SQLite source code but also the ICU Unicode Library source code. There are many build steps outlined on the SQLite.org wiki, but I am not sure if they all have kept up to the changes that have been going on? As a result this guide was produced to tie any loose ends that I found seem to be missing from the various wiki pages. If you find errors, typos or omission please let me know so that I may keep this Guide up to date!

Step 1
If you haven't already done so you will need to download the latest SQLite source code from: http://sqlite.org. Go to the SQLite project website and click on the "Download" link. From there scroll down to Precompiled Binaries For Windows and download the package for the DLL binary with TCL binding (sqlitedll-3_5_4.zip at the time of writing). We will need to get the definition file sqlite3.def which is required to build the SQLite3 DLL.

I have no idea why the project team doesn't add this file to the source code download? If you plan to make a static library, you don't need to do this step.


Step 2
Next you will need to download the SQLite3 source code. Scroll down to the source code area and download the zipped file which contains the preprocessed C code. At the time of writing, the file is called sqlite-source-3_5_4.zip


Step 3
Before you can build the SQLite project you will also need to download the ICU Unicode Library. Go to the, "International Components for Unicode" project website at: http://icu-project.org/index.html

Click on the download link and download the latest "Official Release" source code in zipped format for the Windows platform. At the time of writting the latest file is icu4c-3_8_1-src.zip


Step 4
At this point you should have the following 3 files, the names will be slightly different for future release versions.

Now create a project directory, for the purpose of this article, I am going to create a folder called, "sqlite3" under, "G:\dev\src\". You can choose another location where the source code will be get extracted.

  • extract the ICU zip file to, "G:\dev\src\"

  • extract both SQLite3 zip files to "G:\dev\src\sqlite3"

  • create folder "G:\dev\src\build"

At this point your project folder hierarchy should be similar to:

We have one final clean up to do, and that is to delete "sqlite3.dll" from the location, "G:\dev\src\sqlite3\"

Note let's take a look at the Environment variables section...

Step 5
Now we are ready to set up SQLite project build environment variable =) Once you have done this go to Windows menu and right click on, "My Computer" and select properties.

This will bring up the, "System Properties" dialog box, and you will want to click on the, "Environment Variables" button.

From the, "Environment Variables" dialog box, click on the new button under the "User" section.

In the New User variable dialog box, type in "SQLite3_Project" for the var name, and for the values type in, "G:\dev\src" Click OK and close all the dialog opened dialog boxes.

You will need to add one more environment variable, "BuildDir" with the value of "G:\dev\src\build"

The next section takes a look at the ICU project settings...

浏览次数:   【 打 印 】【 关 闭
上一篇:使用 python 开发 Web Service (2)
下一篇:Building SQLite3 with Visual Studio 2005 (2)
 论坛登陆
用户名:
密  码:
验证码: 
Cookie 选项:
正常登陆 隐身登陆
   
没有注册?
 文章搜索
 推荐文章
 酷站推荐
 热门文章
 网站统计
关于我们 | 网站地图 | 联系我们 | 网站历史 | 友情链接 | TOP
Copyright© 2006 Sqlite中文社区  程序开发: mistletoe  站长: 林轩 陈文成