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