*/}}

lagui-config.cmake 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # LaGUI CMake config file.
  2. get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
  3. include(${SELF_DIR}/lagui-targets.cmake)
  4. get_filename_component(LAGUI_INCLUDE_DIRS "${SELF_DIR}/../../include/lagui" ABSOLUTE)
  5. if (POLICY CMP0072)
  6. set(OpenGL_GL_PREFERENCE GLVND)
  7. endif()
  8. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
  9. find_package(OpenGL REQUIRED)
  10. find_package(X11 REQUIRED)
  11. find_package(Freetype REQUIRED)
  12. find_package(GLEW REQUIRED)
  13. find_package(PNG REQUIRED)
  14. find_package(LuaJIT REQUIRED)
  15. set(CMAKE_THREAD_PREFER_PTHREAD ON)
  16. set(THREADS_PREFER_PTHREAD_FLAG ON)
  17. find_package(Threads REQUIRED)
  18. if (CMAKE_SYSTEM_NAME MATCHES "Linux")
  19. set(LAGUI_SHARED_LIBS
  20. ${X11_LIBRARIES}
  21. ${X11_X11_LIB}
  22. ${GLEW_LIBRARIES}
  23. ${OPENGL_LIBRARY}
  24. ${FREETYPE_LIBRARIES}
  25. ${X11_Xfixes_LIB}
  26. ${X11_Xrandr_LIB}
  27. ${PNG_LIBRARY}
  28. m X11 Xi Xcursor
  29. ${CMAKE_DL_LIBS}
  30. Threads::Threads
  31. ${LUA_LIBRARY}
  32. lagui
  33. CACHE INTERNAL "LaGUI shared libs"
  34. )
  35. set(LAGUI_INCLUDE_DIRS_ALL
  36. ${CMAKE_SOURCE_DIR}
  37. ${X11_INCLUDE_DIR}
  38. ${GLEW_INCLUDE_PATH}
  39. ${FREETYPE_INCLUDE_DIRS}
  40. ${LAGUI_INCLUDE_DIRS}
  41. ${LUA_INCLUDE_DIR}
  42. CACHE INTERNAL "Include dirs of LaGUI and dependencies"
  43. )
  44. elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
  45. set(LAGUI_SHARED_LIBS
  46. ${GLEW_LIBRARIES}
  47. ${OPENGL_LIBRARY}
  48. ${FREETYPE_LIBRARIES}
  49. ${PNG_LIBRARY}
  50. ${CMAKE_DL_LIBS}
  51. ${LUA_LIBRARY}
  52. Threads::Threads
  53. lagui shlwapi
  54. CACHE INTERNAL "LaGUI shared libs"
  55. )
  56. set(LAGUI_INCLUDE_DIRS_ALL
  57. ${CMAKE_SOURCE_DIR}
  58. ${GLEW_INCLUDE_PATH}
  59. ${FREETYPE_INCLUDE_DIRS}
  60. ${LAGUI_INCLUDE_DIRS}
  61. ${LUA_INCLUDE_DIR}
  62. CACHE INTERNAL "Include dirs of LaGUI and dependencies"
  63. )
  64. endif()
  65. # Build Types
  66. set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
  67. CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel tnsan asan lsan msan ubsan"
  68. FORCE)
  69. # ThreadSanitizer
  70. set(CMAKE_C_FLAGS_TSAN
  71. "-fsanitize=thread -g -O1"
  72. CACHE STRING "Flags used by the C compiler during ThreadSanitizer builds."
  73. FORCE)
  74. set(CMAKE_CXX_FLAGS_TSAN
  75. "-fsanitize=thread -g -O1"
  76. CACHE STRING "Flags used by the C++ compiler during ThreadSanitizer builds."
  77. FORCE)
  78. # AddressSanitize
  79. set(CMAKE_C_FLAGS_ASAN
  80. "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g"
  81. CACHE STRING "Flags used by the C compiler during AddressSanitizer builds."
  82. FORCE)
  83. set(CMAKE_CXX_FLAGS_ASAN
  84. "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g"
  85. CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds."
  86. FORCE)
  87. # LeakSanitizer
  88. set(CMAKE_C_FLAGS_LSAN
  89. "-fsanitize=leak -fno-omit-frame-pointer -g"
  90. CACHE STRING "Flags used by the C compiler during LeakSanitizer builds."
  91. FORCE)
  92. set(CMAKE_CXX_FLAGS_LSAN
  93. "-fsanitize=leak -fno-omit-frame-pointer -g"
  94. CACHE STRING "Flags used by the C++ compiler during LeakSanitizer builds."
  95. FORCE)
  96. # MemorySanitizer
  97. set(CMAKE_C_FLAGS_MSAN
  98. "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g"
  99. CACHE STRING "Flags used by the C compiler during MemorySanitizer builds."
  100. FORCE)
  101. set(CMAKE_CXX_FLAGS_MSAN
  102. "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g"
  103. CACHE STRING "Flags used by the C++ compiler during MemorySanitizer builds."
  104. FORCE)
  105. # UndefinedBehaviour
  106. set(CMAKE_C_FLAGS_UBSAN
  107. "-fsanitize=undefined"
  108. CACHE STRING "Flags used by the C compiler during UndefinedBehaviourSanitizer builds."
  109. FORCE)
  110. set(CMAKE_CXX_FLAGS_UBSAN
  111. "-fsanitize=undefined"
  112. CACHE STRING "Flags used by the C++ compiler during UndefinedBehaviourSanitizer builds."
  113. FORCE)
  114. set(LAGUI_FONTS
  115. "NotoEmoji-Regular.ttf"
  116. "NotoSansCJK-Regular.ttc"
  117. "NotoSansMono-Regular.ttf"
  118. "NotoSansSymbols-Regular.ttf"
  119. "NotoSansSymbols2-Regular.ttf"
  120. )