File: CMakeLists.txt

package info (click to toggle)
khtml 5.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,940 kB
  • sloc: cpp: 206,281; java: 4,060; ansic: 2,829; perl: 2,313; yacc: 1,497; python: 339; sh: 141; xml: 37; makefile: 7
file content (827 lines) | stat: -rw-r--r-- 24,820 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
kde_enable_exceptions()

find_package(OpenSSL)
set_package_properties(OpenSSL PROPERTIES DESCRIPTION "Support for secure network communications (SSL and TLS)"
                       URL "http://openssl.org"
                       TYPE RECOMMENDED
                       PURPOSE "KDE uses OpenSSL for the bulk of secure communications, including secure web browsing via HTTPS"
                      )
if(OPENSSL_FOUND)
   set(KSSL_HAVE_SSL 1)
   include_directories(${OPENSSL_INCLUDE_DIR})
endif()

configure_file(config-khtml.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-khtml.h )

set(khtmlgraphics_STAT_SRCS
  platform/graphics/AffineTransform.cpp
  platform/graphics/FloatPoint.cpp
  platform/graphics/FloatRect.cpp
  platform/graphics/FloatSize.cpp
  platform/graphics/IntRect.cpp
  platform/graphics/Path.cpp
  platform/graphics/GraphicsTypes.cpp
  platform/graphics/PathTraversalState.cpp
  #platform/graphics/Image.cpp
  #platform/MIMETypeRegistry.cpp
  platform/graphics/qt/AffineTransformQt.cpp
  platform/graphics/qt/FloatPointQt.cpp
  platform/graphics/qt/FloatRectQt.cpp
  platform/graphics/qt/IntPointQt.cpp
  platform/graphics/qt/IntRectQt.cpp
  platform/graphics/qt/IntSizeQt.cpp
  platform/graphics/qt/PathQt.cpp
  #platform/qt/MIMETypeRegistryQt.cpp
)

set(khtmlsvg_STAT_SRCS
  svg/SVGDocument.cpp
  svg/SVGSVGElement.cpp
  svg/SVGStyledLocatableElement.cpp
  svg/SVGLocatable.cpp
  svg/SVGStyledElement.cpp
  svg/SVGStylable.cpp
  svg/SVGElement.cpp
  svg/SVGLength.cpp
  svg/SVGTransformable.cpp
  svg/SVGTransform.cpp
  svg/SVGAngle.cpp
  svg/SVGDocumentExtensions.cpp
  svg/SVGParserUtilities.cpp
  svg/SVGTransformDistance.cpp
  svg/SVGTransformList.cpp
  svg/SVGStringList.cpp
  svg/SVGStyledTransformableElement.cpp
  svg/SVGTests.cpp
  svg/SVGLangSpace.cpp
  svg/SVGExternalResourcesRequired.cpp
  svg/SVGRectElement.cpp
  svg/SVGPreserveAspectRatio.cpp
  svg/SVGFitToViewBox.cpp
  svg/SVGCircleElement.cpp
  svg/SVGStyleElement.cpp
  svg/SVGEllipseElement.cpp
  svg/SVGPointList.cpp
  svg/SVGAnimatedPoints.cpp
  svg/SVGPolyElement.cpp
  svg/SVGPolygonElement.cpp
  svg/SVGPolylineElement.cpp
  svg/SVGAnimatedPathData.cpp
  svg/SVGPathSegArc.cpp
  svg/SVGPathSegClosePath.cpp
  svg/SVGPathSegCurvetoCubic.cpp
  svg/SVGPathSegCurvetoCubicSmooth.cpp
  svg/SVGPathSegCurvetoQuadratic.cpp
  svg/SVGPathSegCurvetoQuadraticSmooth.cpp
  svg/SVGPathSegLineto.cpp
  svg/SVGPathSegLinetoHorizontal.cpp
  svg/SVGPathSegLinetoVertical.cpp
  svg/SVGPathSegList.cpp
  svg/SVGPathSegMoveto.cpp
  svg/SVGPathElement.cpp
  svg/SVGURIReference.cpp
  svg/SVGStopElement.cpp
  svg/SVGGradientElement.cpp
  svg/SVGLinearGradientElement.cpp
  svg/SVGRadialGradientElement.cpp
  svg/SVGDefsElement.cpp
  svg/SVGClipPathElement.cpp
  svg/SVGGElement.cpp
  svg/SVGElementInstance.cpp
  svg/SVGElementInstanceList.cpp
  svg/SVGUseElement.cpp
  svg/SVGLineElement.cpp
  svg/SVGTextPathElement.cpp
  svg/SVGTextContentElement.cpp
  svg/SVGNumberList.cpp
  svg/SVGTextPositioningElement.cpp
  svg/SVGLengthList.cpp
  svg/SVGTextElement.cpp
  svg/SVGAElement.cpp
  svg/SVGScriptElement.cpp
  svg/SVGTitleElement.cpp
  svg/SVGDescElement.cpp
  svg/SVGNames.cpp
  svg/SVGZoomAndPan.cpp
  svg/SVGViewSpec.cpp
  svg/SVGTSpanElement.cpp
  svg/SVGGlyphElement.cpp
  svg/SVGAltGlyphElement.cpp
  svg/SVGHKernElement.cpp
  svg/SVGMissingGlyphElement.cpp
  svg/SVGFontElement.cpp
  svg/SVGFontData.cpp
#############################################################
## GRAPHICS #################################################
#############################################################
  svg/graphics/SVGResource.cpp
  svg/graphics/SVGPaintServer.cpp
  svg/graphics/qt/SVGPaintServerQt.cpp
  svg/graphics/SVGPaintServerSolid.cpp
  svg/graphics/qt/SVGPaintServerSolidQt.cpp
  svg/graphics/SVGResourceClipper.cpp
  svg/graphics/qt/SVGResourceClipperQt.cpp
  svg/graphics/SVGPaintServerGradient.cpp
  svg/graphics/SVGPaintServerLinearGradient.cpp
  svg/graphics/SVGPaintServerRadialGradient.cpp
  svg/graphics/qt/SVGPaintServerGradientQt.cpp
  svg/graphics/qt/SVGPaintServerLinearGradientQt.cpp
  svg/graphics/qt/SVGPaintServerRadialGradientQt.cpp
#############################################################
## RENDERING PART BELOW   ###################################
#############################################################
  rendering/RenderSVGRoot.cpp
  rendering/RenderPath.cpp
  rendering/SVGRenderStyleDefs.cpp
  rendering/SVGRenderStyle.cpp
  rendering/RenderSVGGradientStop.cpp
  rendering/RenderSVGContainer.cpp
  rendering/SVGRenderSupport.cpp
  rendering/RenderSVGHiddenContainer.cpp
  rendering/RenderSVGTransformableContainer.cpp
  rendering/SVGInlineFlowBox.cpp
  rendering/SVGRootInlineBox.cpp
  rendering/RenderSVGTextPath.cpp
  rendering/SVGInlineTextBox.cpp
  rendering/SVGCharacterLayoutInfo.cpp
  rendering/RenderSVGInline.cpp
  rendering/RenderSVGText.cpp
  rendering/RenderSVGBlock.cpp
  rendering/RenderSVGInlineText.cpp
  rendering/RenderSVGTSpan.cpp
)

# khtml/dom/Makefile.am: khtmldom

set(khtmldom_STAT_SRCS
  dom/dom_misc.cpp
  dom/html_block.cpp
  dom/html_inline.cpp
  dom/css_rule.cpp
  dom/dom_node.cpp
  dom/html_document.cpp
  dom/html_list.cpp
  dom/css_stylesheet.cpp
  dom/dom_string.cpp
  dom/html_element.cpp
  dom/html_misc.cpp
  dom/css_value.cpp
  dom/dom_text.cpp
  dom/html_object.cpp
  dom/dom_doc.cpp
  dom/dom_xml.cpp
  dom/html_head.cpp
  dom/dom_element.cpp
  dom/html_base.cpp
  dom/html_image.cpp
  dom/html_form.cpp
  dom/dom2_range.cpp
  dom/html_table.cpp
  dom/dom2_traversal.cpp
  dom/dom2_events.cpp
  dom/dom2_views.cpp
  dom/QualifiedName.cpp
  dom/dom3_xpath.cpp
)

#set_source_files_properties(${khtmldom_STAT_SRCS} PROPERTIES COMPILE_FLAGS ${KDE_ENABLE_EXCEPTIONS})

# khtml/misc/Makefile.am: khtmlmisc

set(khtmlmisc_STAT_SRCS
  misc/loader.cpp
  misc/helper.cpp
  misc/arena.cpp
  misc/stringit.cpp
  misc/paintbuffer.cpp
  misc/imagefilter.cpp
  misc/borderarcstroker.cpp
  misc/idstring.cpp
  misc/htmlnames.cpp
  misc/AtomicString.cpp
  misc/woff.cpp
  misc/guess_ja.cpp
  misc/kencodingdetector.cpp
)

set(khtmlediting_STAT_SRCS
  editing/jsediting.cpp
  editing/editing.cpp
  editing/editor.cpp
  editing/htmlediting_impl.cpp
)

set(khtmlfind_STAT_SRCS
  ui/findbar/khtmlfind.cpp
  ui/findbar/khtmlfindbar.cpp
)

ki18n_wrap_ui(khtmlfind_STAT_SRCS
  ui/findbar/khtmlfindbar_base.ui
)

set(passwordbar_STAT_SRCS
  ui/passwordbar/storepassbar.cpp
)

ki18n_wrap_ui(passwordbar_STAT_SRCS
  ui/passwordbar/storepassbar_base.ui
)

# khtml/html/Makefile.am: khtmlhtml

set(khtmlhtml_STAT_SRCS
  html/htmlparser.cpp
  html/htmltokenizer.cpp
  html/htmlprospectivetokenizer.cpp
  html/dtd.cpp
  html/html_headimpl.cpp
  html/html_blockimpl.cpp
  html/html_elementimpl.cpp
  html/html_inlineimpl.cpp
  html/html_documentimpl.cpp
  html/html_baseimpl.cpp
  html/html_imageimpl.cpp
  html/html_listimpl.cpp
  html/html_miscimpl.cpp
  html/html_formimpl.cpp
  html/html_objectimpl.cpp
  html/html_tableimpl.cpp
  html/html_canvasimpl.cpp
  html/HTMLMediaElement.cpp
  html/HTMLAudioElement.cpp
  html/HTMLVideoElement.cpp
  html/HTMLSourceElement.cpp
  html/TimeRanges.cpp
  html/ksslkeygen.cpp
  html/kopenssl.cpp
  html/kentities.cpp
)
ecm_gperf_generate(html/doctypes.gperf ${CMAKE_CURRENT_BINARY_DIR}/doctypes.h khtmlhtml_STAT_SRCS
                   GENERATION_FLAGS "--key-positions=*")
ecm_gperf_generate(html/kentities.gperf ${CMAKE_CURRENT_BINARY_DIR}/kentities-gperf.h khtmlhtml_STAT_SRCS
                   GENERATION_FLAGS "--key-positions=* -D -s 2")

# khtml/ecma/Makefile.am: kjs_html

set(EXCLUDE_SRCS_FILES
${CMAKE_CURRENT_BINARY_DIR}/doctypes.h
${CMAKE_CURRENT_BINARY_DIR}/kentities-gperf.h
${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.h
${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.h
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.h
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.h
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.h
${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.cpp
)

set_property(SOURCE ${EXCLUDE_SRCS_FILES} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file

set(kjs_html_STAT_SRCS
  ecma/kjs_binding.cpp
  ecma/kjs_dom.cpp
  ecma/kjs_html.cpp
  ecma/kjs_window.cpp
  ecma/kjs_navigator.cpp
  ecma/kjs_proxy.cpp
  ecma/kjs_css.cpp
  ecma/kjs_range.cpp
  ecma/kjs_traversal.cpp
  ecma/kjs_events.cpp
  ecma/kjs_views.cpp
#  ecma/kjs_debugwin.cpp
  ecma/kjs_mozilla.cpp
  ${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.h
  ${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.cpp
  ${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.h
  ${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.cpp
  ecma/JSHTMLElement.cpp
  ${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.h
  ${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.cpp
  ${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.h
  ${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.cpp
  ${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.h
  ${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.cpp
  ecma/xmlhttprequest.cpp
  ecma/xmlserializer.cpp
  ecma/domparser.cpp
  ecma/kjs_context2d.cpp
  ecma/kjs_audio.cpp
  ecma/kjs_xpath.cpp
  ecma/kjs_scriptable.cpp
  ecma/kjs_data.cpp
  ecma/kjs_arraybuffer.cpp
  ecma/kjs_arraybufferview.cpp
  ecma/kjs_arraytyped.cpp
  ecma/kjs_clientrect.cpp
)

# TODO: set(KJS_DEBUGGER) once we can depend on the ktexteditor interfaces
if (KJS_DEBUGGER)
  set (kjs_html_STAT_SRCS ${kjs_html_STAT_SRCS}
  ecma/debugger/debugwindow.cpp
  ecma/debugger/debugdocument.cpp
  ecma/debugger/consoledock.cpp
  ecma/debugger/breakpointsdock.cpp
  ecma/debugger/callstackdock.cpp
  ecma/debugger/localvariabledock.cpp
  ecma/debugger/scriptsdock.cpp
  ecma/debugger/value2string.cpp
  ecma/debugger/errordlg.cpp
  ecma/debugger/interpreter_ctx.cpp
  )
endif()

#qt5_add_resources( kjs_html_STAT_SRCS ecma/debugger/debugger.qrc )

# khtml/rendering/Makefile.am: khtmlrender

set(khtmlrender_STAT_SRCS
  rendering/bidi.cpp
  rendering/break_lines.cpp
  rendering/render_block.cpp
  rendering/render_inline.cpp
  rendering/render_style.cpp
  rendering/render_object.cpp
  rendering/render_container.cpp
  rendering/render_box.cpp
  rendering/render_flow.cpp
  rendering/render_text.cpp
  rendering/render_arena.cpp
  rendering/render_layer.cpp
  rendering/render_image.cpp
  rendering/render_table.cpp
  rendering/table_layout.cpp
  rendering/render_replaced.cpp
  rendering/render_form.cpp
  rendering/render_list.cpp
  rendering/render_canvas.cpp
  rendering/render_frames.cpp
  rendering/render_br.cpp
  rendering/render_body.cpp
  rendering/font.cpp
  rendering/render_line.cpp
  rendering/render_generated.cpp
  rendering/enumerate.cpp
  rendering/counter_tree.cpp
  rendering/render_canvasimage.cpp
  rendering/render_position.cpp
  rendering/render_media.cpp
  rendering/media_controls.cpp
)

# khtml/css/Makefile.am: khtmlcss

set(khtmlcss_STAT_SRCS
  css/css_stylesheetimpl.cpp
  css/css_ruleimpl.cpp
  css/css_valueimpl.cpp
  css/css_svgvalueimpl.cpp
  css/css_base.cpp
  css/cssparser.cpp
  css/cssstyleselector.cpp
  css/csshelper.cpp
  css/parser.cpp
  css/css_renderstyledeclarationimpl.cpp
  css/css_mediaquery.cpp
  css/css_svgcssparser.cpp
  css/SVGCSSStyleSelector.cpp
  css/css_webfont.cpp
)

# khtml/xml/Makefile.am: khtmlxml

set(khtmlxml_STAT_SRCS
  xml/security_origin.cpp
  xml/dom_docimpl.cpp
  xml/dom_nodeimpl.cpp
  xml/dom_nodelistimpl.cpp
  xml/dom_textimpl.cpp
  xml/dom_elementimpl.cpp
  xml/dom_stringimpl.cpp
  xml/dom2_rangeimpl.cpp
  xml/dom2_traversalimpl.cpp
  xml/xml_tokenizer.cpp
  xml/dom_xmlimpl.cpp
  xml/dom2_eventsimpl.cpp
  xml/dom2_viewsimpl.cpp
  xml/dom_restyler.cpp
  xml/ClassNames.cpp
  xml/dom_position.cpp
  xml/dom_positioniterator.cpp
  xml/dom_selection.cpp
  xml/wa_selectors.cpp
  xml/dom3_xpathimpl.cpp
)

# khtml/imload/Makefile.am: khtmlimload

set(khtmlimload_STAT_SRCS
  imload/imageplane.cpp
  imload/rawimageplane.cpp
  imload/scaledimageplane.cpp
  imload/pixmapplane.cpp
  imload/animprovider.cpp
  imload/imagepainter.cpp
  imload/updater.cpp
  imload/image.cpp
  imload/imagemanager.cpp
  imload/animtimer.cpp
  imload/canvasimage.cpp
)

# khtml/imload/decoders/Makefile.am: decoders

set(decoders_STAT_SRCS
  imload/decoders/jpegloader.cpp
  imload/decoders/pngloader.cpp
  imload/decoders/gifloader.cpp
  imload/decoders/qimageioloader.cpp
)

# khtml/xpath/
set(xpath_STAT_SRCS
  xpath/expression.cpp
  xpath/functions.cpp
  xpath/parsedstatement.cpp
  xpath/path.cpp
  xpath/predicate.cpp
  xpath/step.cpp
  xpath/tokenizer.cpp
  xpath/parser.cpp
  xpath/util.cpp
  xpath/variablereference.cpp
#  xpath/XPathNSResolverImpl.cpp
)

add_subdirectory( css )

include_directories(
   ${PHONON_INCLUDE_DIR}
   ${KWindowSystem_INCLUDE_DIRS}
)

include_directories(
#   ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/misc
  ${CMAKE_CURRENT_SOURCE_DIR}/dom
  ${CMAKE_CURRENT_SOURCE_DIR}/xml
  ${CMAKE_CURRENT_SOURCE_DIR}/html
  ${CMAKE_CURRENT_SOURCE_DIR}/rendering
  ${CMAKE_CURRENT_SOURCE_DIR}/ecma
  ${CMAKE_CURRENT_SOURCE_DIR}/imload
  ${CMAKE_CURRENT_SOURCE_DIR}/imload/decoders
  ${CMAKE_CURRENT_SOURCE_DIR}/java
  ${CMAKE_CURRENT_SOURCE_DIR}/svg
  ${CMAKE_CURRENT_SOURCE_DIR}/svg/graphics
  ${CMAKE_CURRENT_SOURCE_DIR}/platform/graphics
  ${CMAKE_CURRENT_SOURCE_DIR}/platform/text
  ${CMAKE_CURRENT_SOURCE_DIR}/platform
  ${CMAKE_CURRENT_SOURCE_DIR}/compat
  ${CMAKE_CURRENT_SOURCE_DIR}/css
  ${CMAKE_CURRENT_SOURCE_DIR}/xpath
)
include_directories(
 ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}/misc
# ${CMAKE_CURRENT_BINARY_DIR}/dom
# ${CMAKE_CURRENT_BINARY_DIR}/xml
# ${CMAKE_CURRENT_BINARY_DIR}/html
# ${CMAKE_CURRENT_BINARY_DIR}/rendering
# ${CMAKE_CURRENT_BINARY_DIR}/imload
# ${CMAKE_CURRENT_BINARY_DIR}/imload/decoders
  ${CMAKE_CURRENT_BINARY_DIR}/java
# ${CMAKE_CURRENT_BINARY_DIR}/svg
# ${CMAKE_CURRENT_BINARY_DIR}/svg/graphics
# ${CMAKE_CURRENT_BINARY_DIR}/platform/graphics
# ${CMAKE_CURRENT_BINARY_DIR}/platform/text
# ${CMAKE_CURRENT_SOURCE_DIR}/platform
# ${CMAKE_CURRENT_BINARY_DIR}/compat
  ${CMAKE_CURRENT_BINARY_DIR}/css
)

include_directories(${JPEG_INCLUDE_DIR} ${GIF_INCLUDE_DIR} ${PNG_INCLUDE_DIR} )

set( KDELIBSUFF ${LIB_SUFFIX} )
configure_file(html/ksslconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ksslconfig.h )

add_subdirectory( kmultipart )
add_subdirectory( java )

add_definitions(-DENABLE_VIDEO)

########### libkhtml ###############

set(khtml_LIB_SRCS
   khtmlview.cpp
   khtmlviewbar.cpp
   khtmlviewbarwidget.cpp
   khtml_part.cpp
   khtml_childframe.cpp
   khtml_run.cpp
   khtml_global.cpp
   khtml_settings.cpp
   khtml_filter.cpp
   khtml_events.cpp
   khtml_ext.cpp
   khtml_pagecache.cpp
   khtml_printsettings.cpp
   khtml_iface.cpp
   khtmlimage.cpp
   kjserrordlg.cpp
   ${xpath_STAT_SRCS}
   ${khtmlfind_STAT_SRCS}
   ${passwordbar_STAT_SRCS}
   ${khtmlxml_STAT_SRCS}
   ${khtmlhtml_STAT_SRCS}
   ${khtmlrender_STAT_SRCS}
   ${khtmlcss_STAT_SRCS}
   ${khtmlmisc_STAT_SRCS}
   ${khtmlediting_STAT_SRCS}
   ${kjs_html_STAT_SRCS}
   ${khtmldom_STAT_SRCS}
   ${khtmlimload_STAT_SRCS}
   ${decoders_STAT_SRCS}
   ${khtmlgraphics_STAT_SRCS} # for WebCore compatibility
   ${khtmlsvg_STAT_SRCS} # for SVG
   #   ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KHtmlPart.xml # just so that it gets generated
   )

# Fairly certain this isn't used anywhere
# qt5_generate_dbus_interface(khtml_iface.h org.kde.KHtmlPart.xml)

qt5_add_dbus_interface(khtml_LIB_SRCS ${KCookieServer_DBUS_INTERFACE} kcookiejar_interface)

ecm_qt_declare_logging_category(khtml_LIB_SRCS HEADER khtml_debug.h IDENTIFIER KHTML_LOG CATEGORY_NAME kf5.khtml)

ki18n_wrap_ui(khtml_LIB_SRCS
   kjserrordlgbase.ui
   htmlpageinfo.ui
   html/keygenwizard.ui
   html/keygenwizard2.ui
)

qt5_add_resources( khtml_LIB_SRCS khtml.qrc )

add_library(KF5KHtml ${khtml_LIB_SRCS})
add_library(KF5::KHtml ALIAS KF5KHtml)

generate_export_header(KF5KHtml BASE_NAME KHtml)

target_include_directories(KF5KHtml INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KHtml>")

target_link_libraries(KF5KHtml
  PUBLIC
    Qt5::Gui
    KF5::KIOCore
    KF5::JS
    KF5::I18n
    KF5::Parts
    KF5::TextWidgets
    KF5::Codecs
  PRIVATE
    ${PHONON_LIBRARIES}
    ${JPEG_LIBRARIES}
    ${GIF_LIBRARIES}
    ${PNG_LIBRARIES}
    ${X11_LIBRARIES}
    Qt5::PrintSupport
    KF5::Archive
    KF5::SonnetCore
    KF5::WidgetsAddons
    KF5::WindowSystem
    KF5::Wallet
    KF5::IconThemes
    KF5::Notifications
    KF5::Bookmarks
    KF5::KIOWidgets # KUrlRequester
    KF5::GlobalAccel
)
if(NOT WIN32 AND NOT APPLE AND X11_FOUND)
  target_link_libraries(KF5KHtml PRIVATE Qt5::X11Extras)
endif()

if (KJS_DEBUGGER)
  target_link_libraries(KF5KHtml PRIVATE KF5::KTextEditor)
endif()

set_target_properties(KF5KHtml PROPERTIES VERSION ${KHTML_VERSION_STRING}
                                          SOVERSION ${KHTML_SOVERSION}
                                          EXPORT_NAME KHtml
                     )


macro(CREATE_LUT _in_FILE _out_FILE)

   add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
      COMMAND ${PERL_EXECUTABLE} ${KJS_CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
   )
   macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE} )
endmacro(CREATE_LUT)


create_lut(ecma/kjs_dom.cpp kjs_dom.lut.h)
create_lut(ecma/kjs_html.cpp kjs_html.lut.h)
create_lut(ecma/kjs_window.cpp kjs_window.lut.h)
create_lut(ecma/kjs_css.cpp kjs_css.lut.h)
create_lut(ecma/kjs_events.cpp kjs_events.lut.h)
create_lut(ecma/kjs_navigator.cpp kjs_navigator.lut.h)
create_lut(ecma/kjs_mozilla.cpp kjs_mozilla.lut.h)
create_lut(ecma/kjs_range.cpp kjs_range.lut.h)
create_lut(ecma/kjs_traversal.cpp kjs_traversal.lut.h)
create_lut(ecma/kjs_views.cpp kjs_views.lut.h)
create_lut(ecma/xmlhttprequest.cpp xmlhttprequest.lut.h)
create_lut(ecma/xmlserializer.cpp xmlserializer.lut.h)
create_lut(ecma/domparser.cpp domparser.lut.h)
create_lut(ecma/kjs_context2d.cpp kjs_context2d.lut.h)
create_lut(ecma/kjs_xpath.cpp kjs_xpath.lut.h)
create_lut(ecma/kjs_arraybuffer.cpp kjs_arraybuffer.lut.h)
create_lut(ecma/kjs_arraybufferview.cpp kjs_arraybufferview.lut.h)
create_lut(ecma/kjs_clientrect.cpp kjs_clientrect.lut.h)

macro(create_js_binding _in_FILE)
   get_filename_component(_in_filename ${_in_FILE} NAME_WE)
   set(_out_h_FILE "${CMAKE_CURRENT_BINARY_DIR}/JS${_in_filename}.h")
   set(_out_cpp_FILE "${CMAKE_CURRENT_BINARY_DIR}/JS${_in_filename}.cpp")
   set(_scripts_dir "${CMAKE_CURRENT_SOURCE_DIR}/bindings/scripts")
   add_custom_command(OUTPUT ${_out_h_FILE} ${_out_cpp_FILE}
      COMMAND ${PERL_EXECUTABLE} -I${_scripts_dir}
              ${_scripts_dir}/generate-bindings.pl
              --include=html
              --generator=JS
              --outputdir=${CMAKE_CURRENT_BINARY_DIR}
              --preprocessor=\"${QT_MOC_EXECUTABLE} -E\"
              --defines=ENABLE_VIDEO
              ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
      MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
      DEPENDS ${_scripts_dir}/CodeGeneratorJS.pm
      )
   macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${_out_h_FILE} ${_out_cpp_FILE})
endmacro(create_js_binding)

create_js_binding(html/TimeRanges.idl)
create_js_binding(html/MediaError.idl)
create_js_binding(html/HTMLMediaElement.idl)
create_js_binding(html/HTMLAudioElement.idl)
create_js_binding(html/HTMLVideoElement.idl)
#create_js_binding(svg/SVGRectElement.idl)
#create_js_binding(svg/SVGRect.idl)
#create_js_binding(svg/SVGElement.idl)
#create_js_binding(svg/SVGDocument.idl)
#create_js_binding(svg/SVGAngle.idl)
#create_js_binding(svg/SVGSVGElement.idl)
#create_js_binding(svg/SVGLength.idl)
#create_js_binding(svg/SVGNumber.idl)
#create_js_binding(svg/SVGPoint.idl)
#create_js_binding(svg/SVGMatrix.idl)
#create_js_binding(svg/SVGTransform.idl)
#create_js_binding(svg/SVGException.idl)
#create_js_binding(svg/SVGPaint.idl)
#create_js_binding(svg/SVGNumberList.idl)
#create_js_binding(svg/SVGAnimatedLength.idl)
#create_js_binding(svg/SVGRectElement.idl)
#create_js_binding(svg/SVGTransformList.idl)
#create_js_binding(svg/SVGAnimatedTransformList.idl)
##create_js_binding(svg/SVGLocatable.idl)
##create_js_binding(svg/SVGTransformable.idl)
#create_js_binding(svg/SVGAnimatedString.idl)
#create_js_binding(svg/SVGAnimatedBoolean.idl)
#create_js_binding(svg/SVGStringList.idl)
#create_js_binding(svg/SVGEllipseElement.idl)
#create_js_binding(svg/SVGCircleElement.idl)
#create_js_binding(svg/SVGLineElement.idl)
#create_js_binding(svg/SVGScriptElement.idl)
#create_js_binding(svg/SVGPathSeg.idl)
#create_js_binding(svg/SVGPathElement.idl)
#create_js_binding(svg/SVGAnimatedNumber.idl)
#create_js_binding(svg/SVGPathSegArcAbs.idl)
#create_js_binding(svg/SVGPathSegArcRel.idl)
#create_js_binding(svg/SVGPathSegClosePath.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicRel.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicSmoothAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicSmoothRel.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticRel.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticSmoothRel.idl)
#create_js_binding(svg/SVGPathSegLinetoAbs.idl)
#create_js_binding(svg/SVGPathSegLinetoHorizontalAbs.idl)
#create_js_binding(svg/SVGPathSegLinetoHorizontalRel.idl)
#create_js_binding(svg/SVGPathSegLinetoRel.idl)
#create_js_binding(svg/SVGPathSegLinetoVerticalAbs.idl)
#create_js_binding(svg/SVGPathSegLinetoVerticalRel.idl)
#create_js_binding(svg/SVGPathSegList.idl)
#create_js_binding(svg/SVGPathSegMovetoAbs.idl)
#create_js_binding(svg/SVGPathSegMovetoRel.idl)



########### khtmlpart ###############

set(khtmlpart_PART_SRCS khtml_factory.cpp )


add_library(khtmlpart MODULE ${khtmlpart_PART_SRCS})

target_link_libraries(khtmlpart KF5::KHtml KF5::XmlGui KF5::TextWidgets KF5::Parts KF5::I18n)

ecm_generate_headers(KHtml_HEADERS
  HEADER_NAMES
  KHTMLPart
  KHTMLView
  KHTMLSettings

  REQUIRED_HEADERS KHtml_HEADERS
)

install(TARGETS khtmlpart  DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/parts)


########### next target ###############

# Note that khtmlimage.cpp is part of libkhtml because it uses internal objects (render tree and loader)
# Only the entry point is separated into khtmlimage_init.cpp
add_library(khtmlimagepart MODULE khtmlimage_init.cpp)

kservice_desktop_to_json(khtmlimagepart khtmlimage.desktop)

target_link_libraries(khtmlimagepart KF5::KHtml KF5::WidgetsAddons KF5::XmlGui KF5::TextWidgets KF5::Parts KF5::I18n)

install(TARGETS khtmlimagepart  DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/parts)

########### next target ###############

add_library(khtmladaptorpart MODULE khtmladaptorpart.cpp)

target_link_libraries(khtmladaptorpart KF5::Parts KF5::JS KF5::I18n KF5::XmlGui)

install(TARGETS khtmladaptorpart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/parts)


########### install files ###############

install(TARGETS KF5KHtml EXPORT KF5KHtmlTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})

install(FILES
  ${CMAKE_CURRENT_BINARY_DIR}/khtml_export.h
  ${CMAKE_CURRENT_BINARY_DIR}/khtml_debug.h
  khtml_part.h
  khtml_events.h
  khtml_settings.h
  khtmldefaults.h
  misc/kencodingdetector.h
  ${KHtml_HEADERS}
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KHtml COMPONENT Devel
)

install(FILES
  dom/dom_exception.h
  dom/html_base.h
  dom/html_inline.h
  dom/css_rule.h
  dom/dom_html.h
  dom/html_block.h
  dom/html_list.h
  dom/css_stylesheet.h
  dom/dom_misc.h
  dom/html_document.h
  dom/html_misc.h
  dom/css_value.h
  dom/dom_node.h
  dom/html_element.h
  dom/html_object.h
  dom/dom_core.h
  dom/dom_string.h
  dom/html_form.h
  dom/html_table.h
  dom/dom_doc.h
  dom/dom_text.h
  dom/html_head.h
  dom/dom_element.h
  dom/dom_xml.h
  dom/html_image.h
  dom/dom2_range.h
  dom/dom2_traversal.h
  dom/dom2_events.h
  dom/dom2_views.h
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KHtml/dom COMPONENT Devel
)

install(FILES khtml.desktop khtmlimage.desktop
         khtmladaptorpart.desktop DESTINATION  ${KDE_INSTALL_KSERVICES5DIR} )

# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KHtmlPart.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} )

install(FILES error.html DESTINATION ${KDE_INSTALL_DATADIR_KF5}/khtml )

install(FILES khtmlrc DESTINATION ${KDE_INSTALL_CONFDIR} )

include(ECMGeneratePriFile)
ecm_generate_pri_file(BASE_NAME KHtml LIB_NAME KF5KHtml DEPS "gui KIOCore KJS KI18n KParts" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KHtml)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})