CMakeLists.txt 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  1. #===================================
  2. # Build script for RmlUi ===========
  3. #===================================
  4. cmake_minimum_required(VERSION 3.1)
  5. if(APPLE)
  6. # This has to be before most other options so CMake properly handles the
  7. # compiler variables, it MUST bebefore the project() definition
  8. if(IOS_PLATFORM)
  9. set(CMAKE_TOOLCHAIN_FILE CMake/Platform/iOS.cmake)
  10. endif(IOS_PLATFORM)
  11. option(BUILD_UNIVERSAL_BINARIES "Build universal binaries for all architectures supported" ON)
  12. if (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES)
  13. if(IOS)
  14. # set the architecture for iOS
  15. if (${IOS_PLATFORM} STREQUAL "OS")
  16. set (IOS_ARCH armv6 armv7 armv7s arm64)
  17. set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
  18. else (${IOS_PLATFORM} STREQUAL "OS")
  19. set (IOS_ARCH x86_64)
  20. set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator")
  21. endif (${IOS_PLATFORM} STREQUAL "OS")
  22. else(IOS)
  23. # set the architectures for OS X
  24. set (OSXI_ARCH x86_64)
  25. set (CMAKE_OSX_ARCHITECTURES ${OSXI_ARCH} CACHE STRING "Build architecture for OS X universal binaries")
  26. endif(IOS)
  27. endif (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES)
  28. endif(APPLE)
  29. if(COMMAND cmake_policy)
  30. cmake_policy(SET CMP0015 NEW)
  31. endif(COMMAND cmake_policy)
  32. # Enable the use of MACOSX_RPATH by default for CMake v3.0+; this effectively
  33. # allows plug 'n' play functionality, so to speak -- the resulting shared
  34. # library files can simply be copied over into the end-user's application
  35. # bundle or framework bundle. No mucking around with install_name_tool.
  36. #
  37. # See also:
  38. # cmake --help-policy cmp0042
  39. # http://www.kitware.com/blog/home/post/510
  40. if(POLICY CMP0042)
  41. cmake_policy(SET CMP0042 NEW)
  42. endif(POLICY CMP0042)
  43. if (POLICY CMP0072)
  44. cmake_policy (SET CMP0072 NEW)
  45. endif(POLICY CMP0072)
  46. if(POLICY CMP0074)
  47. cmake_policy(SET CMP0074 NEW)
  48. endif(POLICY CMP0074)
  49. project(RmlUi LANGUAGES C CXX VERSION 4.4)
  50. set(RMLUI_VERSION_RELEASE false)
  51. if(RMLUI_VERSION_RELEASE)
  52. set(RMLUI_VERSION_SUFFIX "")
  53. else()
  54. set(RMLUI_VERSION_SUFFIX "-dev")
  55. endif()
  56. set(RMLUI_VERSION_SHORT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${RMLUI_VERSION_SUFFIX})
  57. list(APPEND CORE_PRIVATE_DEFS RMLUI_VERSION="${RMLUI_VERSION_SHORT}")
  58. if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
  59. option(BUILD_TESTING "" OFF)
  60. include(CTest)
  61. if(BUILD_TESTING)
  62. set(RMLUI_TESTS_ENABLED ON)
  63. set(VISUAL_TESTS_RML_DIRECTORIES "" CACHE PATH "Specify additional directories containing *.rml test documents for VisualTests. Separate multiple directories by comma.")
  64. set(VISUAL_TESTS_COMPARE_DIRECTORY "" CACHE PATH "Set the input directory for screenshot comparison performed by VisualTests.")
  65. set(VISUAL_TESTS_CAPTURE_DIRECTORY "" CACHE PATH "Set the output directory for screenshots generated by VisualTests.")
  66. endif()
  67. endif()
  68. # paths
  69. include(GNUInstallDirs)
  70. # Search in the 'cmake' directory for additional CMake modules.
  71. list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake;${PROJECT_SOURCE_DIR}/CMake/Modules)
  72. #===================================
  73. # Environment tests ================
  74. #===================================
  75. include(TestForANSIForScope)
  76. include(TestForANSIStreamHeaders)
  77. include(TestForSTDNamespace)
  78. #===================================
  79. # Provide hints as to where depends=
  80. # might be found =
  81. #===================================
  82. if(NOT DEFINED ENV{FREETYPE_DIR})
  83. set(ENV{FREETYPE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
  84. endif()
  85. if(NOT DEFINED ENV{LUA_DIR})
  86. set(ENV{LUA_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
  87. endif()
  88. if(NOT DEFINED ENV{SDL2DIR})
  89. set(ENV{SDL2DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
  90. endif()
  91. if(NOT DEFINED ENV{SDL2_IMAGE_DIR})
  92. set(ENV{SDL2_IMAGE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
  93. endif()
  94. if(NOT DEFINED ENV{SFML_ROOT})
  95. set(ENV{SFML_ROOT} "${PROJECT_SOURCE_DIR}/Dependencies")
  96. endif()
  97. if(NOT DEFINED ENV{TRACY_DIR})
  98. set(ENV{TRACY_DIR} "${PROJECT_SOURCE_DIR}/Dependencies")
  99. endif()
  100. if(NOT DEFINED ENV{RLOTTIE_DIR})
  101. set(ENV{RLOTTIE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies/rlottie")
  102. endif()
  103. if(NOT DEFINED ENV{LUNASVG_DIR})
  104. set(ENV{LUNASVG_DIR} "${PROJECT_SOURCE_DIR}/Dependencies/lunasvg")
  105. endif()
  106. #===================================
  107. # Plaform specific global hacks ====
  108. #===================================
  109. if(APPLE)
  110. # Disables naked builtins from AssertMacros.h which
  111. # This prevents naming collisions such as those from the check()
  112. # function macro with LuaType::check
  113. add_definitions(-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0)
  114. endif(APPLE)
  115. #===================================
  116. # Build options ====================
  117. #===================================
  118. if(NOT CMAKE_BUILD_TYPE)
  119. set(CMAKE_BUILD_TYPE Release CACHE STRING
  120. "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
  121. FORCE)
  122. endif()
  123. if(NOT IOS)
  124. option(BUILD_SHARED_LIBS "Build shared (dynamic) libraries" ON)
  125. endif(NOT IOS)
  126. option(BUILD_LUA_BINDINGS "Build Lua bindings" OFF)
  127. if(APPLE)
  128. option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
  129. endif()
  130. option(BUILD_SAMPLES "Build samples" OFF)
  131. option(MATRIX_ROW_MAJOR "Use row-major matrices. Column-major matrices are used by default." OFF)
  132. if(APPLE)
  133. if(IOS)
  134. if(BUILD_SHARED_LIBS)
  135. message(FATAL_ERROR "BUILD_SHARED_LIBS must be OFF for iOS builds. iOS does not support shared libraries.")
  136. endif(BUILD_SHARED_LIBS)
  137. endif(IOS)
  138. if(BUILD_FRAMEWORK)
  139. if(NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
  140. message(FATAL_ERROR "You should use Xcode generator with BUILD_FRAMEWORK enabled")
  141. endif()
  142. if(NOT BUILD_SHARED_LIBS)
  143. message(FATAL_ERROR "BUILD_SHARED_LIBS must be ON with BUILD_FRAMEWORK enabled")
  144. endif()
  145. endif()
  146. else(APPLE)
  147. if(BUILD_FRAMEWORK)
  148. message(FATAL_ERROR "BUILD_FRAMEWORK is only supported on Mac OS X with the Xcode generator")
  149. endif()
  150. endif(APPLE)
  151. 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)
  152. if(NO_FONT_INTERFACE_DEFAULT)
  153. list(APPEND CORE_PRIVATE_DEFS RMLUI_NO_FONT_INTERFACE_DEFAULT)
  154. endif()
  155. if(WIN32 AND BUILD_SHARED_LIBS AND BUILD_TESTING)
  156. 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.")
  157. endif()
  158. if(NOT BUILD_SHARED_LIBS)
  159. list(APPEND CORE_PUBLIC_DEFS -DRMLUI_STATIC_LIB)
  160. message("-- Building static libraries. Make sure to #define RMLUI_STATIC_LIB before including RmlUi in your project.")
  161. endif()
  162. option(NO_THIRDPARTY_CONTAINERS "Only use standard library containers." OFF)
  163. if( NO_THIRDPARTY_CONTAINERS )
  164. list(APPEND CORE_PUBLIC_DEFS -DRMLUI_NO_THIRDPARTY_CONTAINERS)
  165. message("-- No third-party containers will be used: Make sure to #define RMLUI_NO_THIRDPARTY_CONTAINERS before including RmlUi in your project.")
  166. endif()
  167. option(CUSTOM_CONFIGURATION "Customize RmlUi configuration files for overriding the default configuration and types." OFF)
  168. set(CUSTOM_CONFIGURATION_FILE "" CACHE STRING "Custom configuration file to be included in place of <RmlUi/Config/Config.h>.")
  169. if( CUSTOM_CONFIGURATION AND CUSTOM_CONFIGURATION_FILE )
  170. list(APPEND CORE_PUBLIC_DEFS -DRMLUI_CUSTOM_CONFIGURATION_FILE="${CUSTOM_CONFIGURATION_FILE}")
  171. message("-- Including ${CUSTOM_CONFIGURATION_FILE} instead of <RmlUi/Config/Config.h>")
  172. endif ()
  173. set(CUSTOM_INCLUDE_DIRS "" CACHE STRING "Extra include directories (use with CUSTOM_CONFIGURATION_FILE).")
  174. if( CUSTOM_CONFIGURATION AND CUSTOM_INCLUDE_DIRS )
  175. include_directories(${CUSTOM_INCLUDE_DIRS})
  176. endif ()
  177. set(CUSTOM_LINK_LIBRARIES "" CACHE STRING "Extra link libraries (use with CUSTOM_CONFIGURATION_FILE).")
  178. if( CUSTOM_CONFIGURATION )
  179. mark_as_advanced( CLEAR CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
  180. else()
  181. mark_as_advanced( FORCE CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
  182. if( CUSTOM_CONFIGURATION_FILE OR CUSTOM_INCLUDE_DIRS OR CUSTOM_LINK_LIBRARIES )
  183. message("-- CUSTOM_CONFIGURATION disabled, but custom configuration variables are set. They will have no effect.")
  184. endif()
  185. endif()
  186. option(ENABLE_TRACY_PROFILING "Enable profiling with Tracy. Source files can be placed in Dependencies/tracy." OFF)
  187. if( ENABLE_TRACY_PROFILING )
  188. find_package(Tracy REQUIRED)
  189. include_directories(${TRACY_INCLUDE_DIR})
  190. if( CMAKE_CONFIGURATION_TYPES )
  191. list(APPEND CMAKE_CONFIGURATION_TYPES Tracy)
  192. list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
  193. set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
  194. "Add the configurations that we need"
  195. FORCE)
  196. set(CMAKE_C_FLAGS_TRACY "${CMAKE_CXX_FLAGS_RELEASE} -DRMLUI_ENABLE_PROFILING")
  197. set(CMAKE_CXX_FLAGS_TRACY "${CMAKE_CXX_FLAGS_RELEASE} -DRMLUI_ENABLE_PROFILING")
  198. set(CMAKE_EXE_LINKER_FLAGS_TRACY "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
  199. set(CMAKE_SHARED_LINKER_FLAGS_TRACY "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
  200. message("-- Tracy profiling enabled in configuration 'Tracy'.")
  201. else()
  202. message("-- Tracy profiling enabled.")
  203. list(APPEND CORE_PUBLIC_DEFS -DRMLUI_ENABLE_PROFILING)
  204. endif()
  205. elseif( CMAKE_CONFIGURATION_TYPES )
  206. list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES Tracy)
  207. endif()
  208. option(ENABLE_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires the rlottie library." OFF)
  209. option(ENABLE_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF)
  210. option(DISABLE_RTTI_AND_EXCEPTIONS "Build with rtti and exceptions disabled." OFF)
  211. if(DISABLE_RTTI_AND_EXCEPTIONS)
  212. list(APPEND CORE_PUBLIC_DEFS -DRMLUI_USE_CUSTOM_RTTI)
  213. message("-- C++ RTTI and exceptions will be disabled: Make sure to #define RMLUI_USE_CUSTOM_RTTI before including RmlUi in your project.")
  214. endif()
  215. option(ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers" ON)
  216. set(PRECOMPILED_HEADERS_ENABLED OFF)
  217. if (ENABLE_PRECOMPILED_HEADERS AND (CMAKE_VERSION VERSION_LESS 3.16.0))
  218. message("-- Could not enable precompiled headers. Need CMake version 3.16.0 or greater.")
  219. elseif (ENABLE_PRECOMPILED_HEADERS)
  220. set(PRECOMPILED_HEADERS_ENABLED ON)
  221. endif()
  222. option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors." OFF)
  223. mark_as_advanced(WARNINGS_AS_ERRORS)
  224. macro(add_common_target_options NAME)
  225. # C++ language version
  226. if(CMAKE_VERSION VERSION_LESS 3.8.0)
  227. set_target_properties(${NAME} PROPERTIES
  228. CXX_STANDARD 14
  229. CXX_STANDARD_REQUIRED YES
  230. )
  231. else()
  232. target_compile_features(${NAME} PUBLIC cxx_std_14)
  233. endif()
  234. set_target_properties(${NAME} PROPERTIES CXX_EXTENSIONS OFF)
  235. # Compiler warnings
  236. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  237. target_compile_options(${NAME} PRIVATE -Wall -pedantic -Wextra)
  238. if(WARNINGS_AS_ERRORS)
  239. target_compile_options(${NAME} PRIVATE -Werror)
  240. endif()
  241. elseif(MSVC)
  242. target_compile_options(${NAME} PRIVATE /MP /W4 /w44062 /permissive-)
  243. target_compile_definitions(${NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
  244. if(WARNINGS_AS_ERRORS)
  245. target_compile_options(${NAME} PRIVATE /WX)
  246. endif()
  247. endif()
  248. endmacro()
  249. #===================================
  250. # Setup paths ======================
  251. #===================================
  252. include_directories(
  253. ${PROJECT_SOURCE_DIR}/Include
  254. )
  255. # Include list of source files
  256. include(FileList)
  257. #===================================
  258. # Find dependencies ================
  259. #===================================
  260. # FreeType
  261. if(NOT NO_FONT_INTERFACE_DEFAULT)
  262. find_package(Freetype REQUIRED)
  263. if(MSVC AND FREETYPE_VERSION_STRING STREQUAL "2.11.0")
  264. 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.")
  265. endif()
  266. list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES})
  267. list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
  268. endif()
  269. # Lua
  270. if(BUILD_LUA_BINDINGS)
  271. find_package(Lua REQUIRED)
  272. list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
  273. list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES})
  274. endif()
  275. # rlottie
  276. if( ENABLE_LOTTIE_PLUGIN )
  277. # Try to find the rlottie library.
  278. if(NOT DEFINED rlottie_DIR)
  279. set(rlottie_DIR $ENV{RLOTTIE_DIR})
  280. endif()
  281. list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/rlottie/build)
  282. find_package(rlottie CONFIG)
  283. find_path(rlottie_INCLUDE_DIR rlottie.h HINTS ${rlottie_DIR} $ENV{rlottie_DIR} PATH_SUFFIXES inc rlottie/inc )
  284. if(rlottie_FOUND AND rlottie_INCLUDE_DIR)
  285. message("-- Can Lottie plugin be added to RmlCore - yes - rlottie library found")
  286. list(APPEND CORE_LINK_LIBS rlottie::rlottie)
  287. list(APPEND CORE_INCLUDE_DIRS ${rlottie_INCLUDE_DIR})
  288. list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_LOTTIE_PLUGIN)
  289. list(APPEND Core_HDR_FILES ${Lottie_HDR_FILES})
  290. list(APPEND Core_PUB_HDR_FILES ${Lottie_PUB_HDR_FILES})
  291. list(APPEND Core_SRC_FILES ${Lottie_SRC_FILES})
  292. else()
  293. if(rlottie_FOUND)
  294. message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie library found - rlottie include directory not found")
  295. elseif(rlottie_INCLUDE_DIR)
  296. message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie library not found - rlottie include directory found at ${rlottie_INCLUDE_DIR}")
  297. else()
  298. message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie not found")
  299. endif()
  300. endif()
  301. endif()
  302. # lunasvg
  303. if( ENABLE_SVG_PLUGIN )
  304. if(NOT DEFINED LUNASVG_DIR)
  305. set(LUNASVG_DIR $ENV{LUNASVG_DIR})
  306. endif()
  307. message("-- Can SVG plugin be enabled - looking for lunasvg library")
  308. find_package(lunasvg REQUIRED)
  309. list(APPEND CORE_LINK_LIBS ${LUNASVG_LIBRARIES})
  310. list(APPEND CORE_INCLUDE_DIRS ${LUNASVG_INCLUDE_DIR})
  311. list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_SVG_PLUGIN)
  312. list(APPEND Core_HDR_FILES ${SVG_HDR_FILES})
  313. list(APPEND Core_PUB_HDR_FILES ${SVG_PUB_HDR_FILES})
  314. list(APPEND Core_SRC_FILES ${SVG_SRC_FILES})
  315. message("-- Can SVG plugin be enabled - yes - lunasvg library found")
  316. endif()
  317. if(NOT BUILD_FRAMEWORK)
  318. #===================================
  319. # Build libraries ==================
  320. #===================================
  321. set(LIBRARIES Core Debugger)
  322. foreach(library ${LIBRARIES})
  323. set(NAME Rml${library})
  324. add_library(${NAME}
  325. ${${library}_HDR_FILES}
  326. ${${library}_PUB_HDR_FILES}
  327. ${MASTER_${library}_PUB_HDR_FILES}
  328. ${${library}_SRC_FILES}
  329. )
  330. set_target_properties(${NAME} PROPERTIES
  331. VERSION ${PROJECT_VERSION}
  332. SOVERSION ${PROJECT_VERSION_MAJOR}
  333. )
  334. add_common_target_options(${NAME})
  335. install(TARGETS ${NAME}
  336. EXPORT RmlUiTargets
  337. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  338. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  339. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  340. )
  341. set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
  342. endforeach(library)
  343. if( CUSTOM_CONFIGURATION )
  344. foreach(library ${CUSTOM_LINK_LIBRARIES})
  345. install(TARGETS ${library}
  346. EXPORT RmlUiTargets
  347. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  348. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  349. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  350. )
  351. set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${library})
  352. endforeach(library ${CUSTOM_LINK_LIBRARIES})
  353. endif()
  354. if( MATRIX_ROW_MAJOR )
  355. list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR)
  356. endif ()
  357. if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES )
  358. target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES})
  359. endif ()
  360. if (PRECOMPILED_HEADERS_ENABLED)
  361. target_precompile_headers(RmlCore PRIVATE ${PROJECT_SOURCE_DIR}/Source/Core/precompiled.h)
  362. endif()
  363. else(NOT BUILD_FRAMEWORK)
  364. #===================================
  365. # Build combined Framework =========
  366. #===================================
  367. set(NAME RmlUi)
  368. set(MASTER_PUB_HDR_FILES
  369. ${MASTER_Core_PUB_HDR_FILES}
  370. ${MASTER_Debugger_PUB_HDR_FILES}
  371. )
  372. add_library(${NAME}
  373. ${Core_HDR_FILES}
  374. ${MASTER_Core_PUB_HDR_FILES}
  375. ${Core_PUB_HDR_FILES}
  376. ${Core_SRC_FILES}
  377. ${Debugger_HDR_FILES}
  378. ${MASTER_Debugger_PUB_HDR_FILES}
  379. ${Debugger_PUB_HDR_FILES}
  380. ${Debugger_SRC_FILES}
  381. )
  382. set_target_properties(${NAME} PROPERTIES
  383. VERSION ${PROJECT_VERSION}
  384. SOVERSION ${PROJECT_VERSION_MAJOR}
  385. )
  386. set_property(SOURCE ${MASTER_PUB_HDR_FILES}
  387. PROPERTY MACOSX_PACKAGE_LOCATION Headers
  388. )
  389. set_property(SOURCE ${Core_PUB_HDR_FILES}
  390. PROPERTY MACOSX_PACKAGE_LOCATION Headers/Core
  391. )
  392. set_property(SOURCE ${Debugger_PUB_HDR_FILES}
  393. PROPERTY MACOSX_PACKAGE_LOCATION Headers/Debugger
  394. )
  395. set_target_properties(${NAME} PROPERTIES
  396. FRAMEWORK TRUE
  397. FRAMEWORK_VERSION ${PROJECT_VERSION}
  398. MACOSX_FRAMEWORK_IDENTIFIER com.rmlui.${NAME}
  399. MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${RMLUI_VERSION_SHORT}
  400. MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
  401. XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
  402. PUBLIC_HEADER ${MASTER_PUB_HDR_FILES}
  403. )
  404. install(TARGETS ${NAME}
  405. EXPORT RmlUiTargets
  406. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  407. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  408. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  409. FRAMEWORK DESTINATION Library/Frameworks
  410. )
  411. set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
  412. endif(NOT BUILD_FRAMEWORK)
  413. # Build Lua bindings
  414. if(BUILD_LUA_BINDINGS)
  415. set(NAME RmlLua)
  416. add_library(${NAME} ${Lua_SRC_FILES}
  417. ${Lua_HDR_FILES}
  418. ${Lua_PUB_HDR_FILES}
  419. )
  420. set_target_properties(${NAME} PROPERTIES
  421. VERSION ${PROJECT_VERSION}
  422. SOVERSION ${PROJECT_VERSION_MAJOR}
  423. )
  424. add_common_target_options(${NAME})
  425. install(TARGETS ${NAME}
  426. EXPORT RmlUiTargets
  427. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  428. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  429. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  430. )
  431. set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
  432. endif()
  433. if(DISABLE_RTTI_AND_EXCEPTIONS)
  434. if( CMAKE_COMPILER_IS_GNUCXX )
  435. add_definitions( -fno-rtti -fno-exceptions )
  436. elseif( MSVC )
  437. add_definitions( -D_HAS_EXCEPTIONS=0 /GR- )
  438. if(CMAKE_CXX_FLAGS MATCHES "/EHsc ")
  439. string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  440. message(STATUS "CMAKE_CXX_FLAGS matches /EHsc before end of string replaced...")
  441. endif()
  442. if(CMAKE_CXX_FLAGS MATCHES "/EHsc$")
  443. string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  444. message(STATUS "CMAKE_CXX_FLAGS matches /EHsc at end of string replaced...")
  445. endif()
  446. else()
  447. message(STATUS "Could not create build configuration without rtti and exceptions...")
  448. endif()
  449. endif()
  450. #===================================
  451. # Link libraries ===================
  452. #===================================
  453. if(NOT BUILD_FRAMEWORK)
  454. target_include_directories(RmlCore PRIVATE ${CORE_INCLUDE_DIRS})
  455. target_include_directories(RmlCore INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include> $<INSTALL_INTERFACE:include>)
  456. target_link_libraries(RmlCore PRIVATE ${CORE_LINK_LIBS})
  457. target_link_libraries(RmlDebugger RmlCore)
  458. target_compile_definitions(RmlCore PRIVATE ${CORE_PRIVATE_DEFS})
  459. target_compile_definitions(RmlCore PUBLIC ${CORE_PUBLIC_DEFS})
  460. else()
  461. target_include_directories(RmlUi PRIVATE ${CORE_INCLUDE_DIRS})
  462. target_link_libraries(RmlUi PRIVATE ${CORE_LINK_LIBS})
  463. target_compile_definitions(RmlUi PRIVATE ${CORE_PRIVATE_DEFS})
  464. target_compile_definitions(RmlUi PUBLIC ${CORE_PUBLIC_DEFS})
  465. endif()
  466. if(BUILD_LUA_BINDINGS)
  467. if(NOT BUILD_FRAMEWORK)
  468. target_link_libraries(RmlLua RmlCore ${LUA_BINDINGS_LINK_LIBS})
  469. target_include_directories(RmlLua PUBLIC ${LUA_BINDINGS_INCLUDE_DIRS})
  470. else()
  471. target_link_libraries(RmlUi ${LUA_BINDINGS_LINK_LIBS})
  472. target_include_directories(RmlUi PUBLIC ${LUA_BINDINGS_INCLUDE_DIRS})
  473. endif()
  474. endif()
  475. #===================================
  476. # Build samples ====================
  477. #===================================
  478. # Build and link the samples
  479. macro(bl_sample NAME)
  480. if (WIN32)
  481. add_executable(${NAME} WIN32 ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
  482. elseif(APPLE)
  483. add_executable(${NAME} MACOSX_BUNDLE ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
  484. # The first rpath is to the proper location where the framework/library SHOULD be, the second is to the location actually seen
  485. # in the build environment
  486. if(BUILD_FRAMEWORK)
  487. set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-rpath @executable_path/../Frameworks")
  488. else()
  489. set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-rpath @executable_path/../lib")
  490. endif()
  491. else()
  492. add_executable(${NAME} ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
  493. endif()
  494. add_common_target_options(${NAME})
  495. target_link_libraries(${NAME} ${ARGN})
  496. endmacro()
  497. # Build shell
  498. if(BUILD_SAMPLES OR BUILD_TESTING)
  499. include(SampleFileList)
  500. if(NOT BUILD_FRAMEWORK)
  501. set(sample_LIBRARIES
  502. shell
  503. RmlCore
  504. RmlDebugger
  505. )
  506. else()
  507. set(sample_LIBRARIES
  508. shell
  509. RmlUi
  510. )
  511. endif()
  512. # Find OpenGL
  513. find_package(OpenGL REQUIRED)
  514. if(OPENGL_FOUND)
  515. include_directories(${OPENGL_INCLUDE_DIR})
  516. list(APPEND sample_LIBRARIES ${OPENGL_LIBRARIES})
  517. endif()
  518. # Set up required system libraries
  519. if(APPLE)
  520. include(FindCarbon)
  521. find_package(Carbon REQUIRED)
  522. if (Carbon_FOUND)
  523. include_directories(${Carbon_INCLUDE_DIR})
  524. list(APPEND sample_LIBRARIES ${Carbon_LIBRARIES})
  525. endif()
  526. else()
  527. find_package(X11 REQUIRED)
  528. if (X11_FOUND)
  529. list(APPEND sample_LIBRARIES ${X11_LIBRARIES})
  530. # shell/src/x11/InputX11.cpp:InitialiseX11Keymap uses Xkb if
  531. # possible instead of XGetKeyboardMapping for performance
  532. if(X11_Xkb_FOUND)
  533. FIND_PACKAGE_MESSAGE(X11 "Found X11 KBlib: ${X11_X11_LIB}" "[${X11_X11_LIB}][${X11_XkbINCLUDE_DIR}]")
  534. add_definitions(-DHAS_X11XKBLIB)
  535. endif()
  536. endif()
  537. endif()
  538. set(SAMPLES_DIR opt/RmlUi/Samples CACHE PATH "path to samples dir")
  539. if(WIN32)
  540. mark_as_advanced(SAMPLES_DIR)
  541. endif()
  542. # The samples and tutorials use the shell library
  543. include_directories(${PROJECT_SOURCE_DIR}/Samples/shell/include)
  544. # Build and install sample shell library
  545. add_library(shell STATIC ${shell_SRC_FILES} ${shell_HDR_FILES})
  546. if (PRECOMPILED_HEADERS_ENABLED)
  547. target_precompile_headers(shell PRIVATE ${PROJECT_SOURCE_DIR}/Samples/shell/src/precompiled.h)
  548. endif()
  549. if (WIN32)
  550. target_link_libraries(shell PUBLIC shlwapi)
  551. endif()
  552. target_link_libraries(shell PUBLIC RmlCore)
  553. add_common_target_options(shell)
  554. endif()
  555. if(BUILD_SAMPLES)
  556. set(samples treeview customlog drag loaddocument transform bitmapfont animation benchmark demo databinding)
  557. set(tutorials template datagrid datagrid_tree drag)
  558. # Build and install the basic samples
  559. foreach(sample ${samples})
  560. bl_sample(${sample} ${sample_LIBRARIES})
  561. # The samples always set this as their current working directory
  562. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/${sample})
  563. install(TARGETS ${sample}
  564. RUNTIME DESTINATION ${SAMPLES_DIR}/${sample}
  565. BUNDLE DESTINATION ${SAMPLES_DIR})
  566. endforeach()
  567. message("-- Can SDL2 samples be built")
  568. find_package(SDL2)
  569. if(SDL2_FOUND)
  570. find_package(SDL2_image)
  571. if(SDL2_IMAGE_FOUND)
  572. find_package(GLEW)
  573. if(GLEW_FOUND)
  574. message("-- Can SDL2 sample w/OpenGL renderer be built - yes")
  575. include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${GLEW_INCLUDE_DIR})
  576. bl_sample(sdl2 ${sample_LIBRARIES} ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${GLEW_LIBRARIES})
  577. # The samples always set this as their current working directory
  578. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/sdl2)
  579. install(TARGETS sdl2
  580. RUNTIME DESTINATION ${SAMPLES_DIR}/sdl2
  581. BUNDLE DESTINATION ${SAMPLES_DIR})
  582. else()
  583. message("-- Can SDL2 sample w/OpenGL renderer be built - no - GLEW not found")
  584. endif()
  585. if("${SDL2_VERSION}" VERSION_GREATER_EQUAL "2.0.20")
  586. message("-- Can SDL2 sample w/SDL-renderer be built - yes")
  587. include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR})
  588. bl_sample(sdl2_sdlrenderer ${sample_LIBRARIES} ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY})
  589. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/sdl2_sdlrenderer)
  590. install(TARGETS sdl2_sdlrenderer
  591. RUNTIME DESTINATION ${SAMPLES_DIR}/sdl2_sdlrenderer
  592. BUNDLE DESTINATION ${SAMPLES_DIR})
  593. else()
  594. message("-- Can SDL2 sample w/SDL-renderer be built - no - requires SDL 2.0.20 (found ${SDL2_VERSION})")
  595. endif()
  596. else()
  597. message("-- Can SDL2 samples be built - SDL2_image not found")
  598. endif()
  599. else()
  600. message("-- Can SDL2 samples be built - SDL2 not found")
  601. endif()
  602. message("-- Can SFML 2.x sample be built")
  603. if (WIN32)
  604. find_package(SFML 2 COMPONENTS graphics window system main)
  605. else()
  606. find_package(SFML 2 COMPONENTS graphics window system)
  607. endif()
  608. if(NOT SFML_FOUND)
  609. message("-- Can SFML 2.x sample be built - no")
  610. else()
  611. find_package(GLEW)
  612. if(GLEW_FOUND)
  613. message("-- Can SFML 2.x sample be built - yes: with GLEW")
  614. include_directories(${SFML_INCLUDE_DIR} ${GLEW_INCLUDE_DIR})
  615. add_definitions( -DENABLE_GLEW )
  616. bl_sample(sfml2 ${sample_LIBRARIES} ${SFML_LIBRARIES} ${GLEW_LIBRARIES})
  617. else()
  618. message("-- Can SFML 2.x sample be built - yes: without GLEW")
  619. include_directories(${SFML_INCLUDE_DIR})
  620. bl_sample(sfml2 ${sample_LIBRARIES} ${SFML_LIBRARIES})
  621. endif()
  622. # The samples always set this as their current working directory
  623. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/sfml2)
  624. install(TARGETS sfml2
  625. RUNTIME DESTINATION ${SAMPLES_DIR}/sfml2
  626. BUNDLE DESTINATION ${SAMPLES_DIR})
  627. endif()
  628. if( ENABLE_LOTTIE_PLUGIN )
  629. bl_sample(lottie ${sample_LIBRARIES})
  630. # The samples always set this as their current working directory
  631. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/lottie)
  632. install(TARGETS lottie
  633. RUNTIME DESTINATION ${SAMPLES_DIR}/lottie
  634. BUNDLE DESTINATION ${SAMPLES_DIR}
  635. )
  636. endif()
  637. if( ENABLE_SVG_PLUGIN )
  638. bl_sample(svg ${sample_LIBRARIES})
  639. # The samples always set this as their current working directory
  640. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/svg)
  641. install(TARGETS svg
  642. RUNTIME DESTINATION ${SAMPLES_DIR}/svg
  643. BUNDLE DESTINATION ${SAMPLES_DIR}
  644. )
  645. endif()
  646. # Build and install the tutorials
  647. foreach(tutorial ${tutorials})
  648. set(tutorial_fullname tutorial_${tutorial})
  649. bl_sample(${tutorial_fullname} ${sample_LIBRARIES})
  650. # The tutorials always set this as their current working directory
  651. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/tutorial/${tutorial})
  652. install(TARGETS ${tutorial_fullname}
  653. RUNTIME DESTINATION ${SAMPLES_DIR}/${tutorial}
  654. BUNDLE DESTINATION ${SAMPLES_DIR})
  655. endforeach()
  656. # Build and install invaders sample
  657. bl_sample(invaders ${sample_LIBRARIES})
  658. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/invaders)
  659. install(TARGETS invaders
  660. RUNTIME DESTINATION ${SAMPLES_DIR}/invaders
  661. BUNDLE DESTINATION ${SAMPLES_DIR})
  662. if(BUILD_LUA_BINDINGS)
  663. bl_sample(luainvaders RmlLua ${sample_LIBRARIES} ${LUA_BINDINGS_LINK_LIBS})
  664. install(DIRECTORY DESTINATION ${SAMPLES_DIR}/luainvaders)
  665. install(TARGETS luainvaders
  666. RUNTIME DESTINATION ${SAMPLES_DIR}/luainvaders
  667. BUNDLE DESTINATION ${SAMPLES_DIR})
  668. endif()
  669. endif()
  670. #===================================
  671. # Add tests ========================
  672. #===================================
  673. if(RMLUI_TESTS_ENABLED)
  674. add_subdirectory(Tests)
  675. endif()
  676. #===================================
  677. # Installation =====================
  678. #===================================
  679. if(BUILD_LUA_BINDINGS)
  680. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Include/RmlUi
  681. DESTINATION include
  682. )
  683. else()
  684. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Include/RmlUi
  685. DESTINATION include
  686. PATTERN "Lua" EXCLUDE
  687. )
  688. endif()
  689. if(BUILD_SAMPLES)
  690. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/assets
  691. DESTINATION ${SAMPLES_DIR}
  692. )
  693. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/template/data
  694. DESTINATION ${SAMPLES_DIR}/tutorial/template
  695. )
  696. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/data
  697. DESTINATION ${SAMPLES_DIR}/tutorial/datagrid
  698. )
  699. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/data
  700. DESTINATION ${SAMPLES_DIR}/tutorial/datagrid_tree
  701. )
  702. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/data
  703. DESTINATION ${SAMPLES_DIR}/tutorial/drag
  704. )
  705. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/animation/data
  706. DESTINATION ${SAMPLES_DIR}/basic/animation
  707. )
  708. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/benchmark/data
  709. DESTINATION ${SAMPLES_DIR}/basic/benchmark
  710. )
  711. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/data
  712. DESTINATION ${SAMPLES_DIR}/basic/bitmapfont
  713. )
  714. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/databinding/data
  715. DESTINATION ${SAMPLES_DIR}/basic/databinding
  716. )
  717. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/demo/data
  718. DESTINATION ${SAMPLES_DIR}/basic/demo
  719. )
  720. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/transform/data
  721. DESTINATION ${SAMPLES_DIR}/basic/transform
  722. )
  723. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/treeview/data
  724. DESTINATION ${SAMPLES_DIR}/basic/treeview
  725. )
  726. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/drag/data
  727. DESTINATION ${SAMPLES_DIR}/basic/drag
  728. )
  729. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/invaders/data
  730. DESTINATION ${SAMPLES_DIR}/invaders
  731. )
  732. if(TARGET lottie)
  733. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/lottie/data
  734. DESTINATION ${SAMPLES_DIR}/basic/lottie
  735. )
  736. endif()
  737. if(TARGET svg)
  738. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/svg/data
  739. DESTINATION ${SAMPLES_DIR}/basic/svg
  740. )
  741. endif()
  742. if(BUILD_LUA_BINDINGS)
  743. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/data
  744. DESTINATION ${SAMPLES_DIR}/luainvaders
  745. )
  746. install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/lua
  747. DESTINATION ${SAMPLES_DIR}/luainvaders
  748. )
  749. endif()
  750. endif()
  751. #===================================
  752. # Generate Config.cmake files ======
  753. #===================================
  754. # Try to include helper module
  755. include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE)
  756. # guard against older versions of cmake which do not provide it
  757. if(PkgHelpers_AVAILABLE)
  758. set (INCLUDE_INSTALL_DIR "include")
  759. set (LIB_INSTALL_DIR "lib")
  760. set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include")
  761. # generate configuration for install tree
  762. configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in
  763. ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake
  764. INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake
  765. PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
  766. write_basic_package_version_file(
  767. ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake
  768. VERSION ${PROJECT_VERSION}
  769. COMPATIBILITY SameMajorVersion )
  770. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake
  771. ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake
  772. DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake )
  773. install(EXPORT RmlUiTargets
  774. DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake)
  775. # generate configuration for build tree
  776. configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in
  777. ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake
  778. INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
  779. PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR)
  780. export(TARGETS ${RMLUI_EXPORTED_TARGETS}
  781. FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake")
  782. write_basic_package_version_file(
  783. ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake
  784. VERSION ${PROJECT_VERSION}
  785. COMPATIBILITY SameMajorVersion )
  786. set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.")
  787. else()
  788. message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library"
  789. " please update cmake to version which provides CMakePackageConfighelpers module"
  790. " or write generators for RmlUiConfig.cmake by yourself.")
  791. endif()