MCPcopy Create free account
hub / github.com/nodejs/node / CMakeBuilder

Class CMakeBuilder

deps/v8/tools/cppgc/gen_cmake.py:223–464  ·  view source on GitHub ↗

Builder that produces the main CMakeLists.txt.

Source from the content-addressed store, hash-verified

221
222
223class CMakeBuilder(object):
224 """
225 Builder that produces the main CMakeLists.txt.
226 """
227 def __init__(self):
228 self.result = []
229 self.source_sets = {}
230
231 def BuildPrologue(self):
232 self.result.append(f"""
233# Copyright {datetime.now().year} the V8 project authors. All rights reserved.
234# Use of this source code is governed by a BSD-style license that can be
235# found in the LICENSE file.
236#
237# This file is automatically generated by {__file__}. Do NOT edit it.
238
239cmake_minimum_required(VERSION 3.11)
240project(cppgc CXX)
241
242set(CMAKE_CXX_STANDARD 14)
243set(CMAKE_CXX_STANDARD_REQUIRED ON)
244
245option(CPPGC_ENABLE_OBJECT_NAMES "Enable object names in cppgc for debug purposes" OFF)
246option(CPPGC_ENABLE_CAGED_HEAP "Enable heap reservation of size 4GB, only possible for 64bit archs" OFF)
247option(CPPGC_ENABLE_VERIFY_HEAP "Enables additional heap verification phases and checks" OFF)
248option(CPPGC_ENABLE_YOUNG_GENERATION "Enable young generation in cppgc" OFF)
249set(CPPGC_TARGET_ARCH "x64" CACHE STRING "Target architecture, possible options: x64, x86, arm, arm64, ppc64, s390x, mips64el")
250
251set(IS_POSIX ${{UNIX}})
252set(IS_MAC ${{APPLE}})
253set(IS_WIN ${{WIN32}})
254if("${{CMAKE_SYSTEM_NAME}}" STREQUAL "Linux")
255 set(IS_LINUX 1)
256elseif("${{CMAKE_SYSTEM_NAME}}" STREQUAL "Fuchsia")
257 set(IS_FUCHSIA 1)
258endif()
259
260set(CURRENT_CPU ${{CPPGC_TARGET_ARCH}})
261
262if("${{CPPGC_TARGET_ARCH}}" STREQUAL "x64" OR
263 "${{CPPGC_TARGET_ARCH}}" STREQUAL "arm64" OR
264 "${{CPPGC_TARGET_ARCH}}" STREQUAL "ppc64" OR
265 "${{CPPGC_TARGET_ARCH}}" STREQUAL "mips64el")
266 if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
267 message(FATAL_ERROR "64-bit arch specified for 32-bit compiler")
268 endif()
269 set(CPPGC_64_BITS ON)
270endif()
271
272if(CPPGC_ENABLE_CAGED_HEAP AND NOT CPPGC_64_BITS)
273 message(FATAL_ERROR "Caged heap is only supported for 64bit archs")
274endif()
275
276if(CPPGC_64_BITS)
277 # Always enable caged heap for 64bits archs.
278 set(CPPGC_ENABLE_CAGED_HEAP ON CACHE BOOL "Enable caged heap for 64bit" FORCE)
279endif()
280

Callers 1

GenCMakeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected