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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # Default to Debug build
  16. set (CMAKE_BUILD_TYPE "Debug")
  17. # Add subdirectories
  18. add_subdirectory (src)
  19. add_subdirectory (test)
  20. #################################################################
  21. if (APPLE)
  22. # Preparing the bundle on install
  23. # http://www.cmake.org/Wiki/BundleUtilitiesExample
  24. set (plugin_dest_dir OpenRaider.app/Contents/MacOS)
  25. set (APPS "${PROJECT_BINARY_DIR}/src/OpenRaider.app")
  26. install (CODE "
  27. file(GLOB_RECURSE PLUGINS
  28. \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
  29. include(BundleUtilities)
  30. fixup_bundle(\"${APPS}\" \"\${PLUGINS}\" \"\")
  31. " COMPONENT Runtime
  32. )
  33. # Copy setup script
  34. install (PROGRAMS ${PROJECT_SOURCE_DIR}/cmake/setup_mac.sh
  35. DESTINATION ${PROJECT_BINARY_DIR}/src/OpenRaider.app/Contents/MacOS
  36. RENAME OpenRaider.sh
  37. )
  38. # Fix executable name, so setup script will be called
  39. install (CODE "
  40. execute_process (
  41. COMMAND /usr/libexec/PlistBuddy -c \"Set :CFBundleExecutable OpenRaider.sh\" Info.plist
  42. WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/src/OpenRaider.app/Contents
  43. )
  44. " COMPONENT Runtime)
  45. endif (APPLE)
  46. #################################################################
  47. # Target for running cppcheck
  48. set (CHECK_STD "--std=c++11" "--std=posix")
  49. set (CHECK_FLAGS "--quiet" "--force")
  50. set (CHECK_NORMAL "--enable=information,warning,performance,portability")
  51. set (CHECK_FULL "--enable=all")
  52. set (CHECK_CONFIG "--check-config")
  53. add_custom_target (check echo "Running cppcheck..."
  54. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_STD} ${CHECK_NORMAL} ${PROJECT_SOURCE_DIR}
  55. )
  56. add_custom_target (checkFull echo "Running full cppcheck..."
  57. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_STD} ${CHECK_FULL} ${PROJECT_SOURCE_DIR}
  58. )
  59. add_custom_target (checkConfig echo "Checking cppcheck config..."
  60. COMMAND cppcheck ${CHECK_FLAGS} "-I${PROJECT_SOURCE_DIR}/include" ${CHECK_CONFIG} ${PROJECT_SOURCE_DIR}
  61. )
  62. #################################################################
  63. # Generate Doxygen Documentation
  64. find_package (Doxygen)
  65. if (DOXYGEN_FOUND)
  66. # Configure the Template Doxyfile for our specific project
  67. configure_file(Doxyfile.in
  68. ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE)
  69. # Add a custom target to run Doxygen when ever the project is built
  70. add_custom_target (doc
  71. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  72. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  73. # Add custom target to create local documentation without graphs
  74. add_custom_target (docLocal
  75. COMMAND sed -i '' "s/HAVE_DOT = YES/HAVE_DOT = NO/g" Doxyfile
  76. COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
  77. COMMAND cp -R doc/html/* ${PROJECT_SOURCE_DIR}/../apache/
  78. COMMAND sed -i '' "s/HAVE_DOT = NO/HAVE_DOT = YES/g" Doxyfile
  79. SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
  80. endif(DOXYGEN_FOUND)
  81. # Clean doc files
  82. set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "doc")