Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CMakeLists.txt 3.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. cmake_minimum_required (VERSION 2.8)
  2. project (OpenRaider)
  3. # Version Number
  4. set (OpenRaider_VERSION_MAJOR 0)
  5. set (OpenRaider_VERSION_MINOR 1)
  6. set (OpenRaider_VERSION_MICRO 2)
  7. set (OpenRaider_VERSION_RELEASE -git)
  8. # Build Host
  9. set (OpenRaider_BUILD_HOST ${CMAKE_HOST_SYSTEM})
  10. # Configuration Header file
  11. configure_file (
  12. "${PROJECT_SOURCE_DIR}/cmake/Config.h.in"
  13. "${PROJECT_BINARY_DIR}/Config.h"
  14. )
  15. # Include directories
  16. include_directories ("${PROJECT_SOURCE_DIR}/include")
  17. include_directories ("${PROJECT_BINARY_DIR}")
  18. # Include External Modules
  19. set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
  20. # Build warnings
  21. set (WARNINGS "${WARNINGS} -Weverything -Wno-padded -Wno-packed")
  22. set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
  23. set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
  24. set (WARNINGS "${WARNINGS} -Wno-missing-prototypes -Wno-missing-variable-declarations")
  25. set (WARNINGS "${WARNINGS} -Wno-disabled-macro-expansion")
  26. set (WARNINGS "${WARNINGS} -Wno-shorten-64-to-32 -Wno-sign-conversion")
  27. # Add subdirectories
  28. add_subdirectory (src)
  29. add_subdirectory (test)
  30. #################################################################
  31. # Target for running the setup
  32. add_custom_target (setup "${PROJECT_SOURCE_DIR}/cmake/setup.sh"
  33. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  34. )
  35. #################################################################
  36. # Target for running cppcheck
  37. set (CHECK_STD "--std=c++11" "--std=posix")
  38. set (CHECK_FLAGS "--quiet" "--force")
  39. set (CHECK_NORMAL "--enable=information,warning,performance,portability")
  40. set (CHECK_FULL "--enable=all")
  41. set (CHECK_CONFIG "--check-config")
  42. add_custom_target (check echo "Running cppcheck..."
  43. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_STD} ${CHECK_NORMAL} ${PROJECT_SOURCE_DIR}
  44. )
  45. add_custom_target (checkFull echo "Running full cppcheck..."
  46. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_STD} ${CHECK_FULL} ${PROJECT_SOURCE_DIR}
  47. )
  48. add_custom_target (checkConfig echo "Checking cppcheck config..."
  49. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_CONFIG} ${PROJECT_SOURCE_DIR}
  50. )
  51. #################################################################
  52. # Generate Doxygen Documentation
  53. find_package (Doxygen)
  54. if (DOXYGEN_FOUND)
  55. # Configure the Template Doxyfile for our specific project
  56. configure_file (cmake/Doxyfile.in
  57. ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE)
  58. # Add a custom target to run Doxygen when ever the project is built
  59. add_custom_target (doc
  60. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  61. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  62. # Add custom target to create local documentation without graphs
  63. add_custom_target (docLocal
  64. COMMAND sed -i '' "s/HAVE_DOT = YES/HAVE_DOT = NO/g" Doxyfile
  65. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  66. COMMAND cp -R doc/html/* ${PROJECT_SOURCE_DIR}/../apache/
  67. COMMAND sed -i '' "s/HAVE_DOT = NO/HAVE_DOT = YES/g" Doxyfile
  68. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  69. # Add custom target to create local documentation with call and caller graphs
  70. add_custom_target (docLocalFull
  71. COMMAND sed -i '' "s/CALL_GRAPH = NO/CALL_GRAPH = YES/g" Doxyfile
  72. COMMAND sed -i '' "s/CALLER_GRAPH = NO/CALLER_GRAPH = YES/g" Doxyfile
  73. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  74. COMMAND cp -R doc/html/* ${PROJECT_SOURCE_DIR}/../apache/
  75. COMMAND sed -i '' "s/CALL_GRAPH = YES/CALL_GRAPH = NO/g" Doxyfile
  76. COMMAND sed -i '' "s/CALLER_GRAPH = YES/CALLER_GRAPH = NO/g" Doxyfile
  77. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  78. endif (DOXYGEN_FOUND)
  79. # Clean doc files
  80. set_directory_properties (PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "doc")