*/}}

lagui-config.cmake 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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(LAGUI_SHARED_LIBS
  14. ${X11_LIBRARIES}
  15. ${X11_X11_LIB}
  16. ${GLEW_LIBRARIES}
  17. ${OPENGL_LIBRARY}
  18. ${FREETYPE_LIBRARIES}
  19. ${X11_Xfixes_LIB}
  20. #${PNG_LIBRARY}
  21. m X11 Xi
  22. lagui
  23. CACHE INTERNAL "LaGUI shared libs"
  24. )
  25. set(LAGUI_INCLUDE_DIRS_ALL
  26. ${CMAKE_SOURCE_DIR}
  27. ${X11_INCLUDE_DIR}
  28. ${GLEW_INCLUDE_PATH}
  29. ${GLM_INCLUDE_PATH}
  30. ${FREETYPE_INCLUDE_DIRS}
  31. ${LAGUI_INCLUDE_DIRS}
  32. CACHE INTERNAL "Include dirs of LaGUI and dependencies"
  33. )
  34. # Build Types
  35. set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
  36. CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel tnsan asan lsan msan ubsan"
  37. FORCE)
  38. # ThreadSanitizer
  39. set(CMAKE_C_FLAGS_TSAN
  40. "-fsanitize=thread -g -O1"
  41. CACHE STRING "Flags used by the C compiler during ThreadSanitizer builds."
  42. FORCE)
  43. set(CMAKE_CXX_FLAGS_TSAN
  44. "-fsanitize=thread -g -O1"
  45. CACHE STRING "Flags used by the C++ compiler during ThreadSanitizer builds."
  46. FORCE)
  47. # AddressSanitize
  48. set(CMAKE_C_FLAGS_ASAN
  49. "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g"
  50. CACHE STRING "Flags used by the C compiler during AddressSanitizer builds."
  51. FORCE)
  52. set(CMAKE_CXX_FLAGS_ASAN
  53. "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g"
  54. CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds."
  55. FORCE)
  56. # LeakSanitizer
  57. set(CMAKE_C_FLAGS_LSAN
  58. "-fsanitize=leak -fno-omit-frame-pointer -g"
  59. CACHE STRING "Flags used by the C compiler during LeakSanitizer builds."
  60. FORCE)
  61. set(CMAKE_CXX_FLAGS_LSAN
  62. "-fsanitize=leak -fno-omit-frame-pointer -g"
  63. CACHE STRING "Flags used by the C++ compiler during LeakSanitizer builds."
  64. FORCE)
  65. # MemorySanitizer
  66. set(CMAKE_C_FLAGS_MSAN
  67. "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g"
  68. CACHE STRING "Flags used by the C compiler during MemorySanitizer builds."
  69. FORCE)
  70. set(CMAKE_CXX_FLAGS_MSAN
  71. "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g"
  72. CACHE STRING "Flags used by the C++ compiler during MemorySanitizer builds."
  73. FORCE)
  74. # UndefinedBehaviour
  75. set(CMAKE_C_FLAGS_UBSAN
  76. "-fsanitize=undefined"
  77. CACHE STRING "Flags used by the C compiler during UndefinedBehaviourSanitizer builds."
  78. FORCE)
  79. set(CMAKE_CXX_FLAGS_UBSAN
  80. "-fsanitize=undefined"
  81. CACHE STRING "Flags used by the C++ compiler during UndefinedBehaviourSanitizer builds."
  82. FORCE)