OSDN Git Service

binding with libharu.
[putex/putex.git] / src / texsourc / lib / libhpdf / demo / CMakeLists.txt
1 # demo/CMakeLists.txt
2 #
3 # Copyright (C) 2008  Werner Smekal
4 #
5 # create demo executables
6
7 if(LIBHARU_EXAMPLES)
8   # =======================================================================
9   # source file names and c flags
10   # =======================================================================
11   set(
12     demos_NAMES
13         character_map
14         encoding_list
15         encryption
16         ext_gstate_demo
17         font_demo
18         image_demo
19         jpeg_demo
20         jpfont_demo
21         line_demo
22         link_annotation
23       make_rawimage
24         outline_demo
25       #outline_demo_jp
26         permission
27         png_demo
28         slide_show_demo
29         text_annotation
30         ttfont_demo
31         ttfont_demo_jp
32   )
33
34   set(
35     demos_with_grid_NAMES
36         arc_demo
37       chfont_demo
38         raw_image_demo
39         text_demo
40         text_demo2
41   )
42
43   # we need to add some definitions for win 32
44   set(DEMO_C_FLAGS)
45   if(WIN32 AND NOT CYGWIN)
46     set(DEMO_C_FLAGS "-D__WIN32__")
47   endif(WIN32 AND NOT CYGWIN)
48
49   # link the examples to the shared library otherwise to the static
50   if(LIBHARU_SHARED)
51     set(_LIBHARU_LIB ${LIBHARU_NAME})
52     if(WIN32 AND NOT CYGWIN)
53       set(DEMO_C_FLAGS "${DEMO_C_FLAGS} -DHPDF_DLL")
54     endif(WIN32 AND NOT CYGWIN)
55   else(LIBHARU_SHARED)
56     set(_LIBHARU_LIB ${LIBHARU_NAME_STATIC})
57   endif(LIBHARU_SHARED)
58   
59   # =======================================================================
60   # create demos
61   # =======================================================================
62   foreach(demo ${demos_NAMES})
63     add_executable(${demo} ${demo}.c)
64     target_link_libraries(${demo} ${_LIBHARU_LIB})
65     if(DEMO_C_FLAGS)
66       set_target_properties(${demo} PROPERTIES COMPILE_FLAGS ${DEMO_C_FLAGS})
67     endif(DEMO_C_FLAGS)
68   endforeach(demo)
69     
70   # some demos need grid_sheet.c compiled in
71   foreach(demo ${demos_with_grid_NAMES})
72     add_executable(${demo} ${demo}.c grid_sheet.c)
73     target_link_libraries(${demo} ${_LIBHARU_LIB})
74     if(DEMO_C_FLAGS)
75       set_target_properties(${demo} PROPERTIES COMPILE_FLAGS ${DEMO_C_FLAGS})
76     endif(DEMO_C_FLAGS)
77   endforeach(demo)
78     
79   # the grid_sheet demo needs extra defines
80   add_executable(grid_sheet grid_sheet.c)
81   target_link_libraries(grid_sheet ${_LIBHARU_LIB})
82   set_target_properties(grid_sheet PROPERTIES COMPILE_FLAGS "${DEMO_C_FLAGS} -DSTAND_ALONE")
83
84   # =======================================================================
85   # install demo source, demo executables and other files
86   # =======================================================================
87   install(
88     TARGETS ${demos_NAMES} ${demos_with_grid_NAMES} grid_sheet
89     DESTINATION demo
90   )
91   foreach(demo ${demos_NAMES} ${demos_with_grid_NAMES} grid_sheet)
92     install(FILES ${demo}.c DESTINATION demo)
93   endforeach(demo)
94
95   # install demo files
96   install(
97     DIRECTORY images mbtext pngsuite rawimage ttfont type1
98     DESTINATION demo
99   )
100 endif(LIBHARU_EXAMPLES)