*/}}

lagui-config.cmake 3.0 KB

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