Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Build Host
  8. set (OpenRaider_BUILD_HOST ${CMAKE_HOST_SYSTEM})
  9. # Configuration Header file
  10. configure_file (
  11. "${PROJECT_SOURCE_DIR}/include/Config.h.in"
  12. "${PROJECT_BINARY_DIR}/Config.h"
  13. )
  14. include_directories ("${PROJECT_BINARY_DIR}")
  15. # Add subdirectories
  16. add_subdirectory (src)
  17. add_subdirectory (test)
  18. #################################################################
  19. # Target for running the setup
  20. add_custom_target (setup "${PROJECT_SOURCE_DIR}/cmake/setup.sh"
  21. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  22. )
  23. #################################################################
  24. # Target for running cppcheck
  25. set (CHECK_STD "--std=c++11" "--std=posix")
  26. set (CHECK_FLAGS "--quiet" "--force")
  27. set (CHECK_NORMAL "--enable=information,warning,performance,portability")
  28. set (CHECK_FULL "--enable=all")
  29. set (CHECK_CONFIG "--check-config")
  30. add_custom_target (check echo "Running cppcheck..."
  31. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_STD} ${CHECK_NORMAL} ${PROJECT_SOURCE_DIR}
  32. )
  33. add_custom_target (checkFull echo "Running full cppcheck..."
  34. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_STD} ${CHECK_FULL} ${PROJECT_SOURCE_DIR}
  35. )
  36. add_custom_target (checkConfig echo "Checking cppcheck config..."
  37. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_CONFIG} ${PROJECT_SOURCE_DIR}
  38. )
  39. #################################################################
  40. # Generate Doxygen Documentation
  41. find_package (Doxygen)
  42. if (DOXYGEN_FOUND)
  43. # Configure the Template Doxyfile for our specific project
  44. configure_file (cmake/Doxyfile.in
  45. ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE)
  46. # Add a custom target to run Doxygen when ever the project is built
  47. add_custom_target (doc
  48. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  49. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  50. # Add custom target to create local documentation without graphs
  51. add_custom_target (docLocal
  52. COMMAND sed -i '' "s/HAVE_DOT = YES/HAVE_DOT = NO/g" Doxyfile
  53. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  54. COMMAND cp -R doc/html/* ${PROJECT_SOURCE_DIR}/../apache/
  55. COMMAND sed -i '' "s/HAVE_DOT = NO/HAVE_DOT = YES/g" Doxyfile
  56. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  57. endif (DOXYGEN_FOUND)
  58. # Clean doc files
  59. set_directory_properties (PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "doc")