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

Method _GenTargetString

deps/v8/tools/cppgc/gen_cmake.py:402–442  ·  view source on GitHub ↗
(target_type, source_sets)

Source from the content-addressed store, hash-verified

400
401 @staticmethod
402 def _GenTargetString(target_type, source_sets):
403 Target = namedtuple('Target', 'name cmake deps desc')
404 CMAKE_TARGETS = {
405 'lib':
406 Target(name='cppgc',
407 cmake='add_library',
408 deps=['Threads::Threads'],
409 desc='Main library'),
410 'sample':
411 Target(name='cppgc_hello_world',
412 cmake='add_executable',
413 deps=['cppgc'],
414 desc='Example'),
415 'tests':
416 Target(name='cppgc_unittests',
417 cmake='add_executable',
418 deps=['cppgc', 'gtest', 'gmock'],
419 desc='Unittests')
420 }
421 target = CMAKE_TARGETS[target_type]
422 return f"""
423# {target.desc} target.
424{target.cmake}({target.name} {' '.join(source_sets)})
425
426{'target_link_libraries(' + target.name + ' ' + ' '.join(target.deps) + ')' if target.deps else ''}
427
428target_include_directories({target.name} PRIVATE "${{CMAKE_SOURCE_DIR}}"
429 PRIVATE "${{CMAKE_SOURCE_DIR}}/include")
430
431if(CPPGC_ENABLE_OBJECT_NAMES)
432 target_compile_definitions({target.name} PRIVATE "-DCPPGC_SUPPORTS_OBJECT_NAMES")
433endif()
434if(CPPGC_ENABLE_CAGED_HEAP)
435 target_compile_definitions({target.name} PRIVATE "-DCPPGC_CAGED_HEAP")
436endif()
437if(CPPGC_ENABLE_VERIFY_HEAP)
438 target_compile_definitions({target.name} PRIVATE "-DCPPGC_ENABLE_VERIFY_HEAP")
439endif()
440if(CPPGC_ENABLE_YOUNG_GENERATION)
441 target_compile_definitions({target.name} PRIVATE "-DCPPGC_YOUNG_GENERATION")
442endif()"""
443
444 @staticmethod
445 def _ExpandSources(target, sources):

Callers 1

BuildEpilogueMethod · 0.95

Calls 2

TargetFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected