Skip to content

Instantly share code, notes, and snippets.

@tfwio
Last active August 29, 2015 14:21
Show Gist options
  • Save tfwio/8176bd32c9b933914a0d to your computer and use it in GitHub Desktop.
Save tfwio/8176bd32c9b933914a0d to your computer and use it in GitHub Desktop.
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 1671)
+++ CMakeLists.txt (working copy)
@@ -492,6 +492,7 @@
${PoDoFo_SOURCE_DIR}
${PoDoFo_SOURCE_DIR}/src
${FREETYPE_INCLUDE_DIR}
+ ${OPENSSL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${EXTRA_INCLUDES}
)
Index: src/doc/PdfPainter.cpp
===================================================================
--- src/doc/PdfPainter.cpp (revision 1671)
+++ src/doc/PdfPainter.cpp (working copy)
@@ -1739,8 +1739,8 @@
{
PODOFO_RAISE_LOGIC_IF( !m_pCanvas, "Call SetPage() first before doing drawing operations." );
- // Need more precision for transformation-matrix !!
- std::streamsize oldPrecision = m_oss.precision(clPainterHighPrecision);
+ // Need more precision for transformation-matrix !!
+ std::streamsize oldPrecision = m_oss.precision(clPainterHighPrecision);
m_oss.str("");
m_oss << a << " "
<< b << " "
@@ -1748,11 +1748,29 @@
<< d << " "
<< e << " "
<< f << " cm" << std::endl;
- m_oss.precision(oldPrecision);
+ m_oss.precision(oldPrecision);
m_pCanvas->Append( m_oss.str() );
}
+void PdfPainter::SetTextMatrix( double a, double b, double c, double d, double e, double f )
+{
+ PODOFO_RAISE_LOGIC_IF( !m_pCanvas, "Call SetPage() first before doing drawing operations." );
+
+ // Need more precision for transformation-matrix !!
+ std::streamsize oldPrecision = m_oss.precision(clPainterHighPrecision);
+ m_oss.str("");
+ m_oss << a << " "
+ << b << " "
+ << c << " "
+ << d << " "
+ << e << " "
+ << f << " Tm" << std::endl;
+ m_oss.precision(oldPrecision);
+
+ m_pCanvas->Append( m_oss.str() );
+}
+
void PdfPainter::SetExtGState( PdfExtGState* inGState )
{
PODOFO_RAISE_LOGIC_IF( !m_pCanvas, "Call SetPage() first before doing drawing operations." );
Index: src/doc/PdfPainter.h
===================================================================
--- src/doc/PdfPainter.h (revision 1671)
+++ src/doc/PdfPainter.h (working copy)
@@ -718,6 +718,30 @@
*/
void SetTransformationMatrix( double a, double b, double c, double d, double e, double f );
+ /** Set the text matrix for the current coordinate system
+ * See the operator 'Tm' in PDF.
+ *
+ * The six parameters are a standard `3x3` transformation matrix
+ * where the `3` left parameters are `0 0 1`.
+ *
+ * The operands shall all be numbers, and the initial value for `T` `m` and `T` `lm`
+ * shall be the identity matrix, `[ 1 0 0 1 0 0 ]`. Although the operands
+ * specify a matrix, they shall be passed to Tm as six separate numbers, not
+ * as an array.
+ *
+ * The matrix specified by the operands shall not be concatenated onto the
+ * current text matrix, but shall replace it.
+ *
+ * \param a scale in x direction
+ * \param b rotation
+ * \param c rotation
+ * \param d scale in y direction
+ * \param e translate in x direction
+ * \param f translate in y direction
+ *
+ */
+ void SetTextMatrix( double a, double b, double c, double d, double e, double f );
+
/** Sets a specific PdfExtGState as being active
* \param inGState the specific ExtGState to set
*/
@cls
@echo "This file was generated by cmake-gen.sh"
@echo "...which was provided along with this file."
@echo.
@echo "You should place a version of cmake greater"
@echo "or equal to the version noted below"
@echo "in the corresponding directory and run this script."
@echo.
@echo.
@echo.
@set PKG_ROOT="%~dp0packages"
@echo.
@set PATH="%~dp0tools\cmake-3.2.2-win32-x86\bin"
@echo.
@IF NOT EXIST "%~dp0podofo-Win32" mkdir podofo-Win32
@cd podofo-Win32
@cmake -G "Visual Studio 12 2013" ..\podofo-svn -DWANT_LIB64:BOOL=FALSE -DPODOFO_BUILD_STATIC:BOOL=FALSE -DCMAKE_INCLUDE_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\include;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\include;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\build\native\include;%PKG_ROOT%\libpng.1.5.10.11\build\native\include;%PKG_ROOT%\libtiff.4.0.1.9\build\native\include;%PKG_ROOT%\lua.5.2.2.13\build\native\include;%PKG_ROOT%\cppunit.1.12.1.4\build\native\include;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DCMAKE_LIBRARY_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\Win32\v110\static\Release;%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\Win32\v110\static\Debug;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\lib\v110\Win32\Release\static\cdecl;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Release;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Debug;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\Win32\v110\static\Release;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\Win32\v110\static\Debug;%PKG_ROOT%\libtiff.4.0.1.9\build\native\lib\Release\Win32\v110;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\Win32\Release\v110\static\cdecl;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\Win32\Debug\v110\static\cdecl;%PKG_ROOT%\cppunit.1.12.1.4\build\native\lib\v110\Win32\Release;%PKG_ROOT%\cppunit.1.12.1.4\build\native\lib\v110\Win32\Debug;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\release" -DEXTRA_INCLUDES="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DOPENSSL_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DLIBCRYPTO_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DLIBCRYPTO_LIBRARY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\release\libeay32.lib" -DLIBCRYPTO_LIBRARY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\debug\libeay32.lib" -DSSL_EAY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\debug\ssleay32.lib" -DSSL_EAY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\release\ssleay32.lib" -DFREETYPE_LIBRARY_NAMES_DEBUG=freetype246_D -DFREETYPE_LIBRARY_NAMES_RELEASE=freetype246 -DZLIB_LIBRARY_NAMES_DEBUG=zlibstatic -DCMAKE_INSTALL_PREFIX="%~dp0build" -DZLIB_LIBRARY_NAMES_RELEASE=zlibstaticd
@cd ..
pause
@cls
@echo "This file was generated by cmake-gen.sh"
@echo "...which was provided along with this file."
@echo.
@echo "You should place a version of cmake greater"
@echo "or equal to the version noted below"
@echo "in the corresponding directory and run this script."
@echo.
@echo.
@echo.
@set PKG_ROOT="%~dp0packages"
@echo.
@set PATH="%~dp0tools\cmake-3.2.2-win32-x86\bin"
@echo.
@IF NOT EXIST "%~dp0podofo-x64" mkdir podofo-x64
@cd podofo-x64
@cmake -G "Visual Studio 12 2013" ..\podofo-svn -DWANT_LIB64:BOOL=TRUE -DPODOFO_BUILD_STATIC:BOOL=FALSE -DCMAKE_INCLUDE_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\include;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\include;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\build\native\include;%PKG_ROOT%\libpng.1.5.10.11\build\native\include;%PKG_ROOT%\libtiff.4.0.1.9\build\native\include;%PKG_ROOT%\lua.5.2.2.13\build\native\include;;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DCMAKE_LIBRARY_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\x64\v110\static\Release;%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\x64\v110\static\Debug;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\lib\v110\x64\Release\static\cdecl;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Release;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Debug;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\x64\v110\static\Release;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\x64\v110\static\Debug;%PKG_ROOT%\libtiff.4.0.1.9\build\native\lib\Release\x64\v110;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\x64\Release\v110\static\cdecl;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\x64\Debug\v110\static\cdecl;;;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\release" -DEXTRA_INCLUDES="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DOPENSSL_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DLIBCRYPTO_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DLIBCRYPTO_LIBRARY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\release\libeay32.lib" -DLIBCRYPTO_LIBRARY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\debug\libeay32.lib" -DSSL_EAY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\debug\ssleay32.lib" -DSSL_EAY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\release\ssleay32.lib" -DFREETYPE_LIBRARY_NAMES_DEBUG=freetype246_D -DFREETYPE_LIBRARY_NAMES_RELEASE=freetype246 -DZLIB_LIBRARY_NAMES_DEBUG=zlibstatic -DCMAKE_INSTALL_PREFIX="%~dp0build" -DZLIB_LIBRARY_NAMES_RELEASE=zlibstaticd
@cd ..
pause
@cls
@echo "This file was generated by cmake-gen.sh"
@echo "...which was provided along with this file."
@echo.
@echo "You should place a version of cmake greater"
@echo "or equal to the version noted below"
@echo "in the corresponding directory and run this script."
@echo.
@echo.
@echo.
@set PKG_ROOT="%~dp0packages"
@echo.
@set PATH="%~dp0tools\cmake-3.2.2-win32-x86\bin"
@echo.
@IF NOT EXIST "%~dp0podofo-Win32" mkdir podofo-Win32
@cd podofo-Win32
@cmake -G "Visual Studio 12 2013" ..\podofo-svn -DWANT_LIB64:BOOL=FALSE -DPODOFO_BUILD_STATIC:BOOL=TRUE -DCMAKE_INCLUDE_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\include;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\include;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\build\native\include;%PKG_ROOT%\libpng.1.5.10.11\build\native\include;%PKG_ROOT%\libtiff.4.0.1.9\build\native\include;%PKG_ROOT%\lua.5.2.2.13\build\native\include;%PKG_ROOT%\cppunit.1.12.1.4\build\native\include;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DCMAKE_LIBRARY_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\Win32\v110\static\Release;%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\Win32\v110\static\Debug;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\lib\v110\Win32\Release\static\cdecl;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Release;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Debug;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\Win32\v110\static\Release;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\Win32\v110\static\Debug;%PKG_ROOT%\libtiff.4.0.1.9\build\native\lib\Release\Win32\v110;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\Win32\Release\v110\static\cdecl;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\Win32\Debug\v110\static\cdecl;%PKG_ROOT%\cppunit.1.12.1.4\build\native\lib\v110\Win32\Release;%PKG_ROOT%\cppunit.1.12.1.4\build\native\lib\v110\Win32\Debug;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\release" -DEXTRA_INCLUDES="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DOPENSSL_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DLIBCRYPTO_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\build\native\include" -DLIBCRYPTO_LIBRARY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\release\libeay32.lib" -DLIBCRYPTO_LIBRARY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\debug\libeay32.lib" -DSSL_EAY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\debug\ssleay32.lib" -DSSL_EAY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x86\release\ssleay32.lib" -DFREETYPE_LIBRARY_NAMES_DEBUG=freetype246_D -DFREETYPE_LIBRARY_NAMES_RELEASE=freetype246 -DZLIB_LIBRARY_NAMES_DEBUG=zlibstatic -DCMAKE_INSTALL_PREFIX="%~dp0build" -DZLIB_LIBRARY_NAMES_RELEASE=zlibstaticd
@cd ..
pause
@cls
@echo "This file was generated by cmake-gen.sh"
@echo "...which was provided along with this file."
@echo.
@echo "You should place a version of cmake greater"
@echo "or equal to the version noted below"
@echo "in the corresponding directory and run this script."
@echo.
@echo.
@echo.
@set PKG_ROOT="%~dp0packages"
@echo.
@set PATH="%~dp0tools\cmake-3.2.2-win32-x86\bin"
@echo.
@IF NOT EXIST "%~dp0podofo-x64" mkdir podofo-x64
@cd podofo-x64
@cmake -G "Visual Studio 12 2013" ..\podofo-svn -DWANT_LIB64:BOOL=TRUE -DPODOFO_BUILD_STATIC:BOOL=TRUE -DCMAKE_INCLUDE_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\include;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\include;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\build\native\include;%PKG_ROOT%\libpng.1.5.10.11\build\native\include;%PKG_ROOT%\libtiff.4.0.1.9\build\native\include;%PKG_ROOT%\lua.5.2.2.13\build\native\include;;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DCMAKE_LIBRARY_PATH="%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\x64\v110\static\Release;%PKG_ROOT%\freetype.2.4.2.1\build\native\lib\x64\v110\static\Debug;%PKG_ROOT%\libjpeg.9.0.1.3\build\native\lib\v110\x64\Release\static\cdecl;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Release;%PKG_ROOT%\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8\lib\native\v120\windesktop\msvcstl\static\rt-dyn\Win32\Debug;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\x64\v110\static\Release;%PKG_ROOT%\libpng.1.5.10.11\build\native\lib\x64\v110\static\Debug;%PKG_ROOT%\libtiff.4.0.1.9\build\native\lib\Release\x64\v110;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\x64\Release\v110\static\cdecl;%PKG_ROOT%\lua.5.2.2.13\build\native\lib\x64\Debug\v110\static\cdecl;;;%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\release" -DEXTRA_INCLUDES="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DOPENSSL_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DLIBCRYPTO_INCLUDE_DIR="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\build\native\include" -DLIBCRYPTO_LIBRARY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\release\libeay32.lib" -DLIBCRYPTO_LIBRARY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\debug\libeay32.lib" -DSSL_EAY_DEBUG="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\debug\ssleay32.lib" -DSSL_EAY_RELEASE="%PKG_ROOT%\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0\lib\native\v120\windesktop\msvcstl\static\rt-dyn\x64\release\ssleay32.lib" -DFREETYPE_LIBRARY_NAMES_DEBUG=freetype246_D -DFREETYPE_LIBRARY_NAMES_RELEASE=freetype246 -DZLIB_LIBRARY_NAMES_DEBUG=zlibstatic -DCMAKE_INSTALL_PREFIX="%~dp0build" -DZLIB_LIBRARY_NAMES_RELEASE=zlibstaticd
@cd ..
pause
#!/bin/sh
# date: 20150525
# author: tfw
# description:
#
# this script is designed to save you a little time
# when it comes to building podofo under VisualStudio.
#
# Its a good starting point at the least,
# though a Nuget package would be nice some day.
#
# This particular script generates `cmake-gen.cmd`
# which when executed (after providing requisites)
# runs cmake, succeeding in generation of
# a working VisualStudio project.
#
# By default we generate setting `TGT_ARCH=Win32`.
# Call as follows for x64 targets:
#
# Examples
#
# cmake-gen.sh [option]
#
# cmake-gen.sh
# TGT_ARCH=x64 cmake-gen.sh
#
# cmake-gen.sh shared
# TGT_ARCH=x64 cmake-gen.sh shared
#
# SUPPLIED
#
# - cppunit
# - libjpeg
# - libopenssl + libcrypto
# - libpng
# - libtiff
# - zlib
#
# NOT SUPPLIED
#
# - boost
# - libIDN (AES-256 Encryption: for PDF-1.6 + PDF-1.7 spec)
# - if you want libIDN, clone, compile and link...
# 'https://github.com/Distrotech/libidn.git'
# into the cmake generation process.
# - Lua (isn't configured)
#
# -----------------------------------------------------------------
#
# By default the script will script producing a static library *.lib.
# run this script with 1 arg: 'shared', for dll script generation.
#
# -----------------------------------------------------------------
#
# This script has worked under VisualStudio 2013 Express
#
# -----------------------------------------------------------------
PROJ_ROOT=`cygpath -w $PWD`
PROJECT_NAME=podofo
PROJECT_OUT=${PROJECT_NAME}-Win32
OUT_FILE=cmake-gen.cmd
# Variable for targeting Win32 or Win64
# + anoter CMAKE specific variable.
if [[ "x${TGT_ARCH}" = "xx64" ]]; then
TGT_ARCH=x64
WANT64=TRUE
PROJECT_OUT=${PROJECT_NAME}-x64
else
TGT_ARCH=Win32
WANT64=FALSE
fi
if [[ "x${1}" = "xshared" ]]; then BUILD_STATIC=FALSE; else BUILD_STATIC=TRUE; fi
get_nuget ()
{
if [[ ! -f tools/nuget.exe ]]; then
curl -L https://nuget.org/nuget.exe -otools/nuget.exe
fi
}
if [[ "x$1" = "xget-nuget" ]]; then get_nuget; exit 0; fi
do_nuget ()
{
tools/nuget.exe install ${1} -Version ${2} -OutputDirectory packages
}
install_nuget_packages ()
{
if [[ -f tools/nuget.exe ]]; then
do_nuget cppunit 1.12.1.4
do_nuget freetype 2.4.2.1
do_nuget libjpeg 9.0.1.3
do_nuget libpng 1.5.10.11
do_nuget libtiff 4.0.1.9
do_nuget lua 5.2.2.13
# includes a static version of zlib
do_nuget openssl.v120.windesktop.msvcstl.static.rt-dyn 1.0.2.0
fi
}
if [[ "x$1" = "xnuget" ]]; then install_nuget_packages; exit 0; fi
show_help ()
{
cat <<EOF
Command Arguments
=================
Example
-----------------
cmake-get.sh [shared|copy-rel|get-nuget|nuget|write-nuget|check|help]
- shared
Generate windows-command for executing cmake for shared-dll targets.
- copy-rel
Copy files to './files directory'
- get-nuget
Download nuget packages
- nuget
Download nuget tool.
- write-nuget
Write nuget windows-command for downloading packages.
- check
Check that all required packages are present.
- help
Show this message.
EOF
}
if [[ "x$1" = "xhelp" ]]; then show_help; exit 0; fi
make_nuget_cmd ()
{
echo ":: hi there
@tools\\nuget.exe install cppunit -Version 1.12.1.4 -OutputDirectory packages
@tools\\nuget.exe install freetype -Version 2.4.2.1 -OutputDirectory packages
@tools\\nuget.exe install libjpeg -Version 9.0.1.3 -OutputDirectory packages
@tools\\nuget.exe install libpng -Version 1.5.10.11 -OutputDirectory packages
@tools\\nuget.exe install libtiff -Version 4.0.1.9 -OutputDirectory packages
@tools\\nuget.exe install lua -Version 5.2.2.13 -OutputDirectory packages
:: the following installes a static zlib dependency
@tools\\nuget.exe install openssl.v120.windesktop.msvcstl.static.rt-dyn -Version 1.0.2.0 -OutputDirectory packages
pause" > "do-nuget.cmd"
}
if [[ "x$1" = "xwrite-nuget" ]]; then make_nuget_cmd; exit 0; fi
# $1=NAME
# $2=PATH
function check_path ()
{
NOT_FOUND=
if [[ ! -d "${2}" ]]; then NOT_FOUND="NOT "; fi
echo "- ${NOT_FOUND}FOUND: $1"
}
function init_vars ()
{
if [[ -z "${1}" ]]; then
pkg_bas="${PROJ_ROOT}\\packages"
else
pkg_bas="${1}"
fi
# :: cppunit.lib
# we ignore these packages when targeting x64
if [[ "x${TGT_ARCH}" = "xWin32" ]]; then
cpu_bas="${pkg_bas}\\cppunit.1.12.1.4"
cpu_inc="${cpu_bas}\\build\\native\\include"
cpu_lib="${cpu_bas}\\build\\native\\lib\\v110\\Win32\\Release"
cpu_lid="${cpu_bas}\\build\\native\\lib\\v110\\Win32\\Debug"
fi
# :: static freetype246.lib
ft2_bas="${pkg_bas}\\freetype.2.4.2.1"
ft2_inc="${ft2_bas}\\build\\native\\include"
ft2_lib="${ft2_bas}\\build\\native\\lib\\${TGT_ARCH}\\v110\\static\\Release"
ft2_lid="${ft2_bas}\\build\\native\\lib\\${TGT_ARCH}\\v110\\static\\Debug"
# :: static jpeg.lib
jpg_bas="${pkg_bas}\\libjpeg.9.0.1.3\\build\\native"
jpg_inc="${jpg_bas}\\include"
jpg_lib="${jpg_bas}\\lib\\v110\\${TGT_ARCH}\\Release\\static\\cdecl"
# :: static libtiff.lib
png_bas="${pkg_bas}\\libpng.1.5.10.11"
png_inc="${png_bas}\\build\\native\\include"
png_lib="${png_bas}\\build\\native\\lib\\${TGT_ARCH}\\v110\\static\\Release"
png_lid="${png_bas}\\build\\native\\lib\\${TGT_ARCH}\\v110\\static\\Debug"
# :: static libtiff.lib
tif_bas="${pkg_bas}\\libtiff.4.0.1.9"
tif_inc="${tif_bas}\\build\\native\\include"
tif_lib="${tif_bas}\\build\\native\\lib\\Release\\${TGT_ARCH}\\v110"
# :: static liblua-static.lib (->library) luac-static (->compiler)
lua_bas="${pkg_bas}\\lua.5.2.2.13"
lua_inc="${lua_bas}\\build\\native\\include"
lua_lib="${lua_bas}\\build\\native\\lib\\${TGT_ARCH}\\Release\\v110\\static\\cdecl"
lua_lid="${lua_bas}\\build\\native\\lib\\${TGT_ARCH}\\Debug\\v110\\static\\cdecl"
# :: libeay32.lib ssleay32.lib
# openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x86.1.0.2.0
# ssl_bas="${pkg_bas}\\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x86.1.0.2.0"
# ssl_inc="${ssl_bas}\\build\\native\\include"
# ssl_lib="${ssl_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\dyn\\rt-dyn\\x86\\release"
# ssl_lid="${ssl_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\dyn\\rt-dyn\\x86\\debug"
# :: libeay32.lib ssleay32.lib
if [[ "x${TGT_ARCH}" = "xWin32" ]]; then
ssl_bas="${pkg_bas}\\openssl.v120.windesktop.msvcstl.static.rt-dyn.x86.1.0.2.0"
ssl_inc="${ssl_bas}\\build\\native\\include"
ssl_lib="${ssl_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\static\\rt-dyn\\x86\\release"
ssl_lid="${ssl_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\static\\rt-dyn\\x86\\debug"
else
ssl_bas="${pkg_bas}\\openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x64.1.0.2.0"
ssl_inc="${ssl_bas}\\build\\native\\include"
ssl_lib="${ssl_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\static\\rt-dyn\\x64\\release"
ssl_lid="${ssl_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\static\\rt-dyn\\x64\\debug"
fi
#
ssl_rll="${ssl_lib}\\ssleay32.lib"
ssl_dll="${ssl_lid}\\ssleay32.lib"
ssc_rll="${ssl_lib}\\libeay32.lib"
ssc_dll="${ssl_lid}\\libeay32.lib"
# :: static zlibstatic.lib
# :: static zlibstaticd.lib
zlb_bas="${pkg_bas}\\zlib.v120.windesktop.msvcstl.static.rt-dyn.1.2.8.8"
zlb_inc="${zlb_bas}\\build\\native\\include"
zlb_lib="${zlb_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\static\\rt-dyn\\Win32\\Release"
zlb_lid="${zlb_bas}\\lib\\native\\v120\\windesktop\\msvcstl\\static\\rt-dyn\\Win32\\Debug"
}
# using actual paths for the following check(s)
pkg_base="${PROJ_ROOT}\\packages"
init_vars "${pkg_base}"
if [[ "x$1" = "xcheck" ]]; then
echo "--- checking include-dirs ---"
check_path "POOP: (yes, this is supposed to fail)" "poop"
check_path FreeType2 "${ft2_inc}"
check_path FreeType2-lib "${ft2_lib}"
check_path JPG "${jpg_inc}"
check_path "JPG-lib (directory)" "${jpg_lib}"
check_path PNG "${png_inc}"
check_path PNG-lib "${png_lib}"
check_path TIFF "${tif_inc}"
check_path "TIFF-lib" "${tif_lib}"
check_path ZLIB "${zlb_inc}"
check_path LUA "${lua_inc}"
check_path CPPUNIT "${cpu_inc}"
check_path OpenSSL "${ssl_inc}"
check_path "POOP: (yes, this is supposed to fail)" "poop"
echo "--- done checking ---"
exit 0
# tpl_bas="${pkg_bas}\\package-template-0.0.0.0"
# tpl_inc="${tpl_bas}"
# tpl_lib="${tpl_bas}"
# tpl_lid="${tpl_bas}"
fi
function rel_targets ()
{
if [ ! -d files ]; then mkdir files; fi
# cp packages/openssl.v120.windesktop.msvcstl.dyn.rt-dyn.x86.1.0.2.0/lib/native/v120/windesktop/msvcstl/dyn/rt-dyn/x86/release/*.dll ./files/.
cp packages/libtiff.redist.4.0.1.9/build/native/bin/Release/Win32/v110/*.dll ./files/.
cp packages/zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8/lib/native/v120/windesktop/msvcstl/dyn/rt-dyn/Win32/Release/*.dll ./files/.
cp ${PROJECT_OUT}/examples/*/Release/*.exe ./files/.
cp ${PROJECT_OUT}/tools/*/Release/*.exe ./files/.
}
if [ "x${1}" = "xcopy-rel" ]; then rel_targets; exit 0; fi;
PROJ_WORK="${PROJ_ROOT}\\${PROJECT_OUT}"
if [[ -d "${PROJ_ROOT}\\${PROJECT_OUT}" ]]; then rm -drf "${PROJ_ROOT}\\${PROJECT_OUT}"; fi
# if [[ ! -d "${PROJ_ROOT}\\podofo" ]]; then mkdir -p "${PROJ_ROOT}\\podofo"; fi
# if [[ ! -d "${PROJ_ROOT}\\podofo" ]]; then mkdir -p "${PROJ_ROOT}\\podofo"; fi
PROJ_SRC="${PROJ_ROOT}\\podofo-svn"
# Set variables to use Windows-style %VARS% in generation
# of a windows-shell command-script.
init_vars "%PKG_ROOT%"
echo "@cls
@echo \"This file was generated by cmake-gen.sh\"
@echo \"...which was provided along with this file.\"
@echo.
@echo \"You should place a version of cmake greater\"
@echo \"or equal to the version noted below\"
@echo \"in the corresponding directory and run this script.\"
@echo.
@echo.
@echo.
@set PKG_ROOT=\"%~dp0packages\"
@echo.
@set PATH=\"%~dp0tools\\cmake-3.2.2-win32-x86\\bin\"
@echo.
@IF NOT EXIST \"%~dp0${PROJECT_OUT}\" mkdir ${PROJECT_OUT}" > ${OUT_FILE}
# enter .\\podofo (visual studio solution) directory
# echo "@cd ${PROJ_WORK}" >> ${OUT_FILE}
echo "@cd ${PROJECT_OUT}" >> ${OUT_FILE}
# alternatively: cmake -G "Visual Studio 9 2008" \
# alternatively: cmake -G "Visual Studio 10 2010" \
# alternatively: cmake -G "Visual Studio 11 2012" \
# alternatively: cmake -G "Visual Studio 12 2013" \
# alternatively: cmake -G "Visual Studio 14 2015" \
# alternatively: cmake -G "NMake Makefiles" \
echo "@cmake -G \"Visual Studio 12 2013\" \
..\\podofo-svn \
-DWANT_LIB64:BOOL=${WANT64} \
-DPODOFO_BUILD_STATIC:BOOL=${BUILD_STATIC} \
-DCMAKE_INCLUDE_PATH=\"${ft2_inc};${jpg_inc};${zlb_inc};${png_inc};${tif_inc};${lua_inc};${cpu_inc};${ssl_inc}\" \
-DCMAKE_LIBRARY_PATH=\"${ft2_lib};${ft2_lid};${jpg_lib};${zlb_lib};${zlb_lid};${png_lib};${png_lid};${tif_lib};${lua_lib};${lua_lid};${cpu_lib};${cpu_lid};${ssl_lib}\" \
-DEXTRA_INCLUDES=\"${ssl_inc}\" \
-DOPENSSL_INCLUDE_DIR=\"${ssl_inc}\" \
-DLIBCRYPTO_INCLUDE_DIR=\"${ssl_inc}\" \
-DLIBCRYPTO_LIBRARY_RELEASE=\"${ssc_rll}\" \
-DLIBCRYPTO_LIBRARY_DEBUG=\"${ssc_dll}\" \
-DSSL_EAY_DEBUG=\"${ssl_dll}\" \
-DSSL_EAY_RELEASE=\"${ssl_rll}\" \
-DFREETYPE_LIBRARY_NAMES_DEBUG=freetype246_D \
-DFREETYPE_LIBRARY_NAMES_RELEASE=freetype246 \
-DZLIB_LIBRARY_NAMES_DEBUG=zlibstatic \
-DCMAKE_INSTALL_PREFIX=\"%~dp0build\" \
-DZLIB_LIBRARY_NAMES_RELEASE=zlibstaticd" >> ${OUT_FILE}
echo "@cd .." >> ${OUT_FILE}
echo "pause" >> ${OUT_FILE}
echo the following has been written to ${OUT_FILE}
cat ${OUT_FILE}
:: hi there
@tools\nuget.exe install cppunit -Version 1.12.1.4 -OutputDirectory packages
@tools\nuget.exe install freetype -Version 2.4.2.1 -OutputDirectory packages
@tools\nuget.exe install libjpeg -Version 9.0.1.3 -OutputDirectory packages
@tools\nuget.exe install libpng -Version 1.5.10.11 -OutputDirectory packages
@tools\nuget.exe install libtiff -Version 4.0.1.9 -OutputDirectory packages
@tools\nuget.exe install lua -Version 5.2.2.13 -OutputDirectory packages
:: the following installes a static zlib dependency
@tools\nuget.exe install openssl.v120.windesktop.msvcstl.static.rt-dyn -Version 1.0.2.0 -OutputDirectory packages
pause
:: do_patch.bat
cd podofo-svn
svn patch "../00 CMakeLists.txt.patch" .
:: svn patch "../01 PdfPatiner-SetTextMatrix.patch" .
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment