sfntly is dependent on several external packages.
You can download the package yourself or extract the one from ext/redist
. The package needs to be extracted to ext and rename/symbolic link to gtest
.
sfntly C++ port had been tested with gTest 1.6.0.
ICU
For Linux, default ICU headers in system will be used. Linux users please make sure you have dev packages for ICU. For example, you can run sudo apt-get install libicu-dev
in Ubuntu and see if the required library is installed.
For Windows, download from http://site.icu-project.org/download or extract the one from ext/redist
. You can also provide your own ICU package. However, you need to alter the include path, library path, and provide icudt.dll
.
Tested with ICU 4.6.1 binary release.
For Mac users, please download ICU source tarball from http://site.icu-project.org/download and install according to ICU documents.
Clone the Git repository from https://github.com/googlei18n/sfntly.
Let's assume your folder for sfntly is d:\src\sfntly
.
If you don't have cmake installed, extract the cmake-XXX.zip into d:\src\sfntly\cpp\ext\cmake
removing the “-XXX” part. The extracted binary should be in d:\src\sfntly\cpp\ext\cmake\bin\cmake.exe
.
Extract gtest-XXX.zip into d:\src\sfntly\cpp\ext\gtest
removing the “-XXX” part.
Extract icu4c-XXX.zip into d:\src\sfntly\cpp\ext\icu
removing the “-XXX” part.
Run the following commands to create the Visual Studio solution files:
d: cd d:\src\sfntly\cpp md build cd build ..\ext\cmake\bin\cmake ..
You should see sfntly.sln
in d:\src\sfntly\cpp\build
.
ext\data
directory: copy the test fonts from d:\src\sfntly\cpp\data\ext\
to d:\src\sfntly\cpp\build\bin\Debug
.d:\src\sfntly\cpp\ext\icu\bin
to the system path).Visual Studio 2008 and 2010 support command line building, therefore you dont need the IDE to build the project.
For Visual Studio 2008 (assume its installed at c:\vs08
)
cd d:\src\sfntly\cpp\build ..\ext\cmake\bin\cmake .. -G "Visual Studio 9 2008" c:\vs08\common7\tools\vsvars32.bat vcbuild sfntly.sln
We invoke the cmake with -G
to make sure Visual Studio 2008 solution/project files are generated. You can also use devenv sfntly.sln /build
to build the solution instead of using vcbuild
.
There are subtle differences between devenv
and vcbuild
. Please refer to your Visual Studio manual for more details.
For Visual Studio 2010 (assume its installed at c:\vs10
)
cd d:\src\sfntly\cpp\build ..\ext\cmake\bin\cmake .. -G "Visual Studio 10" c:\vs10\common7\tools\vsvars32.bat msbuild sfntly.sln
If you install both Visual Studio 2008 and 2010 on your system, you cant run the scripts above in the same Command Prompt window. vsvars32.bat
assumes that it is run from a clean Command Prompt.
cd
<sfntly dir>mkdir build
cd build
cmake ..
make
This is not recommended. Please use out-of-source whenever possible.
cd
<sfntly dir>cmake .
make
Change the cmake
command line to
CC=clang CXX=clang++ cmake ..
The generated Makefile will use clang. Please note that sfntly uses a lot of advanced C++ semantics that might not be understood or compiled correctly by earlier versions of clang (2.8 and before).
sfntly is tested to compile and run correctly on clang 3.0 (trunk 135314). clang 2.9 might work but unfortunately we dont have the resource to test it.
Currently Debug builds are set as default. To build Release builds, you can either modify the CMakeList.txt
, or set environment variable CMAKE_BUILD_TYPE
to Release
before invoking cmake
.
Windows users can just switch the configuration in Visual Studio.
A program named unit_test
will be generated after a full compilation. It expects fonts in data/ext
to be in the same directory it resides to execute the unit tests. Windows users also needs to copy icudt.dll
and icuuc.dll
to that directory.