*/}}

lagui-config.cmake 3.9 KB

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