index.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!doctype html>
  2. <title>CodeMirror: CMake mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="../../addon/edit/matchbrackets.js"></script>
  8. <script src="cmake.js"></script>
  9. <style>
  10. .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
  11. .cm-s-default span.cm-arrow { color: red; }
  12. </style>
  13. <div id=nav>
  14. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  15. <ul>
  16. <li><a href="../../index.html">Home</a>
  17. <li><a href="../../doc/manual.html">Manual</a>
  18. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  19. </ul>
  20. <ul>
  21. <li><a href="../index.html">Language modes</a>
  22. <li><a class=active href="#">CMake</a>
  23. </ul>
  24. </div>
  25. <article>
  26. <h2>CMake mode</h2>
  27. <form><textarea id="code" name="code">
  28. # vim: syntax=cmake
  29. if(NOT CMAKE_BUILD_TYPE)
  30. # default to Release build for GCC builds
  31. set(CMAKE_BUILD_TYPE Release CACHE STRING
  32. "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
  33. FORCE)
  34. endif()
  35. message(STATUS "cmake version ${CMAKE_VERSION}")
  36. if(POLICY CMP0025)
  37. cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
  38. endif()
  39. if(POLICY CMP0042)
  40. cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
  41. endif()
  42. project (x265)
  43. cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
  44. include(CheckIncludeFiles)
  45. include(CheckFunctionExists)
  46. include(CheckSymbolExists)
  47. include(CheckCXXCompilerFlag)
  48. # X265_BUILD must be incremented each time the public API is changed
  49. set(X265_BUILD 48)
  50. configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
  51. "${PROJECT_BINARY_DIR}/x265.def")
  52. configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
  53. "${PROJECT_BINARY_DIR}/x265_config.h")
  54. SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
  55. # System architecture detection
  56. string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
  57. set(X86_ALIASES x86 i386 i686 x86_64 amd64)
  58. list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
  59. if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
  60. message(STATUS "Detected x86 target processor")
  61. set(X86 1)
  62. add_definitions(-DX265_ARCH_X86=1)
  63. if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
  64. set(X64 1)
  65. add_definitions(-DX86_64=1)
  66. endif()
  67. elseif(${SYSPROC} STREQUAL "armv6l")
  68. message(STATUS "Detected ARM target processor")
  69. set(ARM 1)
  70. add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
  71. else()
  72. message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
  73. message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
  74. endif()
  75. if(UNIX)
  76. list(APPEND PLATFORM_LIBS pthread)
  77. find_library(LIBRT rt)
  78. if(LIBRT)
  79. list(APPEND PLATFORM_LIBS rt)
  80. endif()
  81. find_package(Numa)
  82. if(NUMA_FOUND)
  83. list(APPEND CMAKE_REQUIRED_LIBRARIES ${NUMA_LIBRARY})
  84. check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2)
  85. if(NUMA_V2)
  86. add_definitions(-DHAVE_LIBNUMA)
  87. message(STATUS "libnuma found, building with support for NUMA nodes")
  88. list(APPEND PLATFORM_LIBS ${NUMA_LIBRARY})
  89. link_directories(${NUMA_LIBRARY_DIR})
  90. include_directories(${NUMA_INCLUDE_DIR})
  91. endif()
  92. endif()
  93. mark_as_advanced(LIBRT NUMA_FOUND)
  94. endif(UNIX)
  95. if(X64 AND NOT WIN32)
  96. option(ENABLE_PIC "Enable Position Independent Code" ON)
  97. else()
  98. option(ENABLE_PIC "Enable Position Independent Code" OFF)
  99. endif(X64 AND NOT WIN32)
  100. # Compiler detection
  101. if(CMAKE_GENERATOR STREQUAL "Xcode")
  102. set(XCODE 1)
  103. endif()
  104. if (APPLE)
  105. add_definitions(-DMACOS)
  106. endif()
  107. </textarea></form>
  108. <script>
  109. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  110. mode: "text/x-cmake",
  111. matchBrackets: true,
  112. indentUnit: 4
  113. });
  114. </script>
  115. <p><strong>MIME types defined:</strong> <code>text/x-cmake</code>.</p>
  116. </article>