CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. add_library(rmlui_lua
  2. Colourb.cpp
  3. Colourb.h
  4. Colourf.cpp
  5. Colourf.h
  6. Context.cpp
  7. Context.h
  8. ContextDocumentsProxy.cpp
  9. ContextDocumentsProxy.h
  10. Document.cpp
  11. Document.h
  12. Element.cpp
  13. Element.h
  14. ElementAttributesProxy.cpp
  15. ElementAttributesProxy.h
  16. ElementChildNodesProxy.cpp
  17. ElementChildNodesProxy.h
  18. ElementInstancer.cpp
  19. ElementInstancer.h
  20. ElementStyleProxy.cpp
  21. ElementStyleProxy.h
  22. ElementText.cpp
  23. ElementText.h
  24. Event.cpp
  25. Event.h
  26. EventParametersProxy.cpp
  27. EventParametersProxy.h
  28. GlobalLuaFunctions.cpp
  29. GlobalLuaFunctions.h
  30. Interpreter.cpp
  31. Log.cpp
  32. Log.h
  33. Lua.cpp
  34. LuaDataModel.cpp
  35. LuaDataModel.h
  36. LuaDocument.cpp
  37. LuaDocument.h
  38. LuaDocumentElementInstancer.cpp
  39. LuaDocumentElementInstancer.h
  40. LuaElementInstancer.cpp
  41. LuaElementInstancer.h
  42. LuaEventListener.cpp
  43. LuaEventListener.h
  44. LuaEventListenerInstancer.cpp
  45. LuaEventListenerInstancer.h
  46. LuaPlugin.cpp
  47. LuaPlugin.h
  48. LuaType.cpp
  49. Pairs.h
  50. RmlUi.cpp
  51. RmlUi.h
  52. RmlUiContextsProxy.cpp
  53. RmlUiContextsProxy.h
  54. Utilities.cpp
  55. Vector2f.cpp
  56. Vector2f.h
  57. Vector2i.cpp
  58. Vector2i.h
  59. )
  60. target_sources(rmlui_lua PRIVATE
  61. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Header.h"
  62. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/IncludeLua.h"
  63. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Interpreter.h"
  64. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Lua.h"
  65. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.h"
  66. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.inl"
  67. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Utilities.h"
  68. "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua.h"
  69. )
  70. set_common_target_options(rmlui_lua)
  71. target_include_directories(rmlui_lua PRIVATE "${PROJECT_SOURCE_DIR}/Include")
  72. target_include_directories(rmlui_lua INTERFACE
  73. "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Include>"
  74. "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
  75. )
  76. add_library(RmlUi::Lua ALIAS rmlui_lua)
  77. target_link_libraries(rmlui_lua PUBLIC rmlui_core)
  78. # Use public linking, as some of our public headers require Lua. However, in principle the Lua bindings can be used
  79. # without the Lua header files, in particular `RmlUi/Lua/Lua.h` does not require Lua.
  80. target_link_libraries(rmlui_lua PUBLIC RmlUi::External::Lua)
  81. # Set up the necessary compile definition if Lua is compiled as C++.
  82. if(RMLUI_LUA_BINDINGS_LIBRARY STREQUAL "lua_as_cxx")
  83. target_compile_definitions(rmlui_lua PUBLIC "RMLUI_LUA_AS_CXX")
  84. endif()
  85. # Set up definitions to export functions and classes as appropriate
  86. get_target_property(rmlui_lua_TYPE rmlui_lua "TYPE")
  87. if(rmlui_lua_TYPE STREQUAL "SHARED_LIBRARY")
  88. # If RmlUi lua is being compiled as a shared library, notify code to export functions using __dllspec()
  89. # For applications consuming the library, the headers will automatically use dllimport
  90. # Platform and compiler handling is already done by code via pre-processor macros
  91. target_compile_definitions(rmlui_lua PRIVATE "RMLUI_LUA_EXPORTS")
  92. endif()
  93. # Set additional target properties
  94. set_target_properties(rmlui_lua PROPERTIES
  95. # Add export name so that it can be exported with a namespaced name instead
  96. # of using the name we actually used to declare the target
  97. EXPORT_NAME "Lua"
  98. )
  99. add_subdirectory("Elements")
  100. install(TARGETS rmlui_lua
  101. EXPORT RmlUiTargets
  102. ${RMLUI_RUNTIME_DEPENDENCY_SET_ARG}
  103. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  104. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  105. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  106. )
  107. install_target_pdb(rmlui_lua)