*/}}

lagui-config.cmake 3.0 KB

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