LZO源代码编译说明



网站:http://www.oberhumer.com/
源代码:http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz
版本:2.09


目录

  1. Windows Visual Studio编译方法


Windows Visual Studio编译方法

Windows Visual Studio需要编译八种模式:

解压缩

lzo-2.09.tar.gz在「QtLzo/3rdparty/souces」当中可以找到,解压缩lzo-2.09.tar.gz以后,会 留下一个lzo-2.09目录。

在平行的目录下:

mkdir lzo
cd lzo

Windows Visual Studio x64 ( Static , Debug )

cmake -G "VIsual Studio 12 Win64" ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_SHARED关闭掉,打开ENABLE_STATIC,按下「Configure」,然后「Generate」。

如此可以产生Visual Studio的sln文件,接下来选择lzo.sln打开Visual Studio,选择「Debug」,并且开始编译。

Windows Visual Studio x64 ( Static , Release )

cmake -G "VIsual Studio 12 Win64" ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_SHARED关闭掉,打开ENABLE_STATIC,按下「Configure」,然后「Generate」。

如此可以产生Visual Studio的sln文件,接下来选择lzo.sln打开Visual Studio,选择「Release」,并且开始编译。

Windows Visual Studio x64 ( DLL , Debug )

cmake -G "VIsual Studio 12 Win64" ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_STATIC关闭掉,打开ENABLE_SHARED,按下「Configure」,然后「Generate」,如此可以产生 Visual Studio的sln文件。

打开「lzo-2.09/include/lzo/lzoconf.h」,在大约220行找到:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1         /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

修改成为:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1 __declspec(dllexport) /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

接下来选择lzo.sln打开Visual Studio,选择「Debug」,并且开始编译。

Windows Visual Studio x64 ( DLL , Release )

cmake -G "VIsual Studio 12 Win64" ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_STATIC关闭掉,打开ENABLE_SHARED,按下「Configure」,然后「Generate」,如此可以产生 Visual Studio的sln文件。

打开「lzo-2.09/include/lzo/lzoconf.h」,在大约220行找到:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1         /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

修改成为:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1 __declspec(dllexport) /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

接下来选择lzo.sln打开Visual Studio,选择「Release」,并且开始编译。

Windows Visual Studio x86 ( Static , Debug )

cmake ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_SHARED关闭掉,打开ENABLE_STATIC,按下「Configure」,然后「Generate」。

如此可以产生Visual Studio的sln文件,接下来选择lzo.sln打开Visual Studio,选择「Debug」,并且开始编译。

Windows Visual Studio x86 ( Static , Release )

cmake ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_SHARED关闭掉,打开ENABLE_STATIC,按下「Configure」,然后「Generate」。

如此可以产生Visual Studio的sln文件,接下来选择lzo.sln打开Visual Studio,选择「Release」,并且开始编译。

Windows Visual Studio x86 ( DLL , Debug )

cmake ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_STATIC关闭掉,打开ENABLE_SHARED,按下「Configure」,然后「Generate」,如此可以产生 Visual Studio的sln文件。

打开「lzo-2.09/include/lzo/lzoconf.h」,在大约220行找到:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1         /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

修改成为:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1 __declspec(dllexport) /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

接下来选择lzo.sln打开Visual Studio,选择「Debug」,并且开始编译。

Windows Visual Studio x86 ( DLL , Release )

cmake ..\lzo-2.09
cd ..
cmake-gui lzo

将ENABLE_STATIC关闭掉,打开ENABLE_SHARED,按下「Configure」,然后「Generate」,如此可以产生 Visual Studio的sln文件。

打开「lzo-2.09/include/lzo/lzoconf.h」,在大约220行找到:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1         /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

修改成为:

/* DLL export information */
#if !defined(__LZO_EXPORT1)
#  define __LZO_EXPORT1 __declspec(dllexport) /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
#  define __LZO_EXPORT2         /*empty*/
#endif

接下来选择lzo.sln打开Visual Studio,选择「Release」,并且开始编译。


Neutrino International Inc. 2001~2015