| 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 | |
| 239 | cmake_minimum_required(VERSION 3.11) |
| 240 | project(cppgc CXX) |
| 241 | |
| 242 | set(CMAKE_CXX_STANDARD 14) |
| 243 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 244 | |
| 245 | option(CPPGC_ENABLE_OBJECT_NAMES "Enable object names in cppgc for debug purposes" OFF) |
| 246 | option(CPPGC_ENABLE_CAGED_HEAP "Enable heap reservation of size 4GB, only possible for 64bit archs" OFF) |
| 247 | option(CPPGC_ENABLE_VERIFY_HEAP "Enables additional heap verification phases and checks" OFF) |
| 248 | option(CPPGC_ENABLE_YOUNG_GENERATION "Enable young generation in cppgc" OFF) |
| 249 | set(CPPGC_TARGET_ARCH "x64" CACHE STRING "Target architecture, possible options: x64, x86, arm, arm64, ppc64, s390x, mips64el") |
| 250 | |
| 251 | set(IS_POSIX ${{UNIX}}) |
| 252 | set(IS_MAC ${{APPLE}}) |
| 253 | set(IS_WIN ${{WIN32}}) |
| 254 | if("${{CMAKE_SYSTEM_NAME}}" STREQUAL "Linux") |
| 255 | set(IS_LINUX 1) |
| 256 | elseif("${{CMAKE_SYSTEM_NAME}}" STREQUAL "Fuchsia") |
| 257 | set(IS_FUCHSIA 1) |
| 258 | endif() |
| 259 | |
| 260 | set(CURRENT_CPU ${{CPPGC_TARGET_ARCH}}) |
| 261 | |
| 262 | if("${{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) |
| 270 | endif() |
| 271 | |
| 272 | if(CPPGC_ENABLE_CAGED_HEAP AND NOT CPPGC_64_BITS) |
| 273 | message(FATAL_ERROR "Caged heap is only supported for 64bit archs") |
| 274 | endif() |
| 275 | |
| 276 | if(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) |
| 279 | endif() |
| 280 | |
| 281 | if(CPPGC_ENABLE_YOUNG_GENERATION AND NOT CPPGC_ENABLE_CAGED_HEAP) |
| 282 | message(FATAL_ERROR "Young generation is only supported for caged heap configuration") |
| 283 | endif() |
| 284 | |
| 285 | if(NOT CPPGC_64_BITS) |
| 286 | if(NOT MSVC) |
| 287 | set(CMAKE_CXX_FLAGS "${{CMAKE_CXX_FLAGS}} -m32") |
| 288 | set(CMAKE_C_FLAGS "${{CMAKE_C_FLAGS}} -m32") |