forked from mikke89/RmlUi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1032 lines (856 loc) · 34.3 KB
/
CMakeLists.txt
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
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#===================================
# Build script for RmlUi ===========
#===================================
cmake_minimum_required(VERSION 3.1)
if(APPLE)
# This has to be before most other options so CMake properly handles the
# compiler variables, it MUST bebefore the project() definition
if(IOS_PLATFORM)
set(CMAKE_TOOLCHAIN_FILE CMake/Platform/iOS.cmake)
endif(IOS_PLATFORM)
option(BUILD_UNIVERSAL_BINARIES "Build universal binaries for all architectures supported" ON)
if (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES)
if(IOS)
# set the architecture for iOS
if (${IOS_PLATFORM} STREQUAL "OS")
set (IOS_ARCH armv6 armv7 armv7s arm64)
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
else (${IOS_PLATFORM} STREQUAL "OS")
set (IOS_ARCH x86_64)
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator")
endif (${IOS_PLATFORM} STREQUAL "OS")
else(IOS)
# set the architectures for OS X
set (OSXI_ARCH x86_64)
set (CMAKE_OSX_ARCHITECTURES ${OSXI_ARCH} CACHE STRING "Build architecture for OS X universal binaries")
endif(IOS)
endif (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES)
endif(APPLE)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0015 NEW)
endif(COMMAND cmake_policy)
# Enable the use of MACOSX_RPATH by default for CMake v3.0+; this effectively
# allows plug 'n' play functionality, so to speak -- the resulting shared
# library files can simply be copied over into the end-user's application
# bundle or framework bundle. No mucking around with install_name_tool.
#
# See also:
# cmake --help-policy cmp0042
# http://www.kitware.com/blog/home/post/510
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)
if (POLICY CMP0072)
cmake_policy (SET CMP0072 NEW)
endif(POLICY CMP0072)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif(POLICY CMP0074)
project(RmlUi LANGUAGES C CXX VERSION 5.1)
set(RMLUI_VERSION_RELEASE false)
if(RMLUI_VERSION_RELEASE)
set(RMLUI_VERSION_SUFFIX "")
else()
set(RMLUI_VERSION_SUFFIX "-dev")
endif()
set(RMLUI_VERSION_SHORT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${RMLUI_VERSION_SUFFIX})
list(APPEND CORE_PRIVATE_DEFS RMLUI_VERSION="${RMLUI_VERSION_SHORT}")
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
option(BUILD_TESTING "" OFF)
include(CTest)
if(BUILD_TESTING)
set(RMLUI_TESTS_ENABLED ON)
set(VISUAL_TESTS_RML_DIRECTORIES "" CACHE PATH "Specify additional directories containing *.rml test documents for VisualTests. Separate multiple directories by comma.")
set(VISUAL_TESTS_COMPARE_DIRECTORY "" CACHE PATH "Set the input directory for screenshot comparison performed by VisualTests.")
set(VISUAL_TESTS_CAPTURE_DIRECTORY "" CACHE PATH "Set the output directory for screenshots generated by VisualTests.")
endif()
endif()
# paths
include(GNUInstallDirs)
# Search in the 'cmake' directory for additional CMake modules.
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake;${PROJECT_SOURCE_DIR}/CMake/Modules)
#===================================
# Environment tests ================
#===================================
include(TestForANSIForScope)
include(TestForANSIStreamHeaders)
include(TestForSTDNamespace)
#===================================
# Provide hints as to where depends=
# might be found =
#===================================
if(NOT DEFINED ENV{FREETYPE_DIR})
set(ENV{FREETYPE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
endif()
if(NOT DEFINED ENV{LUA_DIR})
set(ENV{LUA_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
endif()
if(NOT DEFINED ENV{SDL2DIR})
set(ENV{SDL2DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
endif()
if(NOT DEFINED ENV{SDL2_IMAGE_DIR})
set(ENV{SDL2_IMAGE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
endif()
if(NOT DEFINED ENV{SFML_ROOT})
set(ENV{SFML_ROOT} "${PROJECT_SOURCE_DIR}/Dependencies")
endif()
if(NOT DEFINED ENV{TRACY_DIR})
set(ENV{TRACY_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
endif()
if(NOT DEFINED ENV{RLOTTIE_DIR})
set(ENV{RLOTTIE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies/rlottie")
endif()
if(NOT DEFINED ENV{LUNASVG_DIR})
set(ENV{LUNASVG_DIR} "${PROJECT_SOURCE_DIR}/Dependencies/lunasvg")
endif()
#===================================
# Plaform specific global hacks ====
#===================================
if(APPLE)
# Disables naked builtins from AssertMacros.h which
# This prevents naming collisions such as those from the check()
# function macro with LuaType::check
add_definitions(-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0)
endif(APPLE)
#===================================
# Build options ====================
#===================================
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
if(NOT IOS)
option(BUILD_SHARED_LIBS "Build shared (dynamic) libraries" ON)
endif(NOT IOS)
option(BUILD_LUA_BINDINGS "Build Lua bindings" OFF)
if(APPLE)
option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
endif()
option(BUILD_SAMPLES "Build samples" OFF)
set(SAMPLES_BACKEND "auto" CACHE STRING "Backend platform and renderer used for the samples.")
set_property(CACHE SAMPLES_BACKEND PROPERTY STRINGS auto Win32_GL2 Win32_VK X11_GL2 SDL_GL2 SDL_GL3 SDL_VK SDL_SDLrenderer SFML_GL2 GLFW_GL2 GLFW_GL3 GLFW_VK)
if(SAMPLES_BACKEND STREQUAL "auto")
if(EMSCRIPTEN)
set(SAMPLES_BACKEND SDL_GL3)
elseif(WIN32)
set(SAMPLES_BACKEND Win32_GL2)
elseif(APPLE)
set(SAMPLES_BACKEND SDL_SDLrenderer)
else()
set(SAMPLES_BACKEND X11_GL2)
endif()
endif()
option(MATRIX_ROW_MAJOR "Use row-major matrices. Column-major matrices are used by default." OFF)
if(APPLE)
if(IOS)
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR "BUILD_SHARED_LIBS must be OFF for iOS builds. iOS does not support shared libraries.")
endif(BUILD_SHARED_LIBS)
endif(IOS)
if(BUILD_FRAMEWORK)
if(NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
message(FATAL_ERROR "You should use Xcode generator with BUILD_FRAMEWORK enabled")
endif()
if(NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "BUILD_SHARED_LIBS must be ON with BUILD_FRAMEWORK enabled")
endif()
endif()
else(APPLE)
if(BUILD_FRAMEWORK)
message(FATAL_ERROR "BUILD_FRAMEWORK is only supported on Mac OS X with the Xcode generator")
endif()
endif(APPLE)
option(NO_FONT_INTERFACE_DEFAULT "Do not include the default font engine in the build. Allows building without the FreeType dependency, but a custom font engine must be created and set." OFF)
if(NO_FONT_INTERFACE_DEFAULT)
list(APPEND CORE_PRIVATE_DEFS RMLUI_NO_FONT_INTERFACE_DEFAULT)
endif()
if(WIN32 AND BUILD_SHARED_LIBS AND BUILD_TESTING)
message(FATAL_ERROR "-- The RmlUi testing framework cannot be built when using shared libraries on Windows. Please disable either BUILD_SHARED_LIBS or BUILD_TESTING.")
endif()
if(EMSCRIPTEN AND BUILD_SHARED_LIBS)
message(FATAL_ERROR "-- Dynamic libraries not supported when using Emscripten. Please disable BUILD_SHARED_LIBS.")
endif()
if(NOT BUILD_SHARED_LIBS)
list(APPEND CORE_PUBLIC_DEFS -DRMLUI_STATIC_LIB)
message("-- Building static libraries. Make sure to #define RMLUI_STATIC_LIB before including RmlUi in your project.")
endif()
option(NO_THIRDPARTY_CONTAINERS "Only use standard library containers." OFF)
if( NO_THIRDPARTY_CONTAINERS )
list(APPEND CORE_PUBLIC_DEFS -DRMLUI_NO_THIRDPARTY_CONTAINERS)
message("-- No third-party containers will be used: Make sure to #define RMLUI_NO_THIRDPARTY_CONTAINERS before including RmlUi in your project.")
endif()
option(CUSTOM_CONFIGURATION "Customize RmlUi configuration files for overriding the default configuration and types." OFF)
set(CUSTOM_CONFIGURATION_FILE "" CACHE STRING "Custom configuration file to be included in place of <RmlUi/Config/Config.h>.")
if( CUSTOM_CONFIGURATION AND CUSTOM_CONFIGURATION_FILE )
list(APPEND CORE_PUBLIC_DEFS -DRMLUI_CUSTOM_CONFIGURATION_FILE="${CUSTOM_CONFIGURATION_FILE}")
message("-- Including ${CUSTOM_CONFIGURATION_FILE} instead of <RmlUi/Config/Config.h>")
endif ()
set(CUSTOM_INCLUDE_DIRS "" CACHE STRING "Extra include directories (use with CUSTOM_CONFIGURATION_FILE).")
if( CUSTOM_CONFIGURATION AND CUSTOM_INCLUDE_DIRS )
include_directories(${CUSTOM_INCLUDE_DIRS})
endif ()
set(CUSTOM_LINK_LIBRARIES "" CACHE STRING "Extra link libraries (use with CUSTOM_CONFIGURATION_FILE).")
if( CUSTOM_CONFIGURATION )
mark_as_advanced( CLEAR CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
else()
mark_as_advanced( FORCE CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
if( CUSTOM_CONFIGURATION_FILE OR CUSTOM_INCLUDE_DIRS OR CUSTOM_LINK_LIBRARIES )
message("-- CUSTOM_CONFIGURATION disabled, but custom configuration variables are set. They will have no effect.")
endif()
endif()
option(ENABLE_TRACY_PROFILING "Enable profiling with Tracy. Source files can be placed in Dependencies/tracy." OFF)
if( ENABLE_TRACY_PROFILING )
find_package(Tracy REQUIRED)
include_directories(${TRACY_INCLUDE_DIR})
if( CMAKE_CONFIGURATION_TYPES )
list(APPEND CMAKE_CONFIGURATION_TYPES Tracy)
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
"Add the configurations that we need"
FORCE)
set(CMAKE_C_FLAGS_TRACY "${CMAKE_CXX_FLAGS_RELEASE} -DRMLUI_ENABLE_PROFILING")
set(CMAKE_CXX_FLAGS_TRACY "${CMAKE_CXX_FLAGS_RELEASE} -DRMLUI_ENABLE_PROFILING")
set(CMAKE_EXE_LINKER_FLAGS_TRACY "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS_TRACY "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
message("-- Tracy profiling enabled in configuration 'Tracy'.")
else()
message("-- Tracy profiling enabled.")
list(APPEND CORE_PUBLIC_DEFS -DRMLUI_ENABLE_PROFILING)
endif()
elseif( CMAKE_CONFIGURATION_TYPES )
list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES Tracy)
endif()
option(ENABLE_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires the rlottie library." OFF)
option(ENABLE_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF)
option(DISABLE_RTTI_AND_EXCEPTIONS "Build with rtti and exceptions disabled." OFF)
if(DISABLE_RTTI_AND_EXCEPTIONS)
list(APPEND CORE_PUBLIC_DEFS -DRMLUI_USE_CUSTOM_RTTI)
message("-- C++ RTTI and exceptions will be disabled: Make sure to #define RMLUI_USE_CUSTOM_RTTI before including RmlUi in your project.")
endif()
option(ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers" ON)
set(PRECOMPILED_HEADERS_ENABLED OFF)
if (ENABLE_PRECOMPILED_HEADERS AND (CMAKE_VERSION VERSION_LESS 3.16.0))
message("-- Could not enable precompiled headers. Need CMake version 3.16.0 or greater.")
elseif (ENABLE_PRECOMPILED_HEADERS)
set(PRECOMPILED_HEADERS_ENABLED ON)
endif()
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors." OFF)
mark_as_advanced(WARNINGS_AS_ERRORS)
macro(add_common_target_options NAME)
# C++ language version
if(CMAKE_VERSION VERSION_LESS 3.8.0)
set_target_properties(${NAME} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)
else()
target_compile_features(${NAME} PUBLIC cxx_std_14)
endif()
set_target_properties(${NAME} PROPERTIES CXX_EXTENSIONS OFF)
# Compiler warnings
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(${NAME} PRIVATE -Wall -pedantic -Wextra)
if(WARNINGS_AS_ERRORS)
target_compile_options(${NAME} PRIVATE -Werror)
endif()
elseif(MSVC)
target_compile_options(${NAME} PRIVATE /MP /W4 /w44062 /permissive-)
target_compile_definitions(${NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
if(WARNINGS_AS_ERRORS)
target_compile_options(${NAME} PRIVATE /WX)
endif()
endif()
endmacro()
#===================================
# Setup paths ======================
#===================================
include_directories(
${PROJECT_SOURCE_DIR}/Include
)
# Include list of source files
include(FileList)
#===================================
# Find dependencies ================
#===================================
# FreeType
if(NOT NO_FONT_INTERFACE_DEFAULT)
if(EMSCRIPTEN)
set(EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -sUSE_FREETYPE=1")
else()
find_package(Freetype REQUIRED)
if(MSVC AND FREETYPE_VERSION_STRING STREQUAL "2.11.0")
message(WARNING "You are using FreeType version 2.11.0 which introduced an issue that causes a crash on startup on some of the samples. Please avoid this version specifically.")
endif()
list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES})
list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
endif()
endif()
# Lua
if(BUILD_LUA_BINDINGS)
find_package(Lua REQUIRED)
list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES})
endif()
# rlottie
if( ENABLE_LOTTIE_PLUGIN )
# Try to find the rlottie library.
if(NOT DEFINED rlottie_DIR)
set(rlottie_DIR $ENV{RLOTTIE_DIR})
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/rlottie/build)
find_package(rlottie CONFIG)
find_path(rlottie_INCLUDE_DIR rlottie.h HINTS ${rlottie_DIR} $ENV{rlottie_DIR} PATH_SUFFIXES inc rlottie/inc )
if(rlottie_FOUND AND rlottie_INCLUDE_DIR)
message("-- Can Lottie plugin be added to RmlCore - yes - rlottie library found")
list(APPEND CORE_LINK_LIBS rlottie::rlottie)
list(APPEND CORE_INCLUDE_DIRS ${rlottie_INCLUDE_DIR})
list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_LOTTIE_PLUGIN)
list(APPEND Core_HDR_FILES ${Lottie_HDR_FILES})
list(APPEND Core_PUB_HDR_FILES ${Lottie_PUB_HDR_FILES})
list(APPEND Core_SRC_FILES ${Lottie_SRC_FILES})
else()
if(rlottie_FOUND)
message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie library found - rlottie include directory not found")
elseif(rlottie_INCLUDE_DIR)
message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie library not found - rlottie include directory found at ${rlottie_INCLUDE_DIR}")
else()
message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie not found")
endif()
endif()
endif()
# lunasvg
if( ENABLE_SVG_PLUGIN )
if(NOT DEFINED LUNASVG_DIR)
set(LUNASVG_DIR $ENV{LUNASVG_DIR})
endif()
message("-- Can SVG plugin be enabled - looking for lunasvg library")
find_package(lunasvg REQUIRED)
list(APPEND CORE_LINK_LIBS ${LUNASVG_LIBRARIES})
list(APPEND CORE_INCLUDE_DIRS ${LUNASVG_INCLUDE_DIR})
list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_SVG_PLUGIN)
list(APPEND Core_HDR_FILES ${SVG_HDR_FILES})
list(APPEND Core_PUB_HDR_FILES ${SVG_PUB_HDR_FILES})
list(APPEND Core_SRC_FILES ${SVG_SRC_FILES})
message("-- Can SVG plugin be enabled - yes - lunasvg library found")
endif()
if(NOT BUILD_FRAMEWORK)
#===================================
# Build libraries ==================
#===================================
set(LIBRARIES Core Debugger)
foreach(library ${LIBRARIES})
set(NAME Rml${library})
add_library(${NAME}
${${library}_HDR_FILES}
${${library}_PUB_HDR_FILES}
${MASTER_${library}_PUB_HDR_FILES}
${${library}_SRC_FILES}
)
add_library(RmlUi::${library} ALIAS ${NAME})
set_target_properties(${NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
add_common_target_options(${NAME})
install(TARGETS ${NAME}
EXPORT RmlUiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
endforeach(library)
if( CUSTOM_CONFIGURATION )
foreach(library ${CUSTOM_LINK_LIBRARIES})
install(TARGETS ${library}
EXPORT RmlUiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${library})
endforeach(library ${CUSTOM_LINK_LIBRARIES})
endif()
if( MATRIX_ROW_MAJOR )
list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR)
endif ()
if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES )
target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES})
endif ()
if (PRECOMPILED_HEADERS_ENABLED)
target_precompile_headers(RmlCore PRIVATE ${PROJECT_SOURCE_DIR}/Source/Core/precompiled.h)
endif()
else(NOT BUILD_FRAMEWORK)
#===================================
# Build combined Framework =========
#===================================
set(NAME RmlUi)
set(MASTER_PUB_HDR_FILES
${MASTER_Core_PUB_HDR_FILES}
${MASTER_Debugger_PUB_HDR_FILES}
)
add_library(${NAME}
${Core_HDR_FILES}
${MASTER_Core_PUB_HDR_FILES}
${Core_PUB_HDR_FILES}
${Core_SRC_FILES}
${Debugger_HDR_FILES}
${MASTER_Debugger_PUB_HDR_FILES}
${Debugger_PUB_HDR_FILES}
${Debugger_SRC_FILES}
)
set_target_properties(${NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
set_property(SOURCE ${MASTER_PUB_HDR_FILES}
PROPERTY MACOSX_PACKAGE_LOCATION Headers
)
set_property(SOURCE ${Core_PUB_HDR_FILES}
PROPERTY MACOSX_PACKAGE_LOCATION Headers/Core
)
set_property(SOURCE ${Debugger_PUB_HDR_FILES}
PROPERTY MACOSX_PACKAGE_LOCATION Headers/Debugger
)
set_target_properties(${NAME} PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${PROJECT_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER com.rmlui.${NAME}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${RMLUI_VERSION_SHORT}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
PUBLIC_HEADER ${MASTER_PUB_HDR_FILES}
)
install(TARGETS ${NAME}
EXPORT RmlUiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION Library/Frameworks
)
set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
endif(NOT BUILD_FRAMEWORK)
# Build Lua bindings
if(BUILD_LUA_BINDINGS)
set(NAME RmlLua)
add_library(${NAME} ${Lua_SRC_FILES}
${Lua_HDR_FILES}
${Lua_PUB_HDR_FILES}
)
set_target_properties(${NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
add_common_target_options(${NAME})
install(TARGETS ${NAME}
EXPORT RmlUiTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
endif()
if(DISABLE_RTTI_AND_EXCEPTIONS)
if( CMAKE_COMPILER_IS_GNUCXX )
add_definitions( -fno-rtti -fno-exceptions )
elseif( MSVC )
add_definitions( -D_HAS_EXCEPTIONS=0 /GR- )
if(CMAKE_CXX_FLAGS MATCHES "/EHsc ")
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS matches /EHsc before end of string replaced...")
endif()
if(CMAKE_CXX_FLAGS MATCHES "/EHsc$")
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS matches /EHsc at end of string replaced...")
endif()
else()
message(STATUS "Could not create build configuration without rtti and exceptions...")
endif()
endif()
#===================================
# Link libraries ===================
#===================================
if(NOT BUILD_FRAMEWORK)
target_include_directories(RmlCore PRIVATE ${CORE_INCLUDE_DIRS})
target_include_directories(RmlCore INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include> $<INSTALL_INTERFACE:include>)
target_link_libraries(RmlCore PRIVATE ${CORE_LINK_LIBS})
target_link_libraries(RmlDebugger RmlCore)
target_compile_definitions(RmlCore PRIVATE ${CORE_PRIVATE_DEFS})
target_compile_definitions(RmlCore PUBLIC ${CORE_PUBLIC_DEFS})
else()
target_include_directories(RmlUi PRIVATE ${CORE_INCLUDE_DIRS})
target_link_libraries(RmlUi PRIVATE ${CORE_LINK_LIBS})
target_compile_definitions(RmlUi PRIVATE ${CORE_PRIVATE_DEFS})
target_compile_definitions(RmlUi PUBLIC ${CORE_PUBLIC_DEFS})
endif()
if(BUILD_LUA_BINDINGS)
if(NOT BUILD_FRAMEWORK)
target_link_libraries(RmlLua RmlCore ${LUA_BINDINGS_LINK_LIBS})
target_include_directories(RmlLua PUBLIC ${LUA_BINDINGS_INCLUDE_DIRS})
else()
target_link_libraries(RmlUi ${LUA_BINDINGS_LINK_LIBS})
target_include_directories(RmlUi PUBLIC ${LUA_BINDINGS_INCLUDE_DIRS})
endif()
endif()
#===================================
# Build samples ====================
#===================================
# Build and link the samples
macro(bl_sample NAME)
if (WIN32)
add_executable(${NAME} WIN32 ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
elseif(APPLE)
add_executable(${NAME} MACOSX_BUNDLE ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
# The first rpath is to the proper location where the framework/library SHOULD be, the second is to the location actually seen
# in the build environment
if(BUILD_FRAMEWORK)
set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-rpath @executable_path/../Frameworks")
else()
set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-rpath @executable_path/../lib")
endif()
else()
add_executable(${NAME} ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
endif()
add_common_target_options(${NAME})
target_link_libraries(${NAME} ${ARGN})
endmacro()
# Build shell
if(BUILD_SAMPLES OR BUILD_TESTING)
message("-- Adding shell with '${SAMPLES_BACKEND}' backend.")
include(SampleFileList)
include(BackendFileList)
if(NOT BUILD_FRAMEWORK)
set(sample_LIBRARIES
shell
RmlCore
RmlDebugger
)
else()
set(sample_LIBRARIES
shell
RmlUi
)
endif()
set(SAMPLES_DIR opt/RmlUi/Samples CACHE PATH "Path to samples directory.")
if(WIN32)
mark_as_advanced(SAMPLES_DIR)
endif()
set(BACKEND_SRC_FILES "${${SAMPLES_BACKEND}_SRC_FILES}")
set(BACKEND_HDR_FILES "${${SAMPLES_BACKEND}_HDR_FILES}")
if("${BACKEND_SRC_FILES}" STREQUAL "" OR "${BACKEND_HDR_FILES}" STREQUAL "")
message(FATAL_ERROR "Unknown samples backend '${SAMPLES_BACKEND}'.")
endif()
list(APPEND shell_SRC_FILES ${BACKEND_SRC_FILES})
list(APPEND shell_HDR_FILES ${BACKEND_HDR_FILES} ${BACKEND_COMMON_HDR_FILES})
add_library(shell STATIC ${shell_SRC_FILES} ${shell_HDR_FILES})
target_include_directories(shell PUBLIC
${PROJECT_SOURCE_DIR}/Backends
${PROJECT_SOURCE_DIR}/Samples/shell/include
)
add_common_target_options(shell)
target_link_libraries(shell PUBLIC RmlCore RmlDebugger)
# Add OS dependencies.
if (WIN32)
target_link_libraries(shell PRIVATE shlwapi imm32)
elseif(APPLE)
target_link_libraries(shell PRIVATE "-framework Cocoa")
elseif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
find_package(X11)
if (X11_FOUND)
message("-- Found X11 library.")
target_link_libraries(shell PRIVATE ${X11_LIBRARIES})
# Platform_X11 uses Xkb if possible instead of XGetKeyboardMapping for performance.
if(X11_Xkb_FOUND)
FIND_PACKAGE_MESSAGE(X11 "Found X11 KBlib: ${X11_X11_LIB}" "[${X11_X11_LIB}][${X11_XkbINCLUDE_DIR}]")
target_compile_definitions(shell PRIVATE HAS_X11XKBLIB)
endif()
endif()
endif()
# Add platform dependencies.
if(SAMPLES_BACKEND MATCHES "^X11")
if(NOT X11_FOUND)
message(FATAL_ERROR "X11 not found or not supported on this platform, select a different sample backend.")
endif()
endif()
if(SAMPLES_BACKEND MATCHES "^SDL")
message("-- Looking for SDL2 library for samples backend.")
if(EMSCRIPTEN)
set(EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS='[tga]'")
else()
find_package(SDL2 REQUIRED)
if(NOT SDL2_FOUND)
message(FATAL_ERROR "SDL2 not found")
endif()
if(SAMPLES_BACKEND STREQUAL "SDL_GL2")
find_package(GLEW REQUIRED)
if(NOT GLEW_FOUND)
message(FATAL_ERROR "GLEW not found")
endif()
endif()
# Check version requirement for the SDL renderer.
if(SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer" AND "${SDL2_VERSION}" VERSION_LESS "2.0.20")
message(FATAL_ERROR "SDL2 native renderer backend (${SAMPLES_BACKEND}) requires SDL 2.0.20 (found ${SDL2_VERSION}).")
endif()
if(SAMPLES_BACKEND STREQUAL "SDL_GL2" OR SAMPLES_BACKEND STREQUAL "SDL_GL3" OR SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer")
find_package(SDL2_image REQUIRED)
if(NOT SDL2_IMAGE_FOUND)
message(FATAL_ERROR "SDL2_image not found")
endif()
endif()
target_include_directories(shell PRIVATE ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${GLEW_INCLUDE_DIR})
target_link_libraries(shell PRIVATE ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${GLEW_LIBRARIES})
endif()
endif()
if(SAMPLES_BACKEND MATCHES "^SFML")
message("-- Looking for SFML 2.x library for samples backend.")
if (WIN32)
find_package(SFML 2 REQUIRED COMPONENTS graphics window system main)
else()
find_package(SFML 2 REQUIRED COMPONENTS graphics window system)
endif()
target_include_directories(shell PRIVATE ${SFML_INCLUDE_DIR})
target_link_libraries(shell PRIVATE ${SFML_LIBRARIES})
endif()
if(SAMPLES_BACKEND MATCHES "^GLFW")
message("-- Looking for GLFW3 library for samples backend.")
find_package(glfw3 3.3 CONFIG REQUIRED)
target_link_libraries(shell PRIVATE glfw)
message("-- Found GLFW version ${glfw3_VERSION}.")
endif()
# Add renderer dependencies.
if(SAMPLES_BACKEND MATCHES "GL2$")
message("-- Adding OpenGL 2 renderer backend.")
find_package(OpenGL REQUIRED)
target_include_directories(shell PRIVATE ${OPENGL_INCLUDE_DIR})
target_link_libraries(shell PRIVATE ${OPENGL_LIBRARIES})
target_compile_definitions(shell PRIVATE RMLUI_RENDERER_GL2)
if(APPLE)
target_compile_definitions(shell PRIVATE GL_SILENCE_DEPRECATION)
endif()
endif()
if(SAMPLES_BACKEND MATCHES "VK$")
message("-- Using Vulkan renderer backend.")
option(RMLUI_VK_DEBUG "Enable debugging mode for Vulkan renderer." OFF)
mark_as_advanced(RMLUI_VK_DEBUG)
if(RMLUI_VK_DEBUG)
target_compile_definitions(shell PRIVATE RMLUI_VK_DEBUG)
endif()
target_link_libraries(shell PRIVATE ${CMAKE_DL_LIBS})
endif()
if(SAMPLES_BACKEND MATCHES "GL3$")
message("-- Adding OpenGL 3 renderer backend.")
if(EMSCRIPTEN)
set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} -sMAX_WEBGL_VERSION=2")
else()
find_package(OpenGL REQUIRED)
target_include_directories(shell PRIVATE ${OPENGL_INCLUDE_DIR})
target_link_libraries(shell PRIVATE ${OPENGL_LIBRARIES} ${CMAKE_DL_LIBS})
target_compile_definitions(shell PRIVATE RMLUI_RENDERER_GL3)
if(APPLE)
target_compile_definitions(shell PRIVATE GL_SILENCE_DEPRECATION)
endif()
endif()
endif()
endif()
if(BUILD_SAMPLES)
set(samples treeview customlog drag loaddocument transform bitmapfont animation benchmark demo databinding)
set(tutorials template datagrid datagrid_tree drag)
if(ENABLE_LOTTIE_PLUGIN)
list(APPEND samples "lottie")
endif()
if(ENABLE_SVG_PLUGIN)
list(APPEND samples "svg")
endif()
# Build and install the basic samples
foreach(sample ${samples})
bl_sample(${sample} ${sample_LIBRARIES})
# The samples always set this as their current working directory
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/${sample})
install(TARGETS ${sample}
RUNTIME DESTINATION ${SAMPLES_DIR}/${sample}
BUNDLE DESTINATION ${SAMPLES_DIR})
endforeach()
# Build and install the tutorials
foreach(tutorial ${tutorials})
set(tutorial_fullname tutorial_${tutorial})
bl_sample(${tutorial_fullname} ${sample_LIBRARIES})
# The tutorials always set this as their current working directory
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/tutorial/${tutorial})
install(TARGETS ${tutorial_fullname}
RUNTIME DESTINATION ${SAMPLES_DIR}/${tutorial}
BUNDLE DESTINATION ${SAMPLES_DIR})
endforeach()
# Build and install invaders sample
bl_sample(invaders ${sample_LIBRARIES})
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/invaders)
install(TARGETS invaders
RUNTIME DESTINATION ${SAMPLES_DIR}/invaders
BUNDLE DESTINATION ${SAMPLES_DIR})
if(BUILD_LUA_BINDINGS)
bl_sample(luainvaders RmlLua ${sample_LIBRARIES} ${LUA_BINDINGS_LINK_LIBS})
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/luainvaders)
install(TARGETS luainvaders
RUNTIME DESTINATION ${SAMPLES_DIR}/luainvaders
BUNDLE DESTINATION ${SAMPLES_DIR})
endif()
# Add assets to emscripten binaries
if(EMSCRIPTEN)
message("-- Preloading emscipten sample assets")
set(COMMON_ASSET_FOLDER "Samples/assets/")
set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/${COMMON_ASSET_FOLDER}@/${COMMON_ASSET_FOLDER}")
foreach(sample ${samples})
set(SAMPLE_DATA_FOLDER "Samples/basic/${sample}/data/")
set(ABS_SAMPLE_DATA_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/${SAMPLE_DATA_FOLDER}")
if(EXISTS ${ABS_SAMPLE_DATA_FOLDER})
target_link_libraries(${sample} "--preload-file ${ABS_SAMPLE_DATA_FOLDER}@/${SAMPLE_DATA_FOLDER}")
endif()
endforeach()
foreach(tutorial ${tutorials})
set(TUTORIAL_DATA_FOLDER "Samples/tutorial/${tutorial}/data/")
set(ABS_TUTORIAL_DATA_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/${TUTORIAL_DATA_FOLDER}")
if(EXISTS ${ABS_TUTORIAL_DATA_FOLDER})
target_link_libraries("tutorial_${tutorial}" "--preload-file ${ABS_TUTORIAL_DATA_FOLDER}@/${TUTORIAL_DATA_FOLDER}")
endif()
endforeach()
set(INVADER_DATA_FOLDER "Samples/invaders/data/")
target_link_libraries(invaders "-sALLOW_MEMORY_GROWTH --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/${INVADER_DATA_FOLDER}@/${INVADER_DATA_FOLDER}")
endif()
endif()
#===================================
# Add global options ===============
#===================================
if(EMSCRIPTEN)
# Enables Asyncify which we only need since the backend doesn't control the main loop. This enables us to yield to the browser during the backend call to
# Backend::ProcessEvents(). Asyncify results in larger and slower code, users are instead encouraged to use 'emscripten_set_main_loop()' and family.
set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} -sASYNCIFY")
message(STATUS "Compiling for Emscripten.\n\t- Flags:${EMSCRIPTEN_FLAGS}\n\t- ExeFlags:${EMSCRIPTEN_EXE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EMSCRIPTEN_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EMSCRIPTEN_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_FLAGS} ${EMSCRIPTEN_EXE_FLAGS}")
set(CMAKE_EXECUTABLE_SUFFIX .html)
endif()
#===================================
# Add tests ========================
#===================================
if(RMLUI_TESTS_ENABLED)
add_subdirectory(Tests)
endif()
#===================================
# Installation =====================
#===================================
if(BUILD_LUA_BINDINGS)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Include/RmlUi
DESTINATION include
)
else()
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Include/RmlUi
DESTINATION include
PATTERN "Lua" EXCLUDE
)
endif()
if(BUILD_SAMPLES)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/assets
DESTINATION ${SAMPLES_DIR}
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/template/data
DESTINATION ${SAMPLES_DIR}/tutorial/template
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/data
DESTINATION ${SAMPLES_DIR}/tutorial/datagrid
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/data
DESTINATION ${SAMPLES_DIR}/tutorial/datagrid_tree
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/data
DESTINATION ${SAMPLES_DIR}/tutorial/drag
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/animation/data
DESTINATION ${SAMPLES_DIR}/basic/animation
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/benchmark/data
DESTINATION ${SAMPLES_DIR}/basic/benchmark
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/data
DESTINATION ${SAMPLES_DIR}/basic/bitmapfont
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/databinding/data
DESTINATION ${SAMPLES_DIR}/basic/databinding
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/demo/data
DESTINATION ${SAMPLES_DIR}/basic/demo
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/transform/data
DESTINATION ${SAMPLES_DIR}/basic/transform
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/treeview/data
DESTINATION ${SAMPLES_DIR}/basic/treeview
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/drag/data
DESTINATION ${SAMPLES_DIR}/basic/drag
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/invaders/data
DESTINATION ${SAMPLES_DIR}/invaders
)
if(TARGET lottie)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/lottie/data
DESTINATION ${SAMPLES_DIR}/basic/lottie
)
endif()
if(TARGET svg)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/svg/data
DESTINATION ${SAMPLES_DIR}/basic/svg
)
endif()
if(BUILD_LUA_BINDINGS)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/data
DESTINATION ${SAMPLES_DIR}/luainvaders
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/lua
DESTINATION ${SAMPLES_DIR}/luainvaders
)
endif()
endif()
#===================================
# Generate Config.cmake files ======
#===================================
# Try to include helper module
include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE)
# guard against older versions of cmake which do not provide it
if(PkgHelpers_AVAILABLE)
set (INCLUDE_INSTALL_DIR "include")
set (LIB_INSTALL_DIR "lib")
set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include")
# generate configuration for install tree
configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in
${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake