3 # Copyright (C) 2008 Werner Smekal
5 # Process this file with cmake to produce Makefiles or project files
6 # for your specific compiler tool set
9 # - shared and static library
12 # =======================================================================
14 # =======================================================================
17 # determine compiler name
18 set(COMPILER_LABEL "unknown")
19 if(CMAKE_COMPILER_IS_GNUCC)
20 set(COMPILER_LABEL "gcc")
21 endif(CMAKE_COMPILER_IS_GNUCC)
23 set(COMPILER_LABEL "vc")
26 # information about libharu
30 set(LIBHARU_VERSION ${LIBHARU_MAJOR}.${LIBHARU_MINOR}.${LIBHARU_PATCH})
31 set(LIBHARU_DESCRIPTION "libHaru is a free, cross platform, open source library for generating PDF files.")
32 set(LIBHARU_PACKAGE_NAME "libHaru-${LIBHARU_VERSION}-${COMPILER_LABEL}")
34 # we want cmake version 2.4.8 at least
35 cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR)
37 # Location where the haru cmake build system first looks for cmake modules
38 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
40 # set library name, msvc does not append 'lib' automatically
43 set(CMAKE_DEBUG_POSTFIX "d")
45 set(LIBHARU_NAME ${LIBHARU_NAME}hpdf)
46 set(LIBHARU_NAME_STATIC ${LIBHARU_NAME}s)
48 # =======================================================================
49 # command line options
50 # =======================================================================
51 option(LIBHARU_SHARED "Build shared lib" YES)
52 option(LIBHARU_STATIC "Build static lib" YES)
53 option(LIBHARU_EXAMPLES "Build libharu examples" NO)
54 option(DEVPAK "Create DevPackage" NO)
56 if(DEVPAK AND NOT WIN32)
57 message( STATUS "DevPackage only available for Win32. Set DEVPAK to OFF." )
59 endif(DEVPAK AND NOT WIN32)
60 if(DEVPAK AND LIBHARU_EXAMPLES)
61 message( STATUS "Examples are not build for DevPackage. Set LIBHARU_EXAMPLES to OFF." )
62 set(LIBHARU_EXAMPLES OFF)
63 endif(DEVPAK AND LIBHARU_EXAMPLES)
66 set(LIBHARU_SHARED ON)
67 endif(BUILD_SHARED_LIBS)
69 # =======================================================================
70 # look for headers and libraries
71 # =======================================================================
75 # check zlib availibility
79 include_directories(${ZLIB_INCLUDE_DIR})
80 set(ADDITIONAL_LIBRARIES ${ZLIB_LIBRARIES})
85 # check png availibility
89 include_directories(${PNG_INCLUDE_DIR})
90 add_definitions(${PNG_DEFINITIONS})
91 set(ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} ${PNG_LIBRARIES})
96 # =======================================================================
97 # configure header files, add compiler flags
98 # =======================================================================
99 # add definitions and directories to include
100 #if(CMAKE_COMPILER_IS_GNUCC)
101 # add_definitions("-Wall")
102 #endif(CMAKE_COMPILER_IS_GNUCC)
103 if(MSVC_VERSION GREATER 1399)
104 add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE)
105 endif(MSVC_VERSION GREATER 1399)
106 include_directories(${CMAKE_SOURCE_DIR}/include)
108 # create hpdf_config.h
110 ${CMAKE_SOURCE_DIR}/include/hpdf_config.h.cmake
111 ${CMAKE_BINARY_DIR}/include/hpdf_config.h
113 include_directories(${CMAKE_BINARY_DIR}/include)
115 # create DevPackage file
118 ${CMAKE_SOURCE_DIR}/libharu.DevPackage.cmake
119 ${CMAKE_BINARY_DIR}/libharu.DevPackage
122 # =======================================================================
123 # create library and demos
124 # =======================================================================
125 add_subdirectory(src)
126 add_subdirectory(demo)
128 # =======================================================================
129 # installation configuration
130 # =======================================================================
135 include/hpdf_consts.h
136 include/hpdf_version.h
137 include/hpdf_annotation.h
138 include/hpdf_catalog.h
140 include/hpdf_destination.h
142 include/hpdf_encoder.h
143 include/hpdf_encrypt.h
144 include/hpdf_encryptdict.h
146 include/hpdf_ext_gstate.h
148 include/hpdf_fontdef.h
149 include/hpdf_gstate.h
154 include/hpdf_objects.h
155 include/hpdf_outline.h
157 include/hpdf_page_label.h
158 include/hpdf_streams.h
162 include/hpdf_3dmeasure.h
163 include/hpdf_exdata.h
164 ${CMAKE_BINARY_DIR}/include/hpdf_config.h
167 # install header files
168 install(FILES ${haru_HDRS} DESTINATION include)
170 # install various files
171 install(FILES README CHANGES INSTALL DESTINATION .)
172 install(DIRECTORY doc DESTINATION .)
174 install(DIRECTORY if DESTINATION .)
177 install(FILES ${CMAKE_BINARY_DIR}/libharu.DevPackage DESTINATION .)
179 # =======================================================================
180 # print out some information
181 # =======================================================================
184 # =======================================================================
186 # =======================================================================
187 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${LIBHARU_DESCRIPTION})
188 set(CPACK_PACKAGE_VENDOR "Werner Smekal")
189 set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
190 set(CPACK_PACKAGE_VERSION_MAJOR "${LIBHARU_MAJOR}")
191 set(CPACK_PACKAGE_VERSION_MINOR "${LIBHARU_MINOR}")
192 set(CPACK_PACKAGE_VERSION_PATCH "${LIBHARU_PATCH}")
193 set(CPACK_PACKAGE_FILE_NAME "libHaru-${LIBHARU_VERSION}-${COMPILER_LABEL}")
195 set(CPACK_STRIP_FILES ON)
198 set(CPACK_GENERATOR ZIP)
200 set(CPACK_GENERATOR TGZ)