(target_type, source_sets)
| 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 | |
| 428 | target_include_directories({target.name} PRIVATE "${{CMAKE_SOURCE_DIR}}" |
| 429 | PRIVATE "${{CMAKE_SOURCE_DIR}}/include") |
| 430 | |
| 431 | if(CPPGC_ENABLE_OBJECT_NAMES) |
| 432 | target_compile_definitions({target.name} PRIVATE "-DCPPGC_SUPPORTS_OBJECT_NAMES") |
| 433 | endif() |
| 434 | if(CPPGC_ENABLE_CAGED_HEAP) |
| 435 | target_compile_definitions({target.name} PRIVATE "-DCPPGC_CAGED_HEAP") |
| 436 | endif() |
| 437 | if(CPPGC_ENABLE_VERIFY_HEAP) |
| 438 | target_compile_definitions({target.name} PRIVATE "-DCPPGC_ENABLE_VERIFY_HEAP") |
| 439 | endif() |
| 440 | if(CPPGC_ENABLE_YOUNG_GENERATION) |
| 441 | target_compile_definitions({target.name} PRIVATE "-DCPPGC_YOUNG_GENERATION") |
| 442 | endif()""" |
| 443 | |
| 444 | @staticmethod |
| 445 | def _ExpandSources(target, sources): |
no test coverage detected