SHARE
TWEET

Untitled

a guest Sep 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmake_minimum_required(VERSION 3.14)
  2.  
  3. SET(CMAKE_C_COMPILER /usr/bin/gcc)
  4. SET(CMAKE_CXX_COMPILER /usr/bin/g++)
  5.  
  6. # Build Types
  7.  
  8.    
  9. if(NOT CMAKE_BUILD_TYPE)
  10.  
  11.   set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
  12.   CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel tsan asan lsan msan ubsan"
  13.   FORCE)
  14.  
  15. endif()
  16.  
  17.  
  18. # ThreadSanitizer
  19. set(CMAKE_C_FLAGS_TSAN
  20.     "-fsanitize=thread -g -O1"
  21.     CACHE STRING "Flags used by the C compiler during ThreadSanitizer builds."
  22.     FORCE)
  23. set(CMAKE_CXX_FLAGS_TSAN
  24.     "-fsanitize=thread -g -O1"
  25.     CACHE STRING "Flags used by the C++ compiler during ThreadSanitizer builds."
  26.     FORCE)
  27.  
  28. # AddressSanitize
  29. set(CMAKE_C_FLAGS_ASAN
  30.     "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
  31.     CACHE STRING "Flags used by the C compiler during AddressSanitizer builds."
  32.     FORCE)
  33. set(CMAKE_CXX_FLAGS_ASAN
  34.     "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
  35.     CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds."
  36.     FORCE)
  37.  
  38. # LeakSanitizer
  39. set(CMAKE_C_FLAGS_LSAN
  40.     "-fsanitize=leak -fno-omit-frame-pointer -g -O1"
  41.     CACHE STRING "Flags used by the C compiler during LeakSanitizer builds."
  42.     FORCE)
  43. set(CMAKE_CXX_FLAGS_LSAN
  44.     "-fsanitize=leak -fno-omit-frame-pointer -g -O1"
  45.     CACHE STRING "Flags used by the C++ compiler during LeakSanitizer builds."
  46.     FORCE)
  47.  
  48. # MemorySanitizer
  49. set(CMAKE_C_FLAGS_MSAN
  50.     "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O2"
  51.     CACHE STRING "Flags used by the C compiler during MemorySanitizer builds."
  52.     FORCE)
  53. set(CMAKE_CXX_FLAGS_MSAN
  54.     "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O2"
  55.     CACHE STRING "Flags used by the C++ compiler during MemorySanitizer builds."
  56.     FORCE)
  57.  
  58. # UndefinedBehaviour
  59. set(CMAKE_C_FLAGS_UBSAN
  60.     "-fsanitize=undefined"
  61.     CACHE STRING "Flags used by the C compiler during UndefinedBehaviourSanitizer builds."
  62.     FORCE)
  63. set(CMAKE_CXX_FLAGS_UBSAN
  64.     "-fsanitize=undefined"
  65.     CACHE STRING "Flags used by the C++ compiler during UndefinedBehaviourSanitizer builds."
  66.     FORCE)
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86. project(run)
  87. set(EXECUTABLE_NAME "run")
  88.  
  89. file(GLOB src ${PROJECT_SOURCE_DIR}/src/*.cpp)
  90. file(GLOB include ${PROJECT_SOURCE_DIR}/include/*.h)
  91. file(GLOB audio ${PROJECT_SOURCE_DIR}/audio/*)
  92.  
  93. add_compile_options(-pedantic -Wall -g -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align  -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast)
  94. add_executable(${EXECUTABLE_NAME} ${main} ${include} ${src} ${audio} )
  95.  
  96. include_directories(${PROJECT_SOURCE_DIR}/include ${GTEST_INCLUDE_DIRS})
  97.  
  98. # set(SFML_STATIC_LIBRARIES TRUE)   niewazne
  99.  
  100. set(SFML_DIR "./library/frameworks/SFML-2.5.1/lib/cmake/SFML")
  101.  
  102.  
  103. find_package(GTest REQUIRED)
  104. target_link_libraries(run sfml-graphics sfml-audio sfml-window sfml-system)
  105.  
  106. # testing
  107.  
  108. enable_testing()
  109. file(GLOB test_src_files ${PROJECT_SOURCE_DIR}/tests/*.cpp)
  110.  
  111. # add_executable(runAllTests ${test_src_files})
  112. # add_test(Tests runAllTests)
  113. # target_link_libraries(runAllTests sfml-graphics sfml-audio sfml-window sfml-system ${GTEST_LIBRARIES} pthread)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top