*/}}
1
0

lagui-config.cmake 3.9 KB

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