@@ -57,7 +57,6 @@ if (HELP)
57
57
# list of figures
58
58
list (APPEND help_figures
59
59
figures/first_start.png
60
- figures/gtkhtml3-vs-mozembed.png
61
60
figures/interface_biblepane-options .png
62
61
figures/interface_biblepane.png
63
62
figures/interface_commentarypane.png
@@ -81,7 +80,6 @@ if (HELP)
81
80
figures/preferences_general-biblesync.png
82
81
figures/preferences_modules-misc.png
83
82
figures/preferences_modules-parallel.png
84
- figures/preferences.png
85
83
figures/search_search.png
86
84
figures/studypad.png
87
85
figures/sword3.png
@@ -93,7 +91,8 @@ if (HELP)
93
91
figures/xiphos-trail-icon.png
94
92
)
95
93
96
- add_custom_target (handbook) # help is a reserved keyword
94
+ # we use 'mhelp' (mallard help) as 'help' is a CMake reserved keyword
95
+ add_custom_target (mhelp)
97
96
98
97
# read languages from LINGUAS
99
98
file (READ ${CMAKE_CURRENT_SOURCE_DIR} /HELP_LINGUAS linguas)
@@ -112,7 +111,7 @@ if (HELP)
112
111
add_custom_target (help-C-pages
113
112
DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /C/pages.timestamp
114
113
)
115
- add_dependencies (handbook help-C-pages)
114
+ add_dependencies (mhelp help-C-pages)
116
115
117
116
# 2. create translated pages for all other languages than C
118
117
foreach (lang ${help_locales} )
@@ -162,7 +161,7 @@ if (HELP)
162
161
DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /pages.timestamp
163
162
)
164
163
165
- add_dependencies (handbook help-${lang} -pages)
164
+ add_dependencies (mhelp help-${lang} -pages)
166
165
167
166
endforeach (lang)
168
167
@@ -181,7 +180,7 @@ if (HELP)
181
180
DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /validate.txt
182
181
)
183
182
184
- add_dependencies (handbook validate-${lang} -pages)
183
+ add_dependencies (mhelp validate-${lang} -pages)
185
184
186
185
endforeach (lang)
187
186
@@ -222,7 +221,7 @@ if (HELP)
222
221
foreach (page ${help_pages} )
223
222
list (APPEND pot_pages ${CMAKE_CURRENT_BINARY_DIR} /C/${page} )
224
223
endforeach (page)
225
- add_custom_target (help_pot
224
+ add_custom_target (mhelp_pot
226
225
COMMAND ${ITSTOOL} -o ${help_pot} ${pot_pages}
227
226
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
228
227
COMMENT "Updating help pot file."
@@ -231,7 +230,7 @@ if (HELP)
231
230
# target for updating a given .po file
232
231
set (help_po_update_all echo)
233
232
foreach (lang ${help_locales} )
234
- add_custom_target (help_ ${lang} .po
233
+ add_custom_target (mhelp_ ${lang} .po
235
234
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --update --verbose ${lang} .po ${help_pot}
236
235
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /${lang}
237
236
COMMENT "Updating ${lang} .po file"
@@ -241,7 +240,7 @@ if (HELP)
241
240
endforeach ()
242
241
243
242
# target for updating all po files
244
- add_custom_target (help_po
243
+ add_custom_target (mhelp_po
245
244
COMMAND ${help_po_update_all}
246
245
VERBATIM
247
246
)
@@ -284,11 +283,11 @@ if (HELP)
284
283
COMMENT "Generating '${lang} ' ePub Help file"
285
284
)
286
285
287
- add_custom_target (${lang} -epub-help
286
+ add_custom_target (mhelp-epub- ${lang}
288
287
DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${PROJECT_NAME} -${lang} .epub
289
288
)
290
289
291
- add_dependencies (handbook ${lang} -epub-help )
290
+ add_dependencies (mhelp mhelp-epub- ${lang} )
292
291
293
292
# install ePub file
294
293
install (FILES
@@ -313,21 +312,20 @@ if (HELP)
313
312
list (APPEND mallard_pages ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${page} )
314
313
endforeach (page)
315
314
316
- # use a custom css (specify font size, hide footer..)
317
- set (custom_css ${CMAKE_CURRENT_SOURCE_DIR} /xml/html.css.custom.xsl)
318
315
# convert Mallard pages into html files
319
316
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${lang} /html.timestamp
320
- COMMAND ${YELP_BUILD} html -x ${custom_css} ${mallard_pages}
317
+ COMMAND ${CMAKE_COMMAND} -E make_directory html
318
+ COMMAND ${YELP_BUILD} html -o html ${mallard_pages}
321
319
# make a tarball of all the .html files
322
- COMMAND ${CMAKE_COMMAND} -E tar cvzf xiphos-html-help.tar.gz *. html
320
+ COMMAND ${CMAKE_COMMAND} -E tar cvzf xiphos-html-help.tar.gz html
323
321
DEPENDS validate-${lang} -pages
324
322
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang}
325
323
COMMENT "Generating '${lang} ' html files"
326
324
)
327
- add_custom_target (${lang} -html-help
325
+ add_custom_target (mhelp-html- ${lang}
328
326
DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /html.timestamp
329
327
)
330
- add_dependencies (handbook ${lang} -html-help )
328
+ add_dependencies (mhelp mhelp-html- ${lang} )
331
329
332
330
# install HTML files
333
331
install (FILES ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos-html-help.tar.gz
@@ -351,106 +349,52 @@ if (HELP)
351
349
# 2. Error: Anchor undefined:
352
350
# due to missing anchors in index.html
353
351
354
- # generate a .chm file for each <lang>
355
352
foreach (lang ${help_all_langs} )
356
- # Create xiphos.hhp file (PROJECT)
357
- # 1. find the according Microsoft language ID
358
- file (STRINGS win32 /ms-langID ms_langID REGEX "^${lang} [ ]" )
359
- # if empty, default to the en-US langID
360
- if (NOT ms_langID)
361
- set (ms_langID "C 0x0409 English (United States)" )
362
- endif ()
363
- # remove lang, keep only langID and country values
364
- string (LENGTH ${lang} len_lang)
365
- math (EXPR len_lang "${len_lang} + 1" )
366
- string (SUBSTRING ${ms_langID} ${len_lang} -1 MS_LANGUAGE_CODE)
367
-
368
- # 2. set the .chm output file name
369
- set (MS_COMPILED_FILE "xiphos_${lang} .chm" )
353
+ # make a distinct directory
354
+ file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm)
370
355
371
- # 3. set the list of files to compile
372
- foreach (line ${help_pages} )
373
- set (MS_FILES_LIST "${MS_FILES_LIST}${line} \n " )
374
- endforeach ()
375
- foreach (line ${help_figures} )
376
- set (MS_FILES_LIST "${MS_FILES_LIST}${line} \n " )
377
- endforeach ()
378
-
379
- # 4. create HHP file (Project file)
380
- configure_file (${PROJECT_SOURCE_DIR} /mhelp/win32 /xiphos.hhp.in
381
- ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.hhp)
382
-
383
- # Create xiphos.hhc (TOC)
384
- # 1. find MS codepage for lang
385
- file (STRINGS win32 /ms-codepages ms_codepage REGEX "^${lang} [ ]" )
386
- # if codepage unset, default to windows-1252
387
- if (${lang} STREQUAL ${ms_codepage} )
388
- message (WARNING "No codepage set for ${lang} , please add it to the win32/ms-codepages file" )
389
- set (ms_codepage "${lang} windows-1252" )
390
- endif ()
391
- # remove lang
392
- string (LENGTH ${lang} len_lang)
393
- math (EXPR len_lang "${len_lang} + 1" )
394
- string (SUBSTRING ${ms_codepage} ${len_lang} -1 MS_WINDOWS_CODEPAGE)
395
-
396
- # 3. create XSLT file
397
- configure_file (${CMAKE_CURRENT_SOURCE_DIR} /win32 /toc.xsl.in
398
- ${CMAKE_CURRENT_BINARY_DIR} /${lang} /toc.xsl)
399
-
400
- # 4. build HHC file
401
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.hhc
402
- # Create HHC file (TOC)
403
- COMMAND ${XSLTPROC} --html ${CMAKE_CURRENT_BINARY_DIR} /${lang} /toc.xsl ${CMAKE_CURRENT_BINARY_DIR} /${lang} /index.html > ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.hhc
404
- # Compile HTML files
405
- DEPENDS ${lang} -html-help
406
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang}
407
- COMMENT "Generating '${lang} ' Windows HHC (Table of Contents) file"
408
- )
356
+ # list pages to convert
357
+ set (mallard_pages)
358
+ foreach (page ${help_pages} )
359
+ list (APPEND mallard_pages ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${page} )
360
+ endforeach (page)
409
361
410
- # 6. TODO: Create a valid HHK file (Index file)
411
- # here is a workaround:
412
- file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.hhk
413
- "<!DOCTYPE html>"
414
- "<html>"
415
- "<head>"
416
- "<!-- Sitemap 1.0 -->"
417
- "</head><body>"
418
- "<object type=\" text/site properties\" >"
419
- "</object>"
420
- "<ul>"
421
- "</ul>"
422
- "</body></html>"
423
- )
362
+ # use a custom css for generating HTML4 copatible pages
363
+ set (custom_css ${CMAKE_CURRENT_SOURCE_DIR} /xml/html.css.custom.xsl)
424
364
425
- # 7. Build CHM
426
- if (WIN32 AND NOT CMAKE_CROSSCOMPILING )
427
- # pure Windows: building help with HHC.EXE [NOTE: First switch to XSLT]
428
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${MS_COMPILED_FILE}
429
- COMMAND ${HHC_EXE} xiphos.hhp
430
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang}
431
- COMMENT "Generating '${lang} ' Windows© Help file - HHC.EXE"
432
- )
433
- else (WIN32 AND NOT CMAKE_CROSSCOMPILING )
434
- # Linux: building help using the chmcmd utility from Free Pascal
435
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${MS_COMPILED_FILE}
436
- # Compile HTML files
437
- COMMAND ${CHMCMD} xiphos.hhp
438
- COMMAND chmod 644 ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${MS_COMPILED_FILE}
439
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.hhc
440
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang}
365
+ # use a Mallard cache file
366
+ set (cache_cache ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm/cache .xml)
367
+
368
+ # use XSLT to create HtmlHelp files
369
+ set (mal2hh_xslt ${CMAKE_CURRENT_SOURCE_DIR} /xml/mal2hh.xsl)
370
+
371
+ # set the output file name
372
+ set (MS_COMPILED_FILE "xiphos_${lang} .chm" )
373
+
374
+ # Compile the Microsoft Windows Help File (.chm)
375
+ if (WIN32 AND CMAKE_CROSSCOMPILING )
376
+ # Linux: build help with the chmcmd utility (from Free Pascal Compiler)
377
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm/${MS_COMPILED_FILE}
378
+ COMMAND ${YELP_BUILD} cache -o ${cache_cache} ${mallard_pages}
379
+ COMMAND ${YELP_BUILD} html -c ${cache_cache} -x ${custom_css} ${mallard_pages}
380
+ COMMAND ${XSLTPROC} --stringparam htmlhelp.chm "${MS_COMPILED_FILE} " ${mal2hh_xslt} ${cache_cache}
381
+ COMMAND ${CHMCMD} htmlhelp.hhp
382
+ COMMAND chmod 644 ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm/${MS_COMPILED_FILE}
383
+ DEPENDS validate-${lang} -pages
384
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm
441
385
COMMENT "Generating '${lang} ' Windows© Help file - chmcmd"
442
386
)
443
- endif (WIN32 AND NOT CMAKE_CROSSCOMPILING )
387
+ endif (WIN32 AND CMAKE_CROSSCOMPILING )
444
388
445
389
# add target to current target
446
- add_custom_target (${lang} -windows-help
447
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${MS_COMPILED_FILE}
390
+ add_custom_target (mhelp-windows- ${lang}
391
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm/ ${MS_COMPILED_FILE}
448
392
)
449
393
450
- add_dependencies (handbook ${lang} -windows-help )
394
+ add_dependencies (mhelp mhelp-windows- ${lang} )
451
395
452
396
# install MS-Help files
453
- install (FILES ${CMAKE_CURRENT_BINARY_DIR} /${lang} /${MS_COMPILED_FILE}
397
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} /${lang} /chm/ ${MS_COMPILED_FILE}
454
398
DESTINATION ${CMAKE_INSTALL_DATADIR} /help
455
399
COMPONENT data
456
400
)
@@ -468,17 +412,17 @@ if (HELP)
468
412
# convert from ePub to PDF
469
413
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.pdf
470
414
COMMAND ${EBOOK_CONVERT} xiphos-C.epub xiphos.pdf --base-font-size 8 --linearize-tables --chapter //h:h1 --use-auto-toc
471
- DEPENDS ${lang} -epub-help
415
+ DEPENDS mhelp-epub- ${lang}
472
416
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /${lang}
473
417
COMMENT "Generating '${lang} ' PDF file"
474
418
)
475
419
476
420
# add target to current target
477
- add_custom_target (${lang} -pdf-help
421
+ add_custom_target (mhelp-pdf- ${lang}
478
422
DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${lang} /xiphos.pdf
479
423
)
480
424
481
- add_dependencies (handbook ${lang} -pdf-help )
425
+ add_dependencies (mhelp mhelp-pdf- ${lang} )
482
426
483
427
# install PDF file
484
428
install (FILES
@@ -489,6 +433,6 @@ if (HELP)
489
433
490
434
endif (PDFHELP)
491
435
492
- add_dependencies (xiphos handbook )
436
+ add_dependencies (xiphos mhelp )
493
437
494
438
endif (HELP)
0 commit comments