*/}}

lagui-config.cmake 3.5 KB

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